Hello! Thank goodness we have this forum where I can ask questions and share information about EVIEWS. I am active user of EVIEWS for many years but I havent done some real programming. Here is my issue...
We are asked to estimate parameters from a mixture of normal distributions using GMM with simulations (we are interested with the bias). The prof wanted us to replicate what was essentially done in Quandt and Ramsey (1978) where they used a "moment generating function". The moment condition that we are looking at is:
(exp(t*Xi)/n)-lambda*exp(mu1*t+(sigma1^2*t^2)/2)-(1-lambda)*exp(mu2*t+(sigma2^2*t^2)/2)=0
Xi is randomly generated coming from either distribution N(mu1, sigma1) and N(mu2, sigma2).
So what we are looking for are estimates of lambda, mu1, mu2, sigma1 and sigma2 - five parameters. The prof gave assumptions for t. We choose t= -3, -2, -1, 0, 1, 2, and 3. With these seven values of t we have seven moment conditions which is enough to estimate via GMM.
When I hit RUN it says "NO COEFFICIENTS SPECIFIED". Here is the code that I have worked on so far. Any information will be very helpful. Thank you.
create u 50
!nreps=100
scalar t1=-3
scalar t2=-2
scalar t3=-1
scalar t4=0
scalar t5=1
scalar t6=2
scalar t7=3
matrix(100,1) c1
matrix(100,1) c2
matrix(100,1) c3
matrix(100,1) c4
matrix(100,1) c5
rndseed 123456
For !j=1 to !nreps
genr z{!j}=rnd
if z{!j}<=0.25 then genr x{!j}=rnd else genr x{!j}=rnd*2 endif
genr m1{!j}=@exp(t1*x{!j})
genr m2{!j}=@exp(t2*x{!j})
genr m3{!j}=@exp(t3*x{!j})
genr m4{!j}=@exp(t4*x{!j})
genr m5{!j}=@exp(t5*x{!j})
genr m6{!j}=@exp(t6*x{!j})
genr m7{!j}=@exp(t7*x{!j})
--------------- ok up to this point -------------------------
@param c(1) 0.5 c(2) 2 c(3) 2 c(4) 3 c(5) 3
equation eq1{!j}.gmm m1{!j}-c(1)*@exp(c(2)*t1+(c(3)*t1^2)/2)-(1-c(1))*@exp(c(4)*t1+(c(5)*t1^2)/2)=0 @ c
equation eq2{!j}.gmm m2{!j}-c(1)*@exp(c(2)*t2+(c(3)*t2^2)/2)-(1-c(1))*@exp(c(4)*t2+(c(5)*t2^2)/2)=0 @ c
equation eq3{!j}.gmm m3{!j}-c(1)*@exp(c(2)*t3+(c(3)*t3^2)/2)-(1-c(1))*@exp(c(4)*t3+(c(5)*t3^2)/2)=0 @ c
equation eq4{!j}.gmm m4{!j}-c(1)*@exp(c(2)*t4+(c(3)*t4^2)/2)-(1-c(1))*@exp(c(4)*t4+(c(5)*t4^2)/2)=0 @ c
equation eq5{!j}.gmm m5{!j}-c(1)*@exp(c(2)*t5+(c(3)*t5^2)/2)-(1-c(1))*@exp(c(4)*t5+(c(5)*t5^2)/2)=0 @ c
equation eq6{!j}.gmm m6{!j}-c(1)*@exp(c(2)*t6+(c(3)*t6^2)/2)-(1-c(1))*@exp(c(4)*t6+(c(5)*t6^2)/2)=0 @ c
equation eq7{!j}.gmm m7{!j}-c(1)*@exp(c(2)*t7+(c(3)*t7^2)/2)-(1-c(1))*@exp(c(4)*t7+(c(5)*t7^2)/2)=0 @ c
c1({!j})=@coefs(1)
c2({!j})=@coefs(2)
c3({!j})=@coefs(3)
c4({!j})=@coefs(4)
c5({!j})=@coefs(5)
next
Help with GMM estimation - seven moment conditions
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
Who is online
Users browsing this forum: No registered users and 34 guests