[R] R ANOVA question

David Winsemius dwinsemius at comcast.net
Sun Dec 6 19:52:51 CET 2009


On Dec 6, 2009, at 1:14 PM, Xin Ge wrote:

> Hi All,
>
> I'm fitting an intercept ANOVA model using R. I'm using following  
> contrast
> statement, so my first level is considered as base level.
>
> options(contrasts = c("contr.treatment", "contr.treatment"))
> My data has two factors are "Month" and "WeekDay". Due to default  
> alphabetic
> ordering, the Month(April) and WeekDay(Friday) are considered as  
> base levels
> and hence their coefficient is not shown in the ouput. Other month
> coefficient's are printed after subtracting April's coefficient from  
> them;
> similarly this holds for weeks' coefficients.
You can specify no-intercept models:

?formula
------

?weekdays
?months
?quarters

You can specify the order of your levels with factor:

wkfac <- factor(wkfac, levels=weekdays(Sys.Date()+1:7) )

>
> My Question is: How to get back the original month coefficients  
> (including
> April's coef.). So that I can find seasonal effects (for e.g. I'll  
> average
> Feb, Mar, Apr to get an estimate for "SPRING" season). Any  
> suggestions on
> how can I do this?

  You seem to need further reading about models that incorporate  
seasonality. RSiteSearch should help provide some worked examples.

>
> Thanks,
> Xin
>
--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list