pat-s / oddsratio

Simplified odds ratio calculation of binomial GAM/GLM models
https://pat-s.github.io/oddsratio
Other
32 stars 2 forks source link

What indicates y-axis for this attached figure? #39

Closed YujiroMatsuishi closed 1 year ago

YujiroMatsuishi commented 4 years ago

I have a question about the "Oddsratio" package in R.

I would like to use that package but I could not understand one part.

What indicates y-axis for this attached figure as you demonstrated? (https://cran.r-project.org/web/packages/oddsratio/vignettes/oddsratio.html) Figure

Can I change the range of y-axis??

Thank you for your contribution for making this great package and I really appreciate for your help.

Respectfully yours.

pat-s commented 4 years ago

plot_gam() plots the smoothing functions of a fitted GAM. The y-axis shows the smoothing value (no unit), the x-axis shows the value range of the predictor.

See also ?mgcv::plot.gam(). I'll try to make this more clear in the documentation.

You can customize everything in the returned plot but I am not sure that this is a good idea.

library(mgcv)
#> Loading required package: nlme
#> This is mgcv 1.8-31. For overview type 'help("mgcv-package")'.
library(oddsratio)
library(ggplot2)
fit_gam <- mgcv::gam(y ~ s(x0) + s(I(x1^2)) + s(x2) + offset(x3) + x4,
                     data = data_gam
)

pl = plot_gam(fit_gam, pred = "x2", title = "Predictor 'x2'")

pl + scale_y_continuous(breaks = seq(-3, 3, 1))

Created on 2020-05-23 by the reprex package (v0.3.0)