0
$\begingroup$

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

$\endgroup$
5
  • $\begingroup$ It's not "abs" it's just arranged in the opposite order (flipping the sign). If you did your t-test the other way around the sign would be the same, or if you replaced exp2 with the complementary indicator (1 where this is 0, and vice versa), the two would also be the same. Note that the t-test actually returns more than it prints. Take a look at str() around your t-test call to see additional information that you can pull out. $\endgroup$
    – Glen_b
    Commented Nov 17, 2019 at 2:00
  • $\begingroup$ Thanks for your answer, is it possible to calculate the Std.error or t value and pr of t.value? $\endgroup$
    – Tlaloc-ES
    Commented Nov 17, 2019 at 11:22
  • $\begingroup$ If you're using the var.equal=TRUE argument to t.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$
    – Glen_b
    Commented Nov 17, 2019 at 12:19
  • $\begingroup$ Sorry I think that I am not explaining too well, realy my question is not about R is about the math and statistics, I want to now if is possible only with that data t.tets ouput and the sd and mean of the two groups calculate the std.error and t value of the intercept and the another fields, for example for f-statistich is the same that t² thanks for your answers. $\endgroup$
    – Tlaloc-ES
    Commented Nov 17, 2019 at 14:39
  • $\begingroup$ If you use R in your question, you need to get your R code correct. The problem is I think you may have the R wrong, which is causing you some extra problems. If you don't feel your question relates to any specific package at all, you could edit to replace it with the relevant formulas. $\endgroup$
    – Glen_b
    Commented Nov 17, 2019 at 16:24

0

Your Answer

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

Browse other questions tagged or ask your own question.