[R] t-stat Curve

Richard M. Heiberger rmh at temple.edu
Wed Sep 27 22:49:09 CEST 2006


## There is some ambiguity in your example.
## You stated a one-sided hypothesis and calculated qt() values for both sides.
## I show both the one-sided and two-sided displays.

library(HH)
## HH_1.5 is available from CRAN for R-2.3.1
##
## HH_1.5 ignores the df.t argument and interprets the request as a
## normal distribution.

## HH_1.8 has been accepted for CRAN for R-2.4.0 and will be in the
## standard places on CRAN when R-2.4.0 is released.
##
## HH_1.8 uses the df.t argument and interprets the request as a
## t-distribution.

old.par <- par(oma=c(4,0,2,5), mar=c(7,7,4,2)+.1)

crit.val.t <- qt(c(.05,.95), 24)
crit.val <- crit.val.t*(12/sqrt(25)) + 80

observed.t <- -1.25
observed.ybar <- 77

norm.setup(mean=80, n=25, sd=12, df.t=24, xlim=c(70,90),
           main="two-sided alpha=.10")
norm.curve(mean=80, n=25, sd=12, df.t=24, crit=crit.val)
abline(v=observed.ybar)
axis(side=3, at=observed.ybar, line=-.5)

norm.setup(mean=80, n=25, sd=12, df.t=24, xlim=c(70,90),
           main="one-sided alpha=.05")
norm.curve(mean=80, n=25, sd=12, df.t=24, crit=crit.val[1], shade="left")
abline(v=observed.ybar)
axis(side=3, at=observed.ybar, line=-.5)

par(old.par)



More information about the R-help mailing list