Displaying 2 results from an estimated 2 matches for "dfrpredictor".
Did you mean:
dfrpredictors
2011 Feb 01
2
Preparing dataset for glmnet: factors to dummies
...input.
They expect the input to be a matrix, where the dummies are already
precoded.
Now I have created a sample dataset with
. 11 factor columns with two levels
. 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...
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