[R] plotting additive ns components
GlenB
glnbrntt at gmail.com
Thu Jan 28 03:09:17 CET 2010
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?
--
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.
More information about the R-help
mailing list