0

I am relatively new to setting up statistical analyses on R.

I am running a phylogenetic least squares regression for multiple observations per species per seasonality. (Example dataframe below). In all, there are 6 species measured (only one shown). Five individuals were measured for a trait values (CN shown) in three periods (Spring, Summer, Autumn).

Tree_Species Period CN
TRE1 Spring 11.847
TRE1 Spring 11.508
TRE1 Spring 7.378
TRE1 Spring 9.768
TRE1 Spring 9.205
TRE1 Summer 0.953
TRE1 Summer 1.053
TRE1 Summer 1.340
TRE1 Summer 1.128
TRE1 Summer 1.273
TRE1 Autumn 1.153
TRE1 Autumn 1.173
TRE1 Autumn 1.366
TRE1 Autumn 1.015
TRE1 Autumn 1.108

In this example, I am trying to find whether seasonality (Period) has an affect on the measured trait (CN) given the species (Tree_Species).However, when I try to create a model while grouping the observations by species with the phylogeny (under brownian motion), I am recovering AIC, BIC, and log-likelihood values of infinity. The output (given by summary function) most likely means there is an issue in the way I am inputting the data, given the phylogeny.

The code that I performed on R is shown below with the libraries used.

library(phytools)

library(phylotools)

library(nlme)

library(piecewiseSEM)

library(picante)

library(geiger)

library(MuMIn)

library(bbmle)


traits <- read.delim("clipboard", as.is=FALSE) #import data
phy <-read.tree("mytimetree_strict_szn.tre") #import phylogeny, 6 tips. Ultrametric tree.

traits_grouped <- groupedData(CN ~ Period | Tree_species, data=traits, FUN=mean) #group the observations by species

bm.CN.season.gls <- gls(CN ~ Period, data=traits_grouped, correlation=corBrownian(1,phy, form= ~Tree_species)) 

summary(bm.CN.season.gls)

Generalized least squares fit by REML
  Model: CN ~ Period 
  Data: traits_grouped 
   AIC  BIC logLik
  -Inf -Inf    Inf

Correlation Structure: corBrownian
 Formula: ~Tree_species 
 Parameter estimate(s):
numeric(0)

Coefficients:
                  Value Std.Error   t-value p-value
(Intercept)   21.715098  3.123492  6.952186  0.0000
PeriodSpring -10.566643  2.485146 -4.251920  0.0001
PeriodSummer  -1.847364  1.667929 -1.107580  0.2711

 Correlation: 
             (Intr) PrdSpr
PeriodSpring -0.866       
PeriodSummer -0.661  0.769

Standardized residuals:
        Min          Q1         Med          Q3         Max 
-3.36080010 -0.92884866 -0.08434883  0.46132229  3.30057650 

Residual standard error: 2.472081 
Degrees of freedom: 90 total; 87 residual

Would anyone be able to help me resolve this issue? I greatly appreciate the help and feedback!

everyjing
  • 1
  • 1
  • Can you make your post [reproducible](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) by providing `phy` or random data that can be used in the place of `phy`? Also please note it's good practice to provide data using `dput()` rather than providing it in table form. – jrcalabrese Dec 05 '22 at 21:48

0 Answers0