Hello Anders,
I'm using a dataset with a country-year format
and I have reason to
believe that there are trends within countries. So I assume I should set
ts=1 and cs=2 (for columns 1 and 2 respectively, correct? Is there also a
way to indicate
which variables in particular need to be controlled by tscs
considerations? Some of my vars should be trendlines, and some not.
This is the correct usage of the ts and cs arguments. You can also
specify the name of the variable, such as ts="year" or cs="ccode".
Currently, Amelia uses time trends globally, that is, for all
variables. However, if time has no explanatory power for a variable,
then the algorithm will use other information in the dataset in place
of time.
Also it is unclear to me from the information on lags
produced by
help(amelia), "lags: a vector of numbers or names indicating columns in
the data that should have their lags included in the imputation model,"
whether, in lags=x, s should be the un-lagged variable that I want lagged
or the lagged variable I created myself. I assume Amelia cannot create a
lagged variable for me, giving me an extra column in the output?
The lags argument tells Amelia which variables should be lagged in the
dataset. Amelia, then, will create lags of those variables and add
them as variables in the dataset. These variables are dumped after the
imputation. Thus, there is no need to specify lagged variables if you
have already lagged them yourself.
# Run Amelia
Multiple imputation program.
ameliaoutput5<-amelia(merge22, p2s=2,
+
idvars=which(names(merge22)==c("year","ccode")),
+ lgstc=c(8,9,33,40), ords=c(10,37,38,39,45,47,48),
+ ts=which(names(merge22)=="year"),
+ cs=which(names(merge22)=="ccode"),polytime=2,intercs=TRUE)
amelia starting
Amelia Error Code: 33
The time series and cross sectional variables cannot be transformed.
save(ameliaoutput5,file="ameliaoutput5.rData")
Finally, I get the error code 33 above but I'm not sure what I'm doing
wrong and a perusal of the help archives "error code 33" didn't produce
much.
The error here results from trying to set your "year" and "ccode"
variables as ID and ts/cs variables. They can only be one or the other
and it looks like you want them to be ts/cs in this case. The idvars
argument is for variables that have no explanatory power at all, such
as coding notes or long country names. Basically, variables that you
will never use in an analysis model, but need to keep in the data for
housekeeping or readability purposes.
hope that helps,
matt.
Any assistance from the seasoned Amelia-users on this
list is much
appreciated!
Thanks,
Anders
-
Amelia mailing list served by Harvard-MIT Data Center
[Un]Subscribe/View Archive:
http://lists.gking.harvard.edu/?info=amelia
-
Amelia mailing list served by Harvard-MIT Data Center
[Un]Subscribe/View Archive:
http://lists.gking.harvard.edu/?info=amelia