Dear Amelia community,
I am a new Amelia user and I have been trying to use Amelia but could not
understand how to run Amelia on a data from a study that has a within
subject and a between subject variable. Below I will try to explain my
situation with a hypothetical experiment and data.
Experiment: Let's assume I am interested to see the reaction time of
subjects to some stimulus (say they have to identify the heaviest of the
objects been placed on their left
and right hands) under either a neutral or a happy setting (I the later
case the subjects are provided with their choice of drinks and a snack).
Added to this, each subject is tested with a range of weights. And I am
interested to see if the subjects with the "happy" atmosphere can perform
well than the "neutral" ones.
Here is the R code that makes the data for the above experiment:
# =====================================================
# Create a dataframe to contain the subject name and the repeated measures
factor Stimulus intensity
mydata=data.frame(SubjectName=sort(rep(paste("Subject",1:8,sep="_"),8)),StimIntensity=(rep(seq(100,800,by=100))));
# Add the between subjects variable Group
mydata =
cbind(mydata,Group=sort(rep(c("Neutral","Happy"),32),decreasing=T));
# Creates the Response time values for first group : "Neutral"
i=0;k=0;while (i < 4)
{a[((i*8)+1):((i*8)+8)]=sort(rnorm(mean=10+(i*10):20+(i*10),1,n=8)); i =
i+1;};
# Creates the Response time values for the second group : "Happy"
i=0;b=0;while (i < 4)
{b[((i*8)+1):((i*8)+8)]=sort(rnorm(mean=10+(i*10):20+(i*10),1,n=8))*c(1,1,1,1,1,1.5,1.75,2);
i = i+1;};
# Add the data to the RT column in mydata dataframe
mydata=cbind(mydata,"RT"=c(a,b));
# Creates a second dataframe with missing data (n=15)
mydataMissing = mydata;
mydataMissing[runif(n=15,min=1,max=64),"RT"] = NA;
# =====================================================
As you can see I have also made an additional data fame that has the
missing data. The question is how do I run Amelia in this case.
Any help would be appreciated.
I guess the cross section variable would be "Group" and the time series
variable = "StimIntensity" but when I just provide only these it produces
the error below.
"amelia starting
Amelia Error Code: 61
There is only 1 column of data after removing the ts, cs and idvars. Cannot
impute without adding polytime."
Thanks in advance
Best
-Anup
Show replies by date