Extracting fixed coefficients from regression equation

For questions regarding programming in the EViews programming language.

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

mkt_mix_models
Posts: 4
Joined: Sat Dec 12, 2009 1:50 pm
Location: London

Extracting fixed coefficients from regression equation

Postby mkt_mix_models » Tue Jan 26, 2010 2:29 pm

Hi All,
I'm trying to write a program that will create a table of coefficients and regressors from a given equation.
Easy enough when all the coefficients in the equation are estimated, as they will all be contained in the coefficient vector. The challenge I am having is when the user's equation contains "fixed" coefficients for example:
log(test_sales) = C(1) + 1*log(control_sales) + c(2)*advertising

the coef vector will give me c(1) and c(2), but is there any way of getting the fixed coefficient (1, in this case)?
From everything I've read so far it seems the only way to achieve this will be to freeze the regression output, concatenate the lines containing the estimation equation, then use some (rather complex) text logic to extract the fixed coefficient.
Is there an easier way?!!

Considerations:
fixed coefficients may have many decimal places and not just integer
there my be more than one fixed coefficient in a given equation

Thanks in advance for you help/ideas!

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

Re: Extracting fixed coefficients from regression equation

Postby EViews Gareth » Tue Jan 26, 2010 2:41 pm

Since EViews doesn't have a way to specify "fixed coefficients", it also doesn't have a way to retrieve them. I think your only hope is through the complicated text processing.

mkt_mix_models
Posts: 4
Joined: Sat Dec 12, 2009 1:50 pm
Location: London

Re: Extracting fixed coefficients from regression equation

Postby mkt_mix_models » Tue Jan 26, 2010 2:58 pm

Thanks for the response. From a practitioner's perpective fixed coefficients are used frequently, so having the functionality to formally specify these would be a welcome addition.
Does Eview currently handle a specification such as the one above, by taking the fixed coefficients to the LHS of the equation and then estimating, before transferring them back over to the RHS?

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

Re: Extracting fixed coefficients from regression equation

Postby EViews Gareth » Tue Jan 26, 2010 3:58 pm

Essentially, yes.

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

Re: Extracting fixed coefficients from regression equation

Postby startz » Tue Jan 26, 2010 4:03 pm

Just a thought, would it be possible to have the user specify the fixed coefficients as scalars or elements of a vector to make them easier to retrieve?

mkt_mix_models
Posts: 4
Joined: Sat Dec 12, 2009 1:50 pm
Location: London

Re: Extracting fixed coefficients from regression equation

Postby mkt_mix_models » Tue Jan 26, 2010 4:19 pm

interesting idea - i'll have a play with it tomorrow to see if this is feasible! I'll post the outcome here for completeness

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

Re: Extracting fixed coefficients from regression equation

Postby EViews Gareth » Tue Jan 26, 2010 4:20 pm

If you haven't already done so, you should take a look at the example program here:
http://forums.eviews.com/viewtopic.php?f=15&t=1631

It creates a formatted equation output table.

mkt_mix_models
Posts: 4
Joined: Sat Dec 12, 2009 1:50 pm
Location: London

Re: Extracting fixed coefficients from regression equation

Postby mkt_mix_models » Wed Jan 27, 2010 3:55 pm

Just a thought, would it be possible to have the user specify the fixed coefficients as scalars or elements of a vector to make them easier to retrieve?
startz - I had the chance to have a play with your idea about using scalars or elements of a vector and I found that eviews will accept equations specified with a scalar/element of a vector as the fixed coefficient for example:
Long Hand: log(test_sales) = C(1) + 1*log(control_sales) + c(2)*advertising
Scalar: log(test_sales) = C(1) + _s*log(control_sales) + c(2)*advertising 'where _s is a scalar with value 1
Vector: log(test_sales) = C(1) + _v(1)*log(control_sales) + c(2)*advertising 'where _v(1) is a vector whose first element is 1

All of these will produce the same estimation results, but different estimation ouput: the long hand method and the vector method will display the estimation equation as log(test_sales) = C(1) + 1*log(control_sales) + c(2)*advertising, whereas the scalar method will display it as log(test_sales) = C(1) + _s*log(control_sales) + c(2)*advertising.

So I'm thinking that if the user can specify all fixed coefficients as unique sequentially named scalars e.g. _s1, _s2... I should be able to iterate through and match them back to the relevant variable in the table that I'm making.
Thanks for the idea!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests