[R-sig-teaching] plotting hypothesis of correlation t-test
Liviu Andronic
landronimirc at gmail.com
Fri Oct 1 00:10:34 CEST 2010
Dear all
I'm not sure that this is an r-sig-teaching per se, but I need it for
teaching so here I go.
I need to plot the hypothesis of a correlation test. The only
semi-automated way I know to do this is RcmdrPlugin.HH. For example,
> cor.test(mtcars$am, mtcars$drat, alternative="two.sided", method="pearson")
Pearson's product-moment correlation
data: mtcars$am and mtcars$drat
t = 5.5651, df = 30, p-value = 4.727e-06
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.4843991 0.8501319
sample estimates:
cor
0.7127111
> qt(c(0.025), df=30, lower.tail=F)
[1] 2.042272
Then I supply these data to the 'Plot Hypotheses (HH)' in Rcmdr >
Cont. Distributions > t distro.
require(RcmdrPlugin.HH)
normal.and.t.dist.result <- normal.and.t.dist(std.dev=NA, n=32,
deg.freedom=30, mu.H0=0, xmin=NA, xmax=NA, gxbar.min=NA, gxbar.max=NA,
Use.alpha.right=TRUE, alpha.right=0.025, Use.alpha.left=TRUE,
alpha.left=0.025, Use.mu.H1=FALSE, mu.H1=NA, Use.obs.mean=TRUE,
obs.mean=5.5651, hypoth.or.conf="Hypoth", col.mean="lime green",
col.alpha="blue", col.beta="red", col.conf="pale green",
col.conf.arrow="dark green", col.mean.label="lime green",
col.alpha.label="blue", col.beta.label="red", col.conf.label="dark green",
cex.crit=1.2)
There are several elements that I do not quite understand in the
resulting graph [1]:
- what does '0.361' correspond to? If this is the mean (x bar), why
would I be interested in this for this particular hypothesis testing?
- what does '31.481' correspond to? From the colors I understand that
it's related to the observed t statistic, but I cannot figure what
exactly it represents.
I'd be grateful for any insights. Regards
Liviu
[1] http://s000.tinyupload.com/index.php?file_id=02099991814244792735
--
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail
More information about the R-sig-teaching
mailing list