Thanks for replying, Sir. For information, I use R version 3.2.2. There are
some steps that I'm doing with Amelia II package and AmeliaView:
1) I have a data (.csv format, you can see production_index.csv) that
contains 2 variable (Date and Production Index). There are 102 observations
that consists of date data from January 2007 to June 2015 and the
production index data for each month.
2) I make a simulation. I replace some data randomly with NA, so there are
88 data of production index and 14 NA data of production index (you can see
production_index_with_miss.csv)
3) I open the Amelia View and then import production_index_with_miss.csv to
the Amelia package. When I click "Impute!", the error log appear, and the
message at the error log is "Amelia Error Code: 13 You cannot set all
variables (or all but one) as ID variables".
4) So I change the date variable into a number from 1 to 102. I re-import
production_index_with_miss.csv to the Amelia package and then click
"Impute!". After that, there are 5 .csv data that contains the impute data.
Am I do right? Or there are something wrong with my steps? Thanks for your
attention.
Kind regards,
Iqbal Hanif
Hi I'm working with cross country time series data, along with binary
variables as dependent variables.
I'm sure it's something simple, but wondering if anyone would be willing to
provide any feedback. I'd very much appreciate it.
Here you can see one of the features with missing values and the imputed
values using Amelia II for the country AUS from 1870 to 1872 at the
beginning of the time series, then again from 1946-1952. ,
The numbers imputed are nonsensical, in that they appear to be sampled from
the broader cross section of countries, and there is no trend to them.
For this type of study, it is common to use linear interpolation. Here is
the code, data, and screenshots.
Also, if anyone wants to me help me build models to forecast crises of
various sorts, that'd be great too. I'm a noob at the modeling but have a
lot of ideas for good models. .
Thanks again,
Brendan
#data wrangling
library(dplyr)
library(Amelia)
#impute missing values
RRcrisis_panel <- read.csv("schularick_taylor_RRcrises_panel.csv")
head(RRcrisis_panel)
RRcrisis_panel_loans1 <- select(RRcrisis_panel, year, iso, loans1)
a.RRcrisis_panel <- amelia(RRcrisis_panel_loans1,
m = 3,
ts = "year",
cs = "iso",
polytime = 1)
#look at individual impututations
a.RRcrisis_panel$imputations[[1]]
head(a.RRcrisis_panel$imputations[[1]])
#save the five different imputations
write.amelia(obj=a.RRcrisis_panel, file.stem = "amelia_11_16_2015")
Before Imputing
[image: Inline image 2]
After Imputing
[image: Inline image 1]
Before Imputing
[image: Inline image 3]
After Imputing:
[image: Inline image 4]
Before Imputing
[image: Inline image 1]
after imputing
[image: Inline image 2]
ᐧ
At 22:40 11/12/2015, W. D. wrote:
>At 21:30 11/12/2015, Matt Blackwell wrote:
>>Hi there,Â
>>
>>I actually don't think you actually need to use ameliabind() here.
>The amelia output already has all of the datasets together. It might
>help us to know what is it that you want to accomplish with
>ameliabind() in this case.
>>
>>Cheers,
>>Matt
>
>Thanks, Matt.
>
>I'm just trying to do a plain old linear regression.
I had to export the data to 5 text files and
combine them manually, deleting the extra header
records. I then imported the combined,
imputed data and ran a regression:
lm.ImputedDataAll5 <- lm(DepVar ~ IndVar1 + IndVar2 +
IndVar3 + IndVar4 + IndVar5, data=ImputedDataAll5)
Is there some way to skip the manual editing steps
and use the imputed data structure with lm?
Thanks for any light you can shed.
>
>I tried going the ameliabind() route because when
>trying to use lm() with the 5 sets of imputed data,
>I get the following error:
>
> Error in as.data.frame.default(data) :
> cannot coerce class ""amelia"" to a data.frame
>
>Would you please let me know the proper way to regress
>these 5 datasets?
>
>Thanks!
>
>
>
>
>
>>On Thu, Nov 12, 2015 at 10:11 PM, W. D. <<mailto:WD@a7h.com>WD(a)a7h.com> wrote:
>>At 06:47 11/11/2015, Matt Blackwell wrote:
>>>Hi there,Ã
>>>
>>>The 5 imputed datasets are actually contained in the DataImputed
>object and you can access each imputed dataset like so:
>>>
>>>DataImputed$imputations[[1]]
>>>DataImputed$imputations[[2]]
>>>
>>>And so on. ameliabind() will merge the output of two amelia() calls
>into 1 so that if each had 5 imputed datasets, then the binded object
>will have 10.Ã
>>
>>Thanks for the clue, Matt.
>>
>>However when I run:
>>
>>DataImputedAll <- ameliabind(DataImputed$imputations[[1]],
>DataImputed$imputations[[2]], DataImputed$imputations[[3]],
>DataImputed$imputations[[4]], DataImputed$imputations[[5]])
>>
>>It rudely spits out:
>>
>>
>>"All arguments must be amelia output."
>>
>>When searching for that particular error, there isn't anything
>>useful.
>>
>>What do you suggest?
>>
>>Thanks for your assistance!
>>
>>
>>
>>
>>>Hope that helps!
>>>
>>>Cheers,
>>>Matt
>>>
>>>~~~~~~~~~~~
>>>Matthew Blackwell
>>>Assistant Professor of Government
>>>Harvard University
>>>url:
><<http://www.mattblackwell.org>http://www.mattblackwell.org>http://www
>.mattblackwell.orgÃ
>>>
>>>On Wed, Nov 11, 2015 at 1:14 AM, W. D.
><<mailto:WD@a7h.com><mailto:WD@a7h.com>WD(a)a7h.com> wrote:
>>>If 5 sets of data are generated using a command like
>>>this:
>>>
>>>DataImputed <- amelia(x=GroupData,incheck=TRUE)
>>>
>>>What would be the names of the 5 sets of data in order
>>>to use ameliabind?
>>>
>>>DataImputedAll <- ameliabind(set1?, set2?, set3?, set4?, set5?)
>>>
>>>There seem to be a dearth of examples online.
>>>
>>>Thanks for your help.
>>>
>>>--
>>>Amelia mailing list served by HUIT
>>>[Un]Subscribe/View Archive:
><<http://lists.gking.harvard.edu/?info=amelia>http://lists.gking.harva
>rd.edu/?info=amelia>http://lists.gking.harvard.edu/?info=amelia
>>>More info about Amelia:
><<http://gking.harvard.edu/amelia>http://gking.harvard.edu/amelia>http
>://gking.harvard.edu/amelia
>>>Amelia mailing list
>>><mailto:Amelia@lists.gking.harvard.edu><mailto:Amelia@lists.gking.ha>rvard.edu>Amelia(a)lists.gking.harvard.edu
>>>
>>>To unsubscribe from this list or get other information:
>>>
>>><<https://lists.gking.harvard.edu/mailman/listinfo/amelia>https://li
>sts.gking.harvard.edu/mailman/listinfo/amelia>https://lists.gking.harv
>ard.edu/mailman/listinfo/amelia
>>>
>>
>
>--
>Amelia mailing list served by HUIT
>[Un]Subscribe/View Archive: http://lists.gking.harvard.edu/?info=amelia
>More info about Amelia: http://gking.harvard.edu/amelia
>Amelia mailing list
>Amelia(a)lists.gking.harvard.edu
>
>To unsubscribe from this list or get other information:
>
>https://lists.gking.harvard.edu/mailman/listinfo/amelia
At 21:30 11/12/2015, Matt Blackwell wrote:
>Hi there,Â
>
>I actually don't think you actually need to use ameliabind() here. The amelia output already has all of the datasets together. It might help us to know what is it that you want to accomplish with ameliabind() in this case.
>
>Cheers,
>Matt
Thanks, Matt.
I'm just trying to do a plain old linear regression.
I tried going the ameliabind() route because when
trying to use lm() with the 5 sets of imputed data,
I get the following error:
Error in as.data.frame.default(data) :
cannot coerce class ""amelia"" to a data.frame
Would you please let me know the proper way to regress
these 5 datasets?
Thanks!
>On Thu, Nov 12, 2015 at 10:11 PM, W. D. <<mailto:WD@a7h.com>WD(a)a7h.com> wrote:
>At 06:47 11/11/2015, Matt Blackwell wrote:
>>Hi there,Ã
>>
>>The 5 imputed datasets are actually contained in the DataImputed object and you can access each imputed dataset like so:
>>
>>DataImputed$imputations[[1]]
>>DataImputed$imputations[[2]]
>>
>>And so on. ameliabind() will merge the output of two amelia() calls into 1 so that if each had 5 imputed datasets, then the binded object will have 10.Ã
>
>Thanks for the clue, Matt.
>
>However when I run:
>
>DataImputedAll <- ameliabind(DataImputed$imputations[[1]], DataImputed$imputations[[2]], DataImputed$imputations[[3]], DataImputed$imputations[[4]], DataImputed$imputations[[5]])
>
>It rudely spits out:
>
>
>"All arguments must be amelia output."
>
>When searching for that particular error, there isn't anything
>useful.
>
>What do you suggest?
>
>Thanks for your assistance!
>
>
>
>
>>Hope that helps!
>>
>>Cheers,
>>Matt
>>
>>~~~~~~~~~~~
>>Matthew Blackwell
>>Assistant Professor of Government
>>Harvard University
>>url: <<http://www.mattblackwell.org>http://www.mattblackwell.org>http://www.mattblackwell.orgÃ
>>
>>On Wed, Nov 11, 2015 at 1:14 AM, W. D. <<mailto:WD@a7h.com><mailto:WD@a7h.com>WD(a)a7h.com> wrote:
>>If 5 sets of data are generated using a command like
>>this:
>>
>>DataImputed <- amelia(x=GroupData,incheck=TRUE)
>>
>>What would be the names of the 5 sets of data in order
>>to use ameliabind?
>>
>>DataImputedAll <- ameliabind(set1?, set2?, set3?, set4?, set5?)
>>
>>There seem to be a dearth of examples online.
>>
>>Thanks for your help.
>>
>>--
>>Amelia mailing list served by HUIT
>>[Un]Subscribe/View Archive: <<http://lists.gking.harvard.edu/?info=amelia>http://lists.gking.harvard.edu/?info=amelia>http://lists.gking.harvard.edu/?info=amelia
>>More info about Amelia: <<http://gking.harvard.edu/amelia>http://gking.harvard.edu/amelia>http://gking.harvard.edu/amelia
>>Amelia mailing list
>><mailto:Amelia@lists.gking.harvard.edu><mailto:Amelia@lists.gking.harvard.edu>Amelia(a)lists.gking.harvard.edu
>>
>>To unsubscribe from this list or get other information:
>>
>><<https://lists.gking.harvard.edu/mailman/listinfo/amelia>https://lists.gking.harvard.edu/mailman/listinfo/amelia>https://lists.gking.harvard.edu/mailman/listinfo/amelia
>>
>
Hi there,
I actually don't think you actually need to use ameliabind() here. The
amelia output already has all of the datasets together. It might help us to
know what is it that you want to accomplish with ameliabind() in this case.
Cheers,
Matt
On Thu, Nov 12, 2015 at 10:11 PM, W. D. <WD(a)a7h.com> wrote:
> At 06:47 11/11/2015, Matt Blackwell wrote:
> >Hi there,Â
> >
> >The 5 imputed datasets are actually contained in the DataImputed object
> and you can access each imputed dataset like so:
> >
> >DataImputed$imputations[[1]]
> >DataImputed$imputations[[2]]
> >
> >And so on. ameliabind() will merge the output of two amelia() calls into
> 1 so that if each had 5 imputed datasets, then the binded object will have
> 10.Â
>
> Thanks for the clue, Matt.
>
> However when I run:
>
> DataImputedAll <- ameliabind(DataImputed$imputations[[1]],
> DataImputed$imputations[[2]], DataImputed$imputations[[3]],
> DataImputed$imputations[[4]], DataImputed$imputations[[5]])
>
> It rudely spits out:
>
>
> "All arguments must be amelia output."
>
> When searching for that particular error, there isn't anything
> useful.
>
> What do you suggest?
>
> Thanks for your assistance!
>
>
>
>
> >Hope that helps!
> >
> >Cheers,
> >Matt
> >
> >~~~~~~~~~~~
> >Matthew Blackwell
> >Assistant Professor of Government
> >Harvard University
> >url: <http://www.mattblackwell.org>http://www.mattblackwell.orgÂ
> <http://www.mattblackwell.xn--org-kla>
> >
> >On Wed, Nov 11, 2015 at 1:14 AM, W. D. <<mailto:WD@a7h.com>WD(a)a7h.com>
> wrote:
> >If 5 sets of data are generated using a command like
> >this:
> >
> >DataImputed <- amelia(x=GroupData,incheck=TRUE)
> >
> >What would be the names of the 5 sets of data in order
> >to use ameliabind?
> >
> >DataImputedAll <- ameliabind(set1?, set2?, set3?, set4?, set5?)
> >
> >There seem to be a dearth of examples online.
> >
> >Thanks for your help.
> >
> >--
> >Amelia mailing list served by HUIT
> >[Un]Subscribe/View Archive: <http://lists.gking.harvard.edu/?info=amelia>
> http://lists.gking.harvard.edu/?info=amelia
> >More info about Amelia: <http://gking.harvard.edu/amelia>
> http://gking.harvard.edu/amelia
> >Amelia mailing list
> ><mailto:Amelia@lists.gking.harvard.edu>Amelia(a)lists.gking.harvard.edu
> >
> >To unsubscribe from this list or get other information:
> >
> ><https://lists.gking.harvard.edu/mailman/listinfo/amelia>
> https://lists.gking.harvard.edu/mailman/listinfo/amelia
> >
>
>
At 06:47 11/11/2015, Matt Blackwell wrote:
>Hi there,Â
>
>The 5 imputed datasets are actually contained in the DataImputed object and you can access each imputed dataset like so:
>
>DataImputed$imputations[[1]]
>DataImputed$imputations[[2]]
>
>And so on. ameliabind() will merge the output of two amelia() calls into 1 so that if each had 5 imputed datasets, then the binded object will have 10.Â
Thanks for the clue, Matt.
However when I run:
DataImputedAll <- ameliabind(DataImputed$imputations[[1]], DataImputed$imputations[[2]], DataImputed$imputations[[3]], DataImputed$imputations[[4]], DataImputed$imputations[[5]])
It rudely spits out:
"All arguments must be amelia output."
When searching for that particular error, there isn't anything
useful.
What do you suggest?
Thanks for your assistance!
>Hope that helps!
>
>Cheers,
>Matt
>
>~~~~~~~~~~~
>Matthew Blackwell
>Assistant Professor of Government
>Harvard University
>url: <http://www.mattblackwell.org>http://www.mattblackwell.orgÂ
>
>On Wed, Nov 11, 2015 at 1:14 AM, W. D. <<mailto:WD@a7h.com>WD(a)a7h.com> wrote:
>If 5 sets of data are generated using a command like
>this:
>
>DataImputed <- amelia(x=GroupData,incheck=TRUE)
>
>What would be the names of the 5 sets of data in order
>to use ameliabind?
>
>DataImputedAll <- ameliabind(set1?, set2?, set3?, set4?, set5?)
>
>There seem to be a dearth of examples online.
>
>Thanks for your help.
>
>--
>Amelia mailing list served by HUIT
>[Un]Subscribe/View Archive: <http://lists.gking.harvard.edu/?info=amelia>http://lists.gking.harvard.edu/?info=amelia
>More info about Amelia: <http://gking.harvard.edu/amelia>http://gking.harvard.edu/amelia
>Amelia mailing list
><mailto:Amelia@lists.gking.harvard.edu>Amelia(a)lists.gking.harvard.edu
>
>To unsubscribe from this list or get other information:
>
><https://lists.gking.harvard.edu/mailman/listinfo/amelia>https://lists.gking.harvard.edu/mailman/listinfo/amelia
>
If 5 sets of data are generated using a command like
this:
DataImputed <- amelia(x=GroupData,incheck=TRUE)
What would be the names of the 5 sets of data in order
to use ameliabind?
DataImputedAll <- ameliabind(set1?, set2?, set3?, set4?, set5?)
There seem to be a dearth of examples online.
Thanks for your help.
At 08:50 11/9/2015, Matt Blackwell wrote:
>Hi there,
>
>Usually this error means one of two things:
>
>1) There are linearly dependent or extremely highly correlated variables in your dataset.
>
>2) The imputation model isn't identified because you have more parameters than observations. Note that you need far more observations than in a typical regression because you need to run regressions for each column with missing data.
>
>Note that you have turned off the internal Amelia error checking, which should give you an informative error message if there is an obvious problem with the data. Use "incheck = TRUE" to get that. Either way, you should probably start with a couple of variable to see if Amelia runs then and then try to remove any highly correlated (rho > 0.95 or so) variables from the data. You can also use the "empri" argument to stabilize the computation. See the manual for more details on this.
>
>Cheers,
>Matt
Thanks, Matt.
Reduced the number of variables and the errors stopped.
Am adding variables a few at a time to see how many and
which ones will not choke Amelia.
Have another question but I'll start a different thread.
>~~~~~~~~~~~
>Matthew Blackwell
>Assistant Professor of Government
>Harvard University
>url: <http://www.mattblackwell.org>http://www.mattblackwell.orgÂ
>
>On Mon, Nov 9, 2015 at 12:31 AM W. D. <<mailto:WD@a7h.com>WD(a)a7h.com> wrote:
>Hi,
>
>I ran something similar to:
>
>Â Â DataImputed <- amelia(x=GroupData,incheck=FALSE)
>
>GroupData is several thousand observations
>with about 4 dozen variables.
>
>After iterating over a thousand times with this
>error:
>
>Â Â error: inv_sympd(): matrix appears to be singular
>
>It ended with:
>
>Â Â Error in emarch(x.stacked$x, p2s = p2s, thetaold = NULL,
>  tolerance = tolerance, :
>Â Â BLAS/LAPACK routine 'DLASCL' gave error code -4
>
>I searched online for both of these error messages
>but didn't find anything useful.
>
>Do you have any idea what might be going on, or how
>to fix it?
>
>Thanks for any light you can shed!
>
>--
>Amelia mailing list served by HUIT
>[Un]Subscribe/View Archive: <http://lists.gking.harvard.edu/?info=amelia>http://lists.gking.harvard.edu/?info=amelia
>More info about Amelia: <http://gking.harvard.edu/amelia>http://gking.harvard.edu/amelia
>Amelia mailing list
><mailto:Amelia@lists.gking.harvard.edu>Amelia(a)lists.gking.harvard.edu
>
>To unsubscribe from this list or get other information:
>
><https://lists.gking.harvard.edu/mailman/listinfo/amelia>https://lists.gking.harvard.edu/mailman/listinfo/amelia
Hi,
I ran something similar to:
DataImputed <- amelia(x=GroupData,incheck=FALSE)
GroupData is several thousand observations
with about 4 dozen variables.
After iterating over a thousand times with this
error:
error: inv_sympd(): matrix appears to be singular
It ended with:
Error in emarch(x.stacked$x, p2s = p2s, thetaold = NULL,
tolerance = tolerance, :
BLAS/LAPACK routine 'DLASCL' gave error code -4
I searched online for both of these error messages
but didn't find anything useful.
Do you have any idea what might be going on, or how
to fix it?
Thanks for any light you can shed!
Dear list members,
My name is Michael and I am a Ph.D. student in political science. I am relatively new to Amelia, so I apologize if my question seems naïve to more experienced users.
I am working with a large dataset based on survey responses. The data includes a number of indices, which were created by taking the mean of multiple survey items. For example, the index "group membership" takes the average of six different types of groups a respondent can be a member of. The values of this variable range from 1 to 3, with 21 unique values (1; 1.2; 1.25; 1.33; ...; 3).
My question is: How can I improve the imputation process so that Amelia only uses these 21 values? As of right now, when I impute variables like "group membership", Amelia generates a wide range of values that do not make sense (negative values, values above three, etc.) given the initial values and coding of these indices. I know how to do this with ordinal variables, a.out <- amelia(data, m = 5, ords = "var name"), but unfortunately I cannot figure out how to do a similar imputation-improving transformation for indices such as "group membership".
I am using Amelia in R, so if anyone could give me the code to solve my problem, I would much appreciate it. Thank you in advance for your help.
Best,
Michael