I'm using cv.glmnet on a binary dataset of genotypes to predict a continuous variable phenotype. Data looks something like this but with >200 genes:
Pheno K00074 K00100 K00179 K00180
1 18.063630 0 0 0 0
2 16.746644 0 0 0 0
3 16.016194 1 0 0 0
4 -1.469207 1 1 0 0
5 -3.047956 1 0 1 1
6 15.274531 1 0 0 0
My code for the cv.glmnet and predict looks like this:
cv.lasso <- cv.glmnet(x = as.matrix(zx), y = unlist(zy), alpha = 1,
type.measure = 'mse',keep = TRUE) # runs the model
prediction<-predict(cv.lasso,s = cv.lasso$lambda.1se,
newx = as.matrix(batch1218.kegg[,-1]),type = 'class')
where zx is just binary columns of gene presence/absence, and zy is the phenotype column. batch1218.kegg is a new set of genotypic data that I want to use to predict the phenotype. My prediction ends up looking like this though:
1
1 6.438563
2 6.438563
3 6.438563
4 6.438563
5 6.438563
6 6.438563
Where all the numbers are the same for every row. I'm getting the same thing happen with other phenotypes as well. I'm thinking the problem might be that I'm only working with ~38 rows of phenotypic data in comparison to a large number of predictor variables. But wanted to see if there's maybe another problem I'm dealing with.