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

Gavin Simpson gavin.simpson at ucl.ac.uk
Tue Nov 10 10:08:19 CET 2009


On Mon, 2009-11-09 at 19:31 -0600, Peng Yu wrote:
> 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

It is on CRAN. just do:

install.packages("fortunes")

Choose a repository near to you and it should install.

There appears to be a problem with R-forge and Mac OsX binaries. The
code you show above works for me on linux and R2.9.x

G

> 
> >> 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?
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%




More information about the R-help mailing list