{VERSION 1 0 "X11/Motif" "1.0"}{GLOBALS 3 1}{FONT 0 "-adobe-helve
tica-bold-r-normal--14-*" "helvetica" "Helvetica-Bold" 8 12 0 "He
lvetica-Bold" 12}{FONT 1 "-adobe-times-medium-r-normal--14-*" "ti
mes" "Times-Roman" 4 12 64 "Times-Roman" 12}{FONT 2 "-adobe-couri
er-medium-r-normal--14-*" "courier" "Courier" 4 12 192 "Courier" 
12}{FONT 3 "-adobe-new century schoolbook-bold-r-normal--*-140-*-
*-*-*-*-*" "new century schoolbook" "Times-Bold" 8 14 64 "Times-B
old" 14}{SCP_R 1 0 29{COM_R 2 0{TEXT 3 21 "Random distributions."
}}{COM_R 3 0{TEXT 1 111 "\012Authors: Je'ro^me M. Lang, Zaven Kar
ian\012\012NOTE: due to the nature of this problem, the exact out
put will vary.\012"}}{COM_R 4 0{TEXT 1 52 "Load the subpackage `r
andom` of the `stats` package."}}{INP_R 5 0 "> "{TEXT 0 20 "with(
stats[random]);"}}{COM_R 6 0{TEXT 1 89 "Give 200 points randomly \+
distributed according to a chi-square with 3 degrees of freedom."
}}{INP_R 7 0 "> "{TEXT 0 26 "sample:=chisquare[3](200);"}}{COM_R 
8 0{TEXT 1 102 "Tally them in the three regions 0 to 1, 1 to 5 an
d 5 to 15. Any extras end up in the variable 'extra'."}}{INP_R 9 
0 "> "{TEXT 0 73 "tsample:=stats[transform,tallyinto['extra']]([s
ample],[0..1,1..5,5..15]);"}}{COM_R 10 0{TEXT 1 44 "A histogram p
lot will show the distribution."}}{INP_R 11 0 "> "{TEXT 0 36 "sta
ts[statplots,histogram](tsample);"}}{COM_R 12 0{TEXT 1 116 "In or
der to compare with the theoretical curve, the experimental data \+
have to be scaled to have a total weight of 1."}}{INP_R 13 0 "> "
{TEXT 0 61 "scaled_tsample:=stats[transform,scaleweight[1/200]](t
sample):"}}{COM_R 14 0{TEXT 1 33 "Show that the weight is indeed \+
1."}}{INP_R 15 0 "> "{TEXT 0 38 "stats[describe,count](scaled_tsa
mple);"}}{COM_R 16 0{TEXT 1 77 "Load the `statevalf` subpackage f
or numerical evaluation of pdf[chisquare[3]]"}}{INP_R 17 0 "> "
{TEXT 0 23 "with(stats[statevalf]);"}}{COM_R 18 0{TEXT 1 70 "Disp
lay both a histogram of the scaled data, and the theoretical curv
e"}}{INP_R 19 0 "> "{TEXT 0 98 "plots[display](\{stats[statplots,
histogram](scaled_tsample),  \012  plot(pdf[chisquare[3]],0..15) \+
\} );"}}{COM_R 20 0{TEXT 1 34 "Load up the `describe` subpackage.
"}}{INP_R 21 0 "> "{TEXT 0 22 "with(stats[describe]);"}}{COM_R 22
 0{TEXT 1 50 "Prepare for computing the 3 quartiles of the data."
}}{INP_R 23 0 "> "{TEXT 0 42 "Qs:=[quartile[1],quartile[2],quarti
le[3]];"}}{COM_R 24 0{TEXT 1 13 "Compute them."}}{INP_R 25 0 "> "
{TEXT 0 13 "Qs([sample]);"}}{COM_R 26 0{TEXT 1 28 "Compute the 37
th percentile."}}{INP_R 27 0 "> "{TEXT 0 25 "percentile[37]([samp
le]);"}}{COM_R 28 0{TEXT 1 31 "Compute the 37.5th percentile. "}}
{INP_R 29 0 "> "{TEXT 0 29 "quantile[375/1000]([sample]);"}}
{INP_R 30 0 "> "{TEXT 0 0 ""}}}{END}
