# [R] proper syntax for testing linear combination of coefficients with glht() from multcomp package

Christopher W Ryan cry@n @end|ng |rom b|ngh@mton@edu
Wed Jun 22 05:16:11 CEST 2022

```I have a linear model with month, guv, and month:guv as predictors, and the
logit of the monthly absenteeism rate as response. I have 9 years of
monthly data, 107 observations altogether. I believe I've accounted for
autocorrelation  and heteroskedasticity properly. But I have a question
about hypothesis tests of linear combinations of predictors.

month is a factor, 12 levels, "january" as the baseline. guv is also a
factor with two levels: 0 until the 59th observation, and 1 thereafter.

I'd like to use the glht() function in the multcomp package for a
simultaneous one-sided hypothesis test of the effect of guv not in each
month, but in each season. So the effect of guv averaged across the 3
months in a season. So for example I define "fall" as comprising september,
october, and november.  Omitting the non-salient parts of the glht()
command, is this appropriate syntax for testing the average effect of guv
in the fall:

linfct = c("guv.fac1 + (1/3)*(guv.fac1:monthseptember) +
(1/3)*(guv.fac1:monthoctober) + (1/3)*(guv.fac1:monthnovember) >= 0")

And if winter comprises december, january, and february, and since january
is the baseline month, would this be the syntax to set up a hypothesis test
for effect of guv in the winter:

linfct= c("(1/3)*(guv.fac1:monthdecember) + (1)*(guv.fac1) +
(1/3)*(guv.fac1:monthfebruary) >= 0")

A glht() built like this runs without error and yields results that make
sense, but am I testing what I think I am testing?

Thanks.

--Chris Ryan

[[alternative HTML version deleted]]

```