ecp_plot {ecpdist}R Documentation

Plot function

Description

Plots the density, cumulative distribution, hazard, cumulative hazard, survival and quantile functions of the extended Chen-Poisson (ecp) distribution.

Usage

ecp_plot(
  data_type,
  from = NULL,
  to = NULL,
  xlim = NULL,
  ylim = NULL,
  x = NULL,
  lambda,
  gamma,
  phi,
  log = FALSE,
  func_type,
  title,
  col = "black",
  lty = 1
)

Arguments

data_type

specifies whether the input is a x vector of data values or an expression. Possible types are

- 'data' for data values,

- 'expression' for expression.

from

lower x axis limit, by default from = 0.

to

upper x axis limit, by default to = 1.

xlim

x axis limits, by default xlim = c(from, to).

ylim

y axis limits.

x

vector of data values when data_type = "data".

lambda, gamma

parameter values > 0.

phi

parameter value != 0.

log

logical value.

func_type

specifies the type of function to be plotted. Possible types are

- 'density' for density plot,

- 'hazard' for hazard plot,

- 'cumulative hazard' for cumulative hazard plot,

- 'survival' for survival plot,

- 'cumulative distribution' for cumulative distribution plot,

- 'quantile' for quantile plot.

title

title of the graphic.

col

to set the color of the graphic.

lty

to set the line type.

Value

If log = TRUE, numeric value of the logarithm of the function.

If cum_haz = TRUE, numeric value of the cumulative hazard function.

graphic of the chosen ecp function.

Examples


#  Example of plotting cumulative distribution using an expression

ecp_plot(data_type = "expression", from = 0, to = 6, lambda = 2, gamma = 0.3,
phi = 30, func_type = "cumulative distribution",
title = "Cumulative Distribution Function (Expression)")

#  Example of plotting an unimodal hazard function using an expression

ecp_plot(data_type = "expression", lambda = 2, gamma = 0.3, phi = 30,
func_type = "hazard", title = "Hazard Function (Expression)")

#  Example of plotting an unimodal hazard function using data points

x_data <- seq(0.0000001, 1, by=0.0001)
ecp_plot(data_type = "data", x = x_data, lambda = 2, gamma = 0.3, phi = 30,
func_type = "hazard", title = "Hazard Function (Data Points)")


[Package ecpdist version 0.2.1 Index]