##### Sections
You are here: Home Maximum likelihood

# Examples - Maximum likelihood

Example: Consider maximum likelihood estimation of the mean of the gamma density.  Example: Consider a model for the growth of fish.

The data set at http://notendur.hi.is/gunnar/kennsla/alsm/data/set121.dat contains measurements of individual fish, collected by the Marine Research Institute (http://www.hafro.is). The data include a column (aldur) containing the age of fish and the column (le) containing the length of the same fish.

The von Bertalanffy growth model can be fitted using the R commands

dat<-read.table("http://notendur.hi.is/~gunnar/kennsla/alsm/data/set121.dat",header=T)
le<-dat$le a<-dat$aldur
fm<-nls(le~Linf*(1-exp(-K*(a-t0))),start=list(t0=0,Linf=80,K=0.25))
summary(fm)


Once the above commands have been issued, the summary command can be used:

> summary(fm)

Formula: le ~ Linf * (1 - exp(-K * (a - t0)))

Parameters:
Estimate Std. Error t value Pr(>|t|)
t0   -0.23160    0.23739  -0.976 0.331683
Linf 91.22292   14.47924   6.300 8.72e-09 ***
K     0.15672    0.04414   3.550 0.000595 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 2.788 on 97 degrees of freedom

Number of iterations to convergence: 3
Achieved convergence tolerance: 6.375e-07


A different test can also be used to investigate whether :

> fmR<-nls(le~Linf*(1-exp(-K*(a))),start=list(Linf=80,K=0.25))
> anova(fm,fmR)
Analysis of Variance Table

Model 1: le ~ Linf * (1 - exp(-K * (a - t0)))
Model 2: le ~ Linf * (1 - exp(-K * (a)))
Res.Df Res.Sum Sq Df Sum Sq F value Pr(>F)
1     97     753.78
2     98     762.33 -1 -8.557  1.1012 0.2966

Note that the F-test and t-test are not the same in the nonlinear case. Both depend on linearity assumptions but in different ways.

Grades may be recorded and used anonymously for research purposes. 