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
Question on merge results not consistentHi Statalist community, I am trying to merge, but every time I run it using the same do.file I get …
Options to plot yearly data for five years in a single graphHi All. I'd like to plot two different graphs using the same data. (1) yearly data over five waves…
there is somthing wrong when use tuples commandthe conditions are set: tuples ,cond(!(1&2) !(3&4) !(5&6) !(7&8) (!(9&10)&!(…
GMM with binary outputDear, I am doing gmm for a system including 3 equations. In which, dependent variable of one equati…
Bookmark in Stata 17The combobox is not refreshed on deleting a bookmark? Is there any way to collapse/expand bookmark (…
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