目前我正在使用 glmnet 包来运行套索回归(在下面的示例中,它被保存到“fits”变量中。然后当我绘制 fit 变量时,它会正确出现,但系数标签非常小。任何想法如何我可以增加这些的大小吗?
下面的可重现示例...
require(glmnet)
#setup sample DF with 5 variables
set.seed(123)
sampleDF <- data.frame("V1"=rnorm(100,mean=0,sd=.10),"V2"=rnorm(100,mean=0,sd=.10),"V3"=rnorm(100,mean=0,sd=.10),"V4"=rnorm(100,mean=0,sd=.10),"V5"=rnorm(100,mean=0,sd=.10))
#break data into yVector & xMatrix to put into glmnet
yVector <- sampleDF[,1]
xMatrix <- as.matrix(sampleDF[,2:ncol(sampleDF)])
#use k-fold cross validation to find the min lambda
cv.glmmod <- cv.glmnet(xMatrix,yVector,alpha=1,nfolds=nrow(xMatrix),grouped=FALSE)
best_lambda <- cv.glmmod$lambda.min
#run glmnet
fits <- glmnet(xMatrix, yVector, family="gaussian", alpha=1, nlambda=100)
#plot results
plot(fits,label=TRUE,xvar="lambda")