## Linear regression
data(prostate)
X <- as.matrix(prostate[,1:8])
y <- prostate$lpsa
pmfit <- perm.ncvreg(X, y)
par(mfcol=c(2,2))
plot(pmfit)
plot(pmfit, type="EF")
plot(pmfit$fit)
pmfit.r <- perm.ncvreg(X, y, permute='residuals')
plot(pmfit.r, col="red") # Permuting residuals is
lines(pmfit$fit$lambda, pmfit$FIR, col="gray60") # less conservative
## Logistic regression
data(heart)
X <- as.matrix(heart[,1:9])
y <- heart$chd
pmfit <- perm.ncvreg(X, y, family="binomial")
par(mfrow=c(2,2))
plot(pmfit)
plot(pmfit, type="EF")
plot(pmfit$fit)
Run the code above in your browser using DataLab