I got a recursive equation to solve, the equation is equation A13 shown in the picture. It is actually much easier than it seems, cause the v and h are constants.
And we can take the p(h/1+nh)/p(h/1+(n+1)h) as a whole, noted as a(n). Then we can simplify the equation as follows (I'm going to show the matlab code),
h = 0.374 ;
v = 4 ;
c1 = @(n) ( (1+(n+2)*h)./(1+(n+3)*h) ).^(2/(v-2 ));
c2 = @(n) v/2*( (1+(n+2)*h)./(1+n*h) ).^(v-2 );
a(1) = (1+h)/(1+2*h) ;
for n = 1:100
a(n+1) = c1(n) *(c2(n)*a(n)^2 - a(n)^v)^(1/(v-2 ));
end
A=prod(a)
The A is the final value I need to get here. It is the product of all the 101 values of a(n).
But since my data is panel data, matlab cannot deal with panel data so well. I need to translate the code into stata. Could you help me please? Thank you!
Array
Related Posts with recursive equation solution
Command for division with ln Hello guys! I would like help to use a command in stata for the following formula that I use in exc…
How to calculate group-wise mean of VarX & subtract it from VarX? ID Year Temp NTemp Temp - NTemp 1 1990 10 12 -2 1 1991 12 12 0 1 1992 14 12 2 2 1990 12 1…
Handling time in stataHey all I am having some trouble with transforming some of the time stamps in my data, they are cur…
descriptive statistics and correlation of panel data from STATA to excelHi, I am trying to export a descriptive statistics of panel data from STATA to excel by using the f…
First stage with ivpoissonHi everyone, I am estimating a country-level gravity model with one endogenous regressor using ivpoi…
Subscribe to:
Post Comments (Atom)
0 Response to recursive equation solution
Post a Comment