Calculating the probability via @tdist

For questions regarding programming in the EViews programming language.

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

jeffreylankhaar
Posts: 1
Joined: Tue Jun 11, 2013 2:20 am

Calculating the probability via @tdist

Postby jeffreylankhaar » Tue Jun 11, 2013 2:36 am

Good day,

I'm trying to calculate the p-value through the @tdist function and extract in a matrix which I copy to excel. I already did the programming of the coefficients, t-stats and r-squared, but facing issues with the calculations of the p-value and putting them automated in the summarizing matrix. Below you will find my coding, can you please have a look were is going wrong?

'Create X variable
%bebci= "x"

'Create X** variable
rename bebci* x*

'Create matrix to store coefseu
matrix(2,5) coefseu

'Create vector to store r-square
rowvector(5) r2eu

'Create matrix to store t-stats
matrix(2,5) tstatseu

'Create matrix to store p-value
matrix(2,5) pvaleu

'Create matrix to summarize
matrix(7,5) Sum1eu

''counter of how many equations we have run
!columncounter=1

'run pairwise regressions between Y(EUUSD) and X
for !i=1 to 5
equation eqeu{!i}.ls xeu{!i} c x
r2eu(!columncounter)=eqeu{!i}.@r2
!columncounter = !columncounter+1
' pval{!i} = @tdist(eqeu{!i}.@tstat, @regobs -@ncoef)

'store p-value into matrix
colplace(pvaleu,eqeu{!i}.@tdist(eqeu{!i}.@tstat, eqeu{!i}.@regobs -eqeu{!i}.@ncoef),!i)

'store tstats into matrix
colplace(tstatseu,eqeu{!i}.@tstats,!i)

'store coefficients into matrix
colplace(coefseu,eqeu{!i}.@coefs,!i)

'delete equations 1 to 5
delete eqeu{!i}

'Combine matrices
matplace(Sum1eu,coefseu,1,1)

'Combine matrices
matplace(Sum1eu,tstatseu,3,1)

'Combine matrices
matplace(Sum1eu,pvaleu,5,1)

'Combine matrices
matplace(Sum1eu,r2eu,7,1)
next

Hope to hear from you guys soon.

Thank you in advance!!

Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests