Hi Statalisters,
I have never used the nl regression command but tried to learn as much as I could by reading the related Stata documents and other resources available on the internet. However, I am stuck right now as I am wondering how the nl command handles interaction terms between continuous variables and factor variables.
I ran the following regression:
. nl (y_LN = {a}*f1*x1_LN + {b}*f2*x1_LN + {c}*f3*x1_LN + {d}*f4*x1_LN + {g}*x2_LN + {h}*x3_LN + {i}* x1_LN + {c})
where,
f1-f4 are four binary variables (0 , 1) that I have created to indicate the four categories of the categorical variable f;
x1_LN is a continuous variable (it’s the log of x1) that I need to be interacted with the four categories of the variable f (f1-f4) and also as a stand-alone variable in the model;
x2_LN and x3_LN are other continuous variables (logs of x2 and x3).
When I used the factor notation for variable f (i.f) in the model , I got an error message; that was the reason I created the four categories f1-f4. However, after running the code above, I realized that the results table included all of the four categories f1-f4 and it did not drop one of the categories (the reference category).
My question is: how should I revise my above code to let Stata know that f1-f4 are categories of a factor variable (f) so it would drop one of the categories as the reference category (like it would, if I run the same regression with a regular regress command: regress y_LN f1*x1_LN f2*x1_LN f3*x1_LN f4*x1_LN x2_LN x3_LN x1_LN)?
Thank you for your help!
I have never used the nl regression command but tried to learn as much as I could by reading the related Stata documents and other resources available on the internet. However, I am stuck right now as I am wondering how the nl command handles interaction terms between continuous variables and factor variables.
I ran the following regression:
. nl (y_LN = {a}*f1*x1_LN + {b}*f2*x1_LN + {c}*f3*x1_LN + {d}*f4*x1_LN + {g}*x2_LN + {h}*x3_LN + {i}* x1_LN + {c})
where,
f1-f4 are four binary variables (0 , 1) that I have created to indicate the four categories of the categorical variable f;
x1_LN is a continuous variable (it’s the log of x1) that I need to be interacted with the four categories of the variable f (f1-f4) and also as a stand-alone variable in the model;
x2_LN and x3_LN are other continuous variables (logs of x2 and x3).
When I used the factor notation for variable f (i.f) in the model , I got an error message; that was the reason I created the four categories f1-f4. However, after running the code above, I realized that the results table included all of the four categories f1-f4 and it did not drop one of the categories (the reference category).
My question is: how should I revise my above code to let Stata know that f1-f4 are categories of a factor variable (f) so it would drop one of the categories as the reference category (like it would, if I run the same regression with a regular regress command: regress y_LN f1*x1_LN f2*x1_LN f3*x1_LN f4*x1_LN x2_LN x3_LN x1_LN)?
Thank you for your help!

Comment