plot.reg.hgld: Predict density plot of a Hurdle Generalized Lambda...

Description Usage Arguments Details Value References Examples

View source: R/plot.reg.hgld.R

Description

Predict density plot of a Hurdle Generalized Lambda Regression.

Usage

1
2
3
4
5
## S3 method for class 'reg.hgld'
plot(x, newvalues, name = row.names(newvalues),
  color = NULL, xlab = "Data",
  xlim = c(min(x$NZdata[[all.vars(x$loc.formula)[1]]]),
  max(x$NZdata[[all.vars(x$loc.formula)[1]]])), title = "", ...)

Arguments

x

An object of class reg.hgld.

newvalues

A data frame with the new values of the covariates. Column names must match the ones given in formulas loc.formula and zero.formula.

name

A vector with the names of the new values profiles. Default is the row names of the newvalues data frame.

color

The color of each density curve. Must have one color for each row of newvalues.

xlab

Label of the x-axis.

xlim

A vector with the limits of the x-axis.

title

Legend title.

...

Arguments to be passed to methods.

Details

Given an object of class reg.hgld and new values for the covariates, returns the density function of the fitted HGLD, given the covariates. The contrast on the newvalues data frame must be same of the data used in the reg.hgld object. All density curves are plotted in the same plot.

Value

plot

ggplot density plot for the given new values

References

Marcondes, D.; Peixoto, C.; Maia, A. C.; A Survey of a Hurdle Model for Heavy-Tailed Data Based on the Generalized Lambda Distributions. (2017) arxiv1712.02183

Examples

1
2
3
4
5
6
7
8
set.seed(100)
tmp <- na.omit(healthcare)
data <- tmp[sample(1:nrow(tmp),50),]
formula <- log_expense ~ age + sex + log_previous_expense
reg <- suppressWarnings(reg.hgld(data = data,zero.formula = formula,loc.formula = formula,
                                 full = FALSE,param = "rs"))
newvalues <- tmp[sample(1:nrow(tmp),5),c(2,3,5,8)]
plot(reg,newvalues)

dmarcondes/HGLD documentation built on May 28, 2019, 12:56 p.m.