lnorms                package:popbio                R Documentation

_G_e_n_e_r_a_t_e _r_a_n_d_o_m _l_o_g_n_o_r_m_a_l _v_a_l_u_e_s _f_o_r _f_e_r_t_i_l_i_t_y _r_a_t_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     Converts standard normal random values to lognormals with defined
     means and variances

_U_s_a_g_e:

     lnorms(means, vars, rawelems)

_A_r_g_u_m_e_n_t_s:

   means: mean value of the fertility rate

    vars: variance of the vital rate (not standard deviation)

rawelems: a vector of one or more normal random values

_V_a_l_u_e:

     A vector of random lognormal values.

_N_o_t_e:

     This function could probably be replaced with built-in functions
     for the Log Normal Distribution 'rlnorm '

_A_u_t_h_o_r(_s):

     Original Matlab code by Morris and Doak (2002: 281). Adapted to R
     by Patrick Nantel, 20 June 2005.

_S_o_u_r_c_e:

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

_R_e_f_e_r_e_n_c_e_s:

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

_S_e_e _A_l_s_o:

     'stretchbetaval '

_E_x_a_m_p_l_e_s:

     lnorms(3,1.5,rnorm(1)) 
      # Generate lognormal random fertilities
      # for a population of 1000 mature individuals (Ni) with mean fertility (f) of
      # 3 and inter-individual variance in fertility (varF) of 1.5.
      Ni   <- 1000
      f    <-  3
      varF <-  1.5
      rndfert  <- lnorms(f,varF,rnorm(Ni,0,1))

      hist(rndfert,40, main="Lognormal random fertilities", 
     xlab="Fertility rate", col="blue")

     ## or using rlnorm in stats
     # hist(rlnorm(1000, log(3), log(1.5)), 40, xlim=c(0,10), col="blue")

      

