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
Putpdf text printing unrounded numbers from a rounded variableHello, I am using FRED data to create a pdf report of unemployment information. The goal is to have…
dependent variable "a percentage" and independent variables are in millions !hi, i have panel data "micro panel" i used "gmm method" without unifying variables, the dependent…
Oneway BonferroniHello, I am trying to compare variables mean and std deviation across three samples. Is oneway bonf…
Delete-one-node jackknife variance estimatorDear colleagues, using a dataset on bilateral trade (i.e. country g exports to h leading to the nod…
Graph treatment effects by propensity scoreHi Everyone, I am trying to understand some of the heterogeneity in my study in which I am working …
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