[R] Problems running a PGLS model with phylogenetic uncertainty

David Winsemius dw|n@em|u@ @end|ng |rom comc@@t@net
Sun Jun 17 22:51:00 CEST 2018


> On Jun 16, 2018, at 10:27 PM, David Winsemius <dwinsemius using comcast.net> wrote:
> 
> 
>> 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.

I didn't notice on first reading that your said you had attached a file about "phylogenetic
tree information." There was only one file in the material passed to Rhelp readers and htat was the .txt data file. Files ending in anything other than ".txt", ".ps", ".pdf", or ".png" will get scrubbed by hte mail-server that mediated rhelp communication. So you can fool your mail-client into thinking that a file is plain text by adding a '.txt' extension and communication will be improved.

Since drafting this I see that you sent another message to both me and Rhelp. I'm the only one who will get the `.nex` and `.R` files. They were scrubbed by the mailserver. I've looked at the .R file and wil now follow my own advice and append a .txt extension  and attach to this email. The 190KB output.nex file is also basically a text file and I'm applying the same treatment:


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: output.nex.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20180617/b18132be/attachment-0004.txt>

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Scripts_Growthrate.R.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20180617/b18132be/attachment-0005.txt>

-------------- next part --------------

 
> 
> 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
> 
> ______________________________________________
> 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