# R-beta: Various R Questions and Comments

Thomas Lumley thomas at biostat.washington.edu
Mon Feb 16 22:34:37 CET 1998

```On Mon, 16 Feb 1998, Doug Morse wrote:
> Peter Dalgaard BSA wrote:
> > morse at pobox.com (Doug Morse) writes:
>
> > > 4.  Anovalist.lm
> > >
> > ..
> > >
> > >     For example, the following should be allowed:
> > >
> > >     -----
> > >     Analysis of Variance Table
> > >
> > >     Model 1: Satisfaction + Age ~ Anxiety
> > >     Model 2: Satisfaction ~ Age + Severity + Anxiety
> > >
> > >        Res.Df  Res.Sum-Sq  Df  Sum-Sq       F  Pr(>F)
> > >     1      21        2152
> > >     2      19        2012   2   139.9  0.6609  0.5279
> > >     -----
> > >
> > >     It represents a test of whether beta1 = -1.0 and beta2 = 0.0
> > >     using the generalized linear test statistic (see "Applied
> >
> > Wouldn't this be better done using offsets?
>
> I'm not sure what you mean by 'offsets'.  Could you elaborate a
> bit?

An offset is a term in the model with coefficient set at 1. There are all
sorts of uses, but one is exactly what you want: testing a coefficient
against a non-zero hypothesised value.

Unfortunately lm() doesn't implement offsets, but glm() does
glm(Satisfaction~Age+Severity+Anxiety,family=gaussian())
glm(Satisfaction~offset(-1.0*Age)+Anxiety,family=gaussian())
which could be compared with anova.glm (the family=gaussian()) option is
not necessary as it is the default)

Thomas Lumley

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```