Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • recursive equation solution

    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!
    Click image for larger version

Name:	44848455_164797817803159116160_n.jpg
Views:	1
Size:	133.8 KB
ID:	1497195

  • #2
    You didn't get a quick answer. You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex.

    This is the kind of problem that might spark someone's interest, but not mine. I'd suggest you figure out what the core problem you're having in programming this in Stata is, and present that problem. Explain exactly what you want to accomplish and your estimation strategy - it may not be obvious to us how exactly you're trying to solve this problem. Dumping a picture with complex equations in your post doesn't encourage folks to help you.

    Comment

    Working...
    X