TreeMig Code
Loading...
Searching...
No Matches
DrawFromDistri.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine drawfromdistri (n, p, ix)
 DrawFromDistri

 
subroutine drawfrompoissondist (mu, x, randomvalue)
 DrawFromPoissonDist

 
subroutine drawfrombinomdist (n, p, x, randomvalue)
 DrawFromBinomDist

 
subroutine drawfromnormaldist (mu, s, rx, randomvalue)
 DrawFromNormalDist

 

Function/Subroutine Documentation

◆ drawfrombinomdist()

subroutine drawfrombinomdist ( integer, intent(in) n,
real, intent(in) p,
integer, intent(out) x,
real, intent(in) randomvalue )

DrawFromBinomDist


Samples from a binomial distribution.

  • binomial distribution density: (n!/(i!(n-i)!)) * p**i (1-p)**(n-i).
  • it is solved iteratively.

IN:

  • Parameters
    n: sample size
    p: probability
    randomvalue: random value

OUT:

  • Parameters
    x: drawn value

CALLS:

  • RANDOM_NUMBER from FORTRAN

CALLED FROM:!> - DrawFromDistri in Interact.f90

Definition at line 160 of file DrawFromDistri.f90.

◆ drawfromdistri()

subroutine drawfromdistri ( integer, intent(in) n,
real, intent(in) p,
integer, intent(out) ix )

DrawFromDistri


samples from a binomial distribution

  1. for large sample sizes n, the binomial distribution is approximated by
    1. a Poisson distribution, if small probability
    2. a normal distribution, if larger probability
  2. otherwise the binomial distribution is explicitly calculated

USE: All_par

Definition at line 50 of file DrawFromDistri.f90.

◆ drawfromnormaldist()

subroutine drawfromnormaldist ( real, intent(in) mu,
real, intent(in) s,
real, intent(out) rx,
real, intent(in) randomvalue )

DrawFromNormalDist


Samples from a normal distribution

  1. uses a pre-stored array of the standard normal distribution
  2. gets the value of the standard normal distribution by interpolating from this array
  3. then transforms with the given mean and standard deviation
  • IN:
    • Parameters
      mu: mean
      s: standard deviation
      randomvalue: random value
  • OUT:
    • Parameters
      rx: drawn value
  • CALLS:
    • RANDOM_NUMBER from FORTRAN
  • CALLED FROM:!> - DrawFromDistri in Interact.f90

Definition at line 214 of file DrawFromDistri.f90.

◆ drawfrompoissondist()

subroutine drawfrompoissondist ( real, intent(in) mu,
integer, intent(out) x,
real, intent(in) randomvalue )

DrawFromPoissonDist


Samples from a poisson distribution

  • density function: P(i,mu)= exp(-mu) * (mu^i)/i!
  • solved iteratively

IN:

  • Parameters
    mu: mean
    randomvalue: random value

OUT:

  • Parameters
    x: drawn value

CALLS:

  • RANDOM_NUMBER from FORTRAN

CALLED FROM:

Definition at line 110 of file DrawFromDistri.f90.