Description Usage Arguments Examples
ordinis provides estimation of linear models with the lasso penalty
1 2 3 4 5 6 7 8 | ordinis(x, y, weights = rep(1, NROW(y)), offset = NULL,
family = NULL, penalty = c("lasso", "alasso", "mcp", "scad"),
lambda = numeric(0), alpha = 1, gamma = ifelse(penalty == "scad",
3.7, 1.4), penalty.factor = NULL, upper.limits = rep(Inf, NCOL(x)),
lower.limits = rep(-Inf, NCOL(x)), nlambda = 100L,
lambda.min.ratio = NULL, intercept = TRUE, standardize = TRUE,
dfmax = nvars, maxit = NULL, tol = NULL, maxit.irls = 25L,
tol.irls = 0.001)
|
x |
The design matrix |
y |
The response vector |
weights |
a vector of weights of length equal to length of |
offset |
A vector of length |
family |
family of underlying model. Only "gaussian" for continuous responses is available now |
penalty |
a string indicating which penalty to use. |
lambda |
A user provided sequence of λ. If set to
|
alpha |
mixing parameter between 0 and 1 for elastic net. |
gamma |
parameter for MCP/SCAD. Defaults to the recommended values from the papers corresponding to each penalty |
penalty.factor |
a vector with length equal to the number of columns in x to be multiplied by lambda. by default
it is a vector of 1s. |
upper.limits |
a vector of length |
lower.limits |
a vector of length |
nlambda |
Number of values in the λ sequence. Only used
when the program calculates its own λ
(by setting |
lambda.min.ratio |
Smallest value in the λ sequence
as a fraction of λ_0. See
the explanation of the |
intercept |
Whether to fit an intercept in the model. Default is |
standardize |
Whether to standardize the design matrix before
fitting the model. Default is |
dfmax |
Maximum number of variables allowed in the model |
maxit |
Maximum number of coordinate descent iterations. |
tol |
convergence tolerance parameter. |
maxit.irls |
Maximum number of coordinate descent iterations. |
tol.irls |
convergence tolerance parameter. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | set.seed(123)
n = 100
p = 1000
b = c(runif(10, min = 0.1, max = 1), rep(0, p - 10))
x = matrix(rnorm(n * p, sd = 1.5), n, p)
y = drop(x %*% b) + rnorm(n)
## fit lasso model with 100 tuning parameter values
res <- ordinis(x, y)
y2 <- 1 * (y > 0)
y3 <- exp(y)
resb <- ordinis(x, y2, family = "binomial")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.