[R] SPM/SemiPar -- Plotting additive interactions
Andrew Crane-Droesch
andrewcd at gmail.com
Sat Oct 6 04:07:59 CEST 2012
I'm taking the residual-regression approach to semiparametric estimation
(Robinson 1988, Econometrica), and basically using SemiPar simply as a
convenient means of doing multivariate nonparamteric additive models.
The final bit of code is here:
finalfit <-
spm(res~f(V3,basis="trunc.poly")+f(V5,basis="trunc.poly")+f(V6,basis="trunc.poly"))
summary(finalfit)
par(mfrow = c(2,2))
plot(finalfit)
you can see the plot here: http://i.imgur.com/qaPc8.png
V3 is a main effect, V5 and V6 are interactions between dummy variables
and V3.
What I want to do is somehow combine V3 and V5, and V3 and V6.
Put differently, V5 shows the additive effect of the dummy variable to
V3 when the dummy equals 1. So V3+V5 shows the effect of interest when
the dummy equals 1.
I would first need to extract the fitted values for each plot, then
simply add them, then add the confidence bands (according to rules for
adding gaussians).
How would I begin to do this based on the objects that semipar gives me,
then how would I plot them?
I'm new to R, so I appreciate any help.
Thanks,
Andrew
More information about the R-help
mailing list