how to print the full name of the factors in summary?
Jen-Chien and Adaikalavan, Weekday is specified as an ordered factor, for which the default contrast type is contr.poly, i.e., orthogonal-polynomial contrasts. I would have expected a 6th-degree polynomial for the 7 days of the week, and there's a message that suggests that 3 coefficients are aliased, so there must be redundancies among the factors. If you want contr.treatment, treating "Mon" as the baseline level, then simply omit ordered=T from the call to factor(), but this won't make the collinearities disappear. I hope this helps, John ------------------------------ John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario, Canada web: socserv.mcmaster.ca/jfox
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
Behalf Of Adaikalavan Ramasamy Sent: November-02-09 10:43 AM To: Jen-Chien Chang Cc: r-help at r-project.org Subject: Re: [R] how to print the full name of the factors in summary? It would be useful to say which package the object SJ comes from or provide a more reproducible example. Assuming that Demand variable is continuous and you are fitting a standard lm() model, then your results looks suspicious. Where are the coefficients for Month, Holiday, Season? Jen-Chien Chang wrote:
Hi, I am wondering if there is a simple way to fix the problem I am having. For unknown reason, I could not get the full name of the factors to be printed in the summary. I have tried to used summary.lm as well but the problem still persists. SJ$Weekday <-
factor(SJ$Weekday,1:7,c("Mon","Tue","Wed","Thu","Fri","Sat","Sun"),ordered=T
)
....
attach(SJ)
lm.SJ <- lm(Demand ~ Weekday+Month+Holiday+Season)
summary(lm.SJ)
Call:
lm(formula = Demand ~ Weekday + Month + Holiday + Season)
Residuals:
Min 1Q Median 3Q Max
-69.767 -12.224 -1.378 10.857 91.376
Coefficients: (3 not defined because of singularities)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 88.7091 3.3442 26.527 < 2e-16 ***
Weekday.L 20.8132 2.8140 7.396 1.08e-12 ***
Weekday.Q -12.7667 2.8156 -4.534 7.99e-06 ***
Weekday.C -10.6375 2.8113 -3.784 0.000182 ***
Weekday^4 -8.3325 2.8103 -2.965 0.003238 **
---------------------------------------------
Is there a way for summary to print the full name of the factors and
levels? Say Weekday.Tue instead Weekday.L?
Thanks!
Jack Chang
______________________________________________ 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.