I am reading about the relationship that can be between t.test and lm, and I am trying to get the way of calculating the coefficients of lm with the data that return t.test
For example, I have the following output with t.test
Two Sample t-test
data: rta[ind1] and rta[ind2]
t = -0.032053, df = 15, p-value = 0.9749
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-9.642382 9.356667
sample estimates:
mean of x mean of y
25.85714 26.00000
And I have the following coefficients in lm
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 25.8571 3.4182 7.564 1.7e-06 ***
exp2 0.1429 4.4568 0.032 0.975
The only relations that I can find are the following
- Intercept estimate is mean of x
- exp2(slope) estimate: is mean of x - mean of y
- exp2(slope) t value is abs of t-value in t.test (But I am not sure about why is abs)
- exp2(slope) Pr(>|t|): is the p-value of t.test
So my question is how can I calculate if it is possible the Std.Error and another t value and p-value?
thanks
str()
around your t-test call to see additional information that you can pull out. $\endgroup$var.equal=TRUE
argument tot.test
and you actually do as I suggested above, you will see that you can directly get the entire second line of the coefficients. You can't get most of the first row without some additional calculation since it's not relevant to a t-test. $\endgroup$