cv.DMR | R Documentation |
Executes k-fold cross-validation for DMR
and returns a value for df.
cv.DMR(
X,
y,
family = "gaussian",
clust.method = "complete",
lam = 10^(-7),
nfolds = 10,
indexation.mode = "GIC"
)
X |
Input data frame, of dimension n x p; |
y |
Response variable. Numerical for |
family |
Response type; one of: |
clust.method |
Clustering method used for partitioning levels of factors; see function hclust in package stats for details. |
lam |
The amount of penalization in ridge regression (used for logistic regression in order to allow for parameter estimation in linearly separable setups) or the amount of matrix regularization in case of linear regression. Used only for numerical reasons. The default is 1e-7. |
nfolds |
Number of folds in cross-validation. The default value is 10. |
indexation.mode |
How the cross validation algorithm should index the models for internal quality comparisons; one of: |
cv.DMR
algorithm does cross-validation for DMR
with nfolds
folds. The df for the minimal estimated prediction error is returned.
An object with S3 class "cv.DMR"
is returned, which is a list with the ingredients of the cross-validation fit.
df (number of parameters) of the model with minimal cross-validated error.
df (number of parameters) of the smallest model falling under the upper curve of a prediction error plus one standard deviation.
Fitted DMR
object for the full data.
The mean cross-validated error for the entire sequence of models.
The fold assignments used.
plot.cv.DMR
for plotting, coef.cv.DMR
for extracting coefficients and predict.cv.DMR
for prediction.
## cv.DMR for linear regression
set.seed(13)
data(miete)
ytr <- miete$rent[1:1500]
Xtr <- miete$area[1:1500]
Xte <- miete$area[1501:2053]
cv <- cv.DMR(Xtr, ytr)
print(cv)
plot(cv)
coef(cv)
ypr <- predict(cv, newx = Xte)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.