[R] logical(0) response from lrm

David Winsemius dwinsemius at comcast.net
Mon Apr 26 15:40:04 CEST 2010


On Apr 26, 2010, at 12:55 AM, Rob James wrote:

> What causes the error report:
>
> logical(0)
>
> to arise in the rms function lrm?
>
> Here's my data:
>
> But both the dependent and the independent variable seem fine...
>
> > str(AABB)
> 'data.frame':    1176425 obs. of  9 variables:
> $ sex     : int  1 1 0 1 1 0 0 0 0 0 ...
> $ faint   : int  0 0 0 0 0 0 0 0 0 0 ...
>
> Here's the simplified model and error
>
> AABB$model1 < lrm (faint ~  sex)
> logical(0)

Two possibilities (four actually):

1) The call. If your call was:
AABB$model1 < lrm (faint ~  sex)

Then you have made two errors in that call:
a) using a dyadic logical operator "<" instead of an an assignment.  
Since AA
b) not providing a data argument in lrm
c) since the results of lrm will not be a vector of the same row count  
as AABB the assignment would probably have failed anyway.
>
>
> But the data seem fine....
>
> > table(AABB$faint)

2) That is not actually enough to prove that the "data is fine". For  
such a statement you would need:

table(AABB$faint, AABB$sex)


>
>      0       1
> 1173475    2950
> > table(AABB$sex)
>
>     0      1
> 502551 673874
>
> Suggestions?
>
> ______________________________________________
> 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list