[R] Problems running a PGLS model with phylogenetic uncertainty

David Winsemius dw|n@em|u@ @end|ng |rom comc@@t@net
Sun Jun 17 23:33:13 CEST 2018


> On Jun 17, 2018, at 10:19 AM, Hannah van Noort <hannahvnoort using gmail.com> wrote:
> 
> Hi again,
> 
> My apologies for the incomplete script last time. Hereby the updated dataset, phylogenetic tree information and R-script. This time the errors I mentioned should pop up.
> Once again thank you in advance for any help/tips.

> row.names(d) <- c("Diomedea_exulans", "Diomedea_epomophora", "Thalassarche_chrysostoma", "Thalassarche_melanophrys", "Phoebetria_palpebrata", "Macronectes_giganteus", "Fulmarus_glacialis",
+                   "Procellaria_aequinoctialis", "Puffinus_tenuirostris", "Puffinus_puffinus", "Oceanites_oceanicus", "Oceanodroma_leucorhoa", "Phaethon_rubricauda", 
+                   "Pelecanus_occidentalis", "Fregata_magnificens", "Morus_bassanus", 
+                   "Sula_dactylatra", "Sula_leucogaster", "Sula_sula", "Phalacrocorax_carbo", "Phalacrocorax_aristotelis", "Larus_dominicanus", "Larus_occidentalis", "Larus_argentatus", "Rissa_tridactyla", "Sterna_bergii",
+                   "Sterna_sandvicensis", "Sterna_dougallii", "Sterna_hirundo", "Sterna_paradisaea", "Sterna_fuscata", "Anous_stolidus", "Anous_minutus", "Cepphus_columba", "Cepphus_grylle", "Uria_lomvia", "Alca_torda")
Error in `.rowNamesDF<-`(x, value = value) : invalid 'row.names' length

Needed to remove the extraneous "+" signs that persisted after copying from the console, but still no progress:


length( c("Diomedea_exulans", "Diomedea_epomophora", "Thalassarche_chrysostoma", "Thalassarche_melanophrys", "Phoebetria_palpebrata", "Macronectes_giganteus", "Fulmarus_glacialis",
+                    "Procellaria_aequinoctialis", "Puffinus_tenuirostris", "Puffinus_puffinus", "Oceanites_oceanicus", "Oceanodroma_leucorhoa", "Phaethon_rubricauda", 
+                   "Pelecanus_occidentalis", "Fregata_magnificens", "Morus_bassanus", 
+                    "Sula_dactylatra", "Sula_leucogaster", "Sula_sula", "Phalacrocorax_carbo", "Phalacrocorax_aristotelis", "Larus_dominicanus", "Larus_occidentalis", "Larus_argentatus", "Rissa_tridactyla", "Sterna_bergii",
+                   "Sterna_sandvicensis", "Sterna_dougallii", "Sterna_hirundo", "Sterna_paradisaea", "Sterna_fuscata", "Anous_stolidus", "Anous_minutus", "Cepphus_columba", "Cepphus_grylle", "Uria_lomvia", "Alca_torda")
+ )
[1] 37

> 
 nrow(d)
[1] 40

So yet another error that prevents further progress.


PLEASE 
PLEASE
PLEASE
Run your code in a clean session and try to recognize and correct the syntactic and other errors that I have already identified. I think it's time for you to adopt a strategy of creating asource file that is then submitted by your editor. (Such a facility is supplied by Rstudio.)


> Kind regards,
> 
> Hannah van Noort
> 
> 2018-06-17 7:27 GMT+02:00 David Winsemius <dwinsemius using comcast.net>:
> 
> > 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
> 
> 
> 
> 
> 
> 
> <Seabirddat_growth.txt><output.nex><Scripts_Growthrate.R>

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