Description Usage Arguments Value Examples
Prediction method for coord lasso fitted objects
1 2 3 |
object |
fitted "ordinis" model object |
newx |
Matrix of new values for |
s |
Value(s) of the penalty parameter lambda at which predictions are required. Default is the entire sequence used to create the model. |
type |
Type of prediction required. |
... |
not used |
An object depending on the type argument
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | set.seed(123)
n.obs <- 1e4
n.vars <- 100
n.obs.test <- 1e3
true.beta <- c(runif(15, -0.5, 0.5), rep(0, n.vars - 15))
x <- matrix(rnorm(n.obs * n.vars), n.obs, n.vars)
y <- rnorm(n.obs, sd = 3) + x %*% true.beta
x.test <- matrix(rnorm(n.obs.test * n.vars), n.obs.test, n.vars)
y.test <- rnorm(n.obs.test, sd = 3) + x.test %*% true.beta
fit <- ordinis(x = x, y = y, nlambda = 10)
preds.lasso <- predict(fit, newx = x.test, type = "response")
apply(preds.lasso, 2, function(x) mean((y.test - x) ^ 2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.