Louise Mair
2012-Jun-18 15:31 UTC
[R] Obtaining r-squared values from phylogenetic autoregression in ape
Hello, I am trying to carry out a phylogenetic autoregression to test whether my data show a phylogenetic signal, but I keep calculating bizzare R-squared values. My script is:> library(ape)> x <-"((((((((R:1,GK:1)d:1,(MW:1,G:1)n:1)a:1,SPW:1)a:1,WB:1)b:1,(((SPBF:1,PBF:1)n:1,(HBF:1,SWF:1)c:1)i:1,(PE:1,((P:1,C:1)w:1,(MF:1,HF:1)l:1)b:1)c:1)x:1)a:1,((((((CHB:1,AD:1)a:1,BA:1,SSB:1)i:1,(HB:1,SB:1)b:1)x:1,SC:1)x:1,((BRH:1,PH:1)e:1,(WLH:1,GH:1)b:1)d:1)x:1,DBF:1)a:1)a:1,((WW:1,(OT:1,SW:1)v:1)b:1,B:1)z:1)a:1,((DS:1,GS:1)j:1,(SSS:1,LS:1,(ES:1,SS:1)a:1)b:1)e:1)a;"> treeX <- read.tree(text=x) > treeX <- compute.brlen(treeX, method = "Grafen")> data <- c(4.854185, 6.008532, 6.221286, 4.369945, 10.044475,5.801292, 5.128374, 5.540995, 4.566704, 10.188250, 7.121077, 4.469329, 4.815972, 7.798617, 5.892205, 4.853027, 5.080509, 7.982360, 7.518022, 5.675702, 11.989929, 6.760587, 7.433313, 7.906303, 7.235088, 7.131338, 5.582816, 6.769775, 11.886225, 5.589256, 5.626147, 4.714369, 6.040151, 9.098583, 5.194043, 8.830687, 6.231105)> species <- c( "AD", "B", "BA", "BRH" , "C", "CHB", "DBF","DS", "ES", "G", "GH", "GK", "GS", "HB", "HBF", "HF", "LS", "MF", "MW", "OT", "P", "PBF", "PE", "PH", "R", "SB","SC", "SPBF", "SPW", "SS", "SSB", "SSS", "SW", "SWF", "WB", "WLH", "WW")> names(data) <- species> cor.mat <- vcv.phylo(treeX, cor=TRUE) > regr <- compar.cheverud(data, cor.mat)> regr$rhohat[1] 5.541462> 1 - var(regr$residuals)/var(data)[,1] [1,] -1.333095 I don't understand why the autoregression coefficient falls outside the interval -1 to 1, or why the calculation for obtaining an R-squared produces a value that doesn't make sense. Have I made a mistake in the application of this method, or have I misunderstood when it is appropriate to use phylogenetic autoregression? Thanks for your help. Louise [[alternative HTML version deleted]]
Apparently Analagous Threads
- [Bug 8829] New: rsync -uav --delete --dry-run prints delete file list in reverse order
- [hivex] [PATCH 1/8] Add test hive and generator script
- LevelOne WPC-0301 11g Wireless CardBus
- AutoRegression with Subset of Lags/Coefficients
- Vectorize linear autoregression with variable coefficients