pcr_coef_path {gamlss.ggplots} | R Documentation |
Plotting the fitted path of a PCR model.
Description
This function is similar to the function plot.PCR()
which is used to plot the path of a fitted principal componet regression model, fitted using the function fitPCR()
of the package gamlss.foreach.
Usage
pcr_coef_path(x, legend=FALSE, plot=TRUE)
pcr_path(x, parameter = c("mu", "sigma", "nu", "tau"),
legend = FALSE, plot = TRUE)
Arguments
x |
a fitted PCR object (or a fitted GAMLSS object for function |
legend |
whether legent is needed |
plot |
whether to plot the path |
parameter |
which GAMLSS parameter, between "mu", "sigma", "nu", "tau" |
Value
A gg-plot.
Author(s)
Mikis Stasinopoulos, Bob Rigby and Fernanda De Bastiani
References
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/).
See Also
Examples
library(gamlss.foreach)
library(glmnet)
library(ggplot2)
data(QuickStartExample)
attach(QuickStartExample)
hist(y, main="(a)")
if (is.null(rownames(x)))
colnames(x) <- paste0("X", seq(1:dim(x)[2]))
# fitting
MM<- fitPCR(x,y, k=log(100))
pp<-pcr_coef_path(MM)
pp+ ggplot2::geom_vline(xintercept = MM$pc, colour = "gray")
# using gamlss
m1 <- gamlss(y~pcr(x=x))
pcr_path(m1)