# Likelihood Ratio Test

### Description

This function compares the fit of two nested models of trait evolution with a loglikelihood-ratio statistic.

### Usage

1 |

### Arguments

`model1` |
The most parameterized model. A fitted object from an mvMORPH model. |

`model2` |
The second model under comparison (fitted object). |

`echo` |
Whether to return the result or not. |

### Details

The LRT function extracts the log-likelihood of two nested models to compute the loglikelihood-ratio statistic which is compared to a Chi-square distribution. Note that if the models are not nested, the LRT is not an appropriate test and you should rely instead on Information criteria, evidence ratios, or simulated distributions (e.g., Lewis et al. 2011).

### Value

`pval ` |
The p-value of the LRT test (comparison with Chi-square distribution). |

`ratio ` |
The LRT (Loglikelihood-ratio test) statistic. |

`ddf ` |
The number of degrees of freedom between the two models. |

`model1 ` |
Name of the first model. |

`model2 ` |
Name of the second model. |

### Author(s)

Julien Clavel

### References

Neyman J., Pearson E.S. 1933. On the problem of the most efficient tests of statistical hypotheses. Philos. Trans. R. Soc. A. 231:289-337.

Lewis F., Butler A., Gilbert L. 2011. A unified approach to model selection using the likelihood ratio test. Meth. Ecol. Evol. 2:155-162.

### See Also

`mvMORPH`

`mvOU`

`mvEB`

`mvBM`

`mvSHIFT`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ```
## Simulated dataset
set.seed(14)
# Generating a random tree
tree<-pbtree(n=50)
# Setting the regime states of tip species
sta<-as.vector(c(rep("Forest",20),rep("Savannah",30))); names(sta)<-tree$tip.label
# Making the simmap tree with mapped states
tree<-make.simmap(tree,sta , model="ER", nsim=1)
col<-c("blue","orange"); names(col)<-c("Forest","Savannah")
# Plot of the phylogeny for illustration
plotSimmap(tree,col,fsize=0.6,node.numbers=FALSE,lwd=3, pts=FALSE)
# Simulate two correlated traits evolving along the phylogeny
traits<-mvSIM(tree,nsim=1, model="BMM", param=list(sigma=list(matrix(c(2,1,1,1.5),2,2),
matrix(c(4,1,1,4),2,2)), ntraits=2, names_traits=c("head.size","mouth.size")))
# Fit of model 1
mod1<-mvBM(tree,traits,model="BMM")
# Fit of model 2
mod2<-mvBM(tree,traits,model="BM1")
# comparing the fit using LRT...
LRT(mod1,mod2)
``` |