Dear all. I am trying to run PAN, multilevel multiple imputation program, by
using a PAN package ported to R;
http://cran.at.r-project.org/src/contrib/Descriptions/pan.html. I could run
PAN when I imputed one variable. However, when I tried to impute two variables
at once, I received an error message, ?Error: subscript out of bounds.? Can
anyone tell why this error happens? I also want to try this program with
S-plus. However, I don?t have an access to older versions of S-plus and cannot
run PAN with S-plus. Can anybody tell if the program below works with S-plus?
The program below is basically same as ?panex?, an example program which comes
with PAN package. The only difference is that I added additional missing
variable, y2, in Y matrix and changed values of ?prior?.
I greatly appreciate any help.
Eishi
#####################################################################
library(pan)
library(ts)
# Two response variables with missing data
y1 <- c(16,20,16,20,-6,-4,
12,24,12,-6,4,-8,
8,8,26,-4,4,8,
20,8,NA,NA,20,-4,
8,4,-8,NA,22,-8,
10,20,28,-20,-4,-4,
4,28,24,12,8,18,
-8,20,24,-3,8,-24,
NA,20,24,8,12,NA)
y2 <- c(1,20,13,0,-1,-5,
1,4,2,-4,6,-3,
2,4,6,-5,6,7,
0,6,NA,NA,10,-5,
7,3,-2,NA,2,-5,
1,0,8,-2,-2,-6,
1,2,4,2,2,8,
-5,2,4,-1,2,-4,
NA,2,4,0,2,NA)
y <- cbind(y1,y2)
subj <- c(1,1,1,1,1,1,
2,2,2,2,2,2,
3,3,3,3,3,3,
4,4,4,4,4,4,
5,5,5,5,5,5,
6,6,6,6,6,6,
7,7,7,7,7,7,
8,8,8,8,8,8,
9,9,9,9,9,9)
pred <- cbind(int=rep(1,54),
dummy1=rep(c(1,0,0,0,0,0),9),
dummy2=rep(c(0,1,0,0,0,0),9),
dummy3=rep(c(0,0,1,0,0,0),9),
dummy4=rep(c(0,0,0,1,0,0),9),
dummy5=rep(c(0,0,0,0,1,0),9))
xcol <- 1:6
zcol <- 1
prior <- list(a=2,Binv=4,c=2,Dinv=4)
result <- pan(y,subj,pred,xcol,zcol,prior,seed=13579,iter=1000)
plot(1:1000,log(result$sigma[1,1,]),type="l")
acf(log(result$sigma[1,1,]))
plot(1:1000,log(result$psi[1,1,]),type="l")
acf(log(result$psi[1,1,]))
par(mfrow=c(3,2))
for(i in 1:6) plot(1:1000,result$beta[i,1,],type="l")
for(i in 1:6) acf(result$beta[i,1,])
y1 <- result$y
result <- pan(y,subj,pred,xcol,zcol,prior,seed=9565,iter=100,start=result$last)
y2 <- result$y
result <- pan(y,subj,pred,xcol,zcol,prior,seed=6047,iter=100,start=result$last)
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.utsouthwestern.edu/pipermail/impute/attachments/20050602/0388913f/attachment.htm
From newgardc <@t> ohsu.edu Mon Jun 13 15:23:30 2005
From: newgardc <@t> ohsu.edu (Craig Newgard)
Date: Sun Jun 26 08:25:02 2005
Subject: [Impute] question
Message-ID: <[email protected]>
Can anyone suggest a method or reference for calculating appropriate confidence
intervals around kappa interrater reliability estimates using multiply imputed
data? Many thanks.
Craig
Craig D. Newgard, MD, MPH
Assistant Professor
Department of Emergency Medicine
Department of Public Health & Preventive Medicine
Oregon Health & Science University
3181 Sam Jackson Park Road
Mail Code CR-114
Portland, OR 97239-3098
(503) 494-1668 (Office)
(503) 494-4640 (Fax)
[email protected]
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.utsouthwestern.edu/pipermail/impute/attachments/20050613/97b9bc64/attachment.htm
From von-hippel.1 <@t> osu.edu Tue Jun 21 15:00:06 2005
From: von-hippel.1 <@t> osu.edu (Paul von Hippel)
Date: Sun Jun 26 08:25:02 2005
Subject: [Impute] convergence of EM under collinearity
Message-ID: <[email protected]>
An HTML attachment was scrubbed...
URL:
http://lists.utsouthwestern.edu/pipermail/impute/attachments/20050621/588d1dc1/attachment.htm
From Howells_W <@t> bmc.wustl.edu Tue Jun 21 15:40:45 2005
From: Howells_W <@t> bmc.wustl.edu (Howells, William)
Date: Sun Jun 26 08:25:02 2005
Subject: [Impute] convergence of EM under collinearity
Message-ID: <2ada428b6944da4b8f8a2fdf4e60e52a196...@exchange.wusm-pcf.wustl.edu>
This is just off the top of my head, but I recall that MCMC is a better
method because it allows for uncertainty in the parameters themselves
(mean and variance), not only at the observation level. MCMC uses the
initial EM estimates as starting values so it might be interesting to
see what happens with the means over a large number of iterations, say
1000, 5000 or 10,000, if you have the computing power and time. PROC MI
will plot the means and variances over the iterations and you can check
if they "stabilize" (timeplot option on the MCMC statement). What to
conclude if MCMC converges but EM does not, or how that relates to
collinearity in the model, I'm not sure.
Bill Howells, MS
Wash U Med School, St Louis
________________________________
From: [email protected]
[mailto:[email protected]] On Behalf Of Paul von
Hippel
Sent: Tuesday, June 21, 2005 3:00 PM
To: [email protected]
Subject: [Impute] convergence of EM under collinearity
I am using SAS PROC MI with the default settings. When I include
nearly-collinear variables in my imputation model, I commonly get
messages like the following:
WARNING: The EM algorithm (MLE) fails to converge after 200 iterations.
You can increase the number of iterations (MAXITER= option) or increase
the value of the convergence criterion (CONVERGE=option).
NOTE: The EM algorithm (posterior mode) converges in 141 iterations.
The messages go away if I remove some of the nearly-collinear variables,
but I would like to keep those variables since I need them for analysis.
Looking at the the messages, I would say that SAS's implementation of
the EM algorithm has two stages: the first stage estimates the MLE; the
second stage estimates the posterior mode. It also appears that the
second stage converged even though the first stage didn't. (Possibly the
second stage benefited from a default prior.)
I don't find any of this discussed in the documentation. Would you agree
with my interpretation?
Also, would you expect it's safe to use the imputed data despite the
warning? Since the second stage of EM converged, I'm thinking that the
imputed data may be okay.
Many thanks for any advice.
Paul von Hippel
Paul von Hippel
Department of Sociology / Initiative in Population Research
Ohio State University
<br/>The materials in this message are private and may contain Protected
Healthcare Information. If you are not the intended recipient, be advised that
any unauthorized use, disclosure, copying or the taking of any action in
reliance on the contents of this information is strictly prohibited. If you
have received this email in error, please immediately notify the sender via
telephone or return mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.utsouthwestern.edu/pipermail/impute/attachments/20050621/4fd5a916/attachment.htm
From rlittle <@t> umich.edu Tue Jun 21 18:56:53 2005
From: rlittle <@t> umich.edu (Rod Little)
Date: Sun Jun 26 08:25:02 2005
Subject: [Impute] convergence of EM under collinearity
In-Reply-To:
<2ada428b6944da4b8f8a2fdf4e60e52a196...@exchange.wusm-pcf.wustl.edu>
References: <2ada428b6944da4b8f8a2fdf4e60e52a196...@exchange.wusm-pcf.wustl.edu>
Message-ID: <pine.wnt.4.61.0506211948500.1...@little-home>
Dear Paul: with a uniform prior on the mean and covariance matrix the ML
estimate is the posterior mode, so I am not sure what is the default prior
that is the basis for the posterior mode statement.
MCMC convergence is much harder to determine than EM convergence, since it
is convergence in the stochastic sense rather than in the sense of the
maximum value of the likelihood function. If ML is having problems
converging then so will MCMC.
Including close to collinear covariates may not hurt you much for
imputation, but it doesn't help much either. I'd check whether the
imputations look reasonable -- a good idea any time MI is applied -- I
would not assume the program produces sensible imputations, particularly
when multicollinearity is an issue.
On Tue, 21 Jun 2005, Howells, William wrote:
> This is just off the top of my head, but I recall that MCMC is a better
> method because it allows for uncertainty in the parameters themselves
> (mean and variance), not only at the observation level. MCMC uses the
> initial EM estimates as starting values so it might be interesting to
> see what happens with the means over a large number of iterations, say
> 1000, 5000 or 10,000, if you have the computing power and time. PROC MI
> will plot the means and variances over the iterations and you can check
> if they "stabilize" (timeplot option on the MCMC statement). What to
> conclude if MCMC converges but EM does not, or how that relates to
> collinearity in the model, I'm not sure.
>
>
>
> Bill Howells, MS
>
> Wash U Med School, St Louis
>
>
>
> ________________________________
>
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Paul von
> Hippel
> Sent: Tuesday, June 21, 2005 3:00 PM
> To: [email protected]
> Subject: [Impute] convergence of EM under collinearity
>
>
>
> I am using SAS PROC MI with the default settings. When I include
> nearly-collinear variables in my imputation model, I commonly get
> messages like the following:
>
> WARNING: The EM algorithm (MLE) fails to converge after 200 iterations.
> You can increase the number of iterations (MAXITER= option) or increase
> the value of the convergence criterion (CONVERGE=option).
> NOTE: The EM algorithm (posterior mode) converges in 141 iterations.
>
> The messages go away if I remove some of the nearly-collinear variables,
> but I would like to keep those variables since I need them for analysis.
>
> Looking at the the messages, I would say that SAS's implementation of
> the EM algorithm has two stages: the first stage estimates the MLE; the
> second stage estimates the posterior mode. It also appears that the
> second stage converged even though the first stage didn't. (Possibly the
> second stage benefited from a default prior.)
>
> I don't find any of this discussed in the documentation. Would you agree
> with my interpretation?
>
> Also, would you expect it's safe to use the imputed data despite the
> warning? Since the second stage of EM converged, I'm thinking that the
> imputed data may be okay.
>
> Many thanks for any advice.
> Paul von Hippel
>
>
>
> Paul von Hippel
> Department of Sociology / Initiative in Population Research
> Ohio State University
>
> <br/>The materials in this message are private and may contain Protected
> Healthcare Information. If you are not the intended recipient, be advised
> that any unauthorized use, disclosure, copying or the taking of any action in
> reliance on the contents of this information is strictly prohibited. If you
> have received this email in error, please immediately notify the sender via
> telephone or return mail.
>
___________________________________________________________________________________
Roderick Little
Richard D. Remington Collegiate Professor of Biostatistics
U-M School of Public Health Tel (734) 936 1003
M4045 SPH II Fax (734) 763 2215
1420 Washington Hgts email [email protected]
Ann Arbor, MI 48109-2029 http://www.sph.umich.edu/~rlittle/