Panelvar - "Error in xtfrm.data.frame(x) : cannot xtfrm data frames"

Hi everyone,

I'm trying to figure out how to make a panelvar-model with the package "panelvar". I tried mimicking an existing example with the existing dataframe "abdata". It works fine when using the code provided in the example. When I try to mimic the code but with my own dataframe however, I get "Error in xtfrm.data.frame(x) : cannot xtfrm data frames". The only difference I can see with my code and the one for abdata is that the one for abdata has 9 years, while I have 7. They have 140 id's and I have 47, but could this really matter? I have ensured that my years are set as a factor variable (as in abdata) and that the id:s and other variables are numeric (as in abdata), but it still gives me an error in xtfrm.

What am I missing?

Thanks in advance, and here are the codes;

Example code with abdata (which works fine);

ex3_abdata <-pvargmm(
dependent_vars = c("emp"),
lags = 4,
predet_vars = c("wage"),
exog_vars = c("cap"),
transformation = "fd",
data = abdata,
panel_identifier = c("id", "year"),
steps = c("twostep"),
system_instruments = TRUE,
max_instr_dependent_vars = 99,
max_instr_predet_vars = 99,
min_instr_dependent_vars = 2L,
min_instr_predet_vars = 1L,
collapse = FALSE)

And then my code with another dataset ("Varframe"), which gives me the errormessage "Error in xtfrm.data.frame(x) : cannot xtfrm data frames";

panelvarmod <-pvargmm(
dependent_vars = c("Population"),
lags = 1,
predet_vars = c("Unemployment"),
exog_vars = c("gdppcppp"),
transformation = "fd",
data=Varframe,
panel_identifier = c("id", "fYear"),
steps = c("twostep"),
system_instruments = TRUE,
max_instr_dependent_vars = 99,
max_instr_predet_vars = 99,
min_instr_dependent_vars = 2L,
min_instr_predet_vars = 1L,
collapse = FALSE)

Seems like I solved it myself. It didn't interprate my dataset as a dataframe, so I had to use "<- as.dataframe()"

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.