granova.contr(resp, con, ngrp = nrow(con),
npg = length(resp)/ngrp, jj = 1)lm.lm
(When effects are simple, as in an equal n's power of 2 design, mean differences will generally correspond to the linear regression coefficients as seen in the lm summary results.)con
should have G rows (the number of groups), and a number of columns equal to the number of a priori contrasts, at most G-1. If
the number of columns of con is G-1, then the number per group, or cell size, is taken to be length(resp)/G, where G = nrow(con).
If the number of columns of con is less than G-1 then the user must stipulate npg, the number in each group or cell.
The function is designed for the case when all cell sizes are the same, and may be most helpful when the a priori contrasts
are mutually orthogonal (e.g., in power of 2 designs, or their fractional counterparts; also when specific row or column comparisons,
or their interactions (see the example below based on rat weight gain data)). It is not essential that contrasts be
mutually orthogonal; but mutual linear independence is required. (When factor levels correspond to some underlying continuum
a standard application might use con = contr.poly(G), for G the number of groups; consider also contr.helmert(G).)
The final plot in each application shows the data for all groups or cells in the design, where groups are simply numbered from 1:G, for G the number of groups, on the horizontal axis, versus the response values on the vertical axis.granova.1w, granova.2w, granova.dsdata(rat)
dat6 <- matrix(c(1, 1, 1, -1, -1, -1, -1, 1, 0, -1, 1, 0, 1, 1, -2,
1, 1, -2, -1, 1, 0, 1, -1, 0, 1, 1, -2, -1, -1, 2), ncol = 5)
granova.contr(rat[,1], con = dat6)
#Polynomial Contrasts
granova.contr(rat[,1],con = contr.poly(6))
#based on random data (not run)
resp <- rt(64, 5)
granova.contr(resp, con = contr.helmert(8))Run the code above in your browser using DataLab