5
$\begingroup$

I am running several phylogenetic least squares analyses in R, where I'm taking an existing data set for several species, and adding two new species for which I have data. I want to do is test whether the new all-species regression is significantly different than the old regression. But I am unsure of the appropriate test to use.

The existing data set establishes a regression that should be applicable to all species. I can add data on two species, and what I find is that one of the two species falls more or less on regression predicted by the original data set. The other species fall way below the regression predicted by the original data set. So I guess what I'm trying to determine is if there are significant differences in both slope and intercept, as well as significant differences in the strength of the regression.

$\endgroup$
4
  • $\begingroup$ Hi @Nate and welcome to the site. Am I correct that the dependent variable (outcome) is the same in the all-species and in the old regression? To test whether the model with all species is an improvement over the old regression you could use a likelihood ratio test. See this post for a worked example in R. $\endgroup$ Commented Jun 2, 2013 at 18:03
  • 1
    $\begingroup$ Can you be more specific regarding how the new regression might differ from the old one? Eg, are you wondering if the slope of the relationship b/t X & Y differs by species, if the intercept does, or if both do? Something else? $\endgroup$ Commented Jun 2, 2013 at 18:22
  • $\begingroup$ COOLSerdash, thanks for the help, ill work through that example and code. @gung Sorry, So what im trying to accomplish is the following. The existing data set establishes a regression that should be applicable to all species. I can add data on two species, and what I find is that one of the two species falls more or less on regression predicted by the original data set. The other species fall way below the regression predicted by the original data set. So I guess what im trying to determine is if there are sig. differences in both slope and intercept, when adding the new data. Thanks! $\endgroup$
    – Nate
    Commented Jun 2, 2013 at 19:43
  • $\begingroup$ There are two general approaches. One (the most common approach, I think) is to combine into a single regression with dummies for the different sets, which looks like the approach COOLSerdash is pointing to). The other is to construct tests based on separate regressions; there are advantages and disadvantages either way. The first requires somewhat more restrictive assumptions (like equality of variance), but is both more convenient and should - if the assumptions are true - have slightly better power. $\endgroup$
    – Glen_b
    Commented Jun 3, 2013 at 1:50

2 Answers 2

4
$\begingroup$

The most basic way to do this is to run a new, larger regression with all of your data. (That is, the data that had been used before, plus the data for the two new species.) You should create a dummy variable to indicate each species (obviously with one species as the reference level--I've explained dummy coding here). You will also want to add product terms for the interaction between whatever your $X$ variable is and the species indicators (I've explained what an interaction is here).

After having run this larger multiple regression model, test to see if the interaction terms are 'significant'. (I have discussed this here.) If you believe that the interactions are contributing something meaningful, then that means the slope of the relationship between $X$ and $Y$ differs by species. You can also test to see if the species dummy variables are statistically significant. This will tell you if the intercepts differ by species. (A couple of notes here: If the interaction is significant, the significance of the dummies / intercepts probably isn't very meaningful, and should definitely be kept in the model either way--see here & here. If the interaction is sufficiently non-significant that you don't believe it, but the dummies are, that means the lines run parallel to each other but are shifted vertically. My answer here puts a lot of this information together in one place.)

$\endgroup$
0
$\begingroup$

This question is concerned with whether a new data point is an influential observation in a PGLS model. I think the easiest way to do this would be to examine diagnostic plots in a regression of phylogenetically independent contrasts. You can do this with help from the 'caper' package. I will demonstrate below.

First I'll simulate a phylogeny, a pair of correlated traits, and make one data point a big outlier.

library(phytools)

# Simulate example data with an influential data point
set.seed(23)
tree <- rcoal(12)
data <- sim.corrs(tree, vcv=matrix(c(1,0.7,0.7,1),2,2))
data <- data.frame(data, rownames=rownames(data))
names(data) <- c("x", "y", "species")
data[4,2] <- -1.8

# Visualize raw data
par(mfrow=c(1,2))
plot(tree)
nodelabels("18", 18)
plot(y~x, type="n",data=data, pch=16, xlab="x", ylab="y")
text(data$x, data$y, labels=data$species)

I highlight node number 18 on the phylogeny, because that is the node ancestral to tip $t2$, which is the influential observation as seen in the scatter plot.

Now, I use caper to do phylogenetically independent contrasts and look at the model diagnostic plots. Note that in these diagnostic plots, data points correspond to independent contrasts, not raw data points. Thus, for a tree with $n$ tips, there are $n - 1$ phylogenetically independent contrasts corresponding to each of the nodes in the tree.

library(caper)

# Compute independent contrasts regression
comp.data <- comparative.data(tree, data, species)
fit <- crunch(y ~ x, data=comp.data)

# Diagnostic plots
par(mfrow=c(2,2))
plot(fit)

As expected, all four of these plots point towards node number 18 as an influential observations.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.