home *** CD-ROM | disk | FTP | other *** search
- .MCD 20000 0
- .CMD PLOTFORMAT logs=0,0 subdivs=1,1 size=5,15 type=l
- .CMD FORMAT rd=d ct=10 im=i et=3 zt=15 pr=3 mass length time charge
- .CMD SET ORIGIN 0
- .CMD SET TOL 0.001000
- .CMD MARGIN 0
- .CMD LINELENGTH 78
- .CMD SET PRNCOLWIDTH 8
- .CMD SET PRNPRECISION 4
- .TXT 0 41 1 39
- a1,38,49,37
- Copyright (c) 1988 by MathSoft, Inc.
- .TXT 1 40 1 49
- a1,48,78,47
- /EQUATIONS FOR CUMULATIVE DISTRIBUTION OF DATA
- .TXT 1 -60 1 34
- a1,33,59,32
- CUMULATIVE DISTRIBUTION OF DATA
- .TXT 2 -21 3 81
- a3,80,78,188
- This application constructs an approximation to the cumulative distribution of
- a set of data points using MathCAD's histogram function.
-
- .TXT 2 80 1 46
- a1,45,78,44
- Establish the interval covered by each bin.
- .EQN 1 -80 1 20
- V~READPRN(CDIST)
- .TXT 0 22 1 46
- a1,45,56,44
- <-- enter file from which data will be read
- .EQN 1 64 1 12
- U~max(V)
- .EQN 0 18 1 12
- L~min(V)
- .EQN 1 -104 1 11
- NBIN~30
- .TXT 0 11 2 23
- a2,22,61,38
- <-- number of bins
- in histogram
- .EQN 0 58 1 9
- T=?
- .EQN 0 24 3 11
- H~(U-L)/NBIN
- .EQN 1 -59 11 35
- T&0&C[J{1,1,9,30,l}@U&L&BINS[J
- .EQN 2 -34 1 10
- NORM~1
- .TXT 0 11 4 23
- a4,22,20,84
- <-- set to 1 if the
- result should be
- normalized, set
- to 0 otherwise
- .TXT 1 69 1 39
- a1,38,78,37
- Create an array containing the bins.
- .EQN 2 18 1 28
- I~ORIGIN;NBIN+ORIGIN
- .EQN 2 0 2 28
- BINS[I~L+(I-ORIGIN)*H
- .TXT 1 -98 1 26
- a1,25,78,24
- sample characteristics:
- .EQN 1 6 1 19
- length(V)={19027}?
- .TXT 0 74 2 76
- a2,75,78,112
- Create an array containing the number of data values falling within each
- interval specified in the BINS array.
- .EQN 1 -72 1 19
- mean(V)=?
- .EQN 1 2 1 17
- sd(V)=?
- .EQN 0 27 1 14
- L={18995}?
- .EQN 0 29 1 13
- U=?
- .EQN 1 38 1 18
- P~hist(BINS,V)
- .TXT 1 -103 1 15
- a1,14,76,13
- [Ctrl][PgDn]
- .TXT 0 79 1 15
- a1,14,78,13
- [Ctrl][PgDn]
- .TXT 2 0 1 77
- a1,76,78,75
- Create an array containing the cumulative distribution corresponding to P.
- .EQN 2 20 1 26
- J~ORIGIN+1;last(P)
- .TXT 2 -98 5 79
- a5,78,76,377
- The function C plotted above is actually a step function, with as many steps
- as there are bins for the histogram function. The plot appears as a smooth
- curve because the values of C are plotted using plot type l (line). You can
- define a smoothed cumulative distribution by using MathCAD's linterp
- function with the normalized step function C (set NORM equal to 1 above):
- .EQN 0 82 2 13
- C[ORIGIN~0
- .EQN 0 19 2 16
- C[J~C[(J-1)+P[J
- .EQN 0 22 2 19
- C[NBIN~length(V)
- .TXT 3 -45 2 78
- a2,77,78,96
- Prepare an index variable for plotting the above array, then normalize the
- array if necessary.
- .EQN 2 22 3 26
- C~C/if(NORM,length(V),1)
- .EQN 1 31 1 12
- T~max(C)
- .EQN 1 -110 1 33
- CUMEDIST(x)~linterp(BINS,C,x)
- .TXT 2 -21 2 79
- a2,78,76,151
- Now you can estimate the fraction of data values less than any given number.
- For example, the fraction of data values less than 1.05 is approximately
- .EQN 0 107 4 33
- sd(V)~stdev(V)*\(length(V)/(length(V)-1))
- .TXT 2 -29 1 29
- a1,28,78,27
- Sample standard deviation:
- .EQN 1 -52 1 25
- CUMEDIST(1.05)={18994}?
-