likelihood: Calculates the Log Likelihood

Description Usage Arguments Value Author(s) References Examples

View source: R/weibull4.r

Description

Likelihood is an Internal Function of the Weibull4 Package

Usage

1
likelihood(x, y, param, modes)

Arguments

x

Vector with the x values

y

Vector with the y values

param

Vector with shape, scale, location, area and SD parameters for calculating the log of Likelihood for the weibull4 package

modes

Sets unimodal (modes=1) or bimodal (modes=2) Weibull's distribution

Value

Unitary vector with the sum of the likelihood

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
function (param)
{
    shape <- param[1]
    scale <- param[2]
    loc <- param[3]
    area <- param[4]
    sd <- param[5]
    pred <- weibull4(xi, shape, scale, loc, area)
    singlelikelihoods <- dnorm(yi, mean = pred, sd = sd, log = T)
    sumll <- sum(singlelikelihoods, na.rm = T)
    return(sumll)
  }

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