[R] In da.norm Error: NA/NaN/Inf in foreign function call (arg 2)

From: <mlz2+_at_pitt.edu>
Date: Mon 24 Oct 2005 - 13:51:26 EST


I am conducting a simulation study generating multivariate normal data, deleting observations to create a
data set with missing values and then using multiple imputation via da.norm in Schafer's norm package.

>From da.norm, I get the following error message: "Error: NA/NaN/Inf in
foreign function call (arg 2)"
The frequency of the error message seems to depend on the ratio of n to p and the percent of missingness.
for example, n=50, p=5, 50% missing, it fails about 9 in 10 runs. For n=100, p=3, 50% missing it fails
about 1 in 10 runs.

I suspected that near-singularity of the starting covariance matrix might be to blame, but I found instances
where the error message occurred, but the covariance was invertible.

Any suggestions as to the reason for the error or an alterative way to generate the imputations?
Sample code is included below.
Thanks,
Melissa

I am using R 2.2.0 with norm 1.0-9 on Windows XP Professional.

#Sample code:
library(norm)
n<-50
p<-5
prob.miss<-.5
#generate complete data
x<-matrix(rnorm(n*p),nrow=n)
#create missing data
for (j in 1:p)
{miss<-rbinom(n,1,prob.miss)
for (i in 1:n){if (miss[i]==1) x[i,j]<-NA}} #create imputations
seed<-1234
rngseed(seed)
s <- prelim.norm(x)
thetahat <- em.norm(s,showits=F)
da.norm(s,thetahat,steps=1000,showits=F,return.ymis=TRUE)



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Oct 24 13:58:45 2005

This archive was generated by hypermail 2.1.8 : Mon 24 Oct 2005 - 19:30:22 EST