> "Here is a program which helps us assess whether a correlation that we see is real or imagined. It produces a t statistic which really is a t-statistic under the hypothesis that there is no correlation. It is actually measures the how likely the slope of the regression line is to be the POSTIVE value you see, given if the correlation did not really exist. In other words, it is a one sided test where the alternate hypothesis is a positive slope of the regression line. ":

with(plots):

with(plottools):

Mine:=proc(L,n)
local k,R;
R:=[];
for k from 1 to nops(L) do
R:=[op(R),[L[k][n],1]];
od:
R;
end:

Mine2:=proc(L,n)
local k,R;
R:=[];
for k from 1 to nops(L) do
R:=[op(R),L[k][n]];
od:
R;
end:

Analysis:=proc(L)
local m,v,sd,k,S,i,j,l;
m:=0;
v:=0;
sd:=0;
for k from 1 to nops(L)
do
m:=m+L[k];
od;
m:=evalf(m/nops(L));
for i from 1 to nops(L)
do
v:=v+(L[i]-m)^2;
od;
v:=evalf(v/nops(L));
sd:=evalf(sqrt(v));
[m,v,sd];
end:

Analysis2:=proc(L,H)
local cov,cor,st,ml,mh,sl,sh,Al,Ah,k;
cov:=0;
cor:=0;
st:=0;
Al:=Analysis(L);
Ah:=Analysis(H);
ml:=Al[1];
mh:=Ah[1];
sl:=Al[3];
sh:=Ah[3];
for k from 1 to nops(L)
do
cov:=cov+(L[k]-ml)*(H[k]-mh);
od;
cov:=cov/nops(L);
cor:=cov/(sl*sh);
st:=cor^2;
[cov,cor,st];
end:

HypothCor:=proc(B)
local ml,mh,sl,sh,cor,str,Al,Ah,A,F,L,H,r,n,t,Pv;
n:=nops(B);
L:=Mine2(B,1):;
H:=Mine2(B,2):;
Al:=Analysis(L);
Ah:=Analysis(H);
A:=Analysis2(L,H);
r:=A[2];
t:=r*sqrt((n-2)/(1-r^2));
Pv:=evalf(1-stats[statevalf,cdf,studentst[n-2]](t));
lprint("the probailty that you see the test statisaitc",t,"
and that that the slope is zero is",100*Pv,"percent.");
A1:=plot(stats[statevalf,pdf,studentst[n-2]](x),x=-3..3):
if abs(t)<3 then
A2:=pointplot({[t,stats[statevalf,pdf,studentst[n-2]](t)]},color=blue,symbol=diamond,thickness=2):
fi;
if abs(t) > 3 then
A2:=plot(stats[statevalf,pdf,studentst[n-2]](x),x=-3..3,color=black):
fi;
display(A1,A2);
end:

Warning, the name changecoords has been redefined

Warning, the name arrow has been redefined

Warning, `A1` is implicitly declared local to procedure `HypothCor`

Warning, `A2` is implicitly declared local to procedure `HypothCor`

> CS:=[[6, 5], [5, 6], [10, 9], [10, 7], [7, 4], [4, 5], [9, 4], [5, 2], [10, 5], [6, 3], [1, 3], [9, 3], [1, 6], [6, 3], [10, 6], [8, 9], [10, 10], [8, 4], [4, 6], [9, 6], [2, 3], [10, 4], [10, 1]];

CS := [[6, 5], [5, 6], [10, 9], [10, 7], [7, 4], [4...
CS := [[6, 5], [5, 6], [10, 9], [10, 7], [7, 4], [4...

> HypothCor(CS);

"the probailty that you see the test statisaitc", 1.275458299, " \nand that that the slope is zero is", 10.80382974, "percent."

[Maple Plot]

>