View source: R/predict.cv.DMR.R
predict.cv.DMR | R Documentation |
Makes predictions from a cv.DMR object (for the model with minimal cross-validated error /the default/ or the smallest model falling under the upper curve of a prediction error plus one standard deviation).
## S3 method for class 'cv.DMR'
predict(
object,
newx,
type = "link",
md = "df.min",
unknown.factor.levels = "error",
...
)
object |
Fitted cv.DMR object. |
newx |
Data frame of new values for |
type |
One of: |
md |
Value of the model dimension parameter at which predictions are required. The default is |
unknown.factor.levels |
The way of handling factor levels in test data not seen while training a model. One of |
... |
Further arguments passed to or from other methods. |
Similar to other predict
methods, this function predicts fitted values from a fitted cv.DMR
object.
Vector of predictions.
## 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.