# [R] linearHypothesis and factors

John Fox jfox at mcmaster.ca
Mon Jul 9 15:14:23 CEST 2012

```Dear Alex,

As explained in ?linearHypothesis, you can use matchCoefs() in the second argument:

linearHypothesis(reg, matchCoefs(reg, "year") , vcov=vcovHC(reg, "HC1"))

In addition, you can set the argument white.adjust="hc1" as an alternative to using the vcov argument. Finally, in this case it would be simpler to just use Anova(), also with white.adjust="hc1".

I hope this helps,
John

------------------------------------------------
John Fox
Sen. William McMaster Prof. of Social Statistics
Department of Sociology
McMaster University
http://socserv.mcmaster.ca/jfox/

On Sun, 8 Jul 2012 18:45:22 -0700 (PDT)
Waikato_alex <oak1 at waikato.ac.nz> wrote:
> Hi everyone,
>
> I'm sure this is pretty basic but I couldn't find a clear example of how to
> do this. I'm running a regression, say:
> reg <- lm(Y ~ x1 + year)
> where x1 is a continuous variable and year is a factor with various year
> levels. Individually,  each year factor variable is not significant, but I
> have a suspicion they are jointly significant. I can't figure out how to run
> a linearHypothesis test with a factor, i.e.
> linearHypothesis(reg, ??? year=0 ??? , vcov=vcovHC(reg, , "HC1"))
>
> Would be very much appreciated.
>
> Many thanks,
>
> Alex
>
> --
> View this message in context: http://r.789695.n4.nabble.com/linearHypothesis-and-factors-tp4635814.html
> Sent from the R help mailing list archive at Nabble.com.
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help