Description Usage Arguments Examples
Extract the penalty from a lvm object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | penalty(x, ...)
## S3 method for class 'lvm'
penalty(x, type = NULL, nuclear = FALSE,
lambdaPerCoef = FALSE, add.names = TRUE, ...)
## S3 method for class 'lvmfit'
penalty(x, type, ...)
## S3 method for class 'penaltyL12'
penalty(x, type = NULL, no.lasso = FALSE,
no.ridge = FALSE, no.group = FALSE, index.group = NULL, ...)
## S3 method for class 'penaltyNuclear'
penalty(x, type, group = NULL, keep.list = FALSE,
...)
|
x |
a lvm model |
type |
the information about the penalty to be returned. |
nuclear |
should informations be extracted for the nuclear penalty |
lambdaPerCoef |
when a regularization parameter is extracted should it expanded to match the parameters of the LVM |
add.names |
when a regularization parameter is extracted should the name of the parameters be added in the output. Only active if lambdaPerCoef is TRUE. |
group |
the group of penalty parameter to be returned |
keep.list |
should the format of the results be always a list |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | set.seed(10)
n <- 300
formula.lvm <- as.formula(paste0("Y~",paste(paste0("X",1:12), collapse = "+")))
mSim <- lvm(formula.lvm)
df.data <- sim(mSim,n)
pm <- penalize(mSim, c("Y~X1","Y~X4", "Y~X10"))
penalty(pm, type = "link")
penalty(pm, type = c("link","group"))
pm <- penalize(pm, value = paste0("Y~X",5:6), group = 1, add = TRUE)
penalty(pm, type = "link") # all parameters
penalty(pm, type = "link", group = 0) # individually penalized parameters
penalty(pm, type = "link", group = 1) # group 1 penalization
penalty(pm, type = "V")
penalty(pm, type = "V", group = 0)
penalty(pm, type = "lambda1")
penalty(pm, type = "lambda1", lambdaPerCoef = TRUE)
penalty(pm, type = "lambda1", lambdaPerCoef = TRUE, add.names = FALSE)
penalty(pm, type = c("lambda1","lambda2"), lambdaPerCoef = TRUE)
penalty(pm, type = "link") <- c("Y~X1" , "Y~X4")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.