[R] Results from clogit out of range?

David Winsemius dwinsemius at comcast.net
Wed Apr 21 00:48:37 CEST 2010


On Apr 20, 2010, at 5:59 PM, Noah Silverman wrote:

> Hi,
>
> I'm calculating a conditional logit on some data stratified by group.
> My understanding was that a conditional logit by definition returns a
> value between 0 and 1 a a probability.  Can anyone suggest why I'm
> seeing results outside of the {0,1} range??

Probably because you did not read the help page for the function  
predict.coxph. Pay special attention to the type argument.

"type=c("lp", "risk", "expected", "terms")"

>
> The call in R is:
>
> m <- clogit(score ~ val_1 + val_2 + strata(group), data=data)
>
> Then
>
> prediction <- predict(m,newdata)

I do not see that you have defined any newdata.

>
>
> A sample of the data with resulting predictive values is:
>     group          score   val_1               val_2        prediction
> 1  2009-01-04_1     1 0.5913962     -1.121589  1.62455210
> 2  2009-01-04_1     1 0.6175472     -3.249820 -0.20093346
> 3  2009-01-04_1     1 0.5439640     -2.424501  0.46651849
> 4  2009-01-04_1     0 0.3745209     -2.477424  0.31263855
> 5  2009-01-04_1     0 0.6329855     -3.424174 -0.34200448
> 6  2009-01-04_1     0 0.4571999     -2.770247  0.11190788
> 7  2009-01-04_1     0 0.3822623     -2.259422  0.50627534
> 8  2009-01-04_1     0 0.2605742     -4.424806 -1.44566070
> 9  2009-01-04_1     0 0.4449604     -2.357060  0.46174993
> 10 2009-01-04_1     0 0.6595178     -2.246518  0.69427842
> 11 2009-01-04_1     0 0.5260032     -2.977887 -0.02393871

By default (which is what you have implicitly chosen) you are  
requesting "lp" = linear predictors rather than "risk".

-- 
David.
>
> ______________________________________________
> 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