I have run some gams in r and am in the process of plotting the predicted response on the y axis and predictors on the x. I have used rug() to indicate the amount of data points on all plots with continuous predictors. I am now in the process where I am doing the same prediction plots but with categorical (factor) predictors. The rug() function now does not work. I have the following data and code:
BFRT_FRC_L <- c('0', '1', '2', '3',
'4', '5', '6')
fit1 <- c(4.794081, 4.024341, 3.747784,
3.690677, 1.991833, 5.28066, 6.82015)
se.fit1 <- c(0.5903663, 0.5822973,
0.5809198, 0.5825511, 0.5999183, 0.5852767,
0.5937017)
b <- c(22, 136, 145, 76, 36, 18, 3)
plot(y=exp(fit1), x=(as.factor(BFRT_FRC_L)), type="l", lwd=2,
xlab="BFRT_FRC",
ylab="Predicted Attendance", ylim = c(0,500))
points(y=exp(fit1+se.fit1), x=BFRT_FRC_p, lwd=1, lty=2)
points(y=exp(fit1-se.fit1), x=BFRT_FRC_p, lwd=1, lty=2)
rug(x = as.integer(b))
where it should look something like this from the gam partial plots:
Any help in getting the rug to work would be appreciated.