pawls | R Documentation |
Compute weighted least squares regression with L_{1}
regularization on both the
coefficients and weight vectors.
pawls(x, y, nlambda1 = 100, nlambda2 = 50, lambda1 = NULL,
lambda2 = NULL, lambda1.min = 0.05, lambda2.min = 0.001, beta0 = NULL,
w0 = NULL, initial = c("uniform", "PAWLS"), delta = 1e-06,
maxIter = 1000, intercept = TRUE, standardize = TRUE,
search = c("grid", "cross"))
x |
a numeric matrix containing the predictor variables without an intercept. |
y |
a numeric vector containing the response variable. |
nlambda1 |
the number of lambda1 values (the default is 100). |
nlambda2 |
the number of lambda2 values (the default is 50). |
lambda1 |
a numeric vector of non-negative values to be used as tuning parameters of the penalty
for coefficients. By default, a sequence of values of length |
lambda2 |
a numeric vector of non-negative values to be used as tunning parameters of the penalty
for weight vectors. By default, a sequence of values of length |
lambda1.min |
a numeric value giving the smallest value for |
lambda2.min |
a numeric value giving the smallest value for |
beta0 |
the initial estimates of coefficients to be used in the adaptive penalty for |
w0 |
the initial estimates of weight vector to be used in the adaptive penalty for |
initial |
a character string specifying the initial estimates of both coeffcients and weight vectors in the adaptive penalties.
If " |
delta |
a small positive numeric value as a convergence threshold. The algorithm iterates until the RMSD for the change in both coefficents and weight vectors is less than delta (the default is 1e-06). |
maxIter |
a positive numeric value used to determin the maximum number of iterations (the default is 1000). |
intercept |
a logical indicating whether a constant term should be
included in the model (the default is |
standardize |
a logical indicating whether the predictor variables should be normalized to have unit L2 norm (the default is TRUE). |
search |
a character string specifying the algorithm to select tunning parameters for both coefficients and weight
vectors. If "cross", the optimal tuning parameters are searched alternatively by minimizing |
An object of class "pawls.cross"(search=cross
) or "pawls.grid"
(search=grid
) contaning:
beta |
a numeric vector containing the respective coefficient estimates with the optimal tuning parameters. |
w |
a numeric vector containing the respective weight estimates with the optimal tuning parameters. |
lambda1 |
same as above. |
lambda2 |
same as above. |
opt.lambda1 |
a numeric value giving the optimal |
opt.lambda2 |
a numeric value giving the optimal |
iter |
a numeric matrix with |
betas |
a 3-dimension numeric array containing the coefficient estimates. The dimensions are equal to |
ws |
a 3-dimension numeric array containing the weight estimates. The dimensions are equal to |
raw.bic |
a numeric matrix with |
bic |
a numeric matrix with |
Bin Luo, Xiaoli Gao
## generate data
library("mvtnorm")
set.seed(123) # for reproducibility
n = 100 # number of observations
p = 8 # number of variables
beta = c(1, 2, 3, 0, 0, 0, 0, 0) # coefficients
sigma <- 0.5 # controls signal-to-noise ratio
epsilon <- 0.1 # contamination level
Sigma <- 0.5^t(sapply(1:p, function(i, j) abs(i-j), 1:p))
x <- rmvnorm(n, sigma=Sigma) # predictor matrix
e <- rnorm(n) # error terms
i <- 1:ceiling(epsilon*n) # observations to be contaminated
e[i] <- e[i] + 5 # vertical outliers
y <- c(x %*% beta + sigma * e) # response
x[i,] <- x[i,] + 5 # bad leverage points
## fit pawls model over a find grid of tuning parameters
pawls(x,y)
## fit adaptive pawls model over a find grid of tuning parameters
pawls(x,y,lambda1.min = 0.001, lambda2.min = 0.05, initial = "PAWLS")
## fit adaptive pawls model using corss search over a grid of tuning parameters
pawls(x,y,lambda1.min = 0.001, lambda2.min = 0.05, initial = "PAWLS", search="cross")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.