Question
I always used a paired t-test or a wilcoxon signed rank test (of course depending on the dataset) to check whether two methods (on average) yielded the same results. After learning more about regression I think that this would work with regression too, however I can't understand which would be "better" in which case?
Example
Let's take this (too small) example dataset, and assume that it's normally distributed.
data <- read.table(text = " sample methodx methody
1 1 0.52 0.53
2 2 0.50 0.51
3 3 0.48 0.48
4 4 0.40 0.41
5 5 0.36 0.36
6 6 0.30 0.32
7 7 0.28 0.30
8 8 0.28 0.29", header = T)
# Regression analysis
model <- lm(data$methodx ~ data$methody)
summary(model)
# Residuals:
# Min 1Q Median 3Q Max
# -0.007317 -0.004931 -0.002012 0.004596 0.011341
#
# Coefficients:
# Estimate Std. Error t value Pr(>|t|)
# (Intercept) -0.02341 0.01181 -1.983 0.0946 .
# data$methody 1.03354 0.02879 35.900 3.11e-08 ***
# ---
# Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#
# Residual standard error: 0.007374 on 6 degrees of freedom
# Multiple R-squared: 0.9954, Adjusted R-squared: 0.9946
# F-statistic: 1289 on 1 and 6 DF, p-value: 3.115e-08
# Paired t-test
t.test(data$methodx, data$methody, paired = TRUE)
# Paired t-test
#
# data: data$methodx and data$methody
# t = -3.7417, df = 7, p-value = 0.007247
# alternative hypothesis: true difference in means is not equal to 0
# 95 percent confidence interval:
# -0.016319724 -0.003680276
# sample estimates:
# mean of the differences
# -0.01
When looking at the regression: I see a high correlation (0.9954
), which seems linear as the rc of the line is 1.03354
. The paired t-test tells me to reject H0, likely because of the fact that this dataset is way too small. But on general both seem to be able to tell me whether the methods on average give the same results. So when to choose a linear regression and when to choose a paired t-test when comparing two methods?