simple bootstrap
Posted: Mon Nov 19, 2012 7:26 am
I've been trying to generate a time series y from an eqn like
y(t)=a+b*X(t) + res(t)
giving a looping randominzed parameter support for a, b and the residual. Thus, i monte carlo not just the error but also the conefficients. I get the message (too many random innovations). See below. Any help much appreciated.
________________
' set seed for random number generator
rndseed 123456
' assign number of replications to a control variable
!reps = 100
!time=43 'length of sample
vector(!time) tech_m
'generate the series
'general form y=(a/b)*(x1-const-c*x2-error)
series tech = ((0.1+(5-0.1)*rnd)/((0.1+(5-0.1)*rnd)-1))*(lcp - 0+(0.5-0)*rnd + (1/(0.1+(5-0.1)*rnd))*log(nsnu) - (0.05*nrnd))*(1/(0+(0.05-0)*rnd))
for !t = 1 to 43 'the full sample is 1963-2005
smpl 1963 1963+!time
for !i = 1 to !reps
tech.resample tech_b
'generate the mean of the series over each incremental time point
tech_m(!t) = @mean(tech_b)
next
next
y(t)=a+b*X(t) + res(t)
giving a looping randominzed parameter support for a, b and the residual. Thus, i monte carlo not just the error but also the conefficients. I get the message (too many random innovations). See below. Any help much appreciated.
________________
' set seed for random number generator
rndseed 123456
' assign number of replications to a control variable
!reps = 100
!time=43 'length of sample
vector(!time) tech_m
'generate the series
'general form y=(a/b)*(x1-const-c*x2-error)
series tech = ((0.1+(5-0.1)*rnd)/((0.1+(5-0.1)*rnd)-1))*(lcp - 0+(0.5-0)*rnd + (1/(0.1+(5-0.1)*rnd))*log(nsnu) - (0.05*nrnd))*(1/(0+(0.05-0)*rnd))
for !t = 1 to 43 'the full sample is 1963-2005
smpl 1963 1963+!time
for !i = 1 to !reps
tech.resample tech_b
'generate the mean of the series over each incremental time point
tech_m(!t) = @mean(tech_b)
next
next