# wbllike

Weibull negative log-likelihood

## Syntax

```nlogL = wbllike(params,data) [logL,AVAR] = wbllike(params,data) [...] = wbllike(params,data,censoring) [...] = wbllike(params,data,censoring,freq) ```

## Description

`nlogL = wbllike(params,data)` returns the Weibull log-likelihood. `params(1)` is the scale parameter, `A`, and `params(2)` is the shape parameter, `B`.

`[logL,AVAR] = wbllike(params,data)` also returns `AVAR`, which is the asymptotic variance-covariance matrix of the parameter estimates if the values in `params` are the maximum likelihood estimates. `AVAR` is the inverse of Fisher's information matrix. The diagonal elements of `AVAR` are the asymptotic variances of their respective parameters.

`[...] = wbllike(params,data,censoring)` accepts a Boolean vector, `censoring`, of the same size as `data`, which is 1 for observations that are right-censored and 0 for observations that are observed exactly.

`[...] = wbllike(params,data,censoring,freq)` accepts a frequency vector, `freq`, of the same size as `data`. `freq` typically contains integer frequencies for the corresponding elements in `data`, but can contain any nonnegative values. Pass in `[]` for `censoring` to use its default value.

The Weibull negative log-likelihood for uncensored data is

`$\left(-\mathrm{log}L\right)=-\mathrm{log}\prod _{i=1}f\left(a,b|{x}_{i}\right)=-\sum _{i=1}^{n}\mathrm{log}f\left(a,b|{x}_{i}\right)$`

where f is the Weibull pdf.

`wbllike` is a utility function for maximum likelihood estimation.

## Examples

This example continues the example from `wblfit`.

```r = wblrnd(0.5,0.8,100,1); [logL, AVAR] = wbllike(wblfit(r),r) logL = 47.3349 AVAR = 0.0048 0.0014 0.0014 0.0040```

## References

[1] Patel, J. K., C. H. Kapadia, and D. B. Owen. Handbook of Statistical Distributions. New York: Marcel Dekker, 1976.