Hi Lydia,

This kind of problem happens sometimes though it's not clear why. One possibility is that the Pagel model is not appropriate for your data. One thing you can do is to estimate lambda by repeatedly fitting models with fixed = TRUE for different values of lambda between 0 and 1, and select the value with the largest logLik (or equivalently smallest AIC). If you find a value of lambda close to 0 or close to 1, this would suggest that the Pagel model may not be ideal.

One point to be careful is that this procedure does not include lambda as a free parameter. For instance, with some simulated data:

R> AIC(gls(y ~ x, correlation=corPagel(phy=tr)))
[1] 56.33383

This gives ^lambda=0.1521213 which can be used as fixed in corPagel:

R> AIC(gls(y ~ x, correlation=corPagel(0.1521213, phy=tr, fixed=TRUE)))
[1] 54.33383

But if this value is found as suggested above, it must be considered as a free parameter and the last AIC value but increased by 2. This could be important if you compare this model with others using AIC.

HTH

Best,

Emmanuel

Le 26/06/2017 à 16:45, Lydia  a écrit :
Hello everyone,

I have problems estimating lambda using the gls function in R.

The gls function works perfectly fine when I am running it with a fixed value of lambda (ie. fixed=TRUE) but when I am trying to estimate lambda and incorporate this estimation of lambda into my analysis, ie. :

>result = gls(traitY ~ traitX, data=DF, correlation=corPagel(value=1, tree_list[[1]], fixed=FALSE), method="ML")

I always get the following error message :

 >Error in eigen(val, only.values = TRUE) :

 >infinite or missing values in 'x'

My question is : How can this be solved

I would be really thankful for any kind of suggestion/help since I can ‘t continue my analysis without solving this particular problem (it is really important to get the estimted lambda for my statistical interpretation) and have been stuck for quite a while and haven’ t found anything useful on the net.

PS.

I am using the libraries : nlme and ape

My dataframe is the following :

                          traitY traitX
Alouatta_palliata 0.5273489 0.6250000
Ateles_geoffroyi 0.5051398 0.4380000
Cebus_capucinus 0.2895715 0.5036667
Saimiri_sciureus 0.3591358 0.6590000
Cebus_apella 0.6884629 0.5572500
Cercopithecus_diana 0.5714286 0.9050000
Chlorocebus_pygerythrus 0.7604781 0.7246667
Erythrocebus_patas 0.0000000 1.0000000
Macaca_arctoides 0.4155720 0.5895000
Macaca_fuscata 0.6594206 0.5563333
Macaca_mulatta 0.6614815 0.8275000
Macaca_nigra 0.6416667 0.8170000
Macaca_radiata 0.7331135 0.6910000
Macaca_tonkeana 0.4991048 0.8932500
Papio_ursinus 0.7044067 0.6570000
Homo_sapiens 0.5037506 0.5320000
Pan_paniscus 0.6000000 0.9000000
Pan_troglodytes_troglodytes 0.1771352 0.8856364
Pongo_pygmaeus 0.5000000 0.6000000
Eulemur_fulvus_fulvus 0.7662338 0.8730000
Eulemur_fulvus_rufus 0.7334606 0.5475000

Thanks in advance,

Lydia


Pour nous remonter une erreur de filtrage, veuillez vous rendre ici <http://f.security-mail.net/3029u8bnc3q>




_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/


Pour nous remonter une erreur de filtrage, veuillez vous rendre ici : 
http://f.security-mail.net/3029u8bnc3q


_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Reply via email to