I'm trying to perform WLS analysis with Conley Robusts standard errors. acreg seems to be the optimal command to perform the exercise in Stata.
However, my regression has interaction terms between continuous variables, which I am passing to acreg as is standard in other regression commands (c.var1#c.var2). I've been trying to implement the specification but get the error r(198) with the message "operator invalid".
I've been able to replicate the error in the simple code below:
While I can simply create the interaction terms and pass them directly, this approach does not work for the purpose of estimating margins and creating margin plots, which is my ultimate goal.
Using reg2hdfespatial is not sensible in my setting, as the command does not take weights.
Any thoughts on either how to solve this or how to get margin plots from interaction terms in a WLS specification with spatially robust standard errors would be very helpful.
Thanks everyone!
Jose Morales-Arilla
PhD Candidate in Public Policy
Harvard University
However, my regression has interaction terms between continuous variables, which I am passing to acreg as is standard in other regression commands (c.var1#c.var2). I've been trying to implement the specification but get the error r(198) with the message "operator invalid".
I've been able to replicate the error in the simple code below:
Code:
sysuse auto, clear qui su mpg gen mpg_high = (mpg > r(mean)) qui su weight gen weight_high = (weight > r(mean)) reg price i.mpg_high i.weight_high reg price i.mpg_high i.weight_high i.mpg_high#i.weight_high reg price c.mpg c.weight reg price c.mpg c.weight c.mpg#c.weight acreg price i.mpg_high i.weight_high cap noi acreg price i.mpg_high i.weight_high i.mpg_high#i.weight_high // Also breaks down for discrete interactions. acreg price c.mpg c.weight cap noi acreg price c.mpg c.weight c.mpg#c.weight // Replicated error that I am getting in my setting.
Using reg2hdfespatial is not sensible in my setting, as the command does not take weights.
Any thoughts on either how to solve this or how to get margin plots from interaction terms in a WLS specification with spatially robust standard errors would be very helpful.
Thanks everyone!
Jose Morales-Arilla
PhD Candidate in Public Policy
Harvard University
Comment