@@ -40,6 +40,8 @@ This package implements:
40
40
* MQuantile regression (e.g. Expectile regression)
41
41
* Robust Ridge regression (using any of the previous estimator)
42
42
* Quantile regression using interior point method
43
+ * Regularized Least Square regression
44
+ * Θ-IPOD regression, possibly with a penalty term
43
45
44
46
## Installation
45
47
@@ -63,6 +65,15 @@ For quantile regression, use `quantreg`:
63
65
64
66
` m = quantreg(X, y; quantile=0.5) `
65
67
68
+ For Regularized Least Squares and a penalty term, use ` rlm ` :
69
+
70
+ ` m = rlm(X, y, L1Penalty(); method=:cgd) `
71
+
72
+ For Θ-IPOD regression with outlier detection and a penalty term, use ` ipod ` :
73
+
74
+ ` m = ipod(X, y, L2Loss(), SquaredL2Penalty(); method=:auto) `
75
+
76
+
66
77
For robust version of ` mean ` , ` std ` , ` var ` and ` sem ` statistics, specify the estimator as first argument.
67
78
Use the ` dims ` keyword for computing the statistics along specific dimensions.
68
79
The following functions are also implemented: ` mean_and_std ` , ` mean_and_var ` and ` mean_and_sem ` .
@@ -119,6 +130,16 @@ m9 = rlm(form, data, MEstimator{TukeyLoss}(); initial_scale=:L1, ridgeλ=1.0)
119
130
# # Quantile regression solved by linear programming interior point method
120
131
m10 = quantreg (form, data; quantile= 0.2 )
121
132
refit! (m10; quantile= 0.8 )
133
+
134
+ # # Penalized regression
135
+ m11 = rlm (form, data, SquaredL2Penalty (); method= :auto )
136
+
137
+ # # Θ-IPOD regression with outlier detection
138
+ m12 = ipod (form, data, TukeyLoss (); method= :auto )
139
+
140
+ # # Θ-IPOD regression with outlier detection and a penalty term
141
+ m13 = ipod (form, data, L2Loss (), L1Penalty (); method= :ama )
142
+
122
143
;
123
144
124
145
# output
@@ -136,7 +157,7 @@ With ordinary least square (OLS), the objective function is, from maximum likeli
136
157
where ` yᵢ ` are the values of the response variable, ` 𝒙ᵢ ` are the covectors of individual covariates
137
158
(rows of the model matrix ` X ` ), ` 𝜷 ` is the vector of fitted coefficients and ` rᵢ ` are the individual residuals.
138
159
139
- A ` RobustLinearModel ` solves instead for the following loss function: ` L' = Σᵢ ρ(rᵢ) `
160
+ A ` RobustLinearModel ` solves instead for the following loss function [ 1 ] : ` L' = Σᵢ ρ(rᵢ) `
140
161
(more precisely ` L' = Σᵢ ρ(rᵢ/σ) ` where ` σ ` is an (robust) estimate of the standard deviation of the residual).
141
162
Several loss functions are implemented:
142
163
@@ -182,6 +203,17 @@ Using an asymmetric variant of the `L1Estimator`, quantile regression is perform
182
203
Identically, with an M-estimator using an asymetric version of the loss function,
183
204
a generalization of quantiles is obtained. For instance, using an asymetric ` L2Loss ` results in _ Expectile Regression_ .
184
205
206
+ ### Quantile regression
207
+
208
+ _ Quantile regression_ results from minimizing the following objective function:
209
+ ` L = Σᵢ wᵢ|yᵢ - 𝒙ᵢ 𝜷| = Σᵢ wᵢ(rᵢ) |rᵢ| ` ,
210
+ where ` wᵢ = ifelse(rᵢ>0, τ, 1-τ) ` and ` τ ` is the quantile of interest. ` τ=0.5 ` corresponds to _ Least Absolute Deviations_ .
211
+
212
+ This problem is solved exactly using linear programming techniques,
213
+ specifically, interior point methods using the internal API of [ Tulip] ( https://github.com/ds4dm/Tulip.jl ) .
214
+ The internal API is considered unstable, but it results in a much lighter dependency than
215
+ including the [ JuMP] ( https://github.com/JuliaOpt/JuMP.jl ) package with Tulip backend.
216
+
185
217
### Robust Ridge regression
186
218
187
219
This is the robust version of the ridge regression, adding a penalty on the coefficients.
@@ -192,16 +224,44 @@ By default, all the coefficients (except the intercept) have the same penalty, w
192
224
all the feature variables have the same scale. If it is not the case, use a robust estimate of scale
193
225
to normalize every column of the model matrix ` X ` before fitting the regression.
194
226
195
- ### Quantile regression
227
+ ### Regularized Least Squares
196
228
197
- _ Quantile regression_ results from minimizing the following objective function:
198
- ` L = Σᵢ wᵢ|yᵢ - 𝒙ᵢ 𝜷| = Σᵢ wᵢ(rᵢ) |rᵢ| ` ,
199
- where ` wᵢ = ifelse(rᵢ>0, τ, 1-τ) ` and ` τ ` is the quantile of interest. ` τ=0.5 ` corresponds to _ Least Absolute Deviations_ .
229
+ _ Regularized Least Squares_ regression is the solution of the minimization of following objective function:
230
+ ` L = ½ Σᵢ |yᵢ - 𝒙ᵢ 𝜷|² + P(𝜷) ` ,
231
+ where ` P(𝜷) ` is a (sparse) penalty on the coefficients.
232
+
233
+ The following penalty function are defined:
234
+ - ` NoPenalty ` : ` cost(𝐱) = 0 ` , no penalty.
235
+ - ` SquaredL2Penalty ` : ` cost(𝐱) = λ ½||𝐱||₂² ` , also called Ridge.
236
+ - ` L1Penalty ` : ` cost(𝐱) = λ||𝐱||₁ ` , also called LASSO.
237
+ - ` ElasticNetPenalty ` : ` cost(𝐱) = λ . l1_ratio .||𝐱||₁ + λ .(1 - l1_ratio) . ½||𝐱||₂² ` .
238
+ - ` EuclideanPenalty ` : ` cost(𝐱) = λ||𝐱||₂ ` , non-separable penalty used in Group LASSO.
239
+
240
+ Different penalties can be applied to different indices of the coefficients, using
241
+ ` RangedPenalties(ranges, penalties) ` . E.g., ` RangedPenalties([2:5], [L1Penalty(1.0)]) ` defines
242
+ a L1 penalty on every coefficients except the first index, which can correspond to the intercept.
243
+
244
+ With a penalty, the following solvers are available (instead of the other ones):
245
+ - ` :cgd ` , Coordinate Gradient Descent [ 2] .
246
+ - ` :fista ` , Fast Iterative Shrinkage-Thresholding Algorithm [ 3] .
247
+ - ` :ama ` , Alternating Minimization Algorithm [ 4] .
248
+ - ` :admm ` , Alternating Direction Method of Multipliers [ 5] .
249
+
250
+ To use a robust loss function with a penalty, see Θ-IPOD regression.
251
+
252
+ ### Θ-IPOD regression
253
+
254
+ _ Θ-IPOD regression_ (Θ-thresholding based Iterative Procedure for Outlier Detection) results from
255
+ minimizing the following objective function [ 6] :
256
+ ` L = ½ Σᵢ |yᵢ - 𝒙ᵢ 𝜷 - γᵢ|² + P(𝜷) + Q(γ) ` ,
257
+ where ` Q(γ) ` is a penalty function on the outliers ` γ ` that is sparse so the problem is not underdetermined.
258
+ We don't need to know the expression of this penalty function, just that it leads to thresholding using
259
+ one of the loss function used by M-Estimators. Then Θ-IPOD is equivalent to solving an M-Estimator.
260
+ This problem is solved using an alternating minimization technique, for the outlier detection.
261
+ Without penalty, the coefficients are updated at every step using a solver for _ Ordinary Least Square_ .
262
+
263
+ ` P(𝜷) ` is an optionnal (sparse) penalty on the coefficients.
200
264
201
- This problem is solved exactly using linear programming techniques,
202
- specifically, interior point methods using the internal API of [ Tulip] ( https://github.com/ds4dm/Tulip.jl ) .
203
- The internal API is considered unstable, but it results in a much lighter dependency than
204
- including the [ JuMP] ( https://github.com/JuliaOpt/JuMP.jl ) package with Tulip backend.
205
265
206
266
## Credits
207
267
@@ -215,4 +275,9 @@ for implementing the Iteratively Reweighted Least Square algorithm.
215
275
216
276
## References
217
277
218
- - "Robust Statistics: Theory and Methods (with R)", 2nd Edition, 2019, R. Maronna, R. Martin, V. Yohai, M. Salibián-Barrera
278
+ [ 1] "Robust Statistics: Theory and Methods (with R)", 2nd Edition, 2019, R. Maronna, R. Martin, V. Yohai, M. Salibián-Barrera
279
+ [ 2] "Regularization Paths for Generalized Linear Models via Coordinate Descent", 2009, J. Friedman, T. Hastie, R. Tibshirani
280
+ [ 3] "A Fast Iterative Shrinkage-Thresholding Algorithm for Linear Inverse Problems", 2009, A. Beck, M. Teboulle
281
+ [ 4] "Applications of a splitting algorithm to decomposition in convex programming and variational inequalities", 1991, P. Tseng
282
+ [ 5] "Fast Alternating Direction Optimization Methods", 2014, T. Goldstein, B. O'Donoghue, S. Setzer, R. Baraniuk
283
+ [ 6] "Outlier Detection Using Nonconvex Penalized Regression", 2011, Y. She, A.B. Owen
0 commit comments