pe_pdf: Partial Effect of a term on the response distribution

pe_pdfR Documentation

Partial Effect of a term on the response distribution

Description

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.

Usage

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, ...)      

Arguments

obj, model

A GAMLSS object

term

The model term

terms

The model terms, more than one for pe_pdf_grid().

from

start from

to

end to

y.grid.points

in how many points the pdf should be evaluates

x.grid.points

in how namy points the terms should be plotted

x.values

possible x values

data

The data used for modelling

scale

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

How to fixed the rest of the variables. For continuous oit takes the median fot factor the level with the highest frequency.

scenario

Alternatively scenatio for fixing the values.

size

the size of the pdf line

horizontal

whether to plot the partial pdf on the x-axis and the x on the y-axix or opposite

col.fill

how to fill the pdf body

alpha

the transparency factor

xlim

the limits for plotting x-axis

title

whether to use a different tittle from the default one

maxcol

maximum of colomns in the grid for pe_pdf_grid()

maxrow

maximum of rows on the grid for pe_pdf_grid()

...

extra argument to be passed form pe_pdf() to pe_pdf_grid()

Details

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().

Value

A plot of the conditional distribution given the term

Author(s)

Mikis Stasinopulos, Rober Rigby and Fernanda de Bastiani

References

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/).

See Also

pe_param

Examples

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"))

gamlss.ggplots documentation built on May 29, 2024, 1:34 a.m.