class: title-slide, left, bottom # Primal cone projections with constrained regression ---- ## **R package 'coneproj'** ### Hyunsu Ju ### 09/17/2021 --- class: inverse, middle, center # Constarined penealized splines Cone projection;convex regression;model selection --- ```r library(coneproj) ``` ``` ## Warning: package 'coneproj' was built under R version 4.1.1 ``` - A simple new algorithm for quadratic programming with applications in statistics: Communications in Statistics (Meyer, 2013) - Constrained penalized splines: The Canadian Journal of Statistics (Meyer, 2012) - Primal or Dual Cone Projections with Routines for Constrained Regression: Journal of Statistical Software (Mary C. Meyer and Xiyue Liao, 2021) --- ### Characterization and convergence rate ### - `$$\sum_{i=1}^{n}[y_i-f(x_i)]^2+ \lambda \int ^1 _0[f^{(q)}(x)]^2 dx,$$` over the monotone non-decreasing function in `\(C^q\)`. - `$$\tilde{f}(x)-f(x)=O_p(n^{-(p+1)/(2p+3)}).$$` - `$$GCV(\lambda)=\frac{\sum^n_{i=1}[y_i-\tilde{\mu}_i (\lambda)]^2}{(1-edf/n)^2}.$$` - The MSE for the constrained penalized splines is less than or equal to that for the unconstrained penalized splines. --- ###**Penalized spline with q-order difference penalties (q=0-3)** ```r knitr::opts_chunk$set( echo = TRUE ) # Code to do penalized spline with # q-order difference penalties (q=0-3) # (if q is anything else, no penalty is applied) # Uses B-splines # scatterplot is (x[i],y[i]); k=number of knots (k-2 interior knots), # and pen=penalty # returns GCV value for unconstrained & constrained splines # type: 1=monotone increasing # 2=monotone decreasing # 3=convex # 4=concave # 5=convex increasing # 6=convex decreasing # 7=concave increasing # 8=concave decreasing # returns: cfit = constrained fit # ucfit = unconstrained fit # cgcv = constrained GCV # ucgcv = unconstrained GCV # edfc = effective degrees of freedom for constrained fit # edfu = effective degrees of freedom for unconstrained fit # knots # xpl = grid of points for plotting smooth fits # cpl = constrained fit values at xpl # ucpl = unconstrained fit values at xpl ``` --- ###** Package 'coneproj': shapereg(y ~ incr(x))** <!-- --> --- ###** Package 'coneproj': shapereg(y ~ incr.conc(x))** <!-- --> --- ###** Package 'coneproj': shapereg(y ~ incr.conv(x))** <!-- --> --- ### **Package 'coneproj':shapereg(y ~ decr(x))** <!-- --> --- ### **Package 'coneproj':shapereg(y ~ decr.conv(x))** <!-- --> --- ### **Package 'coneproj':shapereg(y ~ decr.conc(x))** <!-- --> --- ### Question/Discussion Thank You!