[R] Finding all the coefficients for a logit model
peter dalgaard
pdalgd at gmail.com
Fri Feb 10 10:44:32 CET 2012
On Feb 10, 2012, at 06:08 , R. Michael Weylandt wrote:
> Add -1 to your glm to remove the intercept term -- that will force
> Friday to have its own coefficient.
That's one answer.
Another one is that the coefficient (in the model with an intercept term) for Friday is zero with an s.e. of zero. Namely, by definition, the log-odds for Friday minus the log-odds for Friday.
-pd
>
> E.g.,
>
> dg <- data.frame(value = rnorm(28), day = letters[1:7])
> lm(value ~ day, data = dg)
> lm(value ~ day - 1, data = dg)
>
> Michael
>
> On Thu, Feb 9, 2012 at 6:58 PM, Abraham Mathew <abmathewks at gmail.com> wrote:
>> Let's say I have a variable, day, which is saved as a factor with 7 levels,
>> and I use it in a
>> logistic regression model. I ran the model using the car package in R and
>> printed out the
>> results.
>>
>> mod1 = glm(factor(status1) ~ factor(day), data=mydat,
>> family=binomial(link="logit"))
>> print(summary(mod1))
>>
>> The result I get is:
>>
>> Coefficients:
>> Estimate Std. Error z value Pr(>|z|)
>> (Intercept) -0.4350 0.0379 -11.48 <2e-16 ***
>> factor(day)Monday -0.6072 0.0479 -12.69 <2e-16 ***
>> factor(day)Saturday 0.5964 0.0559 10.67 <2e-16 ***
>> factor(day)Sunday 1.1140 0.0627 17.78 <2e-16 ***
>> factor(day)Thursday -0.4492 0.0516 -8.71 <2e-16 ***
>> factor(day)Tuesday -0.9331 0.0496 -18.82 <2e-16 ***
>> factor(day)Wednesday -0.8575 0.0486 -17.63 <2e-16 ***
>>
>>
>> It seems that Friday is being used as the baseline, but I want to know
>>
>> how I can acquire the coefficient for the baseline (friday)?
>>
>>
>> I ran mod1$coefficients, but that didn't do the trick.
>>
>>
>> Can anyone help.
>>
>>
>> Thank you,
>>
>> Abraham M.
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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.
>
> ______________________________________________
> 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.
--
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
More information about the R-help
mailing list