Hi Albrecht, 

It turns out that the way you have called Amelia attempts to impute your missing value with no other covariates. I believe you intend for time to help you impute, but you must specify the "splinetime" argument for that to work, which adds functions of time to your imputation. Here is an example:

amelia(melt.dates,m=1,ts="variable",cs="Country",idvars=c("Indicator","Group"), splinetime = 3)

Hope that helps!

Cheers,
matt.

On Thu, Jul 21, 2011 at 5:29 AM, Albrecht Gradmann <Albrecht.Gradmann@ecologic.eu> wrote:
Hello,

I am just starting to work with Amelia. The examples from the vignette work all fine, but when I use my own dataset which is being imported from a *.csv, I get the error message "WError in matrix(1, AMn, 1) : non-numeric matrix extent", which is a mystery to me.

Since I am working on computer with a German locale (WinXP) it might have something to do with the imported dataframe. However, from the error message I cannot spot the problem. Attached you find a minimal script and *.csv that should reproduce the error. Any hint how to handle this problem would be greatly appreciated.

With best regards from Berlin,
Albrecht Gradmann

P.S.: This is my first post to an R-related helplist. Please let me know if essential information is missing or improperly posted.






## Minimal script to reproduce error
##
## startup-stuff
library(reshape)
library(Amelia)



## read.csv that
##  - considers ":" as NA
##  - skips the first 10 rows that are used to supply metainfo
##  - does not alter the column names by adding Xes (Stata-convention)
##
name.dates <- read.csv2("minimal.csv",na.strings = ":",skip=10,check.names=FALSE)
# drop superfluous las column
name.dates <- name.dates[,1:13]


## melt and reshape so that the year information is put in colums
melt.dates <- melt(name.dates, id = c("Indicator","Group","Country"))
head(melt.dates)

# Change modes to make summary look like summary(freetrade) from
# Amelia tutorial
melt.dates$value<-as.numeric(melt.dates$value)

melt.dates$variable <- as.character(melt.dates$variable)
melt.dates$variable <- as.integer(melt.dates$variable)

melt.dates$Country <- as.character(melt.dates$Country)

summary(melt.dates)
head(melt.dates)


## Start using Amelia ##

amelia(melt.dates,m=1,ts="variable",cs="Country",idvars=c("Indicator","Group"))
# --> WError in matrix(1, AMn, 1) : non-numeric matrix extent

amelia(melt.dates[,c("Country","variable","value")],m=1,ts="variable",cs="Country")
# --> WError in matrix(1, AMn, 1) : non-numeric matrix extent