Hannah van Noort
2018-Jun-16 20:37 UTC
[R] Problems running a PGLS model with phylogenetic uncertainty
Hi everyone, I'm having trouble running a PGLS model with the package "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. 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]])) } Thank you in advance for any help, it's much appreciated! Kind regards, Hannah van Noort -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: Seabirddat_growth.txt URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20180616/c5e8bbad/attachment.txt>
David Winsemius
2018-Jun-17 05:27 UTC
[R] Problems running a PGLS model with phylogenetic uncertainty
> On Jun 16, 2018, at 1:37 PM, Hannah van Noort <hannahvnoort at 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.omitAnd 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"> ?corPagelNo 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 at 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
Hannah van Noort
2018-Jun-17 17:19 UTC
[R] Problems running a PGLS model with phylogenetic uncertainty
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. Kind regards, Hannah van Noort 2018-06-17 7:27 GMT+02:00 David Winsemius <dwinsemius at comcast.net>:> > > On Jun 16, 2018, at 1:37 PM, Hannah van Noort <hannahvnoort at 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 at 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 > > > > > >-------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: Seabirddat_growth.txt URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20180617/55711f90/attachment.txt>
David Winsemius
2018-Jun-17 20:51 UTC
[R] Problems running a PGLS model with phylogenetic uncertainty
> On Jun 16, 2018, at 10:27 PM, David Winsemius <dwinsemius at comcast.net> wrote: > > >> On Jun 16, 2018, at 1:37 PM, Hannah van Noort <hannahvnoort at 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.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-0001.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 at 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 at 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