PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, October 8, 2022

[FIXED] Why does gsynth sometimes fail with "'data' must be of a vector type, was 'NULL''"?

 October 08, 2022     r, statistics     No comments   

Issue

Disclaimer: I have minimal experience with R, though am familiar with programming in general. All examples were run in RStudio using version 4.0.2 of R.

I am using a package called gsynth to conduct an analysis on some political data. I have a data frame named vdem5 with five variables: country, corruption, democracy, bnp and eu (eu is dichotomous/binary, indicates eu-membership). I have tried using gsynth in accordance with their example page as such:

out <-  gsynth(corruption ~ eu + democracy + bnp, data = vdem5, 
                      index = c("country","year"), force = "two-way",
                      CV = TRUE, r= c(0,5), se = TRUE, 
                      inference = "parametric", nboots = 1000,
                      parallel = FALSE)  

Console output looks like this: Console output

I have checked multiple times that vdem5 is not NULL and that all the columns have no missing data (although gsynth supposedly can handle this).

What really puzzles me is this: If I set se=FALSE, so that no standard errors are computed, it works:

out <-  gsynth(corruption ~ eu + democracy + bnp, data = vdem5, 
                      index = c("country","year"), force = "two-way",
                      CV = TRUE, r= c(0,5), se = FALSE, 
                      inference = "parametric", nboots = 1000,
                      parallel = FALSE)  

Now it runs through just fine:

enter image description here

This seems to indicate that that data is in fact not NULL at the time of running, unless the error message refers to some ther variable with the same name under the hood, maybe?

I would really love to get ahold of those standard errors. Anyone have any tips or similar experience with this?


Solution

I managed to resolve the problem myself by adding more units (aka countries), though the exact reason it failed before is still not clear to me. I've posted an issue on the gsynth github page, recommend anyone struggling with this later on to check it out.

UPDATE:

It turned out that the cause of the problem was the CRAN version of gsynth, removing this and installing vis devtools:

devtools::install_github('xuyiqing/gsynth')

solved the issue!



Answered By - Sifu
Answer Checked By - Willingham (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing