Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracting values used in term.plot #6

Open
Cole-Monnahan-NOAA opened this issue Feb 27, 2024 · 0 comments
Open

Extracting values used in term.plot #6

Cole-Monnahan-NOAA opened this issue Feb 27, 2024 · 0 comments

Comments

@Cole-Monnahan-NOAA
Copy link

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.

image

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant