sample.h1: Generate random deviates from hurdle models

sample.h1R Documentation

Generate random deviates from hurdle models

Description

Generate random deviates from hurdle Poisson, geometric, negative binomial, beta binomial, beta negative binomial, normal, log normal, half normal, and exponential models.

Usage

sample.h1(N,phi,dist="poisson",lambda=NA,r=NA,p=NA,
alpha1=NA,alpha2=NA,n=NA,mean=NA,sigma=NA)

Arguments

N

The sample size. Should be a positive number. If it is not an integer, N will be automatically rounded up to the smallest integer that no less than N.

phi

The structural parameter φ, should be a positive value within (0,1).

dist

The corresponding standard distribution. Can be one of 'poisson', 'geometric','nb','bb', 'bnb','normal', 'lognormal', 'halfnormal','exponential', which corresponds to Poisson, geometric, negative binomial, beta binomial, beta negative binomial, normal, log normal, hal fnormal, and exponential distributions respectively.

lambda

A value for the parameter of Poisson distribution. Should be a positive number.

r

the number of success before which m failures are observed, where m is a random variable from negative binomial or beta negative binomial distribution. Must be a positive number. If it is not an integer, r will be automatically rounded up to the smallest integer that no less than r.

p

The probability of success, should be a positive value within (0,1).

alpha1

The first shape parameter of beta distribution. Should be a positive number.

alpha2

The second shape parameter of beta distribution. Should be a positive number.

n

The number of trials. Must be a positive number. If it is not an integer, n will be automatically rounded up to the smallest integer that no less than n.

mean

A value for parameter of the mean or expectation.

sigma

A value of parameter for standard deviation. Must be a positive real number.

Details

  • Setting dist=poisson and lambda, sample.h1 simulates N random deviates from hurdle Poisson distribution, respectively, and so on forth.

  • Setting the dist=geometric and the argument p is for the use of hurdle geometric distributions.

  • ASetting the dist=nb and the arguments r and p are for the use of and hurdle negative binomial distributions.

  • Setting the dist=bb and the arguments n, alpha1, and alpha2 are for and hurdle beta binomial distributions.

  • Setting the dist=bnb and the arguments r, alpha1, and alpha2 are used in hurdle beta negative binomial distributions.

  • Setting the dist=normal and the arguments mean and sigma are used in and hurdle normal distributions.

  • Setting the dist=lognormal and the arguments mean and sigma are used in and hurdle log normal distributions.

  • Setting the dist=halfnormal and the argument sigma is used in and hurdle half normal distributions.

  • Setting the dist=exponential and the argument lambda is used in and hurdle exponential distributions.

Random deviates from standard Poisson, geometric, negative binomial, normal, log normal, and exponential distributions can be generated by basic R function rpois, rgeom, rnbinom, rnorm, rlnorm, and rexp in R package stats.

Functions rbbinom and rbnbinom, and rhnorm are available for standard beta binomial, beta negative binomial, and half normal distributions in R package extraDistr.

Value

A vector of length N containing non-negative integers from the hurdle version of distribution determined by dist.

References

  • H. Aldirawi, J. Yang, A. A. Metwally, Identifying Appropriate Probabilistic Models for Sparse Discrete Omics Data, accepted for publication in 2019 IEEE EMBS International Conference on Biomedical & Health Informatics (BHI) (2019).

  • T. Wolodzko, extraDistr: Additional Univariate and Multivariate Distributions, R package version 1.8.11 (2019), https://CRAN.R-project.org/package=extraDistr.

Examples

x6=sample.h1(2000,phi=0.3,dist='nb',r=10,p=0.3)              #hurdle negative binomial
x7=sample.h1(2000,phi=0.3,dist='bnb',r=5,alpha=3,alpha2=3)   #hurdle beta negative binomial
x8=sample.h1(2000,phi=0.3,dist="halfnormal",sigma=4)         #hurdle half normal
x9=sample.h1(2000,phi=0.3,dist="lognormal",mean=1,sigma=4)   #hurdle log normal

AZIAD documentation built on Aug. 14, 2022, 9:05 a.m.

Related to sample.h1 in AZIAD...