Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Need help with proc iml

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-19-2013 05:54 PM

Hi, everyone.

I need to do a median regression and I believe I should use the procedure iml, which I know nothing about. Below is a sample code I had found online at http://www.ats.ucla.edu/stat/sas/webbooks/reg/chapter4/sasreg4.htm and I need your help in understanding what they are. My comments are in blue color.

**proc iml ; /*Least absolute values*/ use elemapi2; I think elemapi2 is the dataset read all; a = cons || acs_k3 || acs_46 || full || enroll; so a is the independent variables set. cons is the constant, acs_k3, .... and enroll are all independent variables. b=api00; api00 is the dependent variable opt= { . 3 0 1 }; opt seems to mean output, but I have no idea what **

call lav(rc,xr,a,b,,opt); /*print out the estimates*/ what is rc and xr? Does opt mean to print out the estimates?

opt= { . 0 . 1 }; opt again.

** call lav(rc,xr,a,b,,opt); /*no print out but to create the xr*/ **

** pred = a*t(xr); Calculate the predicted variable**

** resid = b - pred; calculate the residual**

** create _temp_ var { api00 cons acs_k3 acs_46 full enroll pred resid}; create a dataset _temp_ to contain all variables, the predicted, and the residual**

** append; This seems to have something to do with the dataset just created**

**quit;**

After this is run, the result is something like this.

L1 Solution with ASE

Est 17.1505029 1.2690656888 7.2240793844 5.3238408715 -0.124573396 **So the Est. here is the coefficients?**

ASE 123.531545 6.3559394265 2.2262729207 0.602359504 0.0391932684 ** And these are the standard errors?**

I know these are really dumb questions. But I'm learning from zero. Thanks ahead for your help!

Accepted Solutions

Solution

04-20-2013
12:04 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to JOLSAS

04-20-2013 12:04 AM

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to JOLSAS

04-19-2013 08:04 PM

When I run my median regression, the SAS first shows me :

LS Solution |

Est | -96561.87302 | -0.246300175 | -2.602601178 | 97923.982407 | 181960.48881 | -4.306466041 |

LS Solution |

Est | 458949.097 | -95.96810113 | 98394.076103 | 2.6046454768 | 61681.495377 | -1.738022118 |

After a bunch of LAV (L1) Estimation, which looks like a matrix, it gives me:

L1 Solution with ASE |

Est | 8766.7195889 | -2.788729523 | 0.5995400876 | -213853.6231 | -15320.23666 | 2.87805056 | |

ASE | 5226.9687913 | 0.4589723826 | 0.4946914915 | 43854.291056 | 11406.063615 | 0.6643844441 |

L1 Solution with ASE |

Est | 40554.202816 | -6.862368128 | 27982.148817 | 2.6542477447 | -5710.519722 | 0.76728223 | |

ASE | 45907.755422 | 4.981493735 | 7780.6349503 | 0.3645178223 | 7090.9258689 | 0.2950026359 |

The LS solution and L1 solution estimates are different. Which are the coefficients I want to use?

And, since I have coefficients and standard errors, I can calculate the t value. But if I want to know the p value, is this the same with OLS regression? I mean, how can I know the F value?

Solution

04-20-2013
12:04 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to JOLSAS

04-20-2013 12:04 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to JOLSAS

04-23-2013 10:30 AM

While coding it all through IML is possible, this looks exactly like what PROC QUANTREG should give you. Take a look at the documentation here:

http://support.sas.com/documentation/cdl/en/statug/63347/HTML/default/viewer.htm#qreg_toc.htm

Steve Denham