[R] How to display full name for the coefficients/factors in summary()?

Kingsford Jones kingsfordjones at gmail.com
Tue Nov 3 17:51:32 CET 2009


By default orthogonal polynomial contrasts are used for ordered
factors. Drop the 'ordered = TRUE' and you will get treatment
contrasts.

hth,
Kingsford Jones

On Tue, Nov 3, 2009 at 8:52 AM, Jen-Chien Chang <jcchang at andrew.cmu.edu> wrote:
> Hi,
>
> I am wondering if there is a way to display the full anme of the regression
> coeffients/factors in the summary?
>
> Suppose I have a bogus data set using weekday as factor which has 7 levels
> such as:
>
> mydata <- sample(364)
> wk <- rep(1:7, 52)
> weekday <-
> factor(wk,1:7,c("Mon","Tue","Wed","Thu","Fri","Sat","Sun"),ordered=T)
> test <- data.frame(mydata,weekday)
> lm.test <- lm(mydata ~ weekday, test)
> summary(lm.test)
> Call:
> lm(formula = mydata ~ weekday)
>
> Residuals:
>     Min       1Q   Median       3Q      Max
> -205.615  -93.486   -2.212   88.851  199.423
>
> Coefficients:
>            Estimate Std. Error t value Pr(>|t|)
> (Intercept) 182.5000     5.5137  33.100   <2e-16 ***
> weekday.L   -27.0426    14.5878  -1.854   0.0646 .
> weekday.Q    -0.9211    14.5878  -0.063   0.9497
> weekday.C    -1.6565    14.5878  -0.114   0.9097
> weekday^4   -16.6449    14.5878  -1.141   0.2546
> weekday^5     9.9436    14.5878   0.682   0.4959
> weekday^6   -14.3971    14.5878  -0.987   0.3243
> ---
> Signif. codes:  0 *** 0.001 ** 0.01 * 0.05 . 0.1   1
>
> Residual standard error: 105.2 on 357 degrees of freedom
> Multiple R-squared: 0.01705,    Adjusted R-squared: 0.0005341
> F-statistic: 1.032 on 6 and 357 DF,  p-value: 0.4039
> -----------------------------------
>
> Why is the name for the regression coeffients/factors display as weekday.L,
> weekday.Q, ....weekday^6 instead of Tue, Wed, and such? Is there a simple
> way of changing options to fix it?
>
> Please advise and many thanks for your help!
>
> 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.
>




More information about the R-help mailing list