[R] Problems running a PGLS model with phylogenetic uncertainty

David Winsemius dw|n@em|u@ @end|ng |rom comc@@t@net
Sun Jun 17 07:27:01 CEST 2018


> On Jun 16, 2018, at 1:37 PM, Hannah van Noort <hannahvnoort using gmail.com> wrote:
> 
> Hi everyone,
> 
> I'm having trouble running a PGLS model with the package "AICmodavg".

Did you mean "AICmodavg"?


> I
> continuously get the error of false convergence with certain Lambda
> values (even
> when trying to run the model with different Lambda values) and for other La
> mbda values I run into "error in eigen(val) : infinite or missing values in
> 'X' ". I've tried several optimizers and removing some outlier values but
> the same errors keep on popping up.. Does anyone know how to solve this
> problem?
> Below a part of my script with the specific dependent and independent varia
> bles and I've also attached files with the relevant data and phylogenetic
> tree information.

d <- read.table("~/Seabirddat_growth.txt", head=TRUE)
library(AICmodavg)
Error in library(AICmodavg) : there is no package called ‘AICmodavg’
library(AICcmodavg)
> 
> Cand.models = list()
> niter = 100
> for (i in 1:niter) {
>  Cand.models[[i]] = gls(Maxgrowthrate ~ log.Forrang+log.Weight_av),

A syntax error is thrown here -------------------------------------^  #removed paren
> data =
> d, method= "ML", na.action=na.omit

And here ---------------------------^
>                         correlation = corPagel(value=0.4, trees[[i]]))

And after fixing these errors I get the error that `gls` is not found (even after adding `library(AICcmodavg)`

 could not find function "gls"
> ?corPagel
No documentation for ‘corPagel’ in specified packages and libraries:
you could try ‘??corPagel’
> ??gls
> library(nlme)

Attaching package: ‘nlme’

The following object is masked from ‘package:dplyr’:

    collapse

> Cand.models = list()
> niter = 100
> for (i in 1:niter) {
+  Cand.models[[i]] = gls(Maxgrowthrate ~ log.Forrang+log.Weight_av, data =
+ d, method= "ML", na.action=na.omit,
+                         correlation = corPagel(value=0.4, trees[[i]]) )
+ }
Error in corPagel(value = 0.4, trees[[i]]) : 
  could not find function "corPagel"
> ??corPagel
> library(ape)

Attaching package: ‘ape’

The following object is masked from ‘package:Hmisc’:

    zoom

> Cand.models = list()
> niter = 100
> for (i in 1:niter) {
+  Cand.models[[i]] = gls(Maxgrowthrate ~ log.Forrang+log.Weight_av, data =
+ d, method= "ML", na.action=na.omit,
+                         correlation = corPagel(value=0.4, trees[[i]]) )
+ }
Error in corPagel(value = 0.4, trees[[i]]) : 
  object "phy" is not of class "phylo"



Perhaps you have yet another unnamed package with a corPagel that doesn't require a second argument of class "phylo"? I've reached "the end of my rope".




> }
> 
> Thank you in advance for any help, it's much appreciated!

Please submit code that will run in a clean session. Close R. Do not save anything except your history. Delete or rename your `.Rdata` file and staart a fresh session. then include everything needed to get the behavior you are reporting.

> 
> Kind regards,
> 
> Hannah van Noort
> <Seabirddat_growth.txt>______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   -Gehm's Corollary to Clarke's Third Law




More information about the R-help mailing list