On Jan 27, 2010, at 9:09 PM, GlenB wrote:
I have an additive model of the following form :
zmdlfit <- lm(z~ns(x,df=6)+ns(y,df=6))
I can get the fitted values and plot them against z easily enough,
but I
also want to both obtain and plot the two additive components (the
estimates
of the two additive terms on the RHS)
I've been looking at manuals and searching on the internet and
searching the
archives, but I'm apparently incompetent because I can't locate it -
how do
I plot just the x and y splines (against x and y)?
I've read the help on predict.lm, and on predict.ns (/predict.bs)
but it
only shows how to get the new columns for new values of x; I could
multiply
those by the coefficients of the spline fit, and I could also do it by
holding each variable fixed while the other varies in predict (which
is
right up to an additive constant), but it seems like there would
have to be
a more straightforward that way I am missing. It looks like gam and
mgcv do
it for you, but can I do it with just lm and ns?
I don't know about lm and ns but in either the Design package or its
successor, rms, you could have obtained the expression by using the
Function function. You might look at the methods Harrell concocted if
you don't want to switch over and do it the easy way.
--
David.
--
View this message in context:
http://n4.nabble.com/plotting-additive-ns-components-tp1312375p1312375.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.