- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
hello all
kindly I have data analysis in robust regression and I want to get SSE and MSE by M-estimation, S-estimation and MM-estimation didn't know what code and I didn't find anything about that
thank you for your help
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can run a robust regression model by using the ROBUSTREG procedure in SAS/STAT software.
You can use the METHOD= option on the PROC ROBUSTREG to specify the method, including METHOD=M, METHOD=S, and METHOD=LTS.
The best place to start is the Getting Started examples in the doc. There is a GS example for M estimation and for LTS estimation. Another example shows a comparison between various methods, including METHOD=S.
As you are learning the procedure, I encourage you to use the PLOTS=ALL option to visualize your data by using regression diagnostic plots. The plots will help you to understand which observations in the data are influential in OLS regression but have been downweighted by the robust estimation methods.
Regarding the SSE and MSE statistics, those are non-robust statistics so I don't think PROC ROBUSTREG produces them However, you can use the OUTPUT statement to write the residual values to a data set and then compute the SSE and MSE manually. The denominator for the MSE comes from the relevant entries in the ModelInfo table. For example, the following program shows that the model has p=4 vars (three indep vars, plus the intercept) and n=21 valid observations:
/* Getting Started example from PROC ROBUSTREG doc */
data Stack;
input x1 x2 x3 y exp $ @@;
datalines;
80 27 89 42 e1 80 27 88 37 e2
75 25 90 37 e3 62 24 87 28 e4
62 22 87 18 e5 62 23 87 18 e6
62 24 93 19 e7 62 24 93 20 e8
58 23 87 15 e9 58 18 80 14 e10
58 18 89 14 e11 58 17 88 13 e12
58 18 82 11 e13 58 19 93 12 e14
50 18 89 8 e15 50 18 86 7 e16
50 19 72 8 e17 50 19 79 8 e18
50 20 80 9 e19 56 20 82 15 e20
70 20 91 15 e21
;
proc robustreg data=stack method=M;
model y = x1 x2 x3 / diagnostics leverage;
id exp;
output out=RegOut p=Pred r=Resid;
run;
%let p = 4; /* number of indep variables in model + 1 for intercept */
%let n = 21; /* from the NumObs Table: Number of Observations Read 21 */
data Stats;
retain SSE 0;
set RegOut end=EOF;
SSE + Resid**2; /* sum of squares of residuals */
MSE = SSE / (&n-&p); /* DF = n - p */
if EOF then output;
run;
proc print data=Stats noobs;
var SSE MSE;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can run a robust regression model by using the ROBUSTREG procedure in SAS/STAT software.
You can use the METHOD= option on the PROC ROBUSTREG to specify the method, including METHOD=M, METHOD=S, and METHOD=LTS.
The best place to start is the Getting Started examples in the doc. There is a GS example for M estimation and for LTS estimation. Another example shows a comparison between various methods, including METHOD=S.
As you are learning the procedure, I encourage you to use the PLOTS=ALL option to visualize your data by using regression diagnostic plots. The plots will help you to understand which observations in the data are influential in OLS regression but have been downweighted by the robust estimation methods.
Regarding the SSE and MSE statistics, those are non-robust statistics so I don't think PROC ROBUSTREG produces them However, you can use the OUTPUT statement to write the residual values to a data set and then compute the SSE and MSE manually. The denominator for the MSE comes from the relevant entries in the ModelInfo table. For example, the following program shows that the model has p=4 vars (three indep vars, plus the intercept) and n=21 valid observations:
/* Getting Started example from PROC ROBUSTREG doc */
data Stack;
input x1 x2 x3 y exp $ @@;
datalines;
80 27 89 42 e1 80 27 88 37 e2
75 25 90 37 e3 62 24 87 28 e4
62 22 87 18 e5 62 23 87 18 e6
62 24 93 19 e7 62 24 93 20 e8
58 23 87 15 e9 58 18 80 14 e10
58 18 89 14 e11 58 17 88 13 e12
58 18 82 11 e13 58 19 93 12 e14
50 18 89 8 e15 50 18 86 7 e16
50 19 72 8 e17 50 19 79 8 e18
50 20 80 9 e19 56 20 82 15 e20
70 20 91 15 e21
;
proc robustreg data=stack method=M;
model y = x1 x2 x3 / diagnostics leverage;
id exp;
output out=RegOut p=Pred r=Resid;
run;
%let p = 4; /* number of indep variables in model + 1 for intercept */
%let n = 21; /* from the NumObs Table: Number of Observations Read 21 */
data Stats;
retain SSE 0;
set RegOut end=EOF;
SSE + Resid**2; /* sum of squares of residuals */
MSE = SSE / (&n-&p); /* DF = n - p */
if EOF then output;
run;
proc print data=Stats noobs;
var SSE MSE;
run;