% \VignetteIndexEntry{Regularization and Variable Selection for Parametric Models (2)}
% \VignetteDepends{}

\documentclass[a4paper]{article}

\title{Regularization and Variable Selection for Parametric Models (2)}

\begin{document}

\maketitle


<<echo=FALSE,eval=FALSE>>=
options(width=80)
@

<<eval=FALSE>>=
source("glmOSCAR_101028.r")
@

<<eval=FALSE>>=
library(catdata)
data(heart, package="catdata")

X<-heart[,-1]
y<-heart[,1]
X.std<-scale(X)
p<-ncol(X)
n<-length(y)
family <- binomial()
n.fold<-10

ylab.text<-""
xlab.text<-""
Width = 6 
Height = 6 
oma.vec<-c(1,1,1,3) 
size.axis=1.4 
size.lab=1.4 
size.main=1.4 
size.right=1.2 
size.width=2.0
colour=1
@


OSCAR

<<results=hide,eval=FALSE>>=
######### c fixed
c.seq<-0.2
t.seq<-seq(0.01,0.99,length=99)
oscarR<-glm.oscar(y,X,family,t.seq=t.seq,c=c.seq,epsilon=1e-8)
@

<<eval=FALSE>>=
Path<-oscarR$Beta.std[,-1]
@

<<fig=TRUE,eval=FALSE>>=
par(oma=oma.vec,cex.axis=size.axis,cex.lab=size.axis,cex.main=size.main)
matplot(rowSums(abs(Path))/max(rowSums(abs(Path))),Path*sqrt(n),type="l",
ylab=ylab.text,xlab=xlab.text,main="oscarR (c=0.2)",lwd=size.width, col=colour)
axis(4, at = Path[99, ]*sqrt(n), labels = colnames(X), adj = 0, las = 1,
cex.axis=size.right)
@

<<results=hide,eval=FALSE>>=
c.seq<-0.5
t.seq<-seq(0.01,0.99,length=99)
oscarR<-glm.oscar(y,X,family,t.seq=t.seq,c=c.seq,epsilon=1e-8)
@

<<eval=FALSE>>=
Path<-oscarR$Beta.std[,-1]
@
<<fig=TRUE,eval=FALSE>>=
par(oma=oma.vec,cex.axis=size.axis,cex.lab=size.axis,cex.main=size.main)
matplot(rowSums(abs(Path))/max(rowSums(abs(Path))),Path*sqrt(n),type="l",
ylab=ylab.text,xlab=xlab.text,main="oscarR (c=0.5)",lwd=size.width, col=colour)
axis(4, at = Path[99, ]*sqrt(n), labels = colnames(X), adj = 0, las = 1,
cex.axis=size.right)
@

\end{document}