WPC0R v~O\\=Uϥթwvy++_' r L難a:~vc5/tO\2zq F"&}]l;"SS}H⶚%`+s%/,ϵ(ej08tIf)s+*1LRE> 8rzCq!菜/&SocVe0"mQV \9.?Q+v 9|kRalˑL O"?)rZ&p ZKK X~"4iݗ+R(ycF0jYpĞYui.) E~6Pz2cbN## tKP $}uZ:Ud2GG!YK{I[}W݋b wy1*t}B# %e Ck 0fw4 m+^ 3N?U:A{AUTU:$ u.^^U,HH 0HHHEIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII BIIIIIIIIIIIIIIIIIIIIIIIIIIII D5IIIII ASIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII C0(J(J(J(J(J(J(J(J(J(J(J(J(J(J(J(J(J(J(J(J(J(J(J D3XJ B7J B7JJJJJJ 0JJJJ 0{K 0DKKK D+ALALAL ClL BLLLL B*LLL D3L BM D3MMMMMMM BPMPMPMPM CmMmMmMmMmMmM BMMMMMMMMMMMMMMMMM CjNjNjNjNjNjNjNjNjNjNjNjNjNjNjNjNjNjNjNjNjNjNjNjNjNjNjNjNjNjNjNjNjNjN D3NNNNNN D3NNNNN D/N D3O D3LO B*O D3O B*O D3P B*9P D3cP BP D5P D-P DKQQQQQQQQQQ C`Q CzQzQzQzQ CQ CQ CQ CQ CQ CRHP LaserJet 5L0X d(>#o$X XXXFXX Mo4 O},t]3|xU o4 ,{AZ"Arial RegularLevel 1Level 2Level 3Level 4Level 5  'X+XXXAXX+  SMR.wcm@Version13.02006March15(#Page  1  ڀof  6  ڈ  CharlesRossiter@cccharles@rossiter.co.za o AM) xdE-xA . Z<Century Schoolbook Regular"Arial Regular95 H:\MasterMacros\SMR.wcm,~---5u.:!$CHECKVERSION11@$[[LOWER[[[UPPER[&[SMRDEC'o SMR(o OBS)o EXP+[ SMRDISPLAY,[#INSERTINTOTEXT-H[LIB@.H[LIB~@U[o0.0000o0.0253o0.242o0.619o1.09o1.62o2.20o2.81o3.45o4.12o4.80o5.49o6.20o6.92o7.65o8.40o9.15o9.90o10.67o11.44o12.22o13.00o13.79o14.58o15.38o16.18o16.98o17.79o18.61o19.42o20.24[P LOWER[x[o3.69o5.57o7.22o8.77o10.24o11.67o13.06o14.42o15.76o17.08o18.39o19.68o20.96o22.23o23.49o24.74o25.98o27.22o28.45o29.67o30.89o32.10o33.31o34.51o35.71o36.90o38.10o39.28o40.47o41.65o42.83[P UPPER[HoSMRinLQ[ LE[LE[LE[LE[[[[[LIo SMR InputLNB'@HoSMRinLQ oSMRLQ[LE[LE[*LE[ LE[[LI oSMRLQB'@H oSMRinLQ oSMRLQ[7LE[LE[2LE[ LE[LIvSMRINLRB y'@HoSMRinLQ oObsLQ[LE[-LE[*LE[ LE[[LIoObservedLQB'@H oSMRinLQ oObsLQ[7LE[,LE[2LE[ LE[LIvOBSINLRB y'@HoSMRinLQ oExpLQ[LE[FLE[*LE[ LE[[LIoExpectedLQB'@H oSMRinLQ oExpLQ[7LE[ELE[2LE[ LE[LIvEXPINLRB y'@HoSMRinLQoSMRDecLQ[LE[nLE[>LE[ LE[[LI%oOutput decimalsLQB'@H oSMRinLQoSMRDecLQ[PLE[kLE[LE[LEx@LIvSMRDECLR[L @[L @[L @B x'@r SMRDISPLAY[*> HoSMRinLQo WordPerfectLQ oSMRLQB'@ HoSMRinLQo WordPerfectLQ oObsLQB'@)rMACRODIALOGRESULT[; ,QUIT_ rSMRIN SMRrOBSIN OBSrEXPIN EXPrSMRINo* [ SMRDISPLAY [ SMRDISPLAY[BLANK rSMRo*1[BLANK1 rOBSo*rBLANK[BLANK rEXPo*rBLANK[BLANKrBLANK[-2!, NOTENOUGHDATA2 CALCULATE@oSMR= rSMRo Obs= rOBSo Exp= rEXPSTVALHoSMRinLQ[LQB'@HoSMRInLQB'@ o(rLOWER o - rUPPER o) CIHoSMRoutLQ[ LE[LE[LE[LE[[[LIo SMR OutputLNB'@HoSMRoutLQoStValLQ[LE[ LE[/LE[ LE[[LI!o Input values:LQB'@HoSMRoutLQoStValLQ[7LE[ LE[LE[ LE[[LIrSTVALLQB'@rDISCREP[*-HoSMRoutLQoDiscLQ[LE[LE[LE[ LE[[LIGo *** Check discrepancy in SMR ***LQB'@-HoSMRoutLQ oSMRLQ[LE[(LE[HLE[ LE[[LI oSMRLQB'@HoSMRoutLQoSMR1LQ[dLE[(LE[2LE[ LE[[LI rSMRLQB'@HoSMRoutLQo Conf. Int.LQ[LE[7LE[HLE[ LE[[LI-oConfidence IntervalLQB'@HoSMRoutLQ oCILQ[dLE[7LE[FLE[ LE[[LI rCILQB'@HoSMRoutLQ[LQ[dLE[nLE[KLE[LE/o&Another calculationLNB'@HoSMRoutLQ oOKLQ[LE[ZLE[7LE[LE[LI)o&Insert into textLNB'@HoSMRoutLQoCancelLQ[LE[nLE[7LE[LE[LIoExitLNB'@HoNEXT1LOB*@#rINSERTINTOTEXT[*HoSMRoutLQo WordPerfectLQ oOKLQB'@0HoSMRoutLQo WordPerfectLQoCancelLQB'@HoQUIT_LOB*@)rMACRODIALOGRESULT MDRHoSMRoutLQ[LQB'@HoSMRoutLQB'@[#INSERTINTOTEXT rMDR[*e, SMRINAGAIN rMDR[*,QUIT_HB)HI rSMR o  rCILQESHI o rSMR o  rCILQE[#INSERTINTOTEXT, SMROUTAGAIN,QUIT_ rSMRo* o0 SMR rOBSo*B o0 OBSB rEXPo* o0 EXPH rSMRLQB )DSMRH rOBSLQB )DOBSH rEXPLQB )DEXP rEXP o0*$rDSMR[*!, NOTENOUGHDATA[drDOBS:rDSMR!DEXPrDEXPrSMRDEC[TRUNCATE EXP$ rOBS o0*rDSMRrDEXP: a{Gz?:DOBSrDOBS[TRUNCATE OBSH rOBSLQB )DOBS  rSMR o0*rBLANK[*? [drDOBS:rDEXP!DSMR  [DISCREPrBLANK[*HrDSMRH rSMRLQB )LJBr([-?[DISCREP?rDSMRrSMRDECTRUNCATE SMRH rSMRLQB )DSMRrDOBS[- , CHISQCALC H[drDOBS[[SLOWER[:LQB )DLOWERrDLOWERrDEXP!rSMRDECTRUNCATELOWERH[drDOBS[[SUPPER[:LQB )DUPPERrDUPPERrDEXP!rSMRDECTRUNCATEUPPER[|[rDOBS:[ V aq? rV! A rA a?A B  rB a\(\?: C![ rA rC[A D" a? rV: rD: E# rE[d:rDEXP!DUPPER$rDUPPERrSMRDECTRUNCATEUPPER&[rDOBS: V' aq? rV! A( rA a?A B) rB a\(\?: C*[ rA rC[A D+ a? rV: rD: E, rE[d:rDEXP!DLOWER-rDLOWERrSMRDECTRUNCATELOWER.[|1''DECIMALSDVAL4rDVAL a?[ rDECIMALSA! ah㈵>DVAL5HrDVALL@B) VAL7H rVALLQ o.LQB )DECPOS8rDECPOS[*7&9H rVALLQ o,LQB )DECPOS:7&<H rVALLQ[LUrDECPOS[LUB)VAL1=rDECIMALS[-B'>rVAL1H rVALLQrDECPOSLUrDECIMALS[LUB) VAL?h'@rVAL1 VALAB rVAL|C[|5EFHoSMRinLQ[LQB'@GHoError!LNEoYou must enter at least 2 boxesLN[xLIBn)@H, SMRINAGAINJKHE*N,,QHx LIB)VHRTRH[L@[LIB,+ NNNS rNNN aXb/FB2 rNNN a`/FB-x,THvVANSLR!o Macro VersionLN]o+ You are running the first build of WPWin11rVHRToFThere is no certainty that any macro will run correctly in that build.rVHRTrVHRToYPlease install the latest service pack from ftp://ftp.corel.com/pub/WordPerfect/wpwin/11/rVHRTrVHRTo=Click "OK" to run the macro anyway. Click "Cancel" otherwiserVHRTLN[[LIBn)@ZrVANS[-n,HE*n,x,\[|5[)5!1! CHISQCALC!1 CALCULATE10NEXT1)1E' NOTENOUGHDATA1Jm(QUIT_%1 SMROUTAGAIN#1 SMRINAGAIN++1N(CHECKVERSION1111$TRUNCATEN!OEN WordPerfect!OEN WordPerfect)OENPSMacroFacility/OENPSMacroInterpreter,iAZArial (Z3$ #o!X+XXXAXX+   dMMMM)!dxdxiE<<C,Sticky Notedd'dxd3+0 d d d3+0 d d d(Z2$ #o!X+XXXAXX+  (Z3$ #o!X+XXXAXX+  ($$   1  'dxdd d&0 d d'dxd  d'dxdP Pdd dLevel 1Level 2Level 3Level 4Level 5dd'dxd'dxd' dxd'dxd$$$$'dxd&P d d&&&&'dxd&p d Pd(((('dxd&p Pd d****'dxd dMMMMM'dxdM'dxdMMMM?Single Blue!dxdxd(d2d(#p(#p(#2006March15 72  Macroforcalculatingthe95%confidenceintervalsforanSMR,giventhevaluesof  atleast2ofSMR,observedcases,expectedcases    #A A# AACharlesE.Rossiter0 0 (# (#0h(#(# charles@rossiter.co.za #A A#2(#h(#h(# WordPerfectversion9X3LԈ 3 .  @ ,@ AAAA   AA A@ dd A InputvaluesareSMR,observed,expected,numberofdecimalplaces(02) p k  OutputvaluesareSMR,andthe95%confidencelimitsfortheSMR   Theoutputcanbecopiedtothedocumentscreen;repeatcalculationsmaybemade;acheckismade lg  0  ontheSMRvalue,ifallthreepossibleinputvaluesaregiven.+& (#(# ThemethodisthatforcalculatingtheconfidencelimitsforaPoissonvariable,asdescribed   0  intheBiometrikatables.Thelimitscanbedeterminedfortheupperandlowerhc (#(# 0  significancelevelsdirectlyusingthe5%and95%chisquaredpointsfor2'observedand'" (#(# 0  2'(observed+1)degreesoffreedom,respectively. (#(# Forobservedlessthanorequalto30,exactvaluesareused,asinthearrays d_ 0  Obs[],Lower[]andUpper[],below.#(#(# Forobservedgreaterthan30,apreciseapproximationtochisquaredisused,in  0  subroutine ChiSqCalc below.`[(#(# #A A<#@^@, ,AEndIfPlatform("Comments01")#A ,, #  Application(A1;"WordPerfect";Default)   2(#. //CheckBuildofWPWin11     CallCheckVersion11()  MH  C  | 0   #:(#.(#(##  // Initialization  Ԉ " LocalLower[31];Upper[31]  # SMRDec=0 "% SMR="" "& Obs="" #' Exp="" E$@( SMRDisplay=1 %* InsertIntoText=0 &}+ InhibitInput(Off!) A'< , Display(On!) ( -   (#.  //Notethatthe"arrayofobserveds"isadummyarrayforvisualconvenienceonlyԈ (!.   ~)y"/ 'X` XX'.UUXUUXUU(#(#. //ArrayofObserveds   //Obs[]:=  //{ ~ // "0"; B = // "1";   // "2";   // "3";  z // "4"; > 9 // "5";   // "6";    // "7"; {v  // "8"; :5  // "9";   //~~ "10";   //~~ "11"; wr  //~~ "12"; 61  //~~ "13";   //~~ "14";   //~~ "15"; sn  //~~ "16"; 2- //~~ "17";  //~~ "18";  //~~ "19"; oj //~~ "20"; .) //~~ "21";  //~~ "22";  //~~ "23"; kf //~~ "24"; *% //~~ "25";  //~~ "26";  //~~ "27"; gb //~~ "28"; &! //~~ "29";   // "30" ! А//} c ^"  //ArrayforLowerCI & " Lower[]:= # { ~$ ``$"0.0000"; B =% ``$"0.0253";  & ``$"0.242";  ' ``$"0.619";  z( ``$"1.09"; > 9) ``$"1.62";  * ``$"2.20";  + ``$"2.81"; {v, ``$"3.45"; :5- ``$"4.12"; . ``$"4.80";  / ``$"5.49"; wr 0 ``$"6.20"; 61 1 ``$"6.92";  2 ``$"7.65";  3 ``$"8.40"; sn 4 ``$"9.15"; 2-5 ``$"9.90"; 6 #"10.67"; 7 #"11.44"; oj8 #"12.22"; .)9 #"13.00"; : #"13.79"; ; #"14.58"; kf< #"15.38"; *%= #"16.18"; > #"16.98"; ? #"17.79"; gb@ #"18.61"; &!A #"19.42"; B #"20.24" C } c ^D  //ArrayforUpperCI  D Upper[]:= E { ~F PP;"3.69"; B =G PP;"5.57";  H PP;"7.22";  I PP;"8.77";  zJ :"10.24"; > 9K :"11.67";  L :"13.06";  M :"14.42"; {vN :"15.76"; :5O :"17.08"; P :"18.39";  Q :"19.68"; wr R :"20.96"; 61 S :"22.23";  T :"23.49";  U :"24.74"; sn V :"25.98"; 2-W :"27.22"; X :"28.45"; Y :"29.67"; ojZ :"30.89"; .)[ :"32.10"; \ :"33.31"; ] :"34.51"; kf^ :"35.71"; *%_ :"36.90"; ` :"38.10"; a :"39.28"; gbb :"40.47"; &!c :"41.65"; d :"42.83" e } c ^f ' XX` X'.UUXUUXUUG G . Label(SMRinAgain) 0 0 (# (#0h(#(#0h(#h(#0(#(#0p(#(#//Forsubsequentcalculations!fp(#p(#  (#. // Dialogforatleast2ofinputofSMR,observedandexpecteddeaths S%Ԉ _#Zh DialogDefine("SMRin";10;1;150;150;OK!|Cancel!|PerCent!|ModeLess!|Sizeable!;"SMRInput") $j DialogAddText("SMRin";"SMR";8;20;42;10;Left!|RecessBox!;"SMR") [&Vl DialogAddEditBox("SMRin";"SMR";55;19;50;12;Left!;SMRin) ' m DialogAddText("SMRin";"Obs";8;45;42;10;Left!|RecessBox!;"Observed") ' n DialogAddEditBox("SMRin";"Obs";55;44;50;12;Left!;Obsin) (!o DialogAddText("SMRin";"Exp";8;70;42;10;Left!|RecessBox!;"Expected") W)R"p DialogAddEditBox("SMRin";"Exp";55;69;50;12;Left!;Expin) *#q DialogAddText("SMRin";"SMRDec";8;110;62;10;Left!|RecessBox!;"Outputdecimals") *#r DialogAddCounter("SMRin";"SMRDec";80;107;22;15;AutoValidate!;SMRDec;0;2;1) +$s  hh((#. //EndofDialogCreationforSMRin [)Ԉ - &u   -&v  -(#.  // Forsubsequentcalculations )Ԉ  If(SMRDisplay=1)    DialogShow ("SMRin";"WordPerfect";;"SMR") ~   Else B =   DialogShow ("SMRin";"WordPerfect";;"Obs")   Endif   If(MacroDialogResult<>1) Go(Quit_) Endif  z SMR=SMRin   Obs=Obsin    Exp=Expin {v  If(SMRin="")0 ` SMRDisplay=00` (#` (#ELSE0h(#(#SMRDisplay=10ph(#h(#Endif p(#p(# Blank=0 wr  If(SMR="")blank=1Endif 61  If(Obs="")blank=blank+1Endif   If(Exp="")blank=blank+1Endif   If(blank>1) Go(NotEnoughData) Endif (#.- //erroriflessthan2itemsofinputdata -Ԉ sn   Call(Calculate)    StVal="SMR="+SMR+"Obs="+Obs+"Exp="+Exp6(#.8 //Foroutputdisplay    .DialogDismiss ("SMRin";1) .) DialogDestroy("SMRIn")  CI="("+Lower+""+Upper+")"  Label(SMROutAgain) kf 66(#. // Dialogfordisplayofcalculationsandinputvalues /Ԉ  DialogDefine("SMRout";10;1;210;130;PerCent!|ModeLess!|Sizeable!;"SMROutput") gb DialogAddText("SMRout";"StVal";8;10;47;10;Left!|RecessBox!;"Inputvalues:") &! DialogAddText("SMRout";"StVal";55;10;147;10;Left!|RecessBox!;StVal)   ff(#.  //DisplayfordiscrepancybetweengivenandcalculatedSMR w1Ԉ ! If(Discrep=1) c ^" DialogAddText("SMRout";"Disc";8;25;194;12;Center!|ShadowBox!; "!#    ` "***CheckdiscrepancyinSMR***") !$ Endif "% DialogAddText("SMRout";"SMR";8;40;72;10;Left!|RecessBox!;"SMR") _#Z& DialogAddText("SMRout";"SMR1";100;40;50;10;Left!|RecessBox!;SMR) $' DialogAddText("SMRout";"Conf.Int.";8;55;72;10;Left!|RecessBox!;"ConfidenceInterval") $( DialogAddText("SMRout";"CI";100;55;70;10;Left!|RecessBox!;CI) %) DialogAddPushButton("SMRout";6;100;110;75;14;;"&Anothercalculation") [&V* DialogAddPushButton("SMRout";"OK";8;90;55;14;OKBttn!;"&Insertintotext") ' + DialogAddPushButton("SMRout";"Cancel";8;110;55;14;CancelBttn!;"Exit")  ' , '(#. //EndofDialogCreationforSMRou 5t (!- OnCancel(Next1) ??!(#. //Touse"CancelBttn"fordirectingmacro 96Ԉ W)R". If(InsertIntoText=1) *#/   DialogShow ("SMRout";"WordPerfect";;"OK") *#0   Else +$1   DialogShow ("SMRout";"WordPerfect";;"Cancel") S,N%2 Endif  - &3  Label(Next1)   OnCancel(Quit_)  MDR=MacroDialogResult ~  DialogDismiss ("SMRout";1)    DialogDestroy ("SMRout")"(#.N N !8@"(# //Needed,otherwisedisplayisincorrect 8Ԉ   InsertIntoText=0  z If(MDR=6) Go(SMRInAgain) Else8(#.tt'9@8(# //Nextcalculation 9Ԉ     If(MDR=2) Go(Quit_) EndifEndif+(#./ //Exitwithoutmorecalculation :Ԉ    If(?DocBlank)Type(SMR+""+CI) {v  Else :5  Type(""+SMR+""+CI).(#.   //Insertresultsindocument ~;Ԉ   EndIf   InsertIntoText=1 61   Go(SMROutAgain)    Go(Quit_)     (#. //Calculationroutines:Variablesholdingnumericdataallbeginwith"D" k<Ԉ 2-  Label(Calculate)   If(SMR="")SMR="0"Endif oj If(Obs="")Obs="0"Endif .) If(Exp="")Exp="0"Endif  DSMR=StrNum(SMR) kf DObs=StrNum(Obs) *% DExp=StrNum(Exp)  If(Exp="0") gb If(DSMR=0) Go(NotEnoughData) Endif&(#.--,>@&(# //ErrorifbothSMRandExpected=0 >Ԉ &!   DExp=100*DObs/DSMR     Exp=Truncate(DExp;SMRDec+1) ! Endif c ^" If(Obs="0") !$   Dobs=DSMR*DExp*0.01 "%   Obs=Truncate(DObs;0)  _#Z&   DObs=StrNum(Obs)-(#. {@@-(# //Observedmustbeaninteger @Ԉ $' Endif $( If(SMR="0"orBlank=0) [&V*   DSMR=100*DObs/DExp ' + Endif ' , Discrep=07(#.A@7(# //CheckSMR=ObsExp BԈ W)R". If(Blank=0andAbsVal(DSMRStrNum(SMR))>1)Discrep=1Endif *#/  SMR=Truncate(DSMR;SMRDec)  +$1 DSMR=StrNum(SMR) S,N%2   - &3 /(#. // Startcalculationsproper :CԈ  If(Dobs>30) GO(ChisqCalc) Endif,(#.)//Morethan30observeddeathsCԈ  DLower=StrNum(100*Lower[DObs+1])uu1(#.*vD@uu1(# //Getfactorsfromarrays DԈ ~ Lower=Truncate(DLower/DExp;SMRDec) B = DUpper=StrNum(100*Upper[DObs+1])   Upper=Truncate(DUpper/DExp;SMRDec)   Return  z  Label(ChisqCalc)!(#.  @!(# //Biometrikaapproximationtochisquared EԈ   <<=(#. F@<<=(# //Upperlimit FԈ    v=2*DObs+2 {v  a=0.222222222/v :5  b=a**0.5   c=b*1.96   d=(1a+c)**3 wr  e=0.5*v*d 61  DUpper=e*100/DExp   Upper=Truncate(DUpper;SMRDec)   33=(#. UH@33=(# //Lowerlimit HԈ sn  v=2*Dobs 2- a=0.222222222/v  b=a**0.5  c=b*1.96 oj d=(1ac)**3 .) e=0.5*v*d  DLower=e*100/DExp  Lower=Truncate(DLower;SMRDec) kf Return *%    FunctionTruncate(DVal;Decimals)   (#. //FunctiontotruncateanumbertoagivennumberofdecimalplaceswJԈ   DVal=DVal+(0.5/(10**Decimals))0.00001tt+(#.[[4DK@tt+(# //Toensureroundingiscorrect KԈ B = Val=NumStr(DVal)   DecPos=StrPos(Val;".")  z If(DecPos=0) > 9 ЀDecPos=StrPos(Val;",")   ЀEndif    Ѐ {v  Val1=SubStr(Val;1;DecPos1) :5  If(Decimals>0)     Val=Val1+SubStr(Val;DecPos;Decimals+1)   ЀElse wr    Val=Val1 61  EndIf    Return(Val) +(#.--M@+(# //Returnstringvariableresult8NԈ   EndFunc  sn   Label(NotEnoughData)   DialogDismiss("SMRin";1)  MessageBox(;"Error!";"Youmustenteratleast2boxes";IconHand!|Beep!) oj Go(SMRinAgain) .)  Label(Quit_)   Quit kf  ProcedureCheckVersion11()  2(#. //CheckBuildofWPWin11  &! OvHRt=NToC(63754)   nnn=VersionInfo(PerfectFitVersion!;ProductVersionNumber!) ! If(nnn<11000000000300.0andnnn>11000000000000.0) c ^" MessageBox(vAns;"MacroVersion";"YouarerunningthefirstbuildofWPWin11"+vHRt+ "!# "Thereisnocertaintythatanymacrowillruncorrectlyinthatbuild."+vHRt+vHRt+ !$ "Pleaseinstallthelatestservicepackfromftp://ftp.corel.com/pub/WordPerfect/wpwin/11/"+vHRt+vHRt+ "% "Click""OK""torunthemacroanyway.Click""Cancel""otherwise"+vHRt; _#Z& OKCancel!|IconWarning!) $' If(vAns>1)0 ` Quit0 ` (#` (#EndIf0 (# (#EndIf%)(#(#  EndProc  ' + S