Suppose I have two variables: age and attitude. I want to find a cutoff in age such that I can minimize the MSE of predicting attitude with just a binary variable indicating whether age is above or below the cutoff.
I thought I could achieve that with the function nl and I wrote the following:
Code:
nl (attitude = {b0} + {b1}*(age>{cutoff}), hasconstant(b0)
Also, what if I want to find the cutoff with another criteria? One potential idea is finding the cutoff that maximizes the Kolmogorov-Smirnov test statistics between the distribution of attitude among the two age groups.
0 Response to optimization with STATA
Post a Comment