[R] lrm in Design package--missing value where TRUE/FALSE needed

Frank E Harrell Jr f.harrell at vanderbilt.edu
Fri Sep 4 23:44:56 CEST 2009


Ping-Hsun Hsieh wrote:
> Hi,
> 
> A error message arose while I was trying to fit a ordinal model with lrm() I am using R 2.8 with Design package.
> 
> Here is a small set of mydata:
> RC	RS	Sex	CovA	CovB	CovC	CovD	CovE
> 2	1	0	1	1	0	-0.005575280	2
> 2	1	0	1	0	1	-0.001959580	2
> 3	0	0	0	1	0	-0.004725880	2
> 0	0	0	1	0	0	-0.005504850	2
> 2	1	1	0	0	0	-0.003880170	1
> 2	1	0	0	1	0	-0.006074230	2
> 2	1	0	0	1     1 	-0.003963920	2
> 2	1	0	0	1	0	 0.000658230	2
> 2	1	0	1	0	1	-0.002033610	2
> 0	0	0	0	0	1	-0.007761770	2
> 0	0	0	0	1	1	-0.000951784	2
> 
> Note: In the complete data, there are NAs. But the error messages showed in both the complete and above sets.
> 
>> attach(mydata)
>> lrm(RC~RS+Sex+CovA+CovB+CovC+CovD+CovE,data=mydata,na.action=na.pass)
> singular information matrix in lrm.fit (rank= 8 ).  Offending variable(s):
> CovE 
> Error in j:(j + params[i] - 1) : NA/NaN argument
> 
>> detach(mydata)
>> lrm(mydata$RC~ mydata$RS+ mydata$Sex+ mydata$CovA+ mydata$CovB+ mydata$CovC+ mydata$CovD+ mydata$CovE,data=mydata,na.action=na.pass)

Please read the documentation.  Use data=.  Don't use $ in variables in 
the model.  I don't know what na.pass is.  lrm does not allow NAs to be 
used in the attempted model fit.

Frank

> Error in if (!length(fname) || !any(fname == zname)) { : 
>   missing value where TRUE/FALSE needed
> 
> 
> I have debugged for a while, but no success. Does anyone know what happens?
> 
> Thanks,
> Mike
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 


-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University




More information about the R-help mailing list