R-beta: formula() and model formulae

Peter Dalgaard BSA p.dalgaard at kubism.ku.dk
Wed May 7 13:53:07 CEST 1997


Bill Venables <wvenable at attunga.stats.adelaide.edu.au> writes:

> A term such as (a + b + x + y)^2 should be expanded out binomial
> fashion, coefficients stripped away and the remaining products
> treated as : products.  Then S copes with terms like a:a, a:b and
> a:x fine, even x:y is handled by having it generate a column of
> xy-products, as it should.

I tend to agree.

> Ah, the Helmert contrasts b\^ete noir.  For ANOVA the contrast
> matrix used is mostly irrelevant.  For regression models I agree,
> treatment contrasts would be generally more easily interpreted.

Understatement of the year... Last time I bumped into them, it took me
and a colleague more than an hour to figure out how to interpret the
regression coefficients, and, I may add, the solution was *not* what
the white book said it was (it's not just one level minus the average
of the preceding, the parameter is also scaled by the reciprocal of
the level number). [There's a split-second solution -- see below --
but we sort of didn't think of it at the time...] 
 
> I presume the reason they were used at all is because if you have
> equal replication of everything the Helmert contrasts give you a
> model matrix with orthogonal columns, so all estimates are
> uncorrelated.  Whenever do you get equal replication, though?

Hardly ever. Actually, I though that the point was not so much
ortogonality, but the successive testing (A=B, A=B=C, A=B=C=D,...).
However that is just plainly wrong outside of balanced ANOVA's.
And, even in that case, once the first two levels differ, the rest
of the coefficients lose all meaning.

BTW. We have a bug:

> solve(cbind(c(1,1,1,1),contr.helmert(4)))
            [,1]        [,2]          [,3]         [,4]
[1,]  0.25000000  0.25000000  2.500000e-01 2.500000e-01
[2,] -0.50000000  0.50000000  1.850493e-17 1.850493e-17
[3,] -0.16666667 -0.16666667  3.333333e-01 1.117072e-17
[4,] -0.08333333 -0.08333333 -8.333333e-02 2.500000e-01
> solve(cbind(c(1,1,1,1),contr.helmert(4)))
Error: incorrect tag type
solve(cbind(c(1,1,1,1),contr.helmert(4)))
                 ^
Error: syntax error

---------------------
And (in another run):

> A<-contr.helmert(4)
> X<-cbind(c(1,1,1,1),A)
Segmentation fault


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



More information about the R-help mailing list