0

I'm trying to run a PGLS on the attached data set however I keep receiving the following error message:

Error in corFactor.corStruct(object) : 
  NA/NaN/Inf in foreign function call (arg 1)

I do not have any missing of infinite values in my dataset.

Code for PGLS:

pglsPL <-  gls(Y10 ~ X10, 
               data = frame, correlation = corPagel(1, phy=trimTree, fixed=FALSE), method="ML") 
summary(pglsPL)

DATA:

Y 20
-182.1
-0.1
-12.15
-129.3
-657.05
187.7
-666.25
-220.1
-125.55
-487.15
-147.4
-345.6
-1385
-201.55
-288.9
-265.25
-454.85
-394.75
-305.9
-182.85
-487.3
-353.6
-162.05
-61.55
-1226.95
-371.9
-445.75
-1058.65
35.85
-1009.65
-37.1
-201.95
-14.7
-426.15
-0.95
-434.55
-385.85
-403.65
-348.65
-746.1
-643.9
-91.55
-301.1
-102.85
-472
-112.7
187.45
-26.6
-91.8
-282.65
-369.95
-271.3
132.9
-91.7
719.55
-363.45
56.45
-482.9
-201.9
-258.9
149.1
-1229.1
202.05
-469.3
768.1

X 20 
-23.355
-17.79692377
-22.675
-21.21804525
-35.605
-11.99514672
-26.875
-32.875
-21.27939088
-18.38583804
-27.095
-43.135
-26.86
-20.24134812
-19.32
-21.86912901
-17.71334558
-23.29926969
-27.33
-21.85112778
-22.01501812
-40.965
-21.38862038
-21.88734839
-41.27
-33.51
-37.72
-36.585
-20.62247107
-15.80767523
-17.89937246
-21.8677635
-22.90775766
-34.765
-28.325
-16.965
-39.205
-37.55
-26.33
-40.135
-23.1899714
-23.07386214
-23.23526629
-17.78675062
-30.85
-19.83217683
-14.34
-20.89054901
-15.95026538
-36.485
-35.855
-34.445
-14.15935389
-22.17738786
-15.59101754
-16.95864315
-21.33446617
-36.285
-19.05616876
-19.95657141
-20.4025053
-39.355
-14.3912592
-18.50591797
-11.81825505

Unfortunately I cannot attach the phylogenetic tree.

David Arenburg
  • 91,361
  • 17
  • 137
  • 196
PGLS
  • 71
  • 1
  • 5

2 Answers2

1

It is impossible to answer your question without more details, but I do have a few comments.

  1. In general, the R-SIG-phylo e-mail list would be a better place for a question about PGLS

  2. Have you tried changing the starting value of lambda? If not, I would suggest tinkering with that. This discussion on R-SIG-phylo may help you.

  3. You can also try your luck with the pgls function from the caper package.

SlowLoris
  • 995
  • 6
  • 28
0

Seems like this might be a scaling issue (at least it is for other correlation structures in 'gls' function). Try making a new_tree with branch lengths that are 100x longer than those in your original_tree. For example:

new_tree <- original_tree

new_tree$edge.length <- new_tree$edge.length * 100

You should be able to run the gls with the new_tree.

I found this answer [here].(https://lukejharmon.github.io/ilhabela/instruction/2015/07/03/PGLS/ "Luke Harmon - Phylogenetic Generalized Least Squares (PGLS)")

Shawn Hemelstrand
  • 2,676
  • 4
  • 17
  • 30
George
  • 1
  • 1
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/33760271) – Paul Stafford Allen Feb 04 '23 at 12:09