The function pe_pdf()
plots the partial effect that a specified term has on the distribution of the response.
The function pe_pdf_grid()
plot multiple plots on the same page.
pe_pdf(obj = NULL, term = NULL, from = NULL, to = NULL,
y.grid.points = 100, x.grid.points = 10, x.values,
data = NULL, scale = NULL, how = c("median", "last"),
scenario = list(), size = 0.1, horizontal = TRUE,
col.fill = hcl.colors(lqq, palette = "viridis"),
alpha = 0.6, xlim = NULL, title)
pe_pdf_grid(model, terms, maxcol = 2, maxrow = 3, ...)
A plot of the conditional distribution given the term
A GAMLSS object
The model term
The model terms, more than one for pe_pdf_grid()
.
start from
end to
in how many points the pdf should be evaluates
in how namy points the terms should be plotted
possible x values
The data used for modelling
This is a very importnat value for plotting correctly the fitted distrutions. If the defaul values it is not working please try different values
How to fixed the rest of the variables. For continuous oit takes the median fot factor the level with the highest frequency.
Alternatively scenatio for fixing the values.
the size of the pdf line
whether to plot the partial pdf on the x-axis and the x on the y-axix or opposite
how to fill the pdf body
the transparency factor
the limits for plotting x-axis
whether to use a different tittle from the default one
maximum of colomns in the grid for pe_pdf_grid()
maximum of rows on the grid for pe_pdf_grid()
extra argument to be passed form pe_pdf()
to pe_pdf_grid()
Mikis Stasinopulos, Rober Rigby and Fernanda de Bastiani
The function pe_pdf()
is one of the function design to help the use to interpret the GAMLSS model. Provides the partial effect that one of the continuous terms has on distribution of the response while the rest of the variables in the model are set on specific values or scenarios. Others similar functions are
pe_param()
, pe_moment()
and pe_quantile()
.
Rigby, R. A., Stasinopoulos, D. M., Heller, G. Z., and De Bastiani, F. (2019) Distributions for modeling location, scale, and shape: Using GAMLSS in R, Chapman and Hall/CRC. An older version can be found in https://www.gamlss.com/.
Stasinopoulos D. M. Rigby R.A. (2007) Generalized additive models for location scale and shape (GAMLSS) in R. Journal of Statistical Software, Vol. 23, Issue 7, Dec 2007, https://www.jstatsoft.org/v23/i07/.
Stasinopoulos D. M., Rigby R.A., Heller G., Voudouris V., and De Bastiani F., (2017) Flexible Regression and Smoothing: Using GAMLSS in R, Chapman and Hall/CRC.
Stasinopoulos, M.D., Kneib, T., Klein, N., Mayr, A. and Heller, G.Z., (2024). Generalized Additive Models for Location, Scale and Shape: A Distributional Regression Approach, with Applications (Vol. 56). Cambridge University Press.
(see also https://www.gamlss.com/).
pe_param
m1 <- gamlss(R~pb(Fl)+pb(A)+loc+H, data=rent, gamily=GA)
pe_pdf(m1, "A")
pe_pdf(m1, "A")
pe_pdf(m1, "A", horizontal=FALSE)
pe_pdf_grid(m1, c("Fl", "A", "H", "loc"))
Run the code above in your browser using DataLab