Displaying 2 results from an estimated 2 matches for "dfrtmp".
2011 Feb 01
2
Preparing dataset for glmnet: factors to dummies
.... 4 factor columns with three levels
. 135 continuous columns (from a standard normal)
. 100 observations (rows)
Say this dataframe is in dfrPredictors.
What I do now, is use the following code:
form<-paste("~",paste(colnames(dfrPredictors), collapse="+"), sep="")
dfrTmp<-model.frame(dfrPredictors, na.action=na.pass)
result<- as.matrix(model.matrix(as.formula(form), data=dfrTmp))[,-1]
This works (although admittedly, I don't understand everything of it).
However, I notice that for this rather limited dataset, this conversion
takes around 0.1 seconds user...
2011 May 02
2
Lasso with Categorical Variables
Hi! This is my first time posting. I've read the general rules and
guidelines, but please bear with me if I make some fatal error in
posting. Anyway, I have a continuous response and 29 predictors made
up of continuous variables and nominal and ordinal categorical
variables. I'd like to do lasso on these, but I get an error. The way
I am using "lars" doesn't allow for the