The key line is
prep <- .checkinput(match.call(), parent.frame())
Among other things the model matrix is built in .checkinput( ) which is not
exported from the package namespace. So you have to get rough with it and use
penalized:::.checkinput
and then you see these line of code
options(contrasts = c(unordered = "contr.none", ordered =
"contr.diff"))
and the scene is set. The selection of contrasts is hardwired and to get around
it you would need to hack the package, not a great idea.
The namespace will get you if you try to mask contr.none with a function of your
own, for example.
Bill Venables.
________________________________________
From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] On
Behalf Of Lars Bishop [lars52r at gmail.com]
Sent: 20 May 2011 20:52
To: r-help at r-project.org
Subject: [R] Contrasts in Penalized Package
Hi,
The "penalized" documentation says that "Unordered factors are
turned
into as many dummy variables as the factor has levels". This is done
by a function in the package called contr.none. I'm trying to figure
out how exactly is a model matrix created with this contrast option
when the user calls the function with a formula. I typed
"library(penalized) ; penalized" but couldn't point the part of
the
code where this is done.
I'll appreciate any help on this.
Lars.
______________________________________________
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.