Skip to content

T test for Single Mean

2 messages · Sparks, John, Bert Gunter

#
Dear R Helpers,

I am stuck on some syntax and I thought that I was following one of the
examples that I found out there quite faithfully.

I just want to know how to do a t test on a single mean for whether or not
it is greater than a specific value.  So I am using the data set sleep and
I want to know if the mean of extra is greater then zero.  I was under the
impression that the syntax is

t.test(sleep$extra,mu=0,"greater")

but I get the error message

Error in t.test.default(sleep$extra, mu = 0, "greater") :
  not enough 'y' observations

I have tried this on a few other data sets that have more then 20
observations and I get the same error.  I looked in the documentation but
the examples are for the comparison of two groups, not a single group
mean.

Any help would be most appreciated.

--John J. Sparks, Ph.D.
#
(Re-) Read the docs (e.g. Intro to R, R Language Definition) . ...
arguments have to be named!

t.test(sleep$extra,mu=0, alt = "greater")  ## works

-- Bert
On Wed, Jun 19, 2013 at 6:50 AM, Sparks, John James <jspark4 at uic.edu> wrote: