Smoothly Clipped Absolute Deviation

x=seq(-5,5, by=0.1)
L1=abs(x)
L2=x^2

sc=NULL;D=length(x)
for( i in 1:D){

if( abs(x[i])<=1 ){
  sc[i] = abs(x[i])
}else if( abs(x[i]) < 3.7 ){
    sc[i] =(-x[i]^2+2*3.7*abs(x[i])-1)/(2*2.7)
}else{
    sc[i] = 4.7/2
}

}
sc
##   [1] 2.350 2.350 2.350 2.350 2.350 2.350 2.350 2.350 2.350 2.350 2.350
##  [12] 2.350 2.350 2.350 2.348 2.343 2.333 2.320 2.304 2.283 2.259 2.231
##  [23] 2.200 2.165 2.126 2.083 2.037 1.987 1.933 1.876 1.815 1.750 1.681
##  [34] 1.609 1.533 1.454 1.370 1.283 1.193 1.098 1.000 0.900 0.800 0.700
##  [45] 0.600 0.500 0.400 0.300 0.200 0.100 0.000 0.100 0.200 0.300 0.400
##  [56] 0.500 0.600 0.700 0.800 0.900 1.000 1.098 1.193 1.283 1.370 1.454
##  [67] 1.533 1.609 1.681 1.750 1.815 1.876 1.933 1.987 2.037 2.083 2.126
##  [78] 2.165 2.200 2.231 2.259 2.283 2.304 2.320 2.333 2.343 2.348 2.350
##  [89] 2.350 2.350 2.350 2.350 2.350 2.350 2.350 2.350 2.350 2.350 2.350
## [100] 2.350 2.350
plot(x,L1,type="l", col=1,main="penalty functions")
lines(x,L2,col=2)
lines(x,sc,col=3)
legend("bottomright",legend=c("L1","L2","SCAD"),lty=c(1,1,1),col=c(1,2,3))

plot of chunk unnamed-chunk-1

# This completes updating right singular vector v