[R] one sample t-test
Jim Lemon
jim at bitwrit.com.au
Sun Feb 24 20:25:51 CET 2013
On 02/25/2013 06:04 AM, Karsten Rincke wrote:
> Hello,
> I am reasoning about a question concerning the t-test for one sample. My
> data includes 150 values (mean 10.07) which I want to compare to mu=9. A
> tow-sided t-test yields
>
>> t.test(data,mu=9)
>
> One Sample t-test
>
> data: data
> t = 3.0099, df = 149, p-value = 0.00307
> alternative hypothesis: true mean is not equal to 9
> 95 percent confidence interval:
> 9.368676 10.777991
> sample estimates:
> mean of x
> 10.07333
>
> The result would be interpreted as being significant. Furthermore it can
> be said that the true mean is greater than 9 because of the confidence
> interval.
> *My question is*: Why does it seem to be not possible to conduct a
> t-test with option "greater"? The result I get is:
>
>> t.test(data,"greater",mu=9)
> Fehler in t.test.default(data, "greater", mu = 9) :
> nicht genug 'y' Beobachtungen
>
> R complains about the amount of supplied data.
>
> I'd like to understand this behavior.
Hi Karsten,
My guess is that it is due to "positional matching", where unlabelled
arguments are interpreted relative to their position in the argument
list. Try this:
t.test(data,alternative="greater",mu=9)
Jim
More information about the R-help
mailing list