Dear Stata community,
I'm attempting to predict the value of a dependent variable if one of the independent variables is changed.
For example, let's suppose I've modeled testscore as a function of independent variables height, weight, and cupsofcoffee:
regress testscore height weight cupsofcoffee
I can generate predictions with
predict testscorehat
But now I want to predict what everyone's testscore would have been if they'd drank twice as many cups of coffee. What command do I use? Predict? Adjust? Something else? And with what syntax?
If I wanted to predict what would happen if cupsofcoffee had a single value for everyone, e.g. if everyone had one cup of coffee, i.e. I could run:
adjust cupsofcoffee=1
(https://www.stata.com/support/faqs/s...ct-and-adjust/)
But if I try to double everyone's coffee intake by running
generate doublecoffee=cupsofcoffee*2
adjust cupsofcoffee, by(doublecoffee)
I get the error message 'too many values', which seems to mean that the the vector doublecoffee has too many individual values.
It seems that I might be able to make an out-of-sample prediction on a "new" dataset that is the same as the old data set but for the doubled coffee. (https://www.stata.com/manuals13/u20.pdf)
But this seems like a lot of work for what I would think would be a simple command.
I'm sure this must be a routine command or syntax, but I'm having a difficult time finding it.
Thanks,
Jonah
Related Posts with Post-estimation, predicting the dependent variable with a change to one or more independent variables
2SLS with linear time trend.Hi all, I am estimating the following model using fixed effects including linear time trends. Cod…
how to export results from a regression to excel, using STATA 13Hi, Could someone help me with exporting me regression table to Excel. I have tried "copy table" an…
Hausman testHi, I'm running a panel regression. These are my panel commands, followed by regression commands fo…
Joint significance of interactionsHello Everybody! I have a model y = 50+0.3*d-1*d*d+1.5*x+1.5*z-0.5*x*z-3.5*boy+u+5*rnormal() . All …
Sorting a variable by two dummy variablesI am working on a paper about discrimination in the labour market. I have three variables (among man…
Subscribe to:
Post Comments (Atom)
0 Response to Post-estimation, predicting the dependent variable with a change to one or more independent variables
Post a Comment