|
DataMuseum.dkPresents historical artifacts from the history of: RegneCentralen GIER Computer |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about RegneCentralen GIER Computer Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 6223 (0x184f) Description: Bits:30000668 985/71R CHI SQUARE TEST GA4 Types: 8-hole paper tape Notes: Gier Text
algol<begin _____integer n,p,g,i,j,sum,k; _______real m,s,a,h,T,l; ____procedure writesp(x); _________value x; integer x; _____ _______for x:=x step -1 until 1 do writechar(0); ___ ____ _____ __procedure chi square test (n,m,s,a,h,k,g,T,X) ; _________value a,n,m,s ; integer n,k,g; real a,h,m,s,T ; array X ; _____ _______ ____ _____comment _______This procedure performs the chi-square test of the hypothesis that the observations X=X[1:n] are from a normal population. The observations are grouped such that there are at least k observations in each class. parameters: n the number of observations m the sample mean s the sample dispersion a is the upper limit of the first class h the length of the classes k minimal number of observations in each class g is equal 1 if output of the computations are wanted T the value of the test criterion X the observations. At the exit the value of g is the number of classes which are used ;begin integer i,j,q,v,r,y,l ; real W,B ; boolean out; _____ _______ ____ _______real procedure Psi(z) ; value z; real z; ____ _________ _____ ____Psi:=1-1/(1+0.07052308⨯B⨯z + 0.04228201⨯(B⨯z)∧2 + 0.00927053⨯(B⨯z)∧3+ | |0.00015201⨯(B⨯z)∧4 + 0.00027657⨯(B⨯z)∧5 + 0.00004306⨯(B⨯z)∧6)∧16 ; | | | |B:=1/sqrt(2) ; if k<0 then k:=0 ; __ ____if h_0 then begin writetext(|< the length of the classes is too small|); __ < ____ _____ < >h:=10∧(-8) end ; | ___for i:=n-1 step -1 until 1 do ___ ____ _____ __for j:=1 step 1 until i do ___ ____ _____ __if X[j]>X[j+1] then begin W:=X[j] ; X[j]:=X[j+1] ; X[j+1]:=W end ; __ ____ _____ ___comment The elements of X have been ordered ; _______q:=entier((X[n]-a)/h) + 1 ; l:=q+1 ;comment l is the total number of classes ; _______begin integer array on[1:l] ; array F[0:l],cl,U[1:l] ; _____ _______ _____ _____T:=a ; v:=y:=r:=0 ; i:=1 ; ONCE: j:=0 ; AGAIN: i:=i-1 ;for i:=i+1 while X[i]<T do j:=j+1 ; ___ _____ __T:=T + h ; r:=r + 1 ;if j<k ∧ r<q then go to AGAIN ; __ ____ __ __y:=y+1 ; v:=v+j ; cl[y]:=T-h ; on[y]:=j ;if r<q then go to ONCE ; __ ____ __ __comment cl[i] are the class limits. on[i] is the observed number _______in the class (cl[i-1] - cl[i]). All classes, except possibly the last two, contain at least k elements ; v:=n-v ; r:=j+v ;if r<k then begin y:=y-2 ; on[y+1]:=on[y+1]+r end else __ ____ _____ ___ ____if j<k ∨ v<k then begin y:=y-1 ; on[y+1]:=r end __ ____ _____ ___else on[y+1]:=v ; ____comment Each of the last two classes contains now at least k elements ; _______T:=F[0]:=0 ;for i:=1 step 1 until y do ___ ____ _____ __begin _____W:=(cl[i] - m)/s ;if W<0 then F[i]:=.5 - .5⨯Psi(-W) else F[i]:=.5 + .5⨯Psi(W) ; __ ____ ____W:=F[i-1]:=n⨯(F[i] - F[i-1]) ;W:=U[i]:=if W_0 then 0 else (on[i] - W)∧2/W ; __ < ____ ____ |T:=T + Wend i ; ___W:=F[y]:=n⨯(1-F[y]) ;W:=U[y+1]:=if W_0.00000001 then 0 else (on[y+1] - W)∧2/W ; __ < ____ ____ |T:=T + W ;comment _______In the class (cl[i-1] - cl[i]) are grouped on[i] observations, the corresponding theoretical number is F[i-1].U[i]=(on[i] - F[i-1])∧2/F[i-1]. T=Sum(U[i]) is the value of |the test criterion ;if g=1 then __ ____begin _____out:=|-dd dd dd.dd|; < >writetext(|< Class limits Observed number Theor. number <_on_cn_∧_|) ; (__-__)|2> _writecr;writetext(|< cl on cn <cn|); >writecr; writesp(15); write(out,cl[1]); writesp(3); write(out,on[1]); writesp(3); write(out,F[0]); writesp(3); write(out,U[1]); writecr;for i:=2 step 1 until y do ___ ____ _____ __begin _____write(out,cl[i-1]); writesp(3); write(out,cl[i]); writesp(3); write(out,on[i]); writesp(3); write(out,F[i-1]); writesp(3); write(out,U[i]); writecr;end ___write(out,cl[y]); writesp(30); write(out,on[y+1]); writesp(3); write(out,F[y]); writesp(3); write(out,U[y+1]); writecr;writetext(|<_chi_square=_|); < , , ,>write(out,T); writecr;writetext(|<_degrees_of_freedom_|); < , , , ,>write(|pddd|,y-2); < >end if output of results is wanted; ___g:=y+1;end ___end chi square test; ___select(8);writecr;p:=0;nextdatagroup:for n:=read integer while n|0 do ___ _____ = __begin _____writechar(11); g:=1;p:=p+1; m:=read real;s:=read real;a:=read real;h:=read real;k:=readinteger;begin _____real array A[1:n];sum:=0; ____ _____writetext(|<sample number:|);write(|ddd|,p); < > < >writecr;for i:=1 step 1 until n do ___ ____ _____ __begin _____A[i]:=read real;sum:=sum+1;if A[i]=0 then __ ____begin _____writetext(|<input error:too few elements in the datagroup.|); < >writecr;writecr;writecr;go to nextdatagroup; __ __end ___end; ___for l:=read real while l|0 do ___ _____ = __begin _____sum:=sum+1;writetext(|<input error:too many elements in the datagroup.|); < >writecr;end;writecr;writecr; ___if sum>n then go to nextdatagroup; __ ____ __ __chi square test(n,m,s,a,h,k,g,T,A); writecr;writetext(|<level of significance:|); < >writecr;writecr;writecr;end ___end ___end;t< ___