Liviu,

Delightful example.  Thank you.

The t-value in the cor.test is already scaled for 30 df by the time it
is printed.  Giving an n-value scales it again, by dividing the
standard deviation by sqrt(n).  Since you are already in the standard
t-scaling, n=1 is the correct value for your example.
This is the graph you are looking for:

    normal.and.t.dist(obs.mean=5.5651, deg.freedom=30, alpha.right=.025,
                      Use.alpha.left=TRUE, Use.obs.mean=TRUE, xmin=-6)

The above graph does not specifiy n, and therefore shows
"Standard t Density", and only the t axis.  The green 5.565 is the observed
t-value, and the -5.565 is the boundary of the p-value region on the other
side.
We need both sides because the cor.test said the alternative hypothesis is
two-sided.

Here is almost the same graph, this time with n=1.  Now it shows "t density"
with
standard error of x.bar and the x.bar axis as well as the t axis.

    normal.and.t.dist(obs.mean=5.5651, deg.freedom=30, alpha.right=.025,
                      Use.alpha.left=TRUE, Use.obs.mean=TRUE, xmin=-6, n=1)

In this example with n=1, the x.bar scale and the t scale are identical.
The blue +/- 2.042 are the boundaries of the rejection region in x.bar
units.

On your original graph, simplified here

normal.and.t.dist(obs.mean=5.5651, deg.freedom=30, alpha.right=0.025,
                  Use.alpha.left=TRUE, Use.obs.mean=TRUE, n=32)

the blue values are in the x.bar scale (as indicated on the graph),
asssuming that the observed mean x.bar=5.5651 comes from a
distribution of x.bar with standard deviation 1/sqrt(32).
Scale that to the t-scale with 5.5651/(1/sqrt(32)) = 31.48096 and that
is the number you were querying.

Expand the graph to fill the screen and you will see that the right boundary
of the rejection region is suppressed by R to avoid overprinting.
If you extend the graph to the left, with xmin=-6,

normal.and.t.dist(obs.mean=5.5651, deg.freedom=30, alpha.right=0.025,
                  Use.alpha.left=TRUE, Use.obs.mean=TRUE, n=32, xmin=-6)

then you will see that the left boundary of the p-value region -31.481
is also displayed.

Rich

        [[alternative HTML version deleted]]

_______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-teaching

Reply via email to