[R] How to obtain the graph of fitted values against one variable after estimation?
ruser.le at gmail.com
Thu Aug 26 20:35:25 CEST 2010
I did try to use predict() to obtain the graph, but it somehow looks
different from the one generated by "plot" command. So, I was
wondering if there is any way that I can get the one generated by
"plot" so that I can compare. Thank you.
On Wed, Aug 25, 2010 at 11:15 PM, David Winsemius
<dwinsemius at comcast.net> wrote:
> On Aug 25, 2010, at 10:46 PM, Le Wang wrote:
>> Hi there,
>> I have a question regarding the "plot" command after estimation.
>> Specifically, I estimate a model, say regressing y on x and z. And
>> after estimation, I would like to plot the fitted values against x,
>> but I don't need that for z. The following command always gives two
>> graphs, for both variables x and z.
>> plot.np<-plot(model, plot.errors.method = "asymptotic")
>> My question is, what option should I specify in order to get the graph
>> for x only?
> Pick a constant value for "z" and vary "x" in a dataframe that you offer to
> the newdata argument of predict.
> Then plot those values versus x.
>> I know this is probably a very simple question, but I searched around
>> for a while without any luck. Thank you for your time.
> David Winsemius, MD
> West Hartford, CT
Le Wang, Ph.D
University of Minnesota
More information about the R-help