[R] Calculating the probability for a logistic regression

Ben Bolker bbolker at gmail.com
Wed Nov 30 03:22:34 CET 2011


sirilkt <jankee2010 <at> hotmail.com> writes:

> 
> Hi All,
> 
> When we run the command : summary ( newmod<-gam(Dlq~ formula,family,,data) ) 
> 
> in R,  the output would the effect of smoothness in R.
> 
> As of now to calculate the probability I am following the below approach:
> 
> 1)  Run the plot of the GAM , interpret the curves 
> 
> 2) Re Run the Regression as a GLM after taking into account the non linear
> terms in step1
> 
> 3) Calculate the probability from the coefficients obtained in step2, using
> the appropriate link function
> 
> But I came across a paper by SAS ( 
> http://support.sas.com/rnd/app/papers/gams.pdf ), Where the  parameters
> outputs are also given when the program is run.
> 
> So I was wondering if we have something similar in R also? I tried hard but
> could not find anything.

   It's still not entirely clear what you want to do.

 What's wrong with

library(gam)
data(kyphosis)
gg <- gam(Kyphosis ~ s(Age,3) +
          s(Start,3) + s(Number,3),
          data=kyphosis, family=binomial)
predict(gg,type="response")

?

See ?predict.gam for more details.



More information about the R-help mailing list