Le Wang
2010-Aug-26 02:46 UTC
[R] How to obtain the graph of fitted values against one variable after estimation?
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? I know this is probably a very simple question, but I searched around for a while without any luck. Thank you for your time. Best, Le
David Winsemius
2010-Aug-26 03:15 UTC
[R] How to obtain the graph of fitted values against one variable after estimation?
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. ?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
Reasonably Related Threads
- Statistical question: one-sample binomial test for clustered data
- Extreme value distributions (Long.)
- Estimation of the mode
- Sampling from multi-dimensional kernel density estimation
- New package `np' - nonparametric kernel smoothing methods for mixed datatypes