Hi everybody,
I have the following dataset:
I need to fit the estimate the following model: RV=B0+B1*qrt_aday+B2*qrt_nday+B3*qrt_var
with the constraint: RV>=0.
I know that cnsreg cannot be used with interval constraint and thus I appealed to nl command. My solution was to estimate the model with the exp(lnRV) as dependent variable, where lnRV=ln(RV). With the code:
nl (exp(lnRV) = {a}*qrt_aday + {b}*qrt_nday + {c}*qrt_var + {c}), nolog
I get "exp: operator not valid". If I try to the model with defining the exponential of lnRV before using nl command, I obviously get the same results of a unconstrained regression. Somebody has some idea?
Thank you in avdance
I have the following dataset:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(Q MeR RV qrt_aday qrt_nday qrt_var lnRV) 16 .0008290323 4.736642e-06 -.005230409 .05646858 4.608747e-06 -12.260182 17 .00044375 .000012509194 .0091804005 .01881856 .000012538238 -11.289046 18 .0004625 .00001069046 .0012458297 .028011275 .000010679361 -11.446158 19 .00010158731 .000011364647 -.0008584664 .006905314 .000011389733 -11.385003 20 .0004209678 .000010257266 .008079512 .0177161 9.809267e-06 -11.487524 21 -.000515873 .00003718756 .017037444 -.05071094 .00003758523 -10.199536 22 .0010875 .000012483018 .01383731 .05533044 .000012532302 -11.291142 23 .00056666665 9.596032e-06 -.0020172177 .03741645 9.378113e-06 -11.55416 24 -.0004698412 .000023483357 -.0017103762 -.02861211 .00002310704 -10.65922 25 -.0008047619 .00004745881 .00752774 -.05969866 .00004681504 -9.955648 26 -.0016609374 .0000869344 -.02177702 -.08736214 .00008737257 -9.350357 27 .000885484 .00005871836 .029210404 .02385477 .00005932969 -9.742758 28 .0020370968 .000021779417 .011997658 .11352037 .00002142717 -10.734545 29 .00028906247 .00004278279 -.018141773 .035276785 .00004326642 -10.059375 30 .0010571429 .00001257287 .007371168 .05881207 .000012314264 -11.28397 31 .00005161291 .0000289419 .003370562 -.0010431414 .000028606475 -10.45022 32 -.0012209677 .00004922577 .004821284 -.0820741 .00004940278 -9.919093 33 .0019661018 .00003825759 .014042603 .10072759 .00003842825 -10.171168 34 .00051730766 .000028131086 -.0038036145 .02997416 .00002835944 -10.478636 35 .0003320755 .000016813141 -.003634345 .02080315 .000016484906 -10.99335 end format %tq Q
with the constraint: RV>=0.
I know that cnsreg cannot be used with interval constraint and thus I appealed to nl command. My solution was to estimate the model with the exp(lnRV) as dependent variable, where lnRV=ln(RV). With the code:
nl (exp(lnRV) = {a}*qrt_aday + {b}*qrt_nday + {c}*qrt_var + {c}), nolog
I get "exp: operator not valid". If I try to the model with defining the exponential of lnRV before using nl command, I obviously get the same results of a unconstrained regression. Somebody has some idea?
Thank you in avdance
Comment