This is my very first post on Satatlist. If anything is inappropriate, please let me know.
I would like to estimate a special probit model with one of the coefficients to be negative. After reading the FAQ at
https://www.stata.com/support/faqs/s...l-constraints/
I tried to write my own codes as the followings
Code:
program mynormal_b version 16 args todo b lnf tempname a tempvar xb mu mleval `a' = `b', eq(1) scalar mleval `xb' = `b', eq(2) quietly { generate double `mu' = `xb' + `a' * $x2 mlsum `lnf' = $ML_y1 * ln(normal(`mu')) + (1-$ML_y1) * ln(1 - normal(`mu')) } end global x2 _d_Mean_unitpricedluckiness_1 ml model d0 mynormal_b (a: ) (xb: luckiness_d2 = b_gender_d2 b_birthyear b_local br_child br_old br_parent br_move br_invest br_commute) ml search, repeat() ml maximize
I have two questions regarding this (I know I have not placed any constraints)
1. Even without any constraints, the model cannot be estimated. What Should I do?
2. What is the best way to re-parametrize/code the constraint (so the coefficient for variable _d_Mean_unitpricedluckiness_1 is negative)
Any help is much appreciated.
Regards,
Leo
0 Response to ML with interval constraint
Post a Comment