turn on suggestions

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
- /
- regression with constraints

Topic Options

- 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

02-15-2014 10:37 PM

Hi all,

In the attached example, there are dayily trading data for two mutual funds in different months. But in my whole sample, there are daily data for various funds in many different months.

I want to run a regression model as below:

y= b1*x1 + b2*x2 + b3*x3 + b4*x4 + b5*x5 + b6*x6 + b7*x7 + b8*x8 + e

It is not a ordinary regression model but with contraints:

s.t. (1) b1, b2, ..., b8>=0

(2) b1+b2+, ..., +b8=1

min Var（e）

When running this regression, I also want to generate a new data file consisting of coefficients, t and p value from each regression on each fund in each month.

for example,

regress when fundcdym=000001200507 (fund 000001 in July 2005), there are 21 obs and the regression result inclueds coefficients, t and p value.

regress when fundcdym=000001200508 (fund 000001 in July 2005), there are 23 obs and the regression result inclueds coefficients, t and p value.

...

Can anybody help me to deal with this? Thanks in advance.

Accepted Solutions

Solution

02-15-2014
11:47 PM

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

Posted in reply to comeon2012

02-15-2014 11:47 PM

I tried the following with **SAS/ETS proc Model** but didn't find the results very convincing (given your constraints and your number of observations in each month, I am not certain there can be meaningful OLS solutions)

**data rwc;**

**infile "&SASFORUM\datasets\regression with constraints.csv" dsd firstobs=2;**

**length fundcd ym $6 Fundcdclsdt fundcdym $12;**

**input FUNDCD CLSDT :yymmdd10. Fundcdclsdt ym fundcdym y x1-x8;**

**run;**

**proc model data=rwc plots=none;**

**by fundcdym notsorted;**

**y= b1*x1 + b2*x2 + b3*x3 + b4*x4 + b5*x5 + b6*x6 + b7*x7 + b8*x8;**

**bounds 0 <= b1-b8;**

**restrict b1+b2+b3+b4+b5+b6+b7+b8 = 1;**

**fit y / outest=rwcfit;**

**ods output ParameterEstimates=rwcPE;**

**run;**

PG

PG

All Replies

Solution

02-15-2014
11:47 PM

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

Posted in reply to comeon2012

02-15-2014 11:47 PM

I tried the following with **SAS/ETS proc Model** but didn't find the results very convincing (given your constraints and your number of observations in each month, I am not certain there can be meaningful OLS solutions)

**data rwc;**

**infile "&SASFORUM\datasets\regression with constraints.csv" dsd firstobs=2;**

**length fundcd ym $6 Fundcdclsdt fundcdym $12;**

**input FUNDCD CLSDT :yymmdd10. Fundcdclsdt ym fundcdym y x1-x8;**

**run;**

**proc model data=rwc plots=none;**

**by fundcdym notsorted;**

**y= b1*x1 + b2*x2 + b3*x3 + b4*x4 + b5*x5 + b6*x6 + b7*x7 + b8*x8;**

**bounds 0 <= b1-b8;**

**restrict b1+b2+b3+b4+b5+b6+b7+b8 = 1;**

**fit y / outest=rwcfit;**

**ods output ParameterEstimates=rwcPE;**

**run;**

PG

PG