[R] reference on contr.helmert and typo on its help page.

Peng Yu pengyu.ut at gmail.com
Tue Nov 10 02:31:53 CET 2009


On Sun, Nov 8, 2009 at 7:32 PM, John Fox <jfox at mcmaster.ca> wrote:
> Dear Peng,
>
> I'm tempted to try to get an entry in the fortunes package but will instead
> try to answer your questions directly:

I can not install 'fortunes'. What are the fortunes packages about?
> install.packages("fortunes", repos="http://R-Forge.R-project.org")
Warning: unable to access index for repository
http://R-Forge.R-project.org/bin/macosx/leopard/contrib/2.9
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
  package ‘fortunes’ is not available

>> I did read Section 9.1.2 and various other textbooks before posting my
>> questions. But each reference uses slightly different notations and
>> terminology. I get confused and would like a description that
>> summaries everything so that I don't have to refer to many different
>> resources. May I ask a few questions on the section in your textbook?
>>
>> Which variable in Section 9.1.2 is "a matrix of contrasts" mentioned
>> in the help page of 'contr.helmert'? Which matrix of contrast in R
>> corresponds to dummy regression? With different R formula, e.g. y ~ x
>> vs. y ~ x -1, $X_F$ (mentioned on page 189) is different and hence
>> $\beta_F$ (mentioned in eq. 9.3) is be different. So my understanding
>> is that the matrix of contrast should depend on the formula. But it is
>> not according to the help page of "contr.helmert".
>
> If the model is simply y ~ A, for the factor A, then cbind(1, contrasts(A))
> is what I call X_B, the row-basis of the model matrix. As I explain in the
> section that you read, the level means are mu = X_B beta, and thus beta =
> X_B^-1 mu = 0 are the hypotheses tested by the contrasts. Moreover, if, as
> in Helmert contrasts, the columns of X_B are orthogonal, then so are the
> rows of X_B^-1, and the latter are simply rescalings of the former. That
> allows one conveniently to code the hypotheses directly in X_B; all this is
> also explained in that section of my book, and is essentially what Peter D.
> told you. In R, contr.treatment and contr.SAS provide dummy-variable (0/1)
> coding of regressors, differing only in the selection of the reference
> level.

What is the mathematical definition of polynomial contrasts? Why
polynomial contrasts are the default contrasts for ordered factors?




More information about the R-help mailing list