1
$\begingroup$

I feel like I have come as far as I can in statistics while not understanding how design and contrast matrices work. Specifically I am interested in how to code custom contrasts like this and whether such custom contrasts can be integrated into a design matrix via the model.matrix function.

Can anyone recommend a good book on the subject that (a) has a 'from the ground up' approach and (b) provides worked examples in R.

$\endgroup$
3
  • $\begingroup$ I think I would start with the free documents available from the CRAN website and then ask again about specific difficulties you have. $\endgroup$
    – mdewey
    Jan 15, 2018 at 13:18
  • $\begingroup$ Thank you @mdewey. What free documents are you referring to? I have of course installed packages from CRAN and used the help pages for individual functions, however for the model.matrix and contrasts functions the examples provided are quite sparse. Certain packages (afex, glmmADMB etc.) come with vignettes that I have found very helpful. But the model matrix and contrasts functions come from the base package. Are there vignettes on CRAN for this? $\endgroup$
    – llewmills
    Jan 15, 2018 at 20:35
  • 1
    $\begingroup$ Open the CRAN website. Down the left hand side see Documentation. Below that is a link to Contributed which itself links to the contributed documentation. $\endgroup$
    – mdewey
    Jan 16, 2018 at 11:55

1 Answer 1

2
$\begingroup$

For this there is a very good treatment in the chapter about linear models in the MASS book (Modern Applied Statistics with S, fourth edition) by Venables and Ripley. But for that topic any edition will do!

Modern Applied Statistics with S (Statistics and Computing) 4th Edition

$\endgroup$
2
  • $\begingroup$ Thank you @kjetil b halvorsen. This book is for S, but I gather that S code and R code are very similar (if not identical). Is this true? $\endgroup$
    – llewmills
    Jan 16, 2018 at 8:04
  • 1
    $\begingroup$ Yes, the book (at least 4th edition) comment when there is differences between R and S-plus $\endgroup$ Jan 16, 2018 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.