prior: Calculates the Prior Distribution for Metropolis-MCMC

Description Usage Arguments Value Author(s) References Examples

View source: R/weibull4.r

Description

This is an internal function of the Weibull4 package

Usage

1
prior(param)

Arguments

param

A vector with shape, scale, location, area and SD parameters

Value

A vector with prior distribution for Metropolis-MCMC

Author(s)

Florian Hartig - Theoretical Ecology

References

https://theoreticalecology.wordpress.com/2010/09/17/metropolis-hastings-mcmc-in-r/

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
function (param)
{
    shape <- param[1]
    scale <- param[2]
    loc <- param[3]
    area <- param[4]
    sd <- param[5]
    shapeprior <- dunif(shape, min = 1, max = 5, log = T)
    scaleprior <- dnorm(scale, sd = scale/2, log = T)
    locprior <- dunif(loc, min = 1, max = loc * 2, log = T)
    areaprior <- dunif(area, min = area/2, max = area * 2, log = T)
    sdprior <- dunif(sd, min = 1, max = sd * 2, log = T)
    return(shapeprior + scaleprior + locprior + areaprior + sdprior)
  }

weibull4 documentation built on Jan. 26, 2021, 1:06 a.m.

Related to prior in weibull4...