visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Algorithms :: Statistics :: Statistical Tests


By: digitaltree U.S.A.  Date: 17/02/2003 00:00:00  English  Points: 300 Status: Answered
Quality : Excellent
I'm a bit rusty with my statistics and wonder if someone can help.

I have a set of data, with N entries. I can calculate the appropriate statistic (chi-square, z, t, etc)... what do I compare that to?

If I have a computer program that can calculate integral from -infinity to some given value, x, from the appropriate distribution (t, or chi-square, or normal, etc.)

How do I use my calculated statistic with the results from the integral to see if I should accept or reject the hypothesis?
By: collegeBoy Date: 18/02/2003 07:39:00 English  Type : Comment
Hi!

You have to compare the calculated values with the table values of appropriate distribution, sig. level, df. etc. These are now available in most of spreadsheet programs such as Excel. For example, to find out the table value of chi-square distribution with 10 d.f. at 5% level, use the following function in Excel, CHIINV(0.05,10).

You can see for other distribution,usually it is suffixed with inv (inverse)

If the statistic values is less than the table value, the hypothesis (null) is accepted.


By: digitaltree Date: 18/02/2003 07:45:00 English  Type : Comment
That helps a little, but I'm not going to be using Excel so that part isnt really applicable. What I guess I'm looking for is how to create my own tables if I have a program that can compute the area under the curve for a given interval (-infinity to some x, for example) for a given distribution.

If my question still isnt clear, please post a comment to that affect.

I'll increase the points dramatically for a good answer (dramatically is on the order of one to three hundred depending on the accuracy of the answer to my particular problem).
By: VGR Date: 18/02/2003 09:06:00 English  Type : Comment
usually, given the alpha and beta-levels of your confidence intervals for the particular Test, you use an abacus ;-)

ol' solutions

That's why adp1970 suggested using an already-written function for this.

Anyway, I can also propose to you (in source) functions that will do some maths for you in this area (if I can find them, harddrives'contents get rusty too ;-)
By: digitaltree Date: 18/02/2003 09:15:00 English  Type : Comment
Source code would be most excellent (C/C++?) if you can find them. Thats the kind of stuff I'm looking for. You can reach me by email: ai_agent(at)secretagentbill.com


Thanks :)
By: VGR Date: 18/02/2003 09:35:00 English  Type : Answer
well, first of all some (really old, 1987) stuff you will find handy, most precise and wonderful if you know how to use them 8-))

I will try to find something more what you need (if not on my HD, I have to search in the boxes labelled 1988-1991 ;-)

Here we go, and sorry for the beautiful indentation (thanks to EE : why is there no pseudo-tag like

to preserve code layout ? ) :


function gamma(x:real):real;
type coef=array[0..8] of real;
var z,pol,gam:real;
b :coef;
i :integer;
begin
b[0]:=1;
b[1]:=-0.5771191652;
b[2]:=0.988205891;
b[3]:=-0.897056937;
b[4]:=0.918206857;
b[5]:=-0.756704078;
b[6]:=0.482199394;
b[7]:=-0.193527818;
b[8]:=0.035868343;
gam:=1;
z:=x-1;
if ((z<0) or (z>1))
then begin
if z>1
then repeat
gam:=gam*z;
z:=z-1;
until (z<=1)
else begin
gam:=gam/(z+1);
z:=z+1;
end;
end;
pol:=b[8];
for i:=8 downto 1 do pol:=pol*z+b[i-1];
gamma:=gam*pol;
end;

procedure binom(p:real;n,x:integer;var probeg,probinf,probsup:real);
var q,psq:real;
i :integer;
begin
q:=1-p;
psq:=p/q;
probeg:=exp(n*ln(q));
probinf:=probeg;
n:=n+1;
if (x<>0)
then for i:=1 to x do
begin
probeg:=(n-i)*psq*probeg/i;
probinf:=probinf+probeg;
end;
probsup:=1+probeg-probinf;
end;

procedure poisson(mu:real;x:integer;var probeg,probinf,probsup:real);
var i:integer;
begin
probeg:=exp(-mu);
probinf:=probeg;
if (x<>0)
then for i:=1 to x do
begin
probeg:=probeg*mu/i;
probinf:=probinf+probeg;
end;
probsup:=1+probeg-probinf;
end;

procedure normale(mu,s,x:real;var probeg,probinf,probsup:real);
type v=array[0..4] of real;
var b :v;
i :integer;
y,t:real;
begin
b[0]:=1.330274429;
b[1]:=-1.821255978;
b[2]:=1.781477937;
b[3]:=-0.356563782;
b[4]:=0.319381530;
y:=(x-mu)/s;
probeg:=exp(-y*y/2)/s/2.506628274;
t:=1/(1+0.2316419*y);
probsup:=0;
for i:=0 to 4 do probsup:=probsup*t+b;
probsup:=probsup*t;
probsup:=probsup*s*probeg;
if probsup>1 then probsup:=1;
probinf:=1-probsup;
end;

procedure chicarre(nu:integer;x:real;var probeg,probinf,probsup:real);
var precision,nu2,gn2,somme,term:real;
i :integer;
begin
precision:=1E-8;
nu2:=nu/2;
gn2:=gamma(nu2);
probeg:=exp((nu2-1)*ln(x)-nu2*ln(2)-x/2);
probeg:=probeg/gn2;
somme:=1;
term:=1;
probinf:=exp(nu2*ln(x/2)-x/2)/nu2/gn2;
i:=2;
repeat
term:=term*x/(nu+i);
somme:=somme+term;
i:=i+2;
until (term*probinf)<precision;
probinf:=probinf*somme;
probsup:=1-probinf;
end;

procedure student(nu:integer;x:real;var probeg,probinf,probsup:real);
var pair :boolean;
theta,c,s,pi,term,trans,probin:real;
i :integer;
begin
pi:=3.141592653589793;
pair:=(2*trunc(nu/2)=nu);
theta:=arctan(x/sqrt(nu));
c:=cos(theta);
s:=sin(theta);
probeg:=exp(-((nu+1)/2)*ln(1+x*x/nu));
probeg:=probeg/sqrt(pi*nu);
probeg:=probeg*gamma((nu+1)/2)/gamma(nu/2);
trans:=c*c;
if nu=1 then probin:=2*theta/pi
else if pair then begin
probin:=1;
term:=1;
i:=1;
while(i<=nu-3) do
begin
term:=term*trans*i/(i+1);
probin:=probin+term;
i:=i+2
end;
probin:=probin*s;
end
else begin
probin:=c;
term:=c;
i:=2;
while(i<=nu-3) do
begin
term:=term*trans*i/(i+1);
probin:=probin+term;
i:=i+2
end;
probin:=((probin*s)+theta)*2/pi
end;
probinf:=(1+probin)/2;
probsup:=1-probinf
end;
By: digitaltree Date: 18/02/2003 10:14:00 English  Type : Comment
WOW! This isnt C/C++ but it looks straightforward enough that I can probably convert it. Thanks a bunch! I'll take whatever else you're willing to give me. Let me know when you're all out so I can award you some points ;)
By: digitaltree Date: 18/02/2003 10:25:00 English  Type : Comment
I'm upping it by 100 points for the stuff above and will up it at least another 100 more if you can get me anything else :D (f-distribution, and chi-square (unless thats what chicarre is) would be great). I assume normale is the standard normal and student is the student's-t?

Thanks again. This is most helpful.
By: VGR Date: 19/02/2003 00:02:00 English  Type : Comment
yes, chicarre is chi²
look to see if "f-distribution" is not known in the world by an other name :D
Chances are I have it in my functions, 'cause I've the principal of them 8-)

Sorry I will not be able to answer exactly your question, I'm leaving until Monday. Too bad 8-(
By: digitaltree Date: 19/02/2003 03:12:00 English  Type : Comment
Doesnt look like it :) All I can find is mentioned of f-distribution and no mention of it being called something else. Oh well, thanks for the stuff you were able to find, they're great. When you get back, post any more you feel like and I'll increase the points of this question accordingly. Whenever you feel like killing this thread and getting your points, let me know ;)

Thanks a bundle.
By: VGR Date: 25/02/2003 10:58:00 English  Type : Comment
Sorry, I lost all course material I had and schemas for statistical tests (values to compare your statistique to, depending on alpha, beta risks and confidence levels). But you will find everything about H0, H1, 1-alpha etc on google I guess
Sorry for the delay.
By: TheFalklands Date: 01/03/2003 16:16:00 English  Type : Comment
If you can calculate t, f, x-square, then you have already made the comparison. In order to better answer your question, I would need to know more about your data.

If your data are nominal, then you would have to use x-square or simply pearson's r-square for a correlation. If you have interval or ratio data, then a t-test would work. Then, you simply compare your control group to your experimental group. You will get a value t. If you are using statistical software (sas, spss, superanova, etc.) it will give you a p(probability) value. This is the probablity that you made a Type-I error by rejecting the null hypothesis when you should have failed to reject the null hypothesis.

If you have 3 or more groups, then you will run an anova of sorts whether it is multivariate or not. You should run a post-hoc test to determine main effects.

Once you have these statistics, you have made your comparison. You do not need to compare those to anything. I'm not sure what format you are writing in, but in APA (american psychological association) format, you would write: the control(N=#Control) group differed significantly from the experimental (N=#Experimental) group (t=yourTvalue, df=DegreesOfFreedom) with p<=.05.

I hope this helps,
TFL
By: VGR Date: 02/03/2003 20:52:00 English  Type : Comment
"it will give you a p(probability) value. This is the probablity that you made a Type-I error by rejecting the null hypothesis when you should have failed to reject the null hypothesis" : that's the "alpha" risk level I wrote about.
The other interesting one is "beta" : chance to accept H0 whereas you should have rejected it.
By: TheFalklands Date: 02/03/2003 21:48:00 English  Type : Comment
Yes VGR, you are correct. If you report the Type-I error, you do not need to report the beta error. Also, you cannot accept the null hypothesis. You can only reject or fail to reject the null hypothesis. In science, you can never "accept" any hypothesis, you can only support them with confidence and power (both statistics). Beta is 1 - alpha (obviously). The important thing AI_Agent is that once you have your statistics, you have already made your comparison and all you have left to do is report the statistics.

Good luck,
TFL

Do register to be able to answer

EContact
browser fav
page generated in 375.214820 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page