stretchbetaval: Generate stretched beta-distributed random numbers

Description Usage Arguments Details Value Author(s) Source References See Also Examples

View source: R/stretchbetaval.R

Description

Generate a stretched beta number with mean, standard deviation, minimum and maximum values and CDF value for bounded fertility estimates

Usage

1
stretchbetaval(mn, std, minb, maxb, fx)

Arguments

mn

mean of a fertility rate

std

standard deviation

minb

minimum value

maxb

maximum value

fx

Cumulative Distribution Function value

Details

This function calls function 'betaval'.

Value

Returns a stretched beta number with mean mn, standard deviation std, minimum and maximum values (minb, maxb) and CDF value fx.

Author(s)

Original MATLAB script by Morris & Doak (2002: 283). Adapted to R by Patrick Nantel, 11 July 2005.

Source

converted Matlab code from Box 8.5 in Morris and Doak (2002)

References

Morris, W. F., and D. F. Doak. 2002. Quantitative conservation biology: Theory and practice of population viability analysis. Sinauer, Sunderland, Massachusetts, USA.

See Also

betaval

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
stretchbetaval(3, 1.2, 1, 20, runif(1))

 # Generates stretchbeta random
 # fertilities for a population of 1000 mature individuals (Ni) with mean
 # fertility (f) of 3.0 and inter-individual variance in fertility (varF) of 1.5.
 
 Ni   <- 1000
 f    <-    2.5
 varF <-    1
 fmin <- 1
 fmax <- 5
 rndfert<-numeric(Ni) 
for(i in 1:Ni)
{
   rndfert[i]  <- stretchbetaval(f, sqrt(varF), fmin, fmax, runif(1)) 
}
 hist(rndfert,20, main="Stretched beta-distributed random fertilities", 
xlab="Fertility rate", , col="blue") 

Example output

[1] 2.796544

popbio documentation built on May 4, 2018, 1:04 a.m.