Hello
How I can write a Monte Carlo experiment for the following problem?????
Ysi=a+b*Xi+e
Create N = 200 random values of xi that are spread evenly (or uniformly) over the interval [0, 20]. These we will keep fixed in further simulations.
Obtain N = 200 random values ei from a normal distribution with mean 0 and variance 16.
Create N = 200 values of the latent variable. (Ysi)
Obtain N = 200 values of the observed yi using
Yi=0 if Ysi<=0
Yi=Ysi if Ysi>0
then estimate
Ysi=a+b*Xi+e
Yi=c+d*Xi+e
and save the vector of estimated coefficiants of equations written in above. In AandB vectores.
Monte Carlo for Censored varriable
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
startz
- Non-normality and collinearity are NOT problems!
- Posts: 3797
- Joined: Wed Sep 17, 2008 2:25 pm
Re: Monte Carlo for Censored varriable
When you post a homework question, it's best to show what you've done so far so people can figure out how to give you a helpful hint.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13600
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Monte Carlo for Censored varriable
Pretty simple for loop:
Code: Select all
!its = 100
!t = 200
create u !t
matrix(2,!its) res1
matrix(2,!its) res2
series ei
series yi
series ysi
equation e1
equation e2
series xi = rnd*20
for !i=1 to !its
ei = 4*nrnd
ysi=xi+ei
yi = @recode(ysi<0,0,ysi)
e1.ls ysi c xi
e2.ls yi c xi
colplace(res1,e1.@coefs,!i)
colplace(res2,e2.@coefs,!i)
next
Who is online
Users browsing this forum: No registered users and 1 guest
