Learn R Programming

weibull4 (version 1.0.0)

likelihood: Calculates the Log Likelihood

Description

Likelihood is an Internal Function of the Weibull4 Package

Usage

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

References

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

Examples

Run this code
# NOT RUN {
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)
  }
# }

Run the code above in your browser using DataLab