Estimating STVAR model

For questions regarding programming in the EViews programming language.

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

ndzama
Posts: 29
Joined: Tue Aug 10, 2021 8:33 am

Estimating STVAR model

Postby ndzama » Wed Oct 16, 2024 4:39 am

Hi Eviews Experts,

I have tried to estimate the STVAR, using both the Maximum Likelihood Estimation and the NonLinear Least Squares (nls). I get an error message. Please see attached file.

Below is the system of equations that I have tried to estimate:

'================CREATING A SYSTEM OF EQUATIONS FOR A 2-variable STVAR(1)===========================================
system STVAR_{%c} 'The first line declares a system.

!c_start = 255 ' depends on what data you use.
!gamma_start = 1
param c(1) 0 c(2) 0.7 c(3) 0.1 c(4) !gamma_start c(5) !c_start c(6) 0 c(7) -0.3 c(8) -0.1 c(9) 0 c(10) 0.8 c(11) 0.2 c(12) -0.4 c(13) -0.2 c(14) -0.5

STVAR_{%c}.append CA_{%c} = c(1)+c(2)*CA_{%c}(-1)+c(3)*GDP_GROWTH_{%c}(-1)+(1-EXP( -c(4)*(CA_{%c}(-1)-c(5))^2))*(c(6)+c(7)*CA_{%c}(-1)+c(8)*GDP_GROWTH_{%c}(-1)) 'c(4) and c(5) are TRANSITION PARAMETERS
STVAR_{%c}.append GDP_GROWTH_{%c} = c(9)+c(10)*GDP_GROWTH_{%c}(-1)+c(11)*CA_{%c}(-1)+(1-EXP( -c(4)*(GDP_GROWTH_{%c}(-1)-c(5))^2))*(c(12)+c(13)*GDP_GROWTH_{%c}(-1)+c(14)*CA_{%c}(-1))
STVAR_{%c}.append CA_{%c}(-1) GDP_GROWTH_{%c}(-1) 'line appends the list of instruments to be used in estimation.
'STVAR.nls ' estimate the parameters of a model using nonlinear least squares.
STVAR_{%c}.ml(optmethod=Newton) ' estimate the parameters of a model using maximum likelihood estimation
'STVAR.estimate(method=nls)
show STVAR_{%c}.results 'display the estimation results.

Kindly assist,
Nwabisa Ndzama
Attachments
Screenshot 2024-10-13 150707.png
Screenshot 2024-10-13 150707.png (254.76 KiB) Viewed 28958 times

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

Re: Estimating STVAR model

Postby EViews Gareth » Wed Oct 16, 2024 8:41 am

Systems (or any other estimation method in EViews) don't have an "NLS" method. Just use "LS" instead.

ndzama
Posts: 29
Joined: Tue Aug 10, 2021 8:33 am

Re: Estimating STVAR model

Postby ndzama » Sat Oct 19, 2024 3:17 am

Systems (or any other estimation method in EViews) don't have an "NLS" method. Just use "LS" instead.

Dear Gareth,
Thank you for your timeous response. Much appreciated.
Please note that I was getting exactly the same error even if I use .ml (for maximum likelihood estimation).


I have since revised the code and estimated with .LS . But I Keep getting a syntax error. See attachment.

'======CREATING A SYSTEM OF EQUATIONS FOR A 2-variable STVAR(1): APPLYING LOGISTIC TRANSITION FUNCTION===========================================
system STVAR_{%c}

!c_start = 255
!gamma_start = 1
param c(1) 0 c(2) 0.7 c(3) 0.1 c(4) !gamma_start c(5) !c_start c(6) 0 c(7) -0.3 c(8) -0.1 c(9) 0 c(10) 0.8 c(11) 0.2 c(12) -0.4 c(13) -0.2 c(14) -0.5

' Equation for CA_{%c}
STVAR_{%c}.append CA_{%c} = c(1) + c(2)*CA_{%c}(-1) + c(3)*GDP_GROWTH_{%c}(-1) + (1 / (1 + EXP(-c(4)*(CA_{%c}(-1)-c(5))))) * (c(6) + c(7)*CA_{%c}(-1) + c(8)*GDP_GROWTH_{%c}(-1))

' Equation for GDP_GROWTH_{%c}
STVAR_{%c}.append GDP_GROWTH_{%c} = c(9) + c(10)*GDP_GROWTH_{%c}(-1) + c(11)*CA_{%c}(-1) + (1 / (1 + EXP(-c(4)*(GDP_GROWTH_{%c}(-1)-c(5))))) * (c(12) + c(13)*GDP_GROWTH_{%c}(-1) + c(14)*CA_{%c}(-1))

' Add instruments to be used in the estimation
STVAR_{%c}.append CA_{%c}(-1) GDP_GROWTH_{%c}(-1)

' Estimate using least squares (LS)
STVAR_{%c}.ls
show STVAR_{%c}


I can privately message you the data and full code.
Attachments
Screenshot 2024-10-19 120919.png
Screenshot 2024-10-19 120919.png (265.45 KiB) Viewed 28906 times


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests