I'm attempting to plot two locfit models within one plot however I am unable to get the second locfit model to plot the confidence intervals. I've created two locfit models:
1_fit = locfit(Y~Time,data=data_1)
2_fit = locfit(Y~Time,data=data_2)
Each can be plotted on their own just fine with the confidence intervals using the following:
plot(1_fit,band="local",type = "l", xlab = "Time", ylab = "Y-Axis",ylim=c(0,22),
col = "red",lwd = 5,font=3,main="Local Poly Fit 1",cex.lab=1.5, cex.axis=1.5,
cex.main=1.5, cex.sub=1.5)
However, when I attempt to plot an additional locfit model to the plot using:
lines(2_fit,col="blue")
I can only add the locfit line but not the confidence intervals. I've attempted to do:
lines(2_fit,band="local",col="blue")
But I get this message and no confidence intervals:
Warning message: In plot.xy(xy.coords(x, y), type = type, ...) : "band" is not a graphical parameter
I've also looked into using lines.locfit, but had no luck as R just says that it can't find the function lines.locfit.
I have a work around to put both plots within the same window using:
par(mfrow=c(2,1))
But would like to avoid this as it would make the plots more comparable if they were within the same plot.
par(new = TRUE)and then plot one on top of the other. Might need to set xlim/ylim to ensure match.1_fitis not a legal name in R - Richard Telfordpredictto extract the CI and plot directly - Richard Telford