Last data update: 2014.03.03

R: Lasso, Ridge and and Elastic Net Linear regression model to...
sym.glmR Documentation

Lasso, Ridge and and Elastic Net Linear regression model to interval variables

Description

Execute Lasso, Ridge and and Elastic Net Linear regression model to interval variables.

Usage

sym.glm(sym.data, response = 1, method = c("cm", "crm"), 
               alpha = 1, nfolds = 10, grouped = TRUE)

Arguments

sym.data

Should be a symbolic data table read with the function read.sym.table(...).

response

The number of the column where is the response variable in the interval data table.

method

"cm" to generalized Center Method and "crm" to generalized Center and Range Method.

alpha

alpha=1 is the lasso penalty, and alpha=0 the ridge penalty. 0<alpha<1 is the elastic net method.

nfolds

Number of folds - default is 10. Although nfolds can be as large as the sample size (leave-one-out CV), it is not recommended for large datasets. Smallest value allowable is nfolds=3

grouped

This is an experimental argument, with default TRUE, and can be ignored by most users.

Value

An object of class "cv.glmnet" is returned, which is a list with the ingredients of the cross-validation fit.

Author(s)

Oldemar Rodriguez Rojas

References

Rodriguez O. (2013). A generalization of Centre and Range method for fitting a linear regression model to symbolic interval data using Ridge Regression, Lasso and Elastic Net methods. The IFCS2013 conference of the International Federation of Classification Societies, Tilburg University Holland.

See Also

sym.lm

Examples

data(int_prost_train)
data(int_prost_test)
res.cm.lasso<-sym.glm(sym.data=int_prost_train,response=9,method='cm',
                      alpha=1,nfolds=10,grouped=TRUE)
pred.cm.lasso<-predictsym.glm(res.cm.lasso,response=9,int_prost_test,method='cm')
plot(res.cm.lasso)
plot(res.cm.lasso$glmnet.fit, "norm", label=TRUE)
plot(res.cm.lasso$glmnet.fit, "lambda", label=TRUE)
RMSE.L(sym.var(int_prost_test,9),pred.cm.lasso)
RMSE.U(sym.var(int_prost_test,9),pred.cm.lasso)
R2.L(sym.var(int_prost_test,9),pred.cm.lasso)
R2.U(sym.var(int_prost_test,9),pred.cm.lasso)
deter.coefficient(sym.var(int_prost_test,9),pred.cm.lasso)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(RSDA)
Loading required package: XML
Loading required package: scales
Loading required package: ggplot2
Loading required package: princurve
Loading required package: sqldf
Loading required package: gsubfn
Loading required package: proto
Could not load tcltk.  Will use slower R code instead.
Loading required package: RSQLite
Loading required package: DBI
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/RSDA/sym.glm.Rd_%03d_medium.png", width=480, height=480)
> ### Name: sym.glm
> ### Title: Lasso, Ridge and and Elastic Net Linear regression model to
> ###   interval variables
> ### Aliases: sym.glm
> ### Keywords: Symbolic Regression Lasso Ridge
> 
> ### ** Examples
> 
> data(int_prost_train)
> data(int_prost_test)
> res.cm.lasso<-sym.glm(sym.data=int_prost_train,response=9,method='cm',
+                       alpha=1,nfolds=10,grouped=TRUE)
> pred.cm.lasso<-predictsym.glm(res.cm.lasso,response=9,int_prost_test,method='cm')
> plot(res.cm.lasso)
> plot(res.cm.lasso$glmnet.fit, "norm", label=TRUE)
> plot(res.cm.lasso$glmnet.fit, "lambda", label=TRUE)
> RMSE.L(sym.var(int_prost_test,9),pred.cm.lasso)
[1] 0.7077209
> RMSE.U(sym.var(int_prost_test,9),pred.cm.lasso)
[1] 0.7043203
> R2.L(sym.var(int_prost_test,9),pred.cm.lasso)
[1] 0.5221561
> R2.U(sym.var(int_prost_test,9),pred.cm.lasso)
[1] 0.5261883
> deter.coefficient(sym.var(int_prost_test,9),pred.cm.lasso)
[1] 0.4937406
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>