View source: R/pe_param_with_data_1.R
pe_param | R Documentation |
The function pe_param()
is similar to the function getPEF()
of the gamlss package. It plot the partial effect that a particular term has one of the parameters of the distribution or its predictor eta
.
The function pe2_param()
is build for partial effects from two terms and it is suitable to display first order interactions.
pe_param(obj = NULL, term = NULL, data = NULL, n.points = 100,
parameter = c("mu", "sigma", "nu", "tau"),
type = c("parameter", "eta"), scenario = list(),
how = c("median", "last", "fixed"),
col = "darkblue", size = 1.3, name.obj = NULL,
rug.plot = TRUE, rug.col = "gray", rug.size = 0.5,
data.plot = FALSE, data.col = "lightblue",
data.size = 0.1, factor.size = 15,
data.alpha = 0.9, bins = 30,
filled = FALSE, ylim = NULL,
title)
pe_1_param(obj = NULL, term = NULL, data = NULL, n.points = 100,
parameter = c("mu", "sigma", "nu", "tau"),
type = c("parameter", "eta"),
how = c("median", "last", "fixed"),
scale.from = c("mean", "median", "none"),
scenario = list(), col = "darkblue", size = 1.3,
name.obj = NULL, data.plot = FALSE,
data.col = "lightblue",data.size = 0.1,
data.alpha = 0.9, rug.plot = TRUE, rug.col = "gray",
rug.size = 0.5, factor.size = 15,
ylim = NULL, title)
pe_2_param(obj = NULL, terms = NULL, data = NULL, n.points = 100,
parameter = c("mu", "sigma", "nu", "tau"),
type = c("parameter", "eta"),
how = c("median", "last", "fixed"),
scenario = list(), col = "darkblue",
size = 1.3, data.plot = TRUE,
data.col = "lightblue", data.size = 0.1,
data.alpha = 0.9,bins = 30,
filled = FALSE, name.obj = NULL, title)
pe_param_grid(model, terms, maxcol = 2, maxrow = 3, ylim=NULL, ...)
obj |
a GAMLSS fitted object |
model |
a GAMLSS fitted model |
term |
the model term we want to investigate can be one i.e. "Fl" or two c("Fl", "A") |
terms |
a list of model terms for example
|
data |
the data frame used otherwise it takes it from the fitted model |
n.points |
the number of points for the evaluation of the term |
parameter |
the distribution parameter in which the term is fitted |
type |
here you specify or the distribution parameter i.e |
how |
how to set all the other terms in the model |
scenario |
this can be a list of values for the rest of the terms in the model for the distribution parameter |
plot |
whether to plot the result |
col |
the colour of the partial effect of the term |
size |
the size of the line of partial effect of the term |
bins |
the number of binds for the contour plot |
filled |
whether to display the values in the contour |
title |
the title if different from the default |
name.obj |
this is a way to pass the name of the object |
maxcol |
the maximum columns in the grid plot |
maxrow |
the maximum rowss in the grid plot |
data.plot |
whether to plot the data |
rug.plot |
whether to print the rug bellow the figure |
rug.size |
the size of the rug |
rug.col |
the colour of the rug |
data.col |
the color of the data points |
data.size |
the size of the data points |
data.alpha |
the trnsparance constant of the data points |
factor.size |
the size of the symbol if a factor is plotted |
ylim |
if a common y limit is required |
scale.from |
whethet to substact from the mean the median or from zero |
... |
for passing argument from the function |
The functions pe_param()
and pe_param_grid()
can be used to help the use the interpretation of a GAMLSS model.
The functions pe_param()
provides the partial effect of one or two terms of a specified parameter of the distribution while the rest of the terms in the model are set on specific values or scenarios. The function pe_param()
calls pe_1param()
if the argument terms is one i.e. "Fl" or the function
pe_2param()
if the terms are two i.e. c("Fl"","A").
The pe_param_grid()
plots multiple plots specified by the list used in the term
argument.
Similar functions are
pe_quantile()
and pe_moment()
.
It is plotting the partial effect or is producing the resulting function
Mikis Stasinopulos, Rober Rigby and Fernanda de Bastiani
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale and shape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
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/).
getPEF
m1 <- gamlss(R~pb(Fl)+pb(A)+loc+H, data=rent, gamily=GA)
pe_param(m1, "A")
pe_param(m1, c("Fl","A"), filled=TRUE)
pe_param_grid(m1, list(c("Fl","A"), c("H","loc")), filled=TRUE)
# the terms are additive no interaction
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.