[R] how to get inflection point in binomial glm
Rubén Roa
rroa at azti.es
Fri Dec 2 09:19:36 CET 2011
René,
Yes, to fit a re-parameterized logistic model I think you'd have to code the whole enchilada yourself, not relying on glm (but not nls() as nls() deals with least squares minimization whereas here we want to minimize a minus log binomial likelihood).
I did that and have the re-parameterized logistic model in a package I wrote for a colleague (this package has the logistic fit fully functional and documented).
My code though only considers one continuous predictor.
If you want I may email you this package and you figure out how to deal with the categorical predictor.
One thing I believe at this point is that you'd have to do the inference on the continuous predictor _conditional_ on certain level(s) of the categorical predictor.
Rubén
-----Mensaje original-----
De: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] En nombre de René Mayer
Enviado el: jueves, 01 de diciembre de 2011 20:34
Para: David Winsemius
CC: r-help Help
Asunto: Re: [R] how to get inflection point in binomial glm
Thanks David and Rubén!
@David: indeed 15 betas I forgot the interaction terms, thanks for correcting!
@Rubén: the re-parameterize would be done within nls()? how to do this practically with including the factor predictor?
and yes, we can solve within each group for Y=0 getting
0=b0+b1*X |-b0
-b0=b1*X |/b1
-b0/b1=X
but I was hoping there might a more general solution for the case of multiple logistic regression.
HTH
René
Zitat von "David Winsemius" <dwinsemius at comcast.net>:
>
> On Dec 1, 2011, at 8:24 AM, René Mayer wrote:
>
>> Dear All,
>>
>> I have a binomial response with one continuous predictor (d) and one
>> factor (g) (8 levels dummy-coded).
>>
>> glm(resp~d*g, data, family=binomial)
>>
>> Y=b0+b1*X1+b2*X2 ... b7*X7
>
> Dear Dr Mayer;
>
> I think it might be a bit more complex than that. I think you should
> get 15 betas rather than 8. Have you done it?
>
>>
>> how can I get the inflection point per group, e.g., P(d)=.5
>
> Wouldn't that just be at d=1/beta in each group? (Thinking, perhaps
> naively, in the case of X=X1 that
>
> (Pr[y==1])/(1-Pr[y==1])) = 1 = exp( beta *d*(X==X1) ) # all other
> terms = 0
>
> And taking the log of both sides, and then use "middle school" math to solve.
>
> Oh, wait. Muffed my first try on that for sure. Need to add back both
> the constant intercept and the baseline "d" coefficient for the
> non-b0 levels.
>
> (Pr[y==1])/(1-Pr[y==1])) = 1 = exp( beta_0 + beta_d_0*d +
> beta_n + beta_d_n *d*(X==Xn) )
>
> And just
>
> (Pr[y==1])/(1-Pr[y==1])) = 1 = exp( beta_0 + beta_d_0*d ) # for the
> reference level.
>
> This felt like an exam question in my categorical analysis course 25
> years ago. (Might have gotten partial credit for my first stab,
> depending on how forgiving the TA was that night.)
>
>>
>> I would be grateful for any help.
>>
>> Thanks in advance,
>> René
>>
> --
>
> David Winsemius, MD
> West Hartford, CT
>
>
______________________________________________
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.
More information about the R-help
mailing list