Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: nlsuraids need help with AIDS model error please


From   "Liu, Pei Chun" <pliu@mail.smu.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: nlsuraids need help with AIDS model error please
Date   Tue, 10 Jul 2012 08:47:40 +0000

Dear Statlist,

I need help with the AIDS model I am running below. With 3 goods, I get "nlsuraids returned 199 verify that nlsuraids is a function evaluator program" after running it.



program nlsuraids12;
 version 11.2;

 syntax varlist(min=6 max=6) if , at(name);
 tokenize `varlist';
 args w1 w2 lnp1 lnp2 lnp3 lnm;

 tempname a1 a2 a3;
 scalar `a1' = `at'[1,1];
 scalar `a2' = `at'[1,2];
 scalar `a3' = 1 - `a1' - `a2';

 tempname b1 b2;
 scalar `b1' = `at'[1,3];
 scalar `b2' = `at'[1,4];

 tempname g11 g12 g13;
 tempname g21 g22 g23;
 tempname g31 g32 g33;

 scalar `g11' = `at'[1,5];
 scalar `g12' = `at'[1,6];
 scalar `g13' =-`g11'-`g12';


 scalar `g21' = `g12';
 scalar `g22' = `at'[1,7];
 scalar `g23' = -`g21'-`g22';


 scalar `g31' = `g13';
 scalar `g32' = `g23';


 quietly {
  tempvar lnpindex;
  gen double `lnpindex' = 5 + `a1'*`lnp1' + `a2'*`lnp2' +///
        `a3'*`lnp3';
  forvalues i=1/3 {
   forvalues j=1/3 {
    replace `lnpindex' = `lnpindex'+///
       0.5*`g`i'`j''*`lnp`i''*`lnp`j'';
   };
  };
  replace `w1' = `a1' + `g11'*`lnp1' + `g12'*`lnp2' + ///
      `g13'*`lnp3'+ `b1'*(`lnm' - `lnpindex');
  replace `w2' = `a2' + `g21'*`lnp1' + `g22'*`lnp2' + ///
      `g23'*`lnp3'+ `b2'*(`lnm' - `lnpindex');

 };

end;

nlsur aids @ w1 w2 lnp1 lnp2 lnp3 lnm, parameters(a1 a2 b1 b2 g11 g12 g22) neq(2) ifgnls;

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index