Learn R Programming

HelpersMG (version 6.2)

plot.cutter: Plot results of cutter that best describe distribution

Description

Plot the estimates of cut distribution.

Usage

# S3 method for cutter
plot(
  x,
  col.hist = "grey",
  col.DL = "blue",
  col.dist = "black",
  col.unobserved = "green",
  col.mcmc = rgb(red = 0.6, green = 0, blue = 0, alpha = 0.01),
  legend = TRUE,
  show.DL = TRUE,
  show.plot = TRUE,
  set = NULL,
  ...
)

Value

The matrix of all the mcmc curves with invisible state.

Arguments

x

A result file generated by cutter

col.hist

The color of histogram

col.DL

The color of below of above samples

col.dist

The color of distribution

col.unobserved

The color of unobserved states

col.mcmc

The color of mcmc outputs

legend

If TRUE, a legend is shown

show.DL

If TRUE, the limits of DL are shown

show.plot

If FALSE, no plot is shown

set

In case of mixture, will show and return only this set

...

Parameters for plot

Author

Marc Girondot marc.girondot@gmail.com

Details

plot.cutter plot result of cutter

See Also

Other Distributions: cutter(), dSnbinom(), dbeta_new(), dcutter(), dggamma(), logLik.cutter(), print.cutter(), r2norm(), rcutter(), rmnorm(), rnbinom_new()

Examples

Run this code
if (FALSE) {
library(HelpersMG)
# _______________________________________________________________
# right censored distribution with gamma distribution
# _______________________________________________________________
# Detection limit
DL <- 100
# Generate 100 random data from a gamma distribution
obc <- rgamma(100, scale=20, shape=2)
# remove the data below the detection limit
obc[obc>DL] <- +Inf
# search for the parameters the best fit these censored data
result <- cutter(observations=obc, upper_detection_limit=DL, 
                           cut_method="censored")
result
plot(result, xlim=c(0, 150), breaks=seq(from=0, to=150, by=10))
# _______________________________________________________________
# The same data seen as truncated data with gamma distribution
# _______________________________________________________________
obc <- obc[is.finite(obc)]
# search for the parameters the best fit these truncated data
result <- cutter(observations=obc, upper_detection_limit=DL, 
                           cut_method="truncated")
result
plot(result, xlim=c(0, 150), breaks=seq(from=0, to=150, by=10))
# _______________________________________________________________
# left censored distribution with gamma distribution
# _______________________________________________________________
# Detection limit
DL <- 10
# Generate 100 random data from a gamma distribution
obc <- rgamma(100, scale=20, shape=2)
# remove the data below the detection limit
obc[obcUDL] <- +Inf
# search for the parameters the best fit these censored data
result <- cutter(observations=obc, lower_detection_limit=LDL, 
                           upper_detection_limit=UDL, 
                          cut_method="censored")
result
plot(result, xlim=c(0, 150), col.DL=c("black", "grey"), 
                             col.unobserved=c("green", "blue"), 
     breaks=seq(from=0, to=150, by=10))
# _______________________________________________________________
# Example with two values for lower detection limits
# corresponding at two different methods of detection for example
# with gamma distribution
# _______________________________________________________________
obc <- rgamma(50, scale=20, shape=2)
# Detection limit for sample 1 to 50
LDL1 <- 10
# remove the data below the detection limit
obc[obc

Run the code above in your browser using DataLab