non-linear regression and starting values

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

TheOnlyOne
Posts: 8
Joined: Mon Aug 27, 2012 11:20 am

non-linear regression and starting values

Postby TheOnlyOne » Mon Aug 27, 2012 11:34 am

Hi.

I'm struggeling with my non-linear regression. I have a dataset consisting of 223 funds (y-variables) with monthly data, 240 observations in total. I like to use the following formula:

(rp-rf) = Alpha(p) + beta(p)*(rm-rf) + gamma(p)*(rm-rf)^2 (Treynor and Mazuy 1966)

I've tried for quite some time to figure out appropriate starting values, but I keep getting the same error: "Failure to improve SSR after x iterations". Is there any way I can find appropriate starting values without try and error (as I seem to get nowhere with that method)? Or are there some other issues that I'm overlooking?

Secondly, how do I run all (or about 100 at a time) regressions at once? I used "open as a system" with the linear model, but with the new coefficients that doesn't work (or I'm doing it wrong).

Thanks.

Sincerely,
TheOnlyOne

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: non-linear regression and starting values

Postby EViews Gareth » Mon Aug 27, 2012 11:49 am

"failure to improve" doesn't necessarily mean you need to change your starting values. It is possible that the optimum has been reached.

The best way to do the regressions in one go is to write a program that loops through them, estimating them one at a time.

TheOnlyOne
Posts: 8
Joined: Mon Aug 27, 2012 11:20 am

Re: non-linear regression and starting values

Postby TheOnlyOne » Mon Aug 27, 2012 12:08 pm

"failure to improve" doesn't necessarily mean you need to change your starting values. It is possible that the optimum has been reached.

The best way to do the regressions in one go is to write a program that loops through them, estimating them one at a time.
Ah, ok. And how do I write such a program in Eviews? Never done it before.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: non-linear regression and starting values

Postby EViews Gareth » Mon Aug 27, 2012 12:09 pm


TheOnlyOne
Posts: 8
Joined: Mon Aug 27, 2012 11:20 am

Re: non-linear regression and starting values

Postby TheOnlyOne » Mon Aug 27, 2012 12:20 pm


TheOnlyOne
Posts: 8
Joined: Mon Aug 27, 2012 11:20 am

Re: non-linear regression and starting values

Postby TheOnlyOne » Mon Aug 27, 2012 1:39 pm

I already got a workfile, so how do I tell the program to use that workfile?

Edit: Nevermind, figured it out.

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: non-linear regression and starting values

Postby startz » Mon Aug 27, 2012 1:54 pm

Hi.

I'm struggeling with my non-linear regression. I have a dataset consisting of 223 funds (y-variables) with monthly data, 240 observations in total. I like to use the following formula:

(rp-rf) = Alpha(p) + beta(p)*(rm-rf) + gamma(p)*(rm-rf)^2 (Treynor and Mazuy 1966)

TheOnlyOne
This doesn't appear to be nonlinear at all.

TheOnlyOne
Posts: 8
Joined: Mon Aug 27, 2012 11:20 am

Re: non-linear regression and starting values

Postby TheOnlyOne » Mon Aug 27, 2012 1:58 pm

Hi.

I'm struggeling with my non-linear regression. I have a dataset consisting of 223 funds (y-variables) with monthly data, 240 observations in total. I like to use the following formula:

(rp-rf) = Alpha(p) + beta(p)*(rm-rf) + gamma(p)*(rm-rf)^2 (Treynor and Mazuy 1966)

TheOnlyOne
This doesn't appear to be nonlinear at all.
The last term? Due to the squared term, it's non-linear. Right?

TheOnlyOne
Posts: 8
Joined: Mon Aug 27, 2012 11:20 am

Re: non-linear regression and starting values

Postby TheOnlyOne » Mon Aug 27, 2012 2:09 pm

Code: Select all

Wfopen Treynor.wf1 group regs c mkt_rf mkt_rf^2 group deps Y001 Y002 Y003 Y004 Y005 Y006 Y007 Y008 Y009 Y010 Y011 Y012 Y013 Y014 Y015 Y016 Y017 Y018 Y019 Y020 Y021 Y022 Y023 Y024 Y025 Y026 Y027 Y028 Y029 Y030 Y031 Y032 Y033 Y034 Y035 Y036 Y037 Y038 Y039 Y040 Y041 Y042 Y043 Y044 Y045 Y046 Y047 Y048 Y049 Y050 Y051 Y052 Y053 Y054 Y055 Y056 Y057 Y058 Y059 Y060 Y061 Y062 Y063 Y064 Y065 Y066 Y067 Y068 Y069 Y070 Y071 Y072 Y073 Y074 Y075 Y076 Y077 Y078 Y079 Y080 Y081 Y082 Y083 Y084 Y085 Y086 Y087 Y088 Y089 Y090 Y091 Y092 Y093 Y094 Y095 Y096 Y097 Y098 Y099 Y100 Y101 Y102 Y103 Y104 Y105 Y106 Y107 Y108 Y109 Y110 Y111 Y112 Y113 Y114 Y115 Y116 Y117 Y118 Y119 Y120 Y121 Y122 Y123 Y124 Y125 Y126 Y127 Y128 Y129 Y130 Y131 Y132 Y133 Y134 Y135 Y136 Y137 Y138 Y139 Y140 Y141 Y142 Y143 Y144 Y145 Y146 Y147 Y148 Y149 Y150 Y151 Y152 Y153 Y154 Y155 Y156 Y157 Y158 Y159 Y160 Y161 Y162 Y163 Y164 Y165 Y166 Y167 Y168 Y169 Y170 Y171 Y172 Y173 Y174 Y175 Y176 Y177 Y178 Y179 Y180 Y181 Y182 Y183 Y184 Y185 Y186 Y187 Y188 Y189 Y190 Y191 Y192 Y193 Y194 Y195 Y196 Y197 Y198 Y199 Y200 Y201 Y202 Y203 Y204 Y205 Y206 Y207 Y208 Y209 Y210 Y211 Y212 Y213 Y214 Y215 Y216 Y217 Y218 Y219 Y220 Y221 Y222 Y223
This is what I got so far, but I'm kinda lost after that. I want each dependent variable (Y001, Y002 etc) to be regressed on C, Mkt_rf, mkt_rf^2 and I need the coefficient values as well as the t-stats and R^2 (saved as a matrix or something). How will the rest of the syntax look like? (And is what I've done so far correct?)

Thanks for any help.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: non-linear regression and starting values

Postby EViews Gareth » Mon Aug 27, 2012 2:13 pm

Startz is right, assuming that Alpha, Beta and Gamma are your parameters, the equation is linear in them, and thus you probably did something wrong for your initial specification.

TheOnlyOne
Posts: 8
Joined: Mon Aug 27, 2012 11:20 am

Re: non-linear regression and starting values

Postby TheOnlyOne » Mon Aug 27, 2012 2:39 pm

Startz is right, assuming that Alpha, Beta and Gamma are your parameters, the equation is linear in them, and thus you probably did something wrong for your initial specification.
Just to be clear, this is the original formula:

rP - rf a + b(rM - rf ) + c(rM - rf )^2 + eP
where r - P is the portfolio return, and a, b, and c are estimated by regression analysis.

So, I can go back to what I previously did, and use a regular OLS regression?

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: non-linear regression and starting values

Postby startz » Mon Aug 27, 2012 2:41 pm

Startz is right, assuming that Alpha, Beta and Gamma are your parameters, the equation is linear in them, and thus you probably did something wrong for your initial specification.
Just to be clear, this is the original formula:

rP - rf a + b(rM - rf ) + c(rM - rf )^2 + eP
where r - P is the portfolio return, and a, b, and c are estimated by regression analysis.

So, I can go back to what I previously did, and use a regular OLS regression?
Yes. What's relevant for the regression is that it's linear in the parameters, so OLS should be fine in your case.

TheOnlyOne
Posts: 8
Joined: Mon Aug 27, 2012 11:20 am

Re: non-linear regression and starting values

Postby TheOnlyOne » Mon Aug 27, 2012 2:44 pm

Startz is right, assuming that Alpha, Beta and Gamma are your parameters, the equation is linear in them, and thus you probably did something wrong for your initial specification.
Just to be clear, this is the original formula:

rP - rf a + b(rM - rf ) + c(rM - rf )^2 + eP
where r - P is the portfolio return, and a, b, and c are estimated by regression analysis.

So, I can go back to what I previously did, and use a regular OLS regression?
Yes. What's relevant for the regression is that it's linear in the parameters, so OLS should be fine in your case.
Ok. Thank you. :)


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests