A colleague and I have been puzzling over how to get the data out of the term.plot() function so that we can replot the figures as we want to. Basically I am running separate models on 6 populations and want to create a nice multipanel plot of the effect of Month on each population, as below.
Unfortunately, I can't seem to find a way of getting the mean and SD out of term.plot() for my model; we looked through the underlying R code for term.plot() and it was not immediately obvious how to extract the plotted values.
term.plot() does not return the values plotted if you set plot=FALSE
summary(results, save=TRUE)$mu.coef.table
this does return the values needed but not the mean and SD for month 1 only for months 2-12.
I also tried the base function x <- termplot(plot=FALSE) and this does return the mean and SD for months 1-12, the mean is the same (offset by the intercept), but the SD is smaller than for the model, probably because the GAMLSS model uses beta-binomial likelihood.
No doubt there is an easier way of finding this!
Alternatively, perhaps it's worth considering in a future update, adding the plot=FALSE option to term.plot and having it return the plotted values in the same way that termplot does.
A colleague and I have been puzzling over how to get the data out of the
term.plot()
function so that we can replot the figures as we want to. Basically I am running separate models on 6 populations and want to create a nice multipanel plot of the effect of Month on each population, as below.Unfortunately, I can't seem to find a way of getting the mean and SD out of
term.plot()
for my model; we looked through the underlying R code forterm.plot()
and it was not immediately obvious how to extract the plotted values.term.plot()
does not return the values plotted if you setplot=FALSE
summary(results, save=TRUE)$mu.coef.table
this does return the values needed but not the mean and SD for month 1 only for months 2-12.
I also tried the base function
x <- termplot(plot=FALSE)
and this does return the mean and SD for months 1-12, the mean is the same (offset by the intercept), but the SD is smaller than for the model, probably because the GAMLSS model uses beta-binomial likelihood.No doubt there is an easier way of finding this!
Alternatively, perhaps it's worth considering in a future update, adding the
plot=FALSE
option toterm.plot
and having it return the plotted values in the same way thattermplot
does.