View Full Version : T tests using R


georgina_009
10-02-2007, 11:19 PM
Any suggested answers to compare mine too for this qn?

In an experiment to compare two diets for fattening beef steers, nine pairs of animals were
chosen from the herd; members of each pair were matched as closely as possible with respect to
hereditary factors. The members of each pair were randomly allocated, one to each diet. The
following table shows the weight gains (lbs) of the animals over a 140 day period: are given
below:
Pair 1 2 3 4 5 6 7 8 9
diet1 596 422 524 454 538 552 478 564 556
diet2 498 460 468 458 530 482 528 598 456
Using R
(a) Test for a difference between diets.
(b) Calculate a 90% confidence interval for the difference.
(c) Write an informative conclusion

Mike White
10-04-2007, 05:23 AM
Enter your data as below:
diet1 <-c(596, 422, 524, 454, 538, 552, 478, 564, 556)
diet2 <-c(498, 460, 468, 458, 530, 482, 528, 598, 456)

# then use the command below to show you the help file for t.test
# you should then be able to work out how to use it for your problem
# using the variables diet1 and diet2
?t.test

abel
10-18-2007, 09:57 PM
>t.test(diet1, diet2, paired=T, conf=0.9)

Paired t-test

data: diet1 and diet2
t = 1.1585, df = 8, p-value = 0.2801
alternative hypothesis: true difference in means is not equal to 0
90 percent confidence interval:
-13.85051 59.62829
sample estimates:
mean of the differences
22.88889

There is no significant difference between diet1 and diet2, according to the paired t-test;
However, the sample size is small!

And, you'd try some non-parametric methods.

wipeout
11-30-2009, 02:31 PM
You should try permutation test in package "coin", but...

Do no take seriously a two-side test.

Of course, both diets ARE DIFFERENT, it's imposible that diet1= diet2, always there will be a difference, however small it may be, the fact that we don't be able to detect it is another thing.

All two-side Statistical Hypothesis are falses!

With a small sample you have less probability to find any difference.
With a huge sample you can always find a difference, no matter H0.

I think you should look Confidence Interval, it's better than statistical testing. Or use Bayesian statistics