Fetch the P-Values

For questions regarding programming in the EViews programming language.

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

marcounam
Posts: 49
Joined: Tue Jan 11, 2011 10:42 am

Fetch the P-Values

Postby marcounam » Fri Mar 25, 2011 5:14 pm

How do i fetch the P-Values of the variables of a regression example eq1.@coefs(1) gives me the alpha of aregression, so the question is how do i do the same thing for the P-Values in this case im running a regression with 6 independent variables so i need to fetch all 6 P-Values.

Thanks

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

Re: Fetch the P-Values

Postby EViews Gareth » Fri Mar 25, 2011 5:59 pm

There's nothing built in that will grab it for you, you'll have to calculate it from the t/z-statistic.

marcounam
Posts: 49
Joined: Tue Jan 11, 2011 10:42 am

Re: Fetch the P-Values

Postby marcounam » Mon Mar 28, 2011 12:08 pm

Really? but it is an output of the regression, so eviews alredy calculates it. Im talking about the numbers under the heading Prob in the output format of a regression.

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

Fetch the P-Values

Postby EViews Gareth » Mon Mar 28, 2011 12:33 pm

Yep

marcounam
Posts: 49
Joined: Tue Jan 11, 2011 10:42 am

Re: Fetch the P-Values

Postby marcounam » Mon Mar 28, 2011 2:31 pm

Oh well...how do i calculate the Prob in terms of the t-statistics?
Thanks for your time.

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

Re: Fetch the P-Values

Postby EViews Gareth » Mon Mar 28, 2011 2:35 pm

For a standard least squares:

Code: Select all

!pval = @tdist(!tstat, !df)
where !tstat is the corresponding t-statistic, and !df is the degrees of freedom (usually !obs-!ncoefs)

marcounam
Posts: 49
Joined: Tue Jan 11, 2011 10:42 am

Re: Fetch the P-Values

Postby marcounam » Mon Mar 28, 2011 4:55 pm

Ok thanks! What i would really like to have is a list of the things i can fetch of a given regression and how can i fetch it, for example in my first post i showed how to fetch the coefficients of a given regression. The problem i have now is that i dont know how to obtain the number of observations used in the regression, nor if it is even possible to obtain. Also i dont know if the constant c is included in the formula for the p-value in terms of the t-statistic. Is this information in eviews help somewhere?

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

Re: Fetch the P-Values

Postby EViews Gareth » Mon Mar 28, 2011 5:01 pm

The EViews Object Reference is a reference for all EViews objects.

marcounam
Posts: 49
Joined: Tue Jan 11, 2011 10:42 am

Re: Fetch the P-Values

Postby marcounam » Mon Mar 28, 2011 5:21 pm

Im sorry to keep bothering you :
So i checked the object reference and the prob should be equal to :

!pval1 = @tdist( {%i}{!a}{!b}{!c}.tstats(2) , {%i}{!a}{!b}{!c}.regobs-{%i}{!a}{!b}{!c}.ncoef )

But i get the following error:
!pval1 is not defined or an illegal command in !pval=@tdist(banamexA000.TSTATS(2),banamexA000.REGOBS-banamexA000.NCOEF).

once again i dont see the problem :(

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

Re: Fetch the P-Values

Postby EViews Gareth » Mon Mar 28, 2011 6:42 pm

Pretty certain the Object Reference says it is .@regobs and .@ncoef

marcounam
Posts: 49
Joined: Tue Jan 11, 2011 10:42 am

Re: Fetch the P-Values

Postby marcounam » Mon Mar 28, 2011 6:57 pm

In the code i attached, i run it and get the following error:

BANAMEX0412 is not defined in "!PVAL1=@TDIST(BANAMEXA0412.@TSTATS(2) , BANAMEXA0412.@REGOBS-BANAMEXA0412.@REGOBS-BANAMEXA0412.@NCOEF)".

Supposedly im getting the t-statistic of the second dependent variable with BANAMEXA0412.@TSTATS(2) , the number of observations with BANAMEXA0412.@REGOBS and the quantity of coefficients with BANAMEXA0412.@NCOEF which are the inputs i need to calculate the p-value of the second dependent variable. If i put 2 constant numbers as inputs to the @tdist function the program runs completely. Please could someone help me?

Thanks in advance.
Attachments
regressions best lags 2.prg
(848 Bytes) Downloaded 447 times

marcounam
Posts: 49
Joined: Tue Jan 11, 2011 10:42 am

Re: Fetch the P-Values

Postby marcounam » Mon Mar 28, 2011 7:03 pm

Dear Eviews Gareth :

Yes i detected that error, and now i get the error i explained in my most recent post. I aprreciate your time infinitely and i am trying to fix the problem as we speak, but sometimes i see what i want to see and not what is written; maybe you could detect the problem with your eyes.

Again Many Thanks

marcounam
Posts: 49
Joined: Tue Jan 11, 2011 10:42 am

Re: Fetch the P-Values

Postby marcounam » Tue Mar 29, 2011 9:45 am

Code: Select all

if @tdist( {%i}{!a}{!b}{!c}.@tstats(2) , {%i}{!a}{!b}{!c}.@regobs - {%i}{!a}{!b}{!c}.@ncoef )>0.05 then delete {%i}{!a}{!b}{!c}
The problem is on the line i wrote above. I have checked that line a million times i do not see the problem. What is most annoying is that the program runs for the first 8 regressions and then in banamexa0412 it says it is not defined in the line of code i wrote above.

The whole code is the following :

Code: Select all

smpl 2005 2010 for %i banamexa bbva_bancomera santandera banortea hsbca inbursaa scotiabanka inga bajioa interaccionesa ixea aztecaa for !a=0 to 12 step 4 for !b=0 to 12 step 4 for !c=0 to 12 step 4 equation {%i}{!a}{!b}{!c}.ls @qnorm({%i}) c totcred_gdp(-3*!a) vimex(-3*!b) cycle_bienes(-3*!c) if {%i}{!a}{!b}{!c}.@coefs(3)<0 then delete {%i}{!a}{!b}{!c} endif if @tdist( {%i}{!a}{!b}{!c}.@tstats(2) , {%i}{!a}{!b}{!c}.@regobs - {%i}{!a}{!b}{!c}.@ncoef )>0.05 then delete {%i}{!a}{!b}{!c} endif next next next next smpl @all
Anyone see the problem?

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

Re: Fetch the P-Values

Postby EViews Gareth » Tue Mar 29, 2011 9:55 am

You have deleted the equation.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests