vb_bind_nll: Negative log-likelihood for potentially constrained von...

Description Usage Arguments Value Examples

View source: R/vb_bind_nll.R

Description

vb_bind_nll returns the negative log-likelihood for the von Bertalanffy model. Equality constraints across sexes can be implemented for any combination of parameters using the binding argument.

Usage

1
vb_bind_nll(theta, binding, data, distribution)

Arguments

theta

A parameter vector of the same length as the maximum of binding. Unconstrained parameters take the order: lnlinfF, lnlinfM, lnkF, lnkM, lnnt0F, lnnt0M, lnsigmaF, lnsigmaM.

binding

A (4x2) parameter index matrix with rows named (in order): "lnlinf", "lnk", "lnnt0", "lnsigma" and the left column for the female parameter index and right column for male parameter index. Used to impose arbitrary equality constraints across the sexes (see Examples).

data

data.frame with columns: "age", "length" and "weights". "weights" are set to 1 or 0 for known females or males, respectively; proportions otherwise.

distribution

Character with options: "normal" or "lognormal"

Value

Complete data negative log-likelihood:

Examples

1
2
3
4
5
6
7
8
9
## Unconstrained model 
binding <- matrix(c(1:8), ncol = 2, byrow = TRUE)
rownames(binding) <- c("lnlinf", "lnk", "lnnt0", "lnsigma")
colnames(binding) <- c("female", "male")
## starting values 
start.par <- c(rep(log(25), 2), rep(log(0.2), 2), rep(log(3), 2), rep(log(1), 2))
vb_bind_nll(theta = start.par, binding = binding,
            data = data.frame(age = rep(1, 2), length = rep(10, 2), weights = c(1, 0)),
            distribution = "normal")

lhmixr documentation built on May 2, 2019, 11:05 a.m.

Related to vb_bind_nll in lhmixr...