# reconstruct

##### Continuous Ancestral Character Estimation

This function estimates ancestral character states, and the associated uncertainty, for continuous characters. It mainly works as the ace function, from which it differs, first, in the fact that computations are not performed by numerical optimisation but through matrix calculus. Second, besides classical Brownian-based reconstruction methods, it reconstructs ancestral states under Arithmetic Brownian Motion (ABM, i.e. Brownian with linear trend) and Ornstein-Uhlenbeck process (OU, i.e. Brownian with an attractive optimum).

- Keywords
- models

##### Usage

`reconstruct(x, phyInit, method = "ML", alpha = NULL, CI = TRUE)`

##### Arguments

- x
a numerical vector.

- phyInit
an object of class

`"phylo"`

.- method
a character specifying the method used for estimation. Six choices are possible:

`"ML"`

,`"REML"`

,`"GLS"`

,`"GLS_ABM"`

,`"GLS_OU"`

or`"GLS_OUS"`

.- alpha
a numerical value which accounts for the attractive strength parameter of

`"GLS_OU"`

or`"GLS_OUS"`

(used only in these cases). If alpha = NULL (the default), then it is estimated by maximum likelihood using`optim`

which may lead to convergence issue.- CI
a logical specifying whether to return the 95% confidence intervals of the ancestral state estimates.

##### Details

For `"ML"`

, `"REML"`

and `"GLS"`

, the default model is
Brownian motion. This model can be fitted by maximum likelihood
(`method = "ML"`

, Felsenstein 1973, Schluter et al. 1997) - the
default, residual maximum likelihood (`method = "REML"`

), or
generalized least squares (`method = "GLS"`

, Martins and Hansen
1997, Garland T and Ives AR 2000).

`"GLS_ABM"`

is based on Brownian motion with trend model. Both
`"GLS_OU"`

and `"GLS_OUS"`

are based on Ornstein-Uhlenbeck
model.

`"GLS_OU"`

and `"GLS_OUS"`

differs in the fact that
`"GLS_OUS"`

assume that the process starts from the optimum,
while the root state has to be estimated for `"GLS_OU"`

, which
may rise some issues (see Royer-Carenzi and Didier, 2016). Users may
provide the attractive strength parameter `alpha`

, for these two
models.

`"GLS_ABM"`

, `"GLS_OU"`

and `"GLS_OUS"`

are all fitted
by generalized least squares (Royer-Carenzi and Didier, 2016).

##### Value

an object of class `"ace"`

with the following elements:

the estimates of the ancestral character values.

the estimated 95% confidence intervals.

if `method = "ML"`

, the maximum likelihood estimate
of the Brownian parameter.

if `method = "ML"`

, the maximum log-likelihood.

##### Note

`GLS_ABM`

should not be used on ultrametric tree.

`GLS_OU`

may lead to aberrant reconstructions.

##### References

Felsenstein, J. (1973) Maximum likelihood estimation of evolutionary
trees from continuous characters. *American Journal of Human
Genetics*, **25**, 471--492.

Garland T. and Ives A.R. (2000) Using the past to predict the present:
confidence intervals for regression equations in phylogenetic
comparative methods. *American Naturalist*, **155**,
346--364.

Martins, E. P. and Hansen, T. F. (1997) Phylogenies and the
comparative method: a general approach to incorporating phylogenetic
information into the analysis of interspecific data. *American
Naturalist*, **149**, 646--667.

Royer-Carenzi, M. and Didier, G. (2016) A comparison of ancestral
state reconstruction methods for quantitative
characters. *Journal of Theoretical Biology*, **404**,
126--142.

Schluter, D., Price, T., Mooers, A. O. and Ludwig, D. (1997)
Likelihood of ancestor states in adaptive radiation. *Evolution*,
**51**, 1699--1711.

Yang, Z. (2006) *Computational Molecular Evolution*. Oxford:
Oxford University Press.

##### See Also

Reconstruction of ancestral sequences can be done with the package
phangorn (see function `?ancestral.pml`

).

##### Examples

```
# NOT RUN {
### Some random data...
data(bird.orders)
x <- rnorm(23, m=100)
### Reconstruct ancestral quantitative characters:
reconstruct(x, bird.orders)
reconstruct(x, bird.orders, method = "GLS_OUS", alpha=NULL)
# }
```

*Documentation reproduced from package ape, version 5.3, License: GPL (>= 2)*