[R] how to print the full name of the factors in summary?

Adaikalavan Ramasamy adaikalavan.ramasamy at gmail.com
Mon Nov 2 16:42:36 CET 2009


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
>




More information about the R-help mailing list