boot/0000755000176000001440000000000013577111150011246 5ustar ripleyusersboot/NAMESPACE0000644000176000001440000000145613245463617012505 0ustar ripleyusersexport(abc.ci, boot, boot.array, boot.ci, censboot, control, corr, cum3, cv.glm, EEF.profile, EL.profile, empinf, envelope, exp.tilt, freq.array, glm.diag, glm.diag.plots, imp.moments, imp.prob, imp.quantile, imp.weights, inv.logit, jack.after.boot, k3.linear, lik.CI, linear.approx, logit, nested.corr, norm.ci, saddle, saddle.distn, simplex, smooth.f, tilt.boot, tsboot, var.linear) # documented, registered but not exported # export(lines.saddle.distn, plot.boot, print.boot, print.bootci, print.simplex) importFrom(graphics, abline, hist, identify, layout, lines, par, plot, text) import(stats) S3method(c, boot) S3method(lines, saddle.distn) S3method(plot, boot) S3method(print, boot) S3method(print, bootci) S3method(print, saddle.distn) S3method(print, simplex) boot/ChangeLog0000644000176000001440000002300613506472445013032 0ustar ripleyusersversion 1.3-23 2019-07-01 man/catsM.Rd: correct \usage, clarify 'Sex' is all male. version 1.3-22 2019-04-01 Update de translations. version 1.3-21 2019-03-01 Update for R 3.6.0 change of RNG. version 1.3-20 2017-07-30 Allow for calls like boot::boot(), and record the type (boot/censboot/tsboot/tilt.boot) on the object itself. ?print.boot now makes explicit that this assumes one of those four functions was used to generate the object. version 1.3-19 2017-02-11 Update output for R 3.4.0. version 1.3-18 2016-02-22 Prepare for release with R 3.3.0 version 1.3-17 2015-06-29 Tweak imports. version 1.3-16 2015-02-24 Prepare for release with R 3.2.0 version 1.3-15 2015-02-10 Update ko translations. version 1.3-14 2015-01-10 Update URL in ?EEF.profile. remove some unused assignments. (1.3-13 was not released.) version 1.3-12 2014-09-13 Reduce print precision for abc.ci and boot examples (noLD testing) version 1.3-11 2014-03-28 Update translations version 1.3-10 2014-03-07 Record .Random.seed once parallel namespace is loaded, where needed. Move bd.q to inst Use .Rbuildignore to ignore 'extra-tests' Remove 'Author' field from DESCRIPTION. version 1.3-9 2013-03-20 Add ko translations version 1.3-8 2013-02-09 Update reference output for R 3.0.0 version 1.3-7 2012-10-12 Force byte-compilation for compatibility with versions in R releases version 1.3-6 2012-10-08 Work on messages. Update translations. version 1.3-5 2012-06-27 inst/CITATION: protect against TRE bug in UTF-8 locales. Add Polish translations. version 1.3-4 2012-01-16 DESCRIPTION: needs Suggests: MASS for data(package=) version 1.3-3 2011-10-06 Use package 'parallel' rather than multicore/snow. Update tests/Examples/boot-Ex.Rout.save for byte-compiled R >= 2.14.0. Try to force promises in the ... argument with parallel = "snow" version 1.3-2 2011-06-06 Add 'parallel' argument for tsboot(). Allow a 'snow' cluster to be passed in for parallel operations in boot(), censboot() and tsboot(). Use a wrapper rather than ... to avoid problems with argument names in parLapply etc. Force promises in several places to allow parallel operation with 'snow' (which was passing unevaluated promises to worker processes). version 1.3-1 2011-05-23 (formerly 1.22-44) Much faster verstion of nested.corr. c() method for class "boot". 'parallel' argument for boot() and censboot() using 'multicore' or 'snow'. Code cleanup. version 1.2-43 2010-09-25 Update CITATION version 1.2-42 2010-03-28 Various clean ups, including using sample.int for safety Update boot-Ex.Rout.save for 2.11.0. version 1.2-41 2009-10-15 Update German and Russian translations. version 1.2-40 2009-10-07 Add error message in bca.ci for misuse when all the samples are the same. Add German translation. Update boot-Ex.Rout.save for help rendering changes version 1.2-39 2009-09-04 Update boot-Ex.Rout.save for survival change. version 1.2-38 2009-07-28 Add boot-Ex.Rout.save file, remove timing call in censboot.Rd version 1.2-37 2009-06-16 example(censboot) returned the value of a for() loop: need to change for R 2.10.x. version 1.2-36 2009-03-12 guard aginst (some uses of) sample() on length-1 input version 1.2-35 2009-01-01 make use of integer constants spelling corrections, formats for references, 'the the', Rd markup version 1.2-34 2008-09-05 antithetic.arrray, ordinary.array: return integer matrix. ordinary.array: use as little memory as possible. boot: add 'simple' argument. const: use mean(x, na.rm=TRUE) version 1.2-33 2008-05-05 glm.diag: 'gaussian' not 'Gaussian' for family name. cv.glm.Rd: typo version 1.2-32 2008-03-30 Add inst/CITATION file version 1.2-31 2008-02-18 print.simplex now returns its result invisibly. version 1.2-30 2007-10-03 po/R-ru.po: new file *.Rd: remove old \non_function{} markup. version 1.2-29 2007-08-29 R/*.q add licence/copyright statements melanona.Rd: correct the coding of 'sex' beaver.Rd, bootfuns.q cv.glm.Rd, EEF.profile.Rd: spelling corrections glm.diag.Rd: add \link markup. version 1.2-28 2007-06-12 INDEX, man: change 'library' to 'package' and remove some references to S-PLUS. bootfuns.q: avoid abbreviating arguments, switch to seq.int, add drop=TRUE. DESCRIPTION: R >= 2.4.0 because of seq.int. version 1.2-27 2006-11-29 bootfuns.q : use control=NULL for deparsed calls. version 1.2-26 2006-09-05 smooth.f.Rd, tilt.boot.Rd: omit empty argument version 1.2-25 2006-07-25 censboot.Rd: unique() in mel.fun was not working correctly due to rounding error on some P4 Linux machines. version 1.2-24 2005-12-09 catsM.Rd: correct units for hearts to that given (correctly) in MASS. Add French and en@quot translation. version 1.2-23 2005-07-26 Add error message for a = NA in bca.ci. In cv.glm, eval updated formula in the parent. version 1.2-22 2005-02-01 Improve error messages for possible translation. version 1.2-21 2005-01-21 remove <> in ?boot.array version 1.2-20 2004-11-03 remove require(ts) call in tsboot version 1.2-19 2004-08-12 version 1.2-18 2004-08-03 versions for R 2.0.0. version 1.2-17 2004-04-20 remake datasets: looks like wool, coal and manaus were corrupt. version 1.2-16 2003-12-08 updates for R 1.9.0's namespaces version 1.2-15 2003-10-22 consistency in documentation of default args. tapply(foo)[bar] is now still an array in R. version 1.2-14 2003-08-10 remove unused vars add local definition for is.missing use \dQuote markup in help files. ensure .Random.seed is saved/retrieved in the workspace. remove/comment redundant assignments. version 1.2-13 2003-03-09 update NAMESPACE file censboot.Rd: call generic, not predict.smooth.spline version 1.2-12 2003-03-01 Use namespace, remove help for internal functions. glm.diag.plots had one set of axis labels reversed. version 1.2-11 2003-01-29 Replace inv.logit with overflow-proof plogis. Remove birthwt (from MASS) and help page for lynx. version 1.2-10 2002-11-30 Use optim(method="BFGS") for 1D optimization version 1.2-9 2002-11-05 Remove datasets taken from MASS package. version 1.2-8 2002-04-11 Remove arima.sim. Converted data sets to version 2 .rda, compressed larger ones. More care over .Random.seed. version 1.2-7 2002-01-29 Added some help pages from Angelo Canty. Bug fix to simplex() from Duncan Murdoch. version 1.2-6 2001-11-27 Start documenting rest of the objects and arguments. version 1.2-5 2001-08-16 version 1.2-4 2001-08-08 Use TRUE and FALSE on help pages, add ... to arg lists. version 1.2-3 2001-06-16 Change to survival from survival5. version 1.2-2 2001/03/31 Add priority: recommended. Remove test directory, as R CMD check works (but takes a long time). version 1.2-1 2001/03/03 Mods from Angelo Canty for version 1.2 of the library section. Dataset beaver was corrupted and it has been repaired. Change T, F to TRUE, FALSE in R code. version 1.1-7 2000/12/28 Changes for R 1.2.0, this is really boot version 1.1 now, version 1.0-6 2000/11/27 Re-port all the help files with Sd2Rd 1.15. R-specific change in glm.diag. version 1.0-5 2000/02/06 Change tsboot for R, make tsboot examples work. Revise censboot examples to avoid conflicts with survival5 datasets. Help files for datasets now use keyword `datasets' not `sysdata' Replace nlm by optim, as works much better. One example still fails, but it diverges on S and the authors did not notice. version 1.0-4 1999/11/21 version 1.0-3 Adjustments for later versions of R (removing functions added here). version 1.0-2 1999/02/24 Removed sample, model.response from zzz.R Changed attributes(out$spa)$name<- to names(out$spa)<- in saddle. Altered test/test-examples to make use of the examples now in R-ex. Note that saddle.distn and functions that depend on it (control) may fail due to lack of robustness of nlm. version 1.0-1 1998/07/24 boot/R: Many funs store the .Random.seed but that need not exist, so call runif(1) first. Add missing function union in zzz.R Added version of sample that uses prob= in zzz.R Replace is.matrix by isMatrix <- function(x) length(dim(x)) == 2 as R does not think a data frame is a matrix. Replace reading of a number in glm.diag.plots by readline. Replace nlmin by nlm, with appropriate changes to returned components. (This is not wholly successful, as nlm seems less tolerant.) Comment out assigns to frame=1. split.screen etc are not in R yet: use par(mfrow) in plot.glm.diag and layout in plot.boot. add drop=F in cv.glm, cens.weird. change is.inf to is.infinite. change maxit= in glm calls in saddle to calls to control= boot/data: add a dummy rts: rts <- function(units, name, ...) ts(...) to top of bootdata.q edit n= to nmax= in scan (carefully: also occurs in lists in scan commands). add for(obj in ls()) save(obj, file = paste(obj, ".rda", sep=""), ascii=T) to end of bootdata.q R -v 20 --no-save < bootdata.q cd4.nested is made by bd.q in the top directory. boot/man: convert files by Sd2Rd. Add data() lines. boot/test: script to test the examples in the help files. Not all will run, as far as I know due to things missing in R or nlm not coping as well as nlmin. boot/data/0000755000176000001440000000000013245463622012165 5ustar ripleyusersboot/data/salinity.rda0000644000176000001440000000077713245463622014524 0ustar ripleyusers S=hSQ/}CQ(Hy5`n~REq:uhZ 1&bΝuY3[\D7tKW޼u0 |xmSR* 'rQ*o5OڭNkB94Yy}kKk(FF7/\~ s "xQ.!YWJݷݸo!3ٷ~}eϫ۽4_s?'Í󃛴{ 7Q~O13 )_?lPY!E_OSmحwP[cdO)4L\Q՟ֻ`: 5l!~H Fsdd'y7x-y5ptKiBnE/k^bnj1PP AT(hz8IC2F01acf09acXBLp!egY&p)egYp#Fp;v0an9z&$B+%$Q/( @Iboot/data/tuna.rda0000644000176000001440000000105413245463615013626 0ustar ripleyusers ]?LTAg;ㄗz!n< ;1&X@Eq͋J"ƈ5 6XSSC\BarpF ѷ6owg7on.bMQIU\rKHnd92’}?ݼ`?93~jn}==v_qѮOhj+o1VczkȾѹeO8+Ib/ݦҬOD!ۡ7)U|x uROs|9g\T@P7 `~j:Y>bpF)דrshF8>79O&ď2weu]\>J/|4. 훑S{ka&NIѳBE0QdQLG1uT JB)( e2i(0$ C!`H0$ CP`(0 C`h04 C0`0  Àa0`0202020202?wk[KŸ 8kO,boot/data/melanoma.rda0000644000176000001440000000474013245463622014453 0ustar ripleyusers ͛olǟ"Ҭa-K>'X)T^b7XIۺ1ɦS(RKu”)&5,ƋDË9MfpmsΞ3oܖ9۶-˪jXVM]YW[ƲJΎ݅={; _T_Vҳ׬'tME4݅F;>h{Fca?l'>ngBnj`F'`POP{уmA3F`A_> m>>~M=t=C۠߁&(cQy?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1ϥxJRG}Lޗ'i>:8$t]mlcat;n۷?|'6qJο&k1 ;;H?j7myjw [%#+'/N N(N.ҳ9\z=^@/G"Y=V(V8받\R\%c<{${$>)>'',>{$$/$%$%,!)!)!'HHHxȋȋ8U$^X4m\Ǹq}tmC V50lL]32\ep*U WyifȻbgђ'g`z>i F*"sboot/data/wool.rda0000644000176000001440000000325013245463622013635 0ustar ripleyusers eVXG=P vŮ1*`}Bbb5*{=vQDػnw84z{Kf&s{ggvg!!~!*YR9.䟓JUك6b###T*w/j̾d8#_v\|6DA{@^aͣ 6m>14$ٱdԃP;;Sw=EHyRì޽r0Ah\1)0~㉠p~{p {p6m7|[ґZw=%6R ^3:I@aIVJTͰ+ 3@~uKA Ve_@eƾ|.VyM-%f\z_=ܺM"&&GLGrw)uVy8(1@gSefrEW3w.CxɺM^C[m|sB3gEF\~})q/J[}ݍ@3} h?07.Qss m]qjR o=9/ PSTQ Z?g_|7 )4-b ?!aD?"n pn)#m[^2굈m׮Y!Jy}юhA^zճB3cHǵ@wA8*4uN!TA{)ꎿsFoi7"sZ?a2 N?{텎 @$6eG?f{9':Y&^#ȃZ0m8FCF`0`$8kL( `>S샅;NCߐ_iCiR+!xb$$g!uըk\#U=2N23$j'l>*a:X V~ &o lBX})ʹgHao_:`m~amB<7j0rېgIi5,ۦ:Y z&1%_BROЎn3'F& =YA°9e/YB?wz'W T.{ȽI &79ˋ"'@ʩU^RV e!uyouԆ+i>#!`-i"7Rw;D&o4I|&+ S<陜Z@{QBuGʨj"dDI% {V³qzZFSSa`@#z*@ԗ7Va x㮐} :A:0j@[ GD>]yv@?!q?$f% JLeug"焘f]$.|H\T-r[ 3#nau~.y/zףҶyez4e} S{dL Z!y4)@.Y;,3#\1? TmM:"-E_ڣD..!eF /O G; $zqݎVyu;T_j5p OcF2 86~8O6j$O`׭/a\y{As*Tt ?QbOA,߼:6"<*$tIhQ}h o9 boot/data/nodal.rda0000644000176000001440000000061313245463615013754 0ustar ripleyusers j0O"z1szNj7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;yz~=x3x|8vm{!:SoבώѧM|kg=gbsp8ߩl{-dvYi\_~q|=vyss:meۣg0ia&~:;xﲼkio'}3wuYt3kwq_8Ƿc߯>vOs^峼L7_+ϋͺ |s=}WﵼG~{~7=אָE3oW>{qo8~{~?~I4_{?~~㓗“Gn޴:r;윑3L̒#ݺr]T\_rc͕+b*b*bD1Q(F#ňbD1}1b/F_}1b 1c(PC1b 1c,Xc1b1c,TS1bLŘ1c*Ts1bŘ1c.\s1b,Xc)RK1b,X[vdE6d#ىLZAu:hZ&h&h&h&h&hZ@ h-ZCzh=Z6@ hm6@Fh#m6BFh m6AM&h m6Cfh3 m@[-h m@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%K. \$pI%K. \$pI%K. \$pI%K. \$pI%K. \$pI%K. \$pIs{?\vz⇃_R<__*boot/data/remission.rda0000644000176000001440000000045113245463622014665 0ustar ripleyusers r0b```b`d``d2Y#P(5783?]( ToYp`A?K %t8kj.:FPPPq4?\ q?:Cmu( 5/17((I A&O(1(HzȚa* a #01La 3ư1,a14 ,#82L,38βv0an#Fp;у79'BPe\)%ziE0C@Qjboot/data/cav.rda0000644000176000001440000000207613245463622013433 0ustar ripleyusers uYn\U#? $X@S;":1`8 n6?)KX%x ?\KdUuWuEbp7B}8Dw:q۔h齹l|W5+=yiTܫtt]iA :=u*f9y?RK t_1* u&}On]Dk!]=fkz<_p.V{gҠnǜc<==vmv< ma5]Ƿkv.J}5N\S'וUwo@>#cc:[=ǝfzlJkC!">̕scs?bg}_3=z_gԹ-/|b?sv_}c6FgIU=~^wȾ-.F}}Jԟ\mDusul.b'e)Q;o37'<f$ffdfffqCV,YLV.%Épb81N 'Ébx1^ /Ëb$b$b$b$b$b$b$b$b$b$bbbbbbbbbbbdbdbdbdbdbdbdbdbdbdbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbƸ7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ǯC xqc/vد>58tf4c}EgZ:2ZG0oơ@>89΁3sμe E=wgߡ>8 $ȗY:xqy/pz۬W-b'z?1?z?ONh7ۿy7YK߽XE ~|y~8y=žq=pӰCo7<~O9֗_Dx@e.gqトw3/DrLg &9d'0nZ !ןs4'* yY> td'MASXW&}/K;@=秝 ؗ83>Yg=Lb~džov޸k}Jؽ !o3V7sЯ6 \`QPgy?~Cf!3yhi=+X?A|sP|3'IM0_d<ȼk<<Y70ϟ0o|:%G7'g1X?ps &!YOAO?9øYC]39J+`z[ggyG>`GX=0*y; ~pø?|*6'<.|<-)G=㈛ԫwc^sKv^u'xOx "ּb3 ARM9gQ~.JC01L` S 01,` K(ݩ90{ʸRKҊN0I%_boot/data/grav.rda0000644000176000001440000000045613245463622013621 0ustar ripleyusers N@*$=!B8I6&hh굏Ul(23{Y&2"" yyDOalk} yEn.퓜8}6_Hu6/;{u՛*e՘{z@"0 J2rt#V 6zՆNn~/ܗn)eOX>G}C[ Ġ ,Ơ&)(Pp(8`8`8##!]};zGڌ?~Qboot/data/polar.rda0000644000176000001440000000114413245463612013771 0ustar ripleyusers ]ˋA{IA lŅ!1dv>fQpś'OO"i@4q񾴆-;?ao7F>i B+F:53 ٖT:.}5OS77Jcgp2䆽sӼ+8!uĂ%'"SUEQVTQԂEQ0000000000°°°°°°°°°°(ON\x,ù0i;mboot/data/cane.rda0000644000176000001440000000327513245463622013572 0ustar ripleyusers nUU酛7TԪ(kŦ~nERp $QxG|tm}㞴 I,fZ73ə;ZEHE hZVQA>.-ȫл`]_r߀`r(@ Vݦ]?z\!k_3Ym;>X?o]=ujXX7b+j_|t~a=z3??}eݧCs5OCr_[_\՜3뻀|Ag8A_FWk_ a%jׇ]~a v{/®Gw/{~~ȗu==x].y/xOϮ7Y_ _. yy8x܊Ez]@[^o/ƯB=Αy?m񪢄!;<Ycr/䔛/ @n~2>𯚀8<\_MzsR'ub^̃?aH#< s>oJ<֑OGכ:P(VYw> ~ZŷիRh4ǔжBSoy#gZ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ustar ripleyusers KoPomI VJyG{k*n`ӭUUJ$,/C1B sspw86Q׆nphqmix}ha꘿~u&6=$NbLq!,Q]b>+u*,gQyJ|%PIZXv!RiOv#t%p 5Jq"LT!ՈDɃ'N<8ypɃGyx;հM?{~-V?[boot/data/breslow.rda0000644000176000001440000000047513245463615014342 0ustar ripleyusers r0b```b`d``d2Y#P=(8'rY4/(a)eaC1-',5(*2XpegYǚX 3--1$:(`8få ,BO_N{A?B!E5sЀ6h=*tҙ t:D<RÁDG^bn*z2'BŹ0cQ ߼b49 11` c01` sưmM[ђWJbI^Z $F"r8boot/data/poisons.rda0000644000176000001440000000103013245463615014343 0ustar ripleyusers ͔OHAg7₥PzIfFMah=dWc~ 9{p=~k Ү[J,$ ZG-k&U}kddkۿN>,gnNanDqdm=@GI.hl< b,9eH"T JB)( 55 5UC!`H0$ C!P`(0 CP`(04 C`h0t/+|%tG^~=nboot/data/aircondit7.rda0000644000176000001440000000037313245463615014725 0ustar ripleyusers ] @G1*ԡg\MRQt-d-(=JOm+ȏ(fvl FZuuzIX'VEDuMd ! 19C_ HrS(紛.E5-˵rޝNS+( JJz(&sGuKF2e0`|}c rg}?KlDfboot/data/survival.rda0000644000176000001440000000041513245463612014527 0ustar ripleyusers r0b```b`d``d2Y#P,,1]H9&0Ekqmtovz snPc4qzNT ,i߷#u%{~޶`_hZ H%%8&΢r=d|PŌ0a c0acXPegYp ǒsac*JI,IK+:Bs3boot/data/darwin.rda0000644000176000001440000000032413245463622014140 0ustar ripleyusers ] @GBԡcox!"wO1=_ΎqctG0?Z~w1/qizZ%h F$x A SR"uuUm6Rnz!rs}]6e eO$C$G@04Cch 140` a0 0bX a1,ŰbX 0pa8 0<cx 1<#`0Fc1oߠ_{Z&KwSCboot/data/aml.rda0000644000176000001440000000043413245463615013431 0ustar ripleyusers j@@gcDA ^'AFE1lٓER0*W?/7ffK=(BNf6N'3@նKt *^ꥊf=| J"E#g .0D>bE?gDƯ]~_1q+G>@~#yJыkcT('*u.$H:$]O'yF6&<[ٸ{H!=Kҟ LsjZNsxV=boot/data/tau.rda0000644000176000001440000000076413245463613013455 0ustar ripleyusers jA{z"q' 2LߪꌐE ʕАm3$#+!>CvY5|Wn5sA!!Tսݢ2cRdfi$ u"dne,t95֪ 'r:]q]>qЇG1OT8AsU룢A|joQy]G]C <[iQ/ȿT*,/?6cf5gf_2k7{' [&&;Tn׾wOfޖ neZO6n~hx4? ܺTjPf湾5tBg+6tdB!dB!dB%ÒaɰdX2, K%Òpd82 G#Ñpdx2< O'Ódx2<([g;Ny/5\boot/data/ducks.rda0000644000176000001440000000033213245463615013766 0ustar ripleyusers ]K @geT ƑTwt…?;/N `$[U*!0%y-'~#1'{RyH=ڹ:_Df<|8+gLϙv e#~|?>KYi8Q]v9"~ ^:0W=ڟ#`FK? -N pnrE%$`ʹN]ـEۓ5J8p9}blZ+p6.4n3ew,=6*-E Tn@7 {]YMRoTi(xG'xkhkr?fˀ=Sө1nx:SZg迟H怒GۏلI>5_ؒaxm%-(qy`7׋n2m`dyJ;>?O^,: .oμV4!32*#z-DOL;=tlmwѪvt|/5^c~gnB}2 N{t!O `R(M~[!N;~g6>~;˹( ,ۘv:Ռػ{w{kܳnzbڸ 2clqʤaqY͏}E-jmj^[bjJg7'7Ms3,nl(l(l(l(l(l(l(l(l(l(lllllllllllhlhlhlhlhlhlhlhlhlhlllllllllllllllllllllllllllllllXlXlXlXlXlXlXlXlXlXlpbņ .6\lpΈNTU&UjH5ZREs)S4hNќ9EsMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM%{$&f5fJ>]y孶;w۾\^yvyyvy^du=}(/oǗ ŽT^_k^7=?I7y}~_^oŜ'OG~mwj^/'ϝu>ϼ>/z{dz/ߟەgϿf_\'_{V>^w;wy]SwGuj}mo/_Χow_6ۍn/=l~e{qwˇwԼmqޛϻn7ުjx*/_^oEf^O]yz~gv4.uyw|snS=_5s^w?N,vqqF^!l^4/9~9qڷ:+y[o>j~?wg\uS7k<3/}z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|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷>|÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o=|{÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|~÷o?|ͷ==}~m|?muǏiأ_4boot/data/capability.rda0000644000176000001440000000074213245463615015003 0ustar ripleyusers eӿOAD24ě_&PIEA$$'Vkjj#5.<5&λgvvkvcLVJMnbZ9anѽ9<:<;7㻙٣rmb#[3l~o=}s]=le{ח'ٖ]IÝl/[Wk-Sy}U_Kk꯱浞}^:Z4u>4V֡>zNQUʱNc|}wӿ؟?-0zx׷>x;-'W|yUrƿ۪+8BRh6߇iNr$O HJIpa8 0pcx 1<cx0F#`0"FĈ#bD1"FH #a$0FH h1ZhcuҼκqџSboot/data/frets.rda0000644000176000001440000000061313245463613014000 0ustar ripleyusers mSKNA|C0FD7<qYxW, 5pObTU xSڍ#3Xtc _dvUmlV'X+kl*֗g䝻Eխ~ɾ~u|GQ3zYz9?৾`===_><5-J9'Ӝ9k/#x*ex-݇МO]ϗh_-tMí%%;fa~!pLuDʳ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ywcH[\w7~9XŪʉboot/data/dogs.rda0000644000176000001440000000030213245463615013606 0ustar ripleyusers r0b```b`d``d2Y#'^. V@!BB0x8QUwvPqg(m`ƚ tq Aܲ|3M gQ~6vZFC01L` S 0GwRrNb1lF*ĒD"@?9Xpyboot/data/fir.rda0000644000176000001440000000054013245463622013434 0ustar ripleyusers ͓N@ǧHi!@$צJb4)_'0n?t I67-,/[N)Lbڏhfk}vf&<}yMJMݬuo}eo\u>[s'~ϟ\>x%F<0Fâ>ᙣ1|[M_jt(>ގ9mͲ<\՗bY;:?߃ S@(BTX)d@AK p0 p0 p0a0p8 !p!p!p . pTw"i= 7, ] grav1.boot <- boot(grav1, diff.means, R = 999, stype = "f", strata = grav1[ ,2]) boot.ci(grav1.boot, type = c("stud", "norm")) # Nonparametric confidence intervals for mean failure time # of the air-conditioning data as in Example 5.4 of Davison # and Hinkley (1997) mean.fun <- function(d, i) { m <- mean(d$hours[i]) n <- length(i) v <- (n-1)*var(d$hours[i])/n^2 c(m, v) } air.boot <- boot(aircondit, mean.fun, R = 999) boot.ci(air.boot, type = c("norm", "basic", "perc", "stud")) # Now using the log transformation # There are two ways of doing this and they both give the # same intervals. # Method 1 boot.ci(air.boot, type = c("norm", "basic", "perc", "stud"), h = log, hdot = function(x) 1/x) # Method 2 vt0 <- air.boot$t0[2]/air.boot$t0[1]^2 vt <- air.boot$t[, 2]/air.boot$t[ ,1]^2 boot.ci(air.boot, type = c("norm", "basic", "perc", "stud"), t0 = log(air.boot$t0[1]), t = log(air.boot$t[,1]), var.t0 = vt0, var.t = vt) } \keyword{nonparametric} \keyword{htest} boot/man/nuclear.Rd0000644000176000001440000000420513245463610013745 0ustar ripleyusers\name{nuclear} \alias{nuclear} \title{ Nuclear Power Station Construction Data } \description{ The \code{nuclear} data frame has 32 rows and 11 columns. The data relate to the construction of 32 light water reactor (LWR) plants constructed in the U.S.A in the late 1960's and early 1970's. The data was collected with the aim of predicting the cost of construction of further LWR plants. 6 of the power plants had partial turnkey guarantees and it is possible that, for these plants, some manufacturers' subsidies may be hidden in the quoted capital costs. } \usage{ nuclear } \format{ This data frame contains the following columns: \describe{ \item{\code{cost}}{ The capital cost of construction in millions of dollars adjusted to 1976 base. } \item{\code{date}}{ The date on which the construction permit was issued. The data are measured in years since January 1 1990 to the nearest month. } \item{\code{t1}}{ The time between application for and issue of the construction permit. } \item{\code{t2}}{ The time between issue of operating license and construction permit. } \item{\code{cap}}{ The net capacity of the power plant (MWe). } \item{\code{pr}}{ A binary variable where \code{1} indicates the prior existence of a LWR plant at the same site. } \item{\code{ne}}{ A binary variable where \code{1} indicates that the plant was constructed in the north-east region of the U.S.A. } \item{\code{ct}}{ A binary variable where \code{1} indicates the use of a cooling tower in the plant. } \item{\code{bw}}{ A binary variable where \code{1} indicates that the nuclear steam supply system was manufactured by Babcock-Wilcox. } \item{\code{cum.n}}{ The cumulative number of power plants constructed by each architect-engineer. } \item{\code{pt}}{ A binary variable where \code{1} indicates those plants with partial turnkey guarantees. }}} \source{ The data were obtained from Cox, D.R. and Snell, E.J. (1981) \emph{Applied Statistics: Principles and Examples}. Chapman and Hall. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/co.transfer.Rd0000644000176000001440000000222613245463617014550 0ustar ripleyusers\name{co.transfer} \alias{co.transfer} \title{ Carbon Monoxide Transfer } \description{ The \code{co.transfer} data frame has 7 rows and 2 columns. Seven smokers with chickenpox had their levels of carbon monoxide transfer measured on entry to hospital and then again after 1 week. The main question being whether one week of hospitalization has changed the carbon monoxide transfer factor. } \usage{ co.transfer } \format{ This data frame contains the following columns: \describe{ \item{\code{entry}}{ Carbon monoxide transfer factor on entry to hospital. } \item{\code{week}}{ Carbon monoxide transfer one week after admittance to hospital. }}} \source{ The data were obtained from Hand, D.J., Daly, F., Lunn, A.D., McConway, K.J. and Ostrowski, E (1994) \emph{A Handbook of Small Data Sets}. Chapman and Hall. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Ellis, M.E., Neal, K.R. and Webb, A.K. (1987) Is smoking a risk factor for pneumonia in patients with chickenpox? \emph{British Medical Journal}, \bold{294}, 1002. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/freq.array.Rd0000644000176000001440000000251013245463610014363 0ustar ripleyusers\name{freq.array} \alias{freq.array} \title{ Bootstrap Frequency Arrays } \description{ Take a matrix of indices for nonparametric bootstrap resamples and return the frequencies of the original observations in each resample. } \usage{ freq.array(i.array) } \arguments{ \item{i.array}{ This will be an matrix of integers between 1 and n, where n is the number of observations in a data set. The matrix will have n columns and R rows where R is the number of bootstrap resamples. Such matrices are found by \code{boot} when doing nonparametric bootstraps. They can also be found after a bootstrap has been run through the function \code{boot.array}. }} \value{ A matrix of the same dimensions as the input matrix. Each row of the matrix corresponds to a single bootstrap resample. Each column of the matrix corresponds to one of the original observations and specifies its frequency in each bootstrap resample. Thus the first column tells us how often the first observation appeared in each bootstrap resample. Such frequency arrays are often useful for diagnostic purposes such as the jackknife-after-bootstrap plot. They are also necessary for the regression estimates of empirical influence values and for finding importance sampling weights. } \seealso{ \code{\link{boot.array}} } \keyword{nonparametric} % Converted by Sd2Rd version 1.15. boot/man/Imp.Estimates.Rd0000644000176000001440000001471713245463606015014 0ustar ripleyusers\name{Imp.Estimates} \alias{Imp.Estimates} \alias{imp.moments} \alias{imp.prob} \alias{imp.quantile} \alias{imp.reg} \title{ Importance Sampling Estimates } \description{ Central moment, tail probability, and quantile estimates for a statistic under importance resampling. } \usage{ imp.moments(boot.out = NULL, index = 1, t = boot.out$t[, index], w = NULL, def = TRUE, q = NULL) imp.prob(boot.out = NULL, index = 1, t0 = boot.out$t0[index], t = boot.out$t[, index], w = NULL, def = TRUE, q = NULL) imp.quantile(boot.out = NULL, alpha = NULL, index = 1, t = boot.out$t[, index], w = NULL, def = TRUE, q = NULL) } \arguments{ \item{boot.out}{ A object of class \code{"boot"} generated by a call to \code{boot} or \code{tilt.boot}. Use of these functions makes sense only when the bootstrap resampling used unequal weights for the observations. If the importance weights \code{w} are not supplied then \code{boot.out} is a required argument. It is also required if \code{t} is not supplied. } \item{alpha}{ The alpha levels for the required quantiles. The default is to calculate the 1\%, 2.5\%, 5\%, 10\%, 90\%, 95\%, 97.5\% and 99\% quantiles. } \item{index}{ The index of the variable of interest in the output of \code{boot.out$statistic}. This is not used if the argument \code{t} is supplied. } \item{t0}{ The values at which tail probability estimates are required. For each value \code{t0[i]} the function will estimate the bootstrap cdf evaluated at \code{t0[i]}. If \code{imp.prob} is called without the argument \code{t0} then the bootstrap cdf evaluated at the observed value of the statistic is found. } \item{t}{ The bootstrap replicates of a statistic. By default these are taken from the bootstrap output object \code{boot.out} but they can be supplied separately if required (e.g. when the statistic of interest is a function of the calculated values in \code{boot.out}). Either \code{boot.out} or \code{t} must be supplied. } \item{w}{ The importance resampling weights for the bootstrap replicates. If they are not supplied then \code{boot.out} must be supplied, in which case the importance weights are calculated by a call to \code{imp.weights}. } \item{def}{ A logical value indicating whether a defensive mixture is to be used for weight calculation. This is used only if \code{w} is missing and it is passed unchanged to \code{imp.weights} to calculate \code{w}. } \item{q}{ A vector of probabilities specifying the resampling distribution from which any estimates should be found. In general this would correspond to the usual bootstrap resampling distribution which gives equal weight to each of the original observations. The estimates depend on this distribution only through the importance weights \code{w} so this argument is ignored if \code{w} is supplied. If \code{w} is missing then \code{q} is passed as an argument to \code{imp.weights} and used to find \code{w}. } } \value{ A list with the following components : \item{alpha}{ The \code{alpha} levels used for the quantiles, if \code{imp.quantile} is used. } \item{t0}{ The values at which the tail probabilities are estimated, if \code{imp.prob} is used. } \item{raw}{ The raw importance resampling estimates. For \code{imp.moments} this has length 2, the first component being the estimate of the mean and the second being the variance estimate. For \code{imp.prob}, \code{raw} is of the same length as \code{t0}, and for \code{imp.quantile} it is of the same length as \code{alpha}. } \item{rat}{ The ratio importance resampling estimates. In this method the weights \code{w} are rescaled to have average value one before they are used. The format of this vector is the same as \code{raw}. } \item{reg}{ The regression importance resampling estimates. In this method the weights which are used are derived from a regression of \code{t*w} on \code{w}. This choice of weights can be shown to minimize the variance of the weights and also the Euclidean distance of the weights from the uniform weights. The format of this vector is the same as \code{raw}. }} \references{ Davison, A. C. and Hinkley, D. V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Hesterberg, T. (1995) Weighted average importance sampling and defensive mixture distributions. \emph{Technometrics}, \bold{37}, 185--194. Johns, M.V. (1988) Importance sampling for bootstrap confidence intervals. \emph{Journal of the American Statistical Association}, \bold{83}, 709--714. } \seealso{ \code{\link{boot}}, \code{\link{exp.tilt}}, \code{\link{imp.weights}}, \code{\link{smooth.f}}, \code{\link{tilt.boot}} } \examples{ # Example 9.8 of Davison and Hinkley (1997) requires tilting the # resampling distribution of the studentized statistic to be centred # at the observed value of the test statistic, 1.84. In this example # we show how certain estimates can be found using resamples taken from # the tilted distribution. grav1 <- gravity[as.numeric(gravity[,2]) >= 7, ] grav.fun <- function(dat, w, orig) { strata <- tapply(dat[, 2], as.numeric(dat[, 2])) d <- dat[, 1] ns <- tabulate(strata) w <- w/tapply(w, strata, sum)[strata] mns <- as.vector(tapply(d * w, strata, sum)) # drop names mn2 <- tapply(d * d * w, strata, sum) s2hat <- sum((mn2 - mns^2)/ns) c(mns[2] - mns[1], s2hat, (mns[2] - mns[1] - orig)/sqrt(s2hat)) } grav.z0 <- grav.fun(grav1, rep(1, 26), 0) grav.L <- empinf(data = grav1, statistic = grav.fun, stype = "w", strata = grav1[,2], index = 3, orig = grav.z0[1]) grav.tilt <- exp.tilt(grav.L, grav.z0[3], strata = grav1[, 2]) grav.tilt.boot <- boot(grav1, grav.fun, R = 199, stype = "w", strata = grav1[, 2], weights = grav.tilt$p, orig = grav.z0[1]) # Since the weights are needed for all calculations, we shall calculate # them once only. grav.w <- imp.weights(grav.tilt.boot) grav.mom <- imp.moments(grav.tilt.boot, w = grav.w, index = 3) grav.p <- imp.prob(grav.tilt.boot, w = grav.w, index = 3, t0 = grav.z0[3]) unlist(grav.p) grav.q <- imp.quantile(grav.tilt.boot, w = grav.w, index = 3, alpha = c(0.9, 0.95, 0.975, 0.99)) as.data.frame(grav.q) } \keyword{htest} \keyword{nonparametric} % Converted by Sd2Rd version 1.15. boot/man/plot.boot.Rd0000644000176000001440000001304013245463606014236 0ustar ripleyusers\name{plot.boot} \alias{plot.boot} \title{ Plots of the Output of a Bootstrap Simulation } \description{ This takes a bootstrap object and produces plots for the bootstrap replicates of the variable of interest. } \usage{ \method{plot}{boot}(x, index = 1, t0 = NULL, t = NULL, jack = FALSE, qdist = "norm", nclass = NULL, df, \dots) } \arguments{ \item{x}{ An object of class \code{"boot"} returned from one of the bootstrap generation functions. } \item{index}{ The index of the variable of interest within the output of \code{boot.out}. This is ignored if \code{t} and \code{t0} are supplied. } \item{t0}{ The original value of the statistic. This defaults to \code{boot.out$t0[index]} unless \code{t} is supplied when it defaults to \code{NULL}. In that case no vertical line is drawn on the histogram. } \item{t}{ The bootstrap replicates of the statistic. Usually this will take on its default value of \code{boot.out$t[,index]}, however it may be useful sometimes to supply a different set of values which are a function of \code{boot.out$t}. } \item{jack}{ A logical value indicating whether a jackknife-after-bootstrap plot is required. The default is not to produce such a plot. } \item{qdist}{ The distribution against which the Q-Q plot should be drawn. At present \code{"norm"} (normal distribution - the default) and \code{"chisq"} (chi-squared distribution) are the only possible values. } \item{nclass}{ An integer giving the number of classes to be used in the bootstrap histogram. The default is the integer between 10 and 100 closest to \code{ceiling(length(t)/25)}. } \item{df}{ If \code{qdist} is \code{"chisq"} then this is the degrees of freedom for the chi-squared distribution to be used. It is a required argument in that case. } \item{...}{ When \code{jack} is \code{TRUE} additional parameters to \code{jack.after.boot} can be supplied. See the help file for \code{jack.after.boot} for details of the possible parameters. } } \value{ \code{boot.out} is returned invisibly. } \section{Side Effects}{ All screens are closed and cleared and a number of plots are produced on the current graphics device. Screens are closed but not cleared at termination of this function. } \details{ This function will generally produce two side-by-side plots. The left plot will be a histogram of the bootstrap replicates. Usually the breaks of the histogram will be chosen so that \code{t0} is at a breakpoint and all intervals are of equal length. A vertical dotted line indicates the position of \code{t0}. This cannot be done if \code{t} is supplied but \code{t0} is not and so, in that case, the breakpoints are computed by \code{hist} using the \code{nclass} argument and no vertical line is drawn. The second plot is a Q-Q plot of the bootstrap replicates. The order statistics of the replicates can be plotted against normal or chi-squared quantiles. In either case the expected line is also plotted. For the normal, this will have intercept \code{mean(t)} and slope \code{sqrt(var(t))} while for the chi-squared it has intercept 0 and slope 1. If \code{jack} is \code{TRUE} a third plot is produced beneath these two. That plot is the jackknife-after-bootstrap plot. This plot may only be requested when nonparametric simulation has been used. See \code{jack.after.boot} for further details of this plot. } \seealso{ \code{\link{boot}}, \code{\link{jack.after.boot}}, \code{\link{print.boot}} } \examples{ # We fit an exponential model to the air-conditioning data and use # that for a parametric bootstrap. Then we look at plots of the # resampled means. air.rg <- function(data, mle) rexp(length(data), 1/mle) air.boot <- boot(aircondit$hours, mean, R = 999, sim = "parametric", ran.gen = air.rg, mle = mean(aircondit$hours)) plot(air.boot) # In the difference of means example for the last two series of the # gravity data grav1 <- gravity[as.numeric(gravity[, 2]) >= 7, ] grav.fun <- function(dat, w) { strata <- tapply(dat[, 2], as.numeric(dat[, 2])) d <- dat[, 1] ns <- tabulate(strata) w <- w/tapply(w, strata, sum)[strata] mns <- as.vector(tapply(d * w, strata, sum)) # drop names mn2 <- tapply(d * d * w, strata, sum) s2hat <- sum((mn2 - mns^2)/ns) c(mns[2] - mns[1], s2hat) } grav.boot <- boot(grav1, grav.fun, R = 499, stype = "w", strata = grav1[, 2]) plot(grav.boot) # now suppose we want to look at the studentized differences. grav.z <- (grav.boot$t[, 1]-grav.boot$t0[1])/sqrt(grav.boot$t[, 2]) plot(grav.boot, t = grav.z, t0 = 0) # In this example we look at the one of the partial correlations for the # head dimensions in the dataset frets. frets.fun <- function(data, i) { pcorr <- function(x) { # Function to find the correlations and partial correlations between # the four measurements. v <- cor(x) v.d <- diag(var(x)) iv <- solve(v) iv.d <- sqrt(diag(iv)) iv <- - diag(1/iv.d) \%*\% iv \%*\% diag(1/iv.d) q <- NULL n <- nrow(v) for (i in 1:(n-1)) q <- rbind( q, c(v[i, 1:i], iv[i,(i+1):n]) ) q <- rbind( q, v[n, ] ) diag(q) <- round(diag(q)) q } d <- data[i, ] v <- pcorr(d) c(v[1,], v[2,], v[3,], v[4,]) } frets.boot <- boot(log(as.matrix(frets)), frets.fun, R = 999) plot(frets.boot, index = 7, jack = TRUE, stinf = FALSE, useJ = FALSE) } \keyword{hplot} \keyword{nonparametric} boot/man/remission.Rd0000644000176000001440000000140613245463611014325 0ustar ripleyusers\name{remission} \alias{remission} \title{ Cancer Remission and Cell Activity } \description{ The \code{remission} data frame has 27 rows and 3 columns. } \usage{ remission } \format{ This data frame contains the following columns: \describe{ \item{\code{LI}}{ A measure of cell activity. } \item{\code{m}}{ The number of patients in each group (all values are actually 1 here). } \item{\code{r}}{ The number of patients (out of \code{m}) who went into remission. }}} \source{ The data were obtained from Freeman, D.H. (1987) \emph{Applied Categorical Data Analysis}. Marcel Dekker. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/ducks.Rd0000644000176000001440000000312213245463611013423 0ustar ripleyusers\name{ducks} \alias{ducks} \title{ Behavioral and Plumage Characteristics of Hybrid Ducks } \description{ The \code{ducks} data frame has 11 rows and 2 columns. Each row of the data frame represents a male duck who is a second generation cross of mallard and pintail ducks. For 11 such ducks a behavioural and plumage index were calculated. These were measured on scales devised for this experiment which was to examine whether there was any link between which species the ducks resembled physically and which they resembled in behaviour. The scale for the physical appearance ranged from 0 (identical in appearance to a mallard) to 20 (identical to a pintail). The behavioural traits of the ducks were on a scale from 0 to 15 with lower numbers indicating closer to mallard-like in behaviour. } \usage{ ducks } \format{ This data frame contains the following columns: \describe{ \item{\code{plumage}}{ The index of physical appearance based on the plumage of individual ducks. } \item{\code{behaviour}}{ The index of behavioural characteristics of the ducks. }}} \source{ The data were obtained from Larsen, R.J. and Marx, M.L. (1986) \emph{An Introduction to Mathematical Statistics and its Applications} (Second Edition). Prentice-Hall. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Sharpe, R.S., and Johnsgard, P.A. (1966) Inheritance of behavioral characters in \eqn{F_2}{F2} mallard x pintail (\emph{Anas Platyrhynchos L. x Anas Acuta L.}) hybrids. \emph{Behaviour}, \bold{27}, 259-272. } \keyword{datasets} boot/man/corr.Rd0000644000176000001440000000174113245463606013270 0ustar ripleyusers\name{corr} \alias{corr} \title{ Correlation Coefficient } \description{ Calculates the weighted correlation given a data set and a set of weights. } \usage{ corr(d, w = rep(1, nrow(d))/nrow(d)) } \arguments{ \item{d}{ A matrix with two columns corresponding to the two variables whose correlation we wish to calculate. } \item{w}{ A vector of weights to be applied to each pair of observations. The default is equal weights for each pair. Normalization takes place within the function so \code{sum(w)} need not equal 1. }} \value{ The correlation coefficient between \code{d[,1]} and \code{d[,2]}. } \details{ This function finds the correlation coefficient in weighted form. This is often useful in bootstrap methods since it allows for numerical differentiation to get the empirical influence values. It is also necessary to have the statistic in this form to find ABC intervals. } \seealso{ \code{\link{cor}} } \keyword{math} \keyword{multivariate} % Converted by Sd2Rd version 1.15. boot/man/linear.approx.Rd0000644000176000001440000001005213245463610015073 0ustar ripleyusers\name{linear.approx} \alias{linear.approx} \title{ Linear Approximation of Bootstrap Replicates } \description{ This function takes a bootstrap object and for each bootstrap replicate it calculates the linear approximation to the statistic of interest for that bootstrap sample. } \usage{ linear.approx(boot.out, L = NULL, index = 1, type = NULL, t0 = NULL, t = NULL, \dots) } \arguments{ \item{boot.out}{ An object of class \code{"boot"} representing a nonparametric bootstrap. It will usually be created by the function \code{boot}. } \item{L}{ A vector containing the empirical influence values for the statistic of interest. If it is not supplied then \code{L} is calculated through a call to \code{empinf}. } \item{index}{ The index of the variable of interest within the output of \code{boot.out$statistic}. } \item{type}{ This gives the type of empirical influence values to be calculated. It is not used if \code{L} is supplied. The possible types of empirical influence values are described in the help for \code{\link{empinf}}. } \item{t0}{ The observed value of the statistic of interest. The input value is used only if one of \code{t} or \code{L} is also supplied. The default value is \code{boot.out$t0[index]}. If \code{t0} is supplied but neither \code{t} nor \code{L} are supplied then \code{t0} is set to \code{boot.out$t0[index]} and a warning is generated. } \item{t}{ A vector of bootstrap replicates of the statistic of interest. If \code{t0} is missing then \code{t} is not used, otherwise it is used to calculate the empirical influence values (if they are not supplied in \code{L}). } \item{...}{ Any extra arguments required by \code{boot.out$statistic}. These are needed if \code{L} is not supplied as they are used by \code{empinf} to calculate empirical influence values. }} \value{ A vector of length \code{boot.out$R} with the linear approximations to the statistic of interest for each of the bootstrap samples. } \details{ The linear approximation to a bootstrap replicate with frequency vector \code{f} is given by \code{t0 + sum(L * f)/n} in the one sample with an easy extension to the stratified case. The frequencies are found by calling \code{boot.array}. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \seealso{ \code{\link{boot}}, \code{\link{empinf}}, \code{\link{control}} } \examples{ # Using the city data let us look at the linear approximation to the # ratio statistic and its logarithm. We compare these with the # corresponding plots for the bigcity data ratio <- function(d, w) sum(d$x * w)/sum(d$u * w) city.boot <- boot(city, ratio, R = 499, stype = "w") bigcity.boot <- boot(bigcity, ratio, R = 499, stype = "w") op <- par(pty = "s", mfrow = c(2, 2)) # The first plot is for the city data ratio statistic. city.lin1 <- linear.approx(city.boot) lim <- range(c(city.boot$t,city.lin1)) plot(city.boot$t, city.lin1, xlim = lim, ylim = lim, main = "Ratio; n=10", xlab = "t*", ylab = "tL*") abline(0, 1) # Now for the log of the ratio statistic for the city data. city.lin2 <- linear.approx(city.boot,t0 = log(city.boot$t0), t = log(city.boot$t)) lim <- range(c(log(city.boot$t),city.lin2)) plot(log(city.boot$t), city.lin2, xlim = lim, ylim = lim, main = "Log(Ratio); n=10", xlab = "t*", ylab = "tL*") abline(0, 1) # The ratio statistic for the bigcity data. bigcity.lin1 <- linear.approx(bigcity.boot) lim <- range(c(bigcity.boot$t,bigcity.lin1)) plot(bigcity.lin1, bigcity.boot$t, xlim = lim, ylim = lim, main = "Ratio; n=49", xlab = "t*", ylab = "tL*") abline(0, 1) # Finally the log of the ratio statistic for the bigcity data. bigcity.lin2 <- linear.approx(bigcity.boot,t0 = log(bigcity.boot$t0), t = log(bigcity.boot$t)) lim <- range(c(log(bigcity.boot$t),bigcity.lin2)) plot(bigcity.lin2, log(bigcity.boot$t), xlim = lim, ylim = lim, main = "Log(Ratio); n=49", xlab = "t*", ylab = "tL*") abline(0, 1) par(op) } \keyword{nonparametric} % Converted by Sd2Rd version 1.15. boot/man/poisons.Rd0000644000176000001440000000214113245463617014012 0ustar ripleyusers\name{poisons} \alias{poisons} \title{ Animal Survival Times } \description{ The \code{poisons} data frame has 48 rows and 3 columns. The data form a 3x4 factorial experiment, the factors being three poisons and four treatments. Each combination of the two factors was used for four animals, the allocation to animals having been completely randomized. } \usage{ poisons } \format{ This data frame contains the following columns: \describe{ \item{\code{time}}{ The survival time of the animal in units of 10 hours. } \item{\code{poison}}{ A factor with levels \code{1}, \code{2} and \code{3} giving the type of poison used. } \item{\code{treat}}{ A factor with levels \code{A}, \code{B}, \code{C} and \code{D} giving the treatment. }}} \source{ The data were obtained from Box, G.E.P. and Cox, D.R. (1964) An analysis of transformations (with Discussion). \emph{ Journal of the Royal Statistical Society, B}, \bold{26}, 211--252. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/urine.Rd0000644000176000001440000000251013245463610013433 0ustar ripleyusers\name{urine} \alias{urine} \title{ Urine Analysis Data } \description{ The \code{urine} data frame has 79 rows and 7 columns. 79 urine specimens were analyzed in an effort to determine if certain physical characteristics of the urine might be related to the formation of calcium oxalate crystals. } \usage{ urine } \format{ This data frame contains the following columns: \describe{ \item{\code{r}}{ Indicator of the presence of calcium oxalate crystals. } \item{\code{gravity}}{ The specific gravity of the urine. } \item{\code{ph}}{ The pH reading of the urine. } \item{\code{osmo}}{ The osmolarity of the urine. Osmolarity is proportional to the concentration of molecules in solution. } \item{\code{cond}}{ The conductivity of the urine. Conductivity is proportional to the concentration of charged ions in solution. } \item{\code{urea}}{ The urea concentration in millimoles per litre. } \item{\code{calc}}{ The calcium concentration in millimoles per litre. }}} \source{ The data were obtained from Andrews, D.F. and Herzberg, A.M. (1985) \emph{Data: A Collection of Problems from Many Fields for the Student and Research Worker}. Springer-Verlag. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/abc.ci.Rd0000644000176000001440000000664613577106673013461 0ustar ripleyusers\name{abc.ci} \alias{abc.ci} \title{ Nonparametric ABC Confidence Intervals } \description{ Calculate equi-tailed two-sided nonparametric approximate bootstrap confidence intervals for a parameter, given a set of data and an estimator of the parameter, using numerical differentiation. } \usage{ abc.ci(data, statistic, index=1, strata=rep(1, n), conf=0.95, eps=0.001/n, \dots) } \arguments{ \item{data}{ A data set expressed as a vector, matrix or data frame. } \item{statistic}{ A function which returns the statistic of interest. The function must take at least 2 arguments; the first argument should be the data and the second a vector of weights. The weights passed to \code{statistic} will be normalized to sum to 1 within each stratum. Any other arguments should be passed to \code{abc.ci} as part of the \code{\dots{}} argument. } \item{index}{ If \code{statistic} returns a vector of length greater than 1, then this indicates the position of the variable of interest within that vector. } \item{strata}{ A factor or numerical vector indicating to which sample each observation belongs in multiple sample problems. The default is the one-sample case. } \item{conf}{ A scalar or vector containing the confidence level(s) of the required interval(s). } \item{eps}{ The value of epsilon to be used for the numerical differentiation. } \item{...}{ Any other arguments for \code{statistic}. These will be passed unchanged to \code{statistic} each time it is called within \code{abc.ci}. }} \value{ A \code{length(conf)} by 3 matrix where each row contains the confidence level followed by the lower and upper end-points of the ABC interval at that level. } \details{ This function is based on the function \code{abcnon} written by R. Tibshirani. A listing of the original function is available in DiCiccio and Efron (1996). The function uses numerical differentiation for the first and second derivatives of the statistic and then uses these values to approximate the bootstrap BCa intervals. The total number of evaluations of the statistic is \code{2*n+2+2*length(conf)} where \code{n} is the number of data points (plus calculation of the original value of the statistic). The function works for the multiple sample case without the need to rewrite the statistic in an artificial form since the stratified normalization is done internally by the function. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}, Chapter 5. Cambridge University Press. DiCiccio, T. J. and Efron B. (1992) More accurate confidence intervals in exponential families. \emph{Biometrika}, \bold{79}, 231--245. DiCiccio, T. J. and Efron B. (1996) Bootstrap confidence intervals (with Discussion). \emph{Statistical Science}, \bold{11}, 189--228. } \seealso{ \code{\link{boot.ci}} } \examples{ \dontshow{op <- options(digits = 5)} # 90\% and 95\% confidence intervals for the correlation # coefficient between the columns of the bigcity data abc.ci(bigcity, corr, conf=c(0.90,0.95)) # A 95\% confidence interval for the difference between the means of # the last two samples in gravity mean.diff <- function(y, w) { gp1 <- 1:table(as.numeric(y$series))[1] sum(y[gp1, 1] * w[gp1]) - sum(y[-gp1, 1] * w[-gp1]) } grav1 <- gravity[as.numeric(gravity[, 2]) >= 7, ] ## IGNORE_RDIFF_BEGIN abc.ci(grav1, mean.diff, strata = grav1$series) ## IGNORE_RDIFF_END \dontshow{options(op)} } \keyword{nonparametric} \keyword{htest} boot/man/saddle.distn.object.Rd0000644000176000001440000000431013245463610016132 0ustar ripleyusers\name{saddle.distn.object} \alias{saddle.distn.object} \title{ Saddlepoint Distribution Approximation Objects } \description{ Class of objects that result from calculating saddlepoint distribution approximations by a call to \code{saddle.distn}. } \section{Generation}{ This class of objects is returned from calls to the function \code{\link{saddle.distn}}. } \section{Methods}{ The class \code{"saddle.distn"} has methods for the functions \code{\link{lines}} and \code{\link{print}}. } \section{Structure}{ Objects of class \code{"saddle.distn"} are implemented as a list with the following components. \describe{ \item{quantiles}{ A matrix with 2 columns. The first column contains the probabilities \code{alpha} and the second column contains the estimated quantiles of the distribution at those probabilities derived from the spline. } \item{points}{ A matrix of evaluations of the saddlepoint approximation. The first column contains the values of \code{t} which were used, the second and third contain the density and cdf approximations at those points and the rest of the columns contain the solutions to the saddlepoint equations. When \code{type} is \code{"simp"}, there is only one of those. When \code{type} is \code{"cond"} there are \code{2*d-1} where \code{d} is the number of columns in \code{A} or the output of \code{A(t,\dots{})}. The first \code{d} of these correspond to the numerator and the remainder correspond to the denominator. } \item{distn}{ An object of class \code{smooth.spline}. This corresponds to the spline fitted to the saddlepoint cdf approximations in points in order to approximate the entire distribution. For the structure of the object see \code{smooth.spline}. } \item{call}{ The original call to \code{saddle.distn} which generated the object. } \item{LR}{ A logical variable indicating whether the Lugananni-Rice approximations were used. } } } \seealso{ \code{\link{lines.saddle.distn}}, \code{\link{saddle.distn}}, \code{\link{print.saddle.distn}} } \keyword{nonparametric} \keyword{methods} \keyword{smooth} boot/man/smooth.f.Rd0000644000176000001440000001102513245463615014054 0ustar ripleyusers\name{smooth.f} \alias{smooth.f} \title{ Smooth Distributions on Data Points } \description{ This function uses the method of frequency smoothing to find a distribution on a data set which has a required value, \code{theta}, of the statistic of interest. The method results in distributions which vary smoothly with \code{theta}. } \usage{ smooth.f(theta, boot.out, index = 1, t = boot.out$t[, index], width = 0.5) } \arguments{ \item{theta}{ The required value for the statistic of interest. If \code{theta} is a vector, a separate distribution will be found for each element of \code{theta}. } \item{boot.out}{ A bootstrap output object returned by a call to \code{boot}. } \item{index}{ The index of the variable of interest in the output of \code{boot.out$statistic}. This argument is ignored if \code{t} is supplied. \code{index} must be a scalar. } \item{t}{ The bootstrap values of the statistic of interest. This must be a vector of length \code{boot.out$R} and the values must be in the same order as the bootstrap replicates in \code{boot.out}. } \item{width}{ The standardized width for the kernel smoothing. The smoothing uses a value of \code{width*s} for epsilon, where \code{s} is the bootstrap estimate of the standard error of the statistic of interest. \code{width} should take a value in the range (0.2, 1) to produce a reasonable smoothed distribution. If \code{width} is too large then the distribution becomes closer to uniform. }} \value{ If \code{length(theta)} is 1 then a vector with the same length as the data set \code{boot.out$data} is returned. The value in position \code{i} is the probability to be given to the data point in position \code{i} so that the distribution has parameter value approximately equal to \code{theta}. If \code{length(theta)} is bigger than 1 then the returned value is a matrix with \code{length(theta)} rows each of which corresponds to a distribution with the parameter value approximately equal to the corresponding value of \code{theta}. } \details{ The new distributional weights are found by applying a normal kernel smoother to the observed values of \code{t} weighted by the observed frequencies in the bootstrap simulation. The resulting distribution may not have parameter value exactly equal to the required value \code{theta} but it will typically have a value which is close to \code{theta}. The details of how this method works can be found in Davison, Hinkley and Worton (1995) and Section 3.9.2 of Davison and Hinkley (1997). } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Davison, A.C., Hinkley, D.V. and Worton, B.J. (1995) Accurate and efficient construction of bootstrap likelihoods. \emph{Statistics and Computing}, \bold{5}, 257--264. } \seealso{ \code{\link{boot}}, \code{\link{exp.tilt}}, \code{\link{tilt.boot}} } \examples{ # Example 9.8 of Davison and Hinkley (1997) requires tilting the resampling # distribution of the studentized statistic to be centred at the observed # value of the test statistic 1.84. In the book exponential tilting was used # but it is also possible to use smooth.f. grav1 <- gravity[as.numeric(gravity[, 2]) >= 7, ] grav.fun <- function(dat, w, orig) { strata <- tapply(dat[, 2], as.numeric(dat[, 2])) d <- dat[, 1] ns <- tabulate(strata) w <- w/tapply(w, strata, sum)[strata] mns <- as.vector(tapply(d * w, strata, sum)) # drop names mn2 <- tapply(d * d * w, strata, sum) s2hat <- sum((mn2 - mns^2)/ns) c(mns[2] - mns[1], s2hat, (mns[2]-mns[1]-orig)/sqrt(s2hat)) } grav.z0 <- grav.fun(grav1, rep(1, 26), 0) grav.boot <- boot(grav1, grav.fun, R = 499, stype = "w", strata = grav1[, 2], orig = grav.z0[1]) grav.sm <- smooth.f(grav.z0[3], grav.boot, index = 3) # Now we can run another bootstrap using these weights grav.boot2 <- boot(grav1, grav.fun, R = 499, stype = "w", strata = grav1[, 2], orig = grav.z0[1], weights = grav.sm) # Estimated p-values can be found from these as follows mean(grav.boot$t[, 3] >= grav.z0[3]) imp.prob(grav.boot2, t0 = -grav.z0[3], t = -grav.boot2$t[, 3]) # Note that for the importance sampling probability we must # multiply everything by -1 to ensure that we find the correct # probability. Raw resampling is not reliable for probabilities # greater than 0.5. Thus 1 - imp.prob(grav.boot2, index = 3, t0 = grav.z0[3])$raw # can give very strange results (negative probabilities). } \keyword{smooth} \keyword{nonparametric} % Converted by Sd2Rd version 1.15. boot/man/cd4.Rd0000644000176000001440000000256213245463612012774 0ustar ripleyusers\name{cd4} \alias{cd4} \title{ CD4 Counts for HIV-Positive Patients } \description{ The \code{cd4} data frame has 20 rows and 2 columns. CD4 cells are carried in the blood as part of the human immune system. One of the effects of the HIV virus is that these cells die. The count of CD4 cells is used in determining the onset of full-blown AIDS in a patient. In this study of the effectiveness of a new anti-viral drug on HIV, 20 HIV-positive patients had their CD4 counts recorded and then were put on a course of treatment with this drug. After using the drug for one year, their CD4 counts were again recorded. The aim of the experiment was to show that patients taking the drug had increased CD4 counts which is not generally seen in HIV-positive patients. } \usage{ cd4 } \format{ This data frame contains the following columns: \describe{ \item{\code{baseline}}{ The CD4 counts (in 100's) on admission to the trial. } \item{\code{oneyear }}{ The CD4 counts (in 100's) after one year of treatment with the new drug. }}} \source{ The data were obtained from DiCiccio, T.J. and Efron B. (1996) Bootstrap confidence intervals (with Discussion). \emph{Statistical Science}, \bold{11}, 189--228. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/fir.Rd0000644000176000001440000000135213245463611013075 0ustar ripleyusers\name{fir} \alias{fir} \title{ Counts of Balsam-fir Seedlings } \description{ The \code{fir} data frame has 50 rows and 3 columns. The number of balsam-fir seedlings in each quadrant of a grid of 50 five foot square quadrants were counted. The grid consisted of 5 rows of 10 quadrants in each row. } \usage{ fir } \format{ This data frame contains the following columns: \describe{ \item{\code{count}}{ The number of seedlings in the quadrant. } \item{\code{row}}{ The row number of the quadrant. } \item{\code{col}}{ The quadrant number within the row. }}} \source{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/breslow.Rd0000644000176000001440000000316513245463615014002 0ustar ripleyusers\name{breslow} \alias{breslow} \title{ Smoking Deaths Among Doctors } \description{ The \code{breslow} data frame has 10 rows and 5 columns. In 1961 Doll and Hill sent out a questionnaire to all men on the British Medical Register enquiring about their smoking habits. Almost 70\% of such men replied. Death certificates were obtained for medical practitioners and causes of death were assigned on the basis of these certificates. The \code{breslow} data set contains the person-years of observations and deaths from coronary artery disease accumulated during the first ten years of the study. } \usage{ breslow } \format{ This data frame contains the following columns: \describe{ \item{\code{age}}{ The mid-point of the 10 year age-group for the doctors. } \item{\code{smoke}}{ An indicator of whether the doctors smoked (1) or not (0). } \item{\code{n}}{ The number of person-years in the category. } \item{\code{y}}{ The number of deaths attributed to coronary artery disease. } \item{\code{ns}}{ The number of smoker years in the category (\code{smoke*n}). }}} \source{ The data were obtained from Breslow, N.E. (1985) Cohort Analysis in Epidemiology. In \emph{A Celebration of Statistics} A.C. Atkinson and S.E. Fienberg (editors), 109--143. Springer-Verlag. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Doll, R. and Hill, A.B. (1966) Mortality of British doctors in relation to smoking: Observations on coronary thrombosis. \emph{National Cancer Institute Monograph}, \bold{19}, 205-268. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/imp.weights.Rd0000644000176000001440000000563113245463606014563 0ustar ripleyusers\name{imp.weights} \alias{imp.weights} \title{ Importance Sampling Weights } \description{ This function calculates the importance sampling weight required to correct for simulation from a distribution with probabilities \code{p} when estimates are required assuming that simulation was from an alternative distribution with probabilities \code{q}. } \usage{ imp.weights(boot.out, def = TRUE, q = NULL) } \arguments{ \item{boot.out}{ A object of class \code{"boot"} generated by \code{boot} or \code{tilt.boot}. Typically the bootstrap simulations would have been done using importance resampling and we wish to do our calculations under the assumption of sampling with equal probabilities. } \item{def}{ A logical variable indicating whether the defensive mixture distribution weights should be calculated. This makes sense only in the case where the replicates in \code{boot.out} were simulated under a number of different distributions. If this is the case then the defensive mixture weights use a mixture of the distributions used in the bootstrap. The alternative is to calculate the weights for each replicate using knowledge of the distribution from which the bootstrap resample was generated. } \item{q}{ A vector of probabilities specifying the resampling distribution from which we require inferences to be made. In general this would correspond to the usual bootstrap resampling distribution which gives equal weight to each of the original observations and this is the default. \code{q} must have length equal to the number of observations in the \code{boot.out$data} and all elements of \code{q} must be positive. }} \value{ A vector of importance weights of the same length as \code{boot.out$t}. These weights can then be used to reweight \code{boot.out$t} so that estimates can be found as if the simulations were from a distribution with probabilities \code{q}. } \details{ The importance sampling weight for a bootstrap replicate with frequency vector \code{f} is given by \code{prod((q/p)^f)}. This reweights the replicates so that estimates can be found as if the bootstrap resamples were generated according to the probabilities \code{q} even though, in fact, they came from the distribution \code{p}. } \references{ Davison, A. C. and Hinkley, D. V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Hesterberg, T. (1995) Weighted average importance sampling and defensive mixture distributions. \emph{Technometrics}, \bold{37}, 185--194. Johns, M.V. (1988) Importance sampling for bootstrap confidence intervals. \emph{Journal of the American Statistical Association}, \bold{83}, 709--714. } \seealso{ \code{\link{boot}}, \code{\link{exp.tilt}}, \code{\link{imp.moments}}, \code{\link{smooth.f}}, \code{\link{tilt.boot}} } \note{ See the example in the help for \code{imp.moments} for an example of using \code{imp.weights}. } \keyword{nonparametric} % Converted by Sd2Rd version 1.15. boot/man/var.linear.Rd0000644000176000001440000000175213245463606014366 0ustar ripleyusers\name{var.linear} \alias{var.linear} \title{ Linear Variance Estimate } \description{ Estimates the variance of a statistic from its empirical influence values. } \usage{ var.linear(L, strata = NULL) } \arguments{ \item{L}{ Vector of the empirical influence values of a statistic. These will usually be calculated by a call to \code{empinf}. } \item{strata}{ A numeric vector or factor specifying which observations (and hence empirical influence values) come from which strata. }} \value{ The variance estimate calculated from \code{L}. } \references{ Davison, A. C. and Hinkley, D. V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \seealso{ \code{\link{empinf}}, \code{\link{linear.approx}}, \code{\link{k3.linear}} } \examples{ # To estimate the variance of the ratio of means for the city data. ratio <- function(d,w) sum(d$x * w)/sum(d$u * w) var.linear(empinf(data = city, statistic = ratio)) } \keyword{nonparametric} % Converted by Sd2Rd version 1.15. boot/man/catsM.Rd0000644000176000001440000000227313506472514013371 0ustar ripleyusers\name{catsM} \alias{catsM} \title{ Weight Data for Domestic Cats } \description{ The \code{catsM} data frame has 97 rows and 3 columns. 144 adult (over 2kg in weight) cats used for experiments with the drug digitalis had their heart and body weight recorded. 47 of the cats were female and 97 were male. The \code{catsM} data frame consists of the data for the male cats. The full data are in dataset \code{\link{cats}} in package \code{MASS}. } \usage{ catsM } \format{ This data frame contains the following columns: \describe{ \item{\code{Sex}}{ A factor for the sex of the cat (levels are \code{F} and \code{M}: all cases are \code{M} in this subset). } \item{\code{Bwt}}{ Body weight in kg. } \item{\code{Hwt}}{ Heart weight in g. }}} \seealso{ \code{\link{cats}} } \source{ The data were obtained from Fisher, R.A. (1947) The analysis of covariance method for the relation between a part and the whole. \emph{Biometrics}, \bold{3}, 65--68. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Venables, W.N. and Ripley, B.D. (1994) \emph{Modern Applied Statistics with S-Plus}. Springer-Verlag. } \keyword{datasets} boot/man/nitrofen.Rd0000644000176000001440000000352613245463610014145 0ustar ripleyusers\name{nitrofen} \alias{nitrofen} \title{ Toxicity of Nitrofen in Aquatic Systems } \description{ The \code{nitrofen} data frame has 50 rows and 5 columns. Nitrofen is a herbicide that was used extensively for the control of broad-leaved and grass weeds in cereals and rice. Although it is relatively non-toxic to adult mammals, nitrofen is a significant tetragen and mutagen. It is also acutely toxic and reproductively toxic to cladoceran zooplankton. Nitrofen is no longer in commercial use in the U.S., having been the first pesticide to be withdrawn due to tetragenic effects. The data here come from an experiment to measure the reproductive toxicity of nitrofen on a species of zooplankton (\emph{Ceriodaphnia dubia}). 50 animals were randomized into batches of 10 and each batch was put in a solution with a measured concentration of nitrofen. Then the number of live offspring in each of the three broods to each animal was recorded. } \usage{ nitrofen } \format{ This data frame contains the following columns: \describe{ \item{\code{conc}}{ The nitrofen concentration in the solution (mug/litre). } \item{\code{brood1}}{ The number of live offspring in the first brood. } \item{\code{brood2}}{ The number of live offspring in the second brood. } \item{\code{brood3}}{ The number of live offspring in the third brood. } \item{\code{total}}{ The total number of live offspring in the first three broods. }}} \source{ The data were obtained from Bailer, A.J. and Oris, J.T. (1994) Assessing toxicity of pollutants in aquatic systems. In \emph{Case Studies in Biometry}. N. Lange, L. Ryan, L. Billard, D. Brillinger, L. Conquest and J. Greenhouse (editors), 25--40. John Wiley. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/tau.Rd0000644000176000001440000000402413245463616013112 0ustar ripleyusers\name{tau} \alias{tau} \title{ Tau Particle Decay Modes } \description{ The \code{tau} data frame has 60 rows and 2 columns. The tau particle is a heavy electron-like particle discovered in the 1970's by Martin Perl at the Stanford Linear Accelerator Center. Soon after its production the tau particle decays into various collections of more stable particles. About 86\% of the time the decay involves just one charged particle. This rate has been measured independently 13 times. The one-charged-particle event is made up of four major modes of decay as well as a collection of other events. The four main types of decay are denoted rho, pi, e and mu. These rates have been measured independently 6, 7, 14 and 19 times respectively. Due to physical constraints each experiment can only estimate the composite one-charged-particle decay rate or the rate of one of the major modes of decay. Each experiment consists of a major research project involving many years work. One of the goals of the experiments was to estimate the rate of decay due to events other than the four main modes of decay. These are uncertain events and so cannot themselves be observed directly. } \usage{ tau } \format{ This data frame contains the following columns: \describe{ \item{\code{rate}}{ The decay rate expressed as a percentage. } \item{\code{decay}}{ The type of decay measured in the experiment. It is a factor with levels \code{1}, \code{rho}, \code{pi}, \code{e} and \code{mu}. }}} \source{ The data were obtained from Efron, B. (1992) Jackknife-after-bootstrap standard errors and influence functions (with Discussion). \emph{Journal of the Royal Statistical Society, B}, \bold{54}, 83--127. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Hayes, K.G., Perl, M.L. and Efron, B. (1989) Application of the bootstrap statistical method to the tau-decay-mode problem. \emph{Physical Review, D}, \bold{39}, 274-279. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/simplex.object.Rd0000644000176000001440000000732013245463610015243 0ustar ripleyusers\name{simplex.object} \alias{simplex.object} \title{ Linear Programming Solution Objects } \description{ Class of objects that result from solving a linear programming problem using \code{simplex}. } \section{Generation}{ This class of objects is returned from calls to the function \code{simplex}. } \section{Methods}{ The class \code{"saddle.distn"} has a method for the function \code{print}. } \section{Structure}{ Objects of class \code{"simplex"} are implemented as a list with the following components. \describe{ \item{soln}{ The values of \code{x} which optimize the objective function under the specified constraints provided those constraints are jointly feasible. } \item{solved}{ This indicates whether the problem was solved. A value of \code{-1} indicates that no feasible solution could be found. A value of \code{0} that the maximum number of iterations was reached without termination of the second stage. This may indicate an unbounded function or simply that more iterations are needed. A value of \code{1} indicates that an optimal solution has been found. } \item{value}{ The value of the objective function at \code{soln}. } \item{val.aux}{ This is \code{NULL} if a feasible solution is found. Otherwise it is a positive value giving the value of the auxiliary objective function when it was minimized. } \item{obj}{ The original coefficients of the objective function. } \item{a}{ The objective function coefficients re-expressed such that the basic variables have coefficient zero. } \item{a.aux}{ This is \code{NULL} if a feasible solution is found. Otherwise it is the re-expressed auxiliary objective function at the termination of the first phase of the simplex method. } \item{A}{ The final constraint matrix which is expressed in terms of the non-basic variables. If a feasible solution is found then this will have dimensions \code{m1+m2+m3} by \code{n+m1+m2}, where the final \code{m1+m2} columns correspond to slack and surplus variables. If no feasible solution is found there will be an additional \code{m1+m2+m3} columns for the artificial variables introduced to solve the first phase of the problem. } \item{basic}{ The indices of the basic (non-zero) variables in the solution. Indices between \code{n+1} and \code{n+m1} correspond to slack variables, those between \code{n+m1+1} and \code{n+m2} correspond to surplus variables and those greater than \code{n+m2} are artificial variables. Indices greater than \code{n+m2} should occur only if \code{solved} is \code{-1} as the artificial variables are discarded in the second stage of the simplex method. } \item{slack}{ The final values of the \code{m1} slack variables which arise when the "<=" constraints are re-expressed as the equalities \code{A1\%*\%x + slack = b1}. } \item{surplus}{ The final values of the \code{m2} surplus variables which arise when the "<=" constraints are re-expressed as the equalities \code{A2\%*\%x - surplus = b2}. } \item{artificial}{ This is NULL if a feasible solution can be found. If no solution can be found then this contains the values of the \code{m1+m2+m3} artificial variables which minimize their sum subject to the original constraints. A feasible solution exists only if all of the artificial variables can be made 0 simultaneously. } } } \seealso{ \code{\link{print.simplex}}, \code{\link{simplex}} } \keyword{optimize} \keyword{methods} % Converted by Sd2Rd version 0.3-1. boot/man/jack.after.boot.Rd0000644000176000001440000001261213245463615015274 0ustar ripleyusers\name{jack.after.boot} \alias{jack.after.boot} \title{ Jackknife-after-Bootstrap Plots } \description{ This function calculates the jackknife influence values from a bootstrap output object and plots the corresponding jackknife-after-bootstrap plot. } \usage{ jack.after.boot(boot.out, index = 1, t = NULL, L = NULL, useJ = TRUE, stinf = TRUE, alpha = NULL, main = "", ylab = NULL, \dots) } \arguments{ \item{boot.out}{ An object of class \code{"boot"} which would normally be created by a call to \code{\link{boot}}. It should represent a nonparametric bootstrap. For reliable results \code{boot.out$R} should be reasonably large. } \item{index}{ The index of the statistic of interest in the output of \code{boot.out$statistic}. } \item{t}{ A vector of length \code{boot.out$R} giving the bootstrap replicates of the statistic of interest. This is useful if the statistic of interest is a function of the calculated bootstrap output. If it is not supplied then the default is \code{boot.out$t[,index]}. } \item{L}{ The empirical influence values for the statistic of interest. These are used only if \code{useJ} is \code{FALSE}. If they are not supplied and are needed, they are calculated by a call to \code{empinf}. If \code{L} is supplied then it is assumed that they are the infinitesimal jackknife values. } \item{useJ}{ A logical variable indicating if the jackknife influence values calculated from the bootstrap replicates should be used. If \code{FALSE} the empirical influence values are used. The default is \code{TRUE}. } \item{stinf}{ A logical variable indicating whether to standardize the jackknife values before plotting them. If \code{TRUE} then the jackknife values used are divided by their standard error. } \item{alpha}{ The quantiles at which the plots are required. The default is \code{c(0.05, 0.1, 0.16, 0.5, 0.84, 0.9, 0.95)}. } \item{main}{ A character string giving the main title for the plot. } \item{ylab}{ The label for the Y axis. If the default values of \code{alpha} are used and \code{ylab} is not supplied then a label indicating which percentiles are plotted is used. If \code{alpha} is supplied then the default label will not say which percentiles were used. } \item{...}{ Any extra arguments required by \code{boot.out$statistic}. These are required only if \code{useJ} is \code{FALSE} and \code{L} is not supplied, in which case they are passed to \code{empinf} for use in calculation of the empirical influence values. }} \value{ There is no returned value but a plot is generated on the current graphics display. } \section{Side Effects}{ A plot is created on the current graphics device. } \details{ The centred jackknife quantiles for each observation are estimated from those bootstrap samples in which the particular observation did not appear. These are then plotted against the influence values. If \code{useJ} is \code{TRUE} then the influence values are found in the same way as the difference between the mean of the statistic in the samples excluding the observations and the mean in all samples. If \code{useJ} is \code{FALSE} then empirical influence values are calculated by calling \code{empinf}. The resulting plots are useful diagnostic tools for looking at the way individual observations affect the bootstrap output. The plot will consist of a number of horizontal dotted lines which correspond to the quantiles of the centred bootstrap distribution. For each data point the quantiles of the bootstrap distribution calculated by omitting that point are plotted against the (possibly standardized) jackknife values. The observation number is printed below the plots. To make it easier to see the effect of omitting points on quantiles, the plotted quantiles are joined by line segments. These plots provide a useful diagnostic tool in establishing the effect of individual observations on the bootstrap distribution. See the references below for some guidelines on the interpretation of the plots. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Efron, B. (1992) Jackknife-after-bootstrap standard errors and influence functions (with Discussion). \emph{Journal of the Royal Statistical Society, B}, \bold{54}, 83--127. } \seealso{ \code{\link{boot}}, \code{\link{empinf}} } \examples{ # To draw the jackknife-after-bootstrap plot for the head size data as in # Example 3.24 of Davison and Hinkley (1997) frets.fun <- function(data, i) { pcorr <- function(x) { # Function to find the correlations and partial correlations between # the four measurements. v <- cor(x) v.d <- diag(var(x)) iv <- solve(v) iv.d <- sqrt(diag(iv)) iv <- - diag(1/iv.d) \%*\% iv \%*\% diag(1/iv.d) q <- NULL n <- nrow(v) for (i in 1:(n-1)) q <- rbind( q, c(v[i, 1:i], iv[i,(i+1):n]) ) q <- rbind( q, v[n, ] ) diag(q) <- round(diag(q)) q } d <- data[i, ] v <- pcorr(d) c(v[1,], v[2,], v[3,], v[4,]) } frets.boot <- boot(log(as.matrix(frets)), frets.fun, R = 999) # we will concentrate on the partial correlation between head breadth # for the first son and head length for the second. This is the 7th # element in the output of frets.fun so we set index = 7 jack.after.boot(frets.boot, useJ = FALSE, stinf = FALSE, index = 7) } \keyword{hplot} \keyword{nonparametric} boot/man/cd4.nested.Rd0000644000176000001440000000074213245463610014251 0ustar ripleyusers\name{cd4.nested} \alias{cd4.nested} \title{ Nested Bootstrap of cd4 data } \description{ This is an example of a nested bootstrap for the correlation coefficient of the \code{cd4} data frame. It is used in a practical in Chapter 5 of Davison and Hinkley (1997). } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \seealso{ \code{\link{cd4}} } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/print.simplex.Rd0000644000176000001440000000207513245463617015142 0ustar ripleyusers\name{print.simplex} \alias{print.simplex} \title{ Print Solution to Linear Programming Problem } \description{ This is a method for the function \code{print()} to print objects of class \code{"simplex"}. } \usage{ \method{print}{simplex}(x, \dots) } \arguments{ \item{x}{ An object of class \code{"simplex"} created by calling the function \code{simplex} to solve a linear programming problem. } \item{\dots}{further arguments passed to or from other methods.} } \value{ \code{x} is returned silently. } \details{ The coefficients of the objective function are printed. If a solution to the linear programming problem was found then the solution and the optimal value of the objective function are printed. If a feasible solution was found but the maximum number of iterations was exceeded then the last feasible solution and the objective function value at that point are printed. If no feasible solution could be found then a message stating that is printed. } \seealso{ \code{\link{simplex}} } \keyword{print} \keyword{optimize} % Converted by Sd2Rd version 0.3-1. boot/man/dogs.Rd0000644000176000001440000000106613245463610013252 0ustar ripleyusers\name{dogs} \alias{dogs} \title{ Cardiac Data for Domestic Dogs } \usage{dogs} \description{ The \code{dogs} data frame has 7 rows and 2 columns. Data on the cardiac oxygen consumption and left ventricular pressure were gathered on 7 domestic dogs. } \format{ This data frame contains the following columns: \describe{ \item{mvo}{Cardiac Oxygen Consumption} \item{lvp}{Left Ventricular Pressure} } } \references{ Davison, A. C. and Hinkley, D. V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} boot/man/manaus.Rd0000644000176000001440000000377313245463610013611 0ustar ripleyusers\name{manaus} \alias{manaus} \title{ Average Heights of the Rio Negro river at Manaus } \description{ The \code{manaus} time series is of class \code{"ts"} and has 1080 observations on one variable. The data values are monthly averages of the daily stages (heights) of the Rio Negro at Manaus. Manaus is 18km upstream from the confluence of the Rio Negro with the Amazon but because of the tiny slope of the water surface and the lower courses of its flatland affluents, they may be regarded as a good approximation of the water level in the Amazon at the confluence. The data here cover 90 years from January 1903 until December 1992. The Manaus gauge is tied in with an arbitrary bench mark of 100m set in the steps of the Municipal Prefecture; gauge readings are usually referred to sea level, on the basis of a mark on the steps leading to the Parish Church (Matriz), which is assumed to lie at an altitude of 35.874 m according to observations made many years ago under the direction of Samuel Pereira, an engineer in charge of the Manaus Sanitation Committee Whereas such an altitude cannot, by any means, be considered to be a precise datum point, observations have been provisionally referred to it. The measurements are in metres. } \source{ The data were kindly made available by Professors H. O'Reilly Sternberg and D. R. Brillinger of the University of California at Berkeley. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Sternberg, H. O'R. (1987) Aggravation of floods in the Amazon river as a consequence of deforestation? \emph{Geografiska Annaler}, \bold{69A}, 201-219. Sternberg, H. O'R. (1995) Waters and wetlands of Brazilian Amazonia: An uncertain future. In \emph{The Fragile Tropics of Latin America: Sustainable Management of Changing Environments}, Nishizawa, T. and Uitto, J.I. (editors), United Nations University Press, 113-179. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/print.saddle.distn.Rd0000644000176000001440000000147213245463610016026 0ustar ripleyusers\name{print.saddle.distn} \alias{print.saddle.distn} \title{ Print Quantiles of Saddlepoint Approximations } \description{ This is a method for the function \code{print()} to print objects of class \code{"saddle.distn"}. } \usage{ \method{print}{saddle.distn}(x, \dots) } \arguments{ \item{x}{ An object of class \code{"saddle.distn"} created by a call to \code{saddle.distn}. } \item{\dots}{further arguments passed to or from other methods.} } \value{ The input is returned invisibly. } \details{ The quantiles of the saddlepoint approximation to the distribution are printed along with the original call and some other useful information. } \seealso{ \code{\link{lines.saddle.distn}}, \code{\link{saddle.distn}} } \keyword{print} \keyword{smooth} \keyword{nonparametric} % Converted by Sd2Rd version 0.3-1. boot/man/coal.Rd0000644000176000001440000000204013245463611013226 0ustar ripleyusers\name{coal} \alias{coal} \title{ Dates of Coal Mining Disasters } \description{ The \code{coal} data frame has 191 rows and 1 columns. This data frame gives the dates of 191 explosions in coal mines which resulted in 10 or more fatalities. The time span of the data is from March 15, 1851 until March 22 1962. } \usage{ coal } \format{ This data frame contains the following column: \describe{ \item{\code{date}}{ The date of the disaster. The integer part of \code{date} gives the year. The day is represented as the fraction of the year that had elapsed on that day. }}} \source{ The data were obtained from Hand, D.J., Daly, F., Lunn, A.D., McConway, K.J. and Ostrowski, E. (1994) \emph{A Handbook of Small Data Sets}, Chapman and Hall. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Jarrett, R.G. (1979) A note on the intervals between coal-mining disasters. \emph{Biometrika}, \bold{66}, 191-193. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/envelope.Rd0000644000176000001440000000741713245463606014146 0ustar ripleyusers\name{envelope} \alias{envelope} \title{ Confidence Envelopes for Curves } \description{ This function calculates overall and pointwise confidence envelopes for a curve based on bootstrap replicates of the curve evaluated at a number of fixed points. } \usage{ envelope(boot.out = NULL, mat = NULL, level = 0.95, index = 1:ncol(mat)) } \arguments{ \item{boot.out}{ An object of class \code{"boot"} for which \code{boot.out$t} contains the replicates of the curve at a number of fixed points. } \item{mat}{ A matrix of bootstrap replicates of the values of the curve at a number of fixed points. This is a required argument if \code{boot.out} is not supplied and is set to \code{boot.out$t} otherwise. } \item{level}{ The confidence level of the envelopes required. The default is to find 95\% confidence envelopes. It can be a scalar or a vector of length 2. If it is scalar then both the pointwise and the overall envelopes are found at that level. If is a vector then the first element gives the level for the pointwise envelope and the second gives the level for the overall envelope. } \item{index}{ The numbers of the columns of \code{mat} which contain the bootstrap replicates. This can be used to ensure that other statistics which may have been calculated in the bootstrap are not considered as values of the function. }} \value{ A list with the following components : \item{point}{ A matrix with two rows corresponding to the values of the upper and lower pointwise confidence envelope at the same points as the bootstrap replicates were calculated. } \item{overall}{ A matrix similar to \code{point} but containing the envelope which controls the overall error. } \item{k.pt}{ The quantiles used for the pointwise envelope. } \item{err.pt}{ A vector with two components, the first gives the pointwise error rate for the pointwise envelope, and the second the overall error rate for that envelope. } \item{k.ov}{ The quantiles used for the overall envelope. } \item{err.ov}{ A vector with two components, the first gives the pointwise error rate for the overall envelope, and the second the overall error rate for that envelope. } \item{err.nom}{ A vector of length 2 giving the nominal error rates for the pointwise and the overall envelopes. }} \details{ The pointwise envelope is found by simply looking at the quantiles of the replicates at each point. The overall error for that envelope is then calculated using equation (4.17) of Davison and Hinkley (1997). A sequence of pointwise envelopes is then found until one of them has overall error approximately equal to the level required. If no such envelope can be found then the envelope returned will just contain the extreme values of each column of \code{mat}. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \seealso{ \code{\link{boot}}, \code{\link{boot.ci}} } \examples{ # Testing whether the final series of measurements of the gravity data # may come from a normal distribution. This is done in Examples 4.7 # and 4.8 of Davison and Hinkley (1997). grav1 <- gravity$g[gravity$series == 8] grav.z <- (grav1 - mean(grav1))/sqrt(var(grav1)) grav.gen <- function(dat, mle) rnorm(length(dat)) grav.qqboot <- boot(grav.z, sort, R = 999, sim = "parametric", ran.gen = grav.gen) grav.qq <- qqnorm(grav.z, plot.it = FALSE) grav.qq <- lapply(grav.qq, sort) plot(grav.qq, ylim = c(-3.5, 3.5), ylab = "Studentized Order Statistics", xlab = "Normal Quantiles") grav.env <- envelope(grav.qqboot, level = 0.9) lines(grav.qq$x, grav.env$point[1, ], lty = 4) lines(grav.qq$x, grav.env$point[2, ], lty = 4) lines(grav.qq$x, grav.env$overall[1, ], lty = 1) lines(grav.qq$x, grav.env$overall[2, ], lty = 1) } \keyword{dplot} \keyword{htest} % Converted by Sd2Rd version 1.15. boot/man/aircondit.Rd0000644000176000001440000000216013245463611014267 0ustar ripleyusers\name{aircondit} \alias{aircondit} \alias{aircondit7} \title{ Failures of Air-conditioning Equipment } \description{ Proschan (1963) reported on the times between failures of the air-conditioning equipment in 10 Boeing 720 aircraft. The \code{aircondit} data frame contains the intervals for the ninth aircraft while \code{aircondit7} contains those for the seventh aircraft. Both data frames have just one column. Note that the data have been sorted into increasing order. } \usage{ aircondit } \format{ The data frames contain the following column: \describe{ \item{\code{hours}}{ The time interval in hours between successive failures of the air-conditioning equipment }}} \source{ The data were taken from Cox, D.R. and Snell, E.J. (1981) \emph{Applied Statistics: Principles and Examples}. Chapman and Hall. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Proschan, F. (1963) Theoretical explanation of observed decreasing failure rate. \emph{Technometrics}, \bold{5}, 375-383. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/simplex.Rd0000644000176000001440000001054613245463615014007 0ustar ripleyusers\name{simplex} \alias{simplex} \title{ Simplex Method for Linear Programming Problems } \description{ This function will optimize the linear function \code{a\%*\%x} subject to the constraints \code{A1\%*\%x <= b1}, \code{A2\%*\%x >= b2}, \code{A3\%*\%x = b3} and \code{x >= 0}. Either maximization or minimization is possible but the default is minimization. } \usage{ simplex(a, A1 = NULL, b1 = NULL, A2 = NULL, b2 = NULL, A3 = NULL, b3 = NULL, maxi = FALSE, n.iter = n + 2 * m, eps = 1e-10) } \arguments{ \item{a}{ A vector of length \code{n} which gives the coefficients of the objective function. } \item{A1}{ An \code{m1} by \code{n} matrix of coefficients for the \eqn{\leq}{<=} type of constraints. } \item{b1}{ A vector of length \code{m1} giving the right hand side of the \eqn{\leq}{<=} constraints. This argument is required if \code{A1} is given and ignored otherwise. All values in \code{b1} must be non-negative. } \item{A2}{ An \code{m2} by \code{n} matrix of coefficients for the \eqn{\geq}{>=} type of constraints. } \item{b2}{ A vector of length \code{m2} giving the right hand side of the \eqn{\geq}{>=} constraints. This argument is required if \code{A2} is given and ignored otherwise. All values in \code{b2} must be non-negative. Note that the constraints \code{x >= 0} are included automatically and so should not be repeated here. } \item{A3}{ An \code{m3} by \code{n} matrix of coefficients for the equality constraints. } \item{b3}{ A vector of length \code{m3} giving the right hand side of equality constraints. This argument is required if \code{A3} is given and ignored otherwise. All values in \code{b3} must be non-negative. } \item{maxi}{ A logical flag which specifies minimization if \code{FALSE} (default) and maximization otherwise. If \code{maxi} is \code{TRUE} then the maximization problem is recast as a minimization problem by changing the objective function coefficients to their negatives. } \item{n.iter}{ The maximum number of iterations to be conducted in each phase of the simplex method. The default is \code{n+2*(m1+m2+m3)}. } \item{eps}{ The floating point tolerance to be used in tests of equality. } } \value{ An object of class \code{"simplex"}: see \code{\link{simplex.object}}. } \details{ The method employed by this function is the two phase tableau simplex method. If there are \eqn{\geq}{>=} or equality constraints an initial feasible solution is not easy to find. To find a feasible solution an artificial variable is introduced into each \eqn{\geq}{>=} or equality constraint and an auxiliary objective function is defined as the sum of these artificial variables. If a feasible solution to the set of constraints exists then the auxiliary objective will be minimized when all of the artificial variables are 0. These are then discarded and the original problem solved starting at the solution to the auxiliary problem. If the only constraints are of the \eqn{\leq}{<=} form, the origin is a feasible solution and so the first stage can be omitted. } \note{ The method employed here is suitable only for relatively small systems. Also if possible the number of constraints should be reduced to a minimum in order to speed up the execution time which is approximately proportional to the cube of the number of constraints. In particular if there are any constraints of the form \code{x[i] >= b2[i]} they should be omitted by setting \code{x[i] = x[i]-b2[i]}, changing all the constraints and the objective function accordingly and then transforming back after the solution has been found. } \references{ Gill, P.E., Murray, W. and Wright, M.H. (1991) \emph{Numerical Linear Algebra and Optimization Vol. 1}. Addison-Wesley. Press, W.H., Teukolsky, S.A., Vetterling, W.T. and Flannery, B.P. (1992) \emph{Numerical Recipes: The Art of Scientific Computing (Second Edition)}. Cambridge University Press. } \examples{ # This example is taken from Exercise 7.5 of Gill, Murray and Wright (1991). enj <- c(200, 6000, 3000, -200) fat <- c(800, 6000, 1000, 400) vitx <- c(50, 3, 150, 100) vity <- c(10, 10, 75, 100) vitz <- c(150, 35, 75, 5) simplex(a = enj, A1 = fat, b1 = 13800, A2 = rbind(vitx, vity, vitz), b2 = c(600, 300, 550), maxi = TRUE) } \keyword{optimize} boot/man/saddle.Rd0000644000176000001440000001631513245463615013562 0ustar ripleyusers\name{saddle} \alias{saddle} \title{ Saddlepoint Approximations for Bootstrap Statistics } \description{ This function calculates a saddlepoint approximation to the distribution of a linear combination of \bold{W} at a particular point \code{u}, where \bold{W} is a vector of random variables. The distribution of \bold{W} may be multinomial (default), Poisson or binary. Other distributions are possible also if the adjusted cumulant generating function and its second derivative are given. Conditional saddlepoint approximations to the distribution of one linear combination given the values of other linear combinations of \bold{W} can be calculated for \bold{W} having binary or Poisson distributions. } \usage{ saddle(A = NULL, u = NULL, wdist = "m", type = "simp", d = NULL, d1 = 1, init = rep(0.1, d), mu = rep(0.5, n), LR = FALSE, strata = NULL, K.adj = NULL, K2 = NULL) } \arguments{ \item{A}{ A vector or matrix of known coefficients of the linear combinations of \bold{W}. It is a required argument unless \code{K.adj} and \code{K2} are supplied, in which case it is ignored. } \item{u}{ The value at which it is desired to calculate the saddlepoint approximation to the distribution of the linear combination of \bold{W}. It is a required argument unless \code{K.adj} and \code{K2} are supplied, in which case it is ignored. } \item{wdist}{ The distribution of \bold{W}. This can be one of \code{"m"} (multinomial), \code{"p"} (Poisson), \code{"b"} (binary) or \code{"o"} (other). If \code{K.adj} and \code{K2} are given \code{wdist} is set to \code{"o"}. } \item{type}{ The type of saddlepoint approximation. Possible types are \code{"simp"} for simple saddlepoint and \code{"cond"} for the conditional saddlepoint. When \code{wdist} is \code{"o"} or \code{"m"}, \code{type} is automatically set to \code{"simp"}, which is the only type of saddlepoint currently implemented for those distributions. } \item{d}{ This specifies the dimension of the whole statistic. This argument is required only when \code{wdist = "o"} and defaults to 1 if not supplied in that case. For other distributions it is set to \code{ncol(A)}. } \item{d1}{ When \code{type} is \code{"cond"} this is the dimension of the statistic of interest which must be less than \code{length(u)}. Then the saddlepoint approximation to the conditional distribution of the first \code{d1} linear combinations given the values of the remaining combinations is found. Conditional distribution function approximations can only be found if the value of \code{d1} is 1. } \item{init}{ Used if \code{wdist} is either \code{"m"} or \code{"o"}, this gives initial values to \code{nlmin} which is used to solve the saddlepoint equation. } \item{mu}{ The values of the parameters of the distribution of \bold{W} when \code{wdist} is \code{"m"}, \code{"p"} \code{"b"}. \code{mu} must be of the same length as W (i.e. \code{nrow(A)}). The default is that all values of \code{mu} are equal and so the elements of \bold{W} are identically distributed. } \item{LR}{ If \code{TRUE} then the Lugananni-Rice approximation to the cdf is used, otherwise the approximation used is based on Barndorff-Nielsen's r*. } \item{strata}{ The strata for stratified data. } \item{K.adj}{ The adjusted cumulant generating function used when \code{wdist} is \code{"o"}. This is a function of a single parameter, \code{zeta}, which calculates \code{K(zeta)-u\%*\%zeta}, where \code{K(zeta)} is the cumulant generating function of \bold{W}. } \item{K2}{ This is a function of a single parameter \code{zeta} which returns the matrix of second derivatives of \code{K(zeta)} for use when \code{wdist} is \code{"o"}. If \code{K.adj} is given then this must be given also. It is called only once with the calculated solution to the saddlepoint equation being passed as the argument. This argument is ignored if \code{K.adj} is not supplied. } } \value{ A list consisting of the following components \item{spa}{ The saddlepoint approximations. The first value is the density approximation and the second value is the distribution function approximation. } \item{zeta.hat}{ The solution to the saddlepoint equation. For the conditional saddlepoint this is the solution to the saddlepoint equation for the numerator. } \item{zeta2.hat}{ If \code{type} is \code{"cond"} this is the solution to the saddlepoint equation for the denominator. This component is not returned for any other value of \code{type}. } } \details{ If \code{wdist} is \code{"o"} or \code{"m"}, the saddlepoint equations are solved using \code{nlmin} to minimize \code{K.adj} with respect to its parameter \code{zeta}. For the Poisson and binary cases, a generalized linear model is fitted such that the parameter estimates solve the saddlepoint equations. The response variable 'y' for the \code{glm} must satisfy the equation \code{t(A)\%*\%y = u} (\code{t()} being the transpose function). Such a vector can be found as a feasible solution to a linear programming problem. This is done by a call to \code{simplex}. The covariate matrix for the \code{glm} is given by \code{A}. } \references{ Booth, J.G. and Butler, R.W. (1990) Randomization distributions and saddlepoint approximations in generalized linear models. \emph{Biometrika}, \bold{77}, 787--796. Canty, A.J. and Davison, A.C. (1997) Implementation of saddlepoint approximations to resampling distributions. \emph{Computing Science and Statistics; Proceedings of the 28th Symposium on the Interface}, 248--253. Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and their Application}. Cambridge University Press. Jensen, J.L. (1995) \emph{Saddlepoint Approximations}. Oxford University Press. } \seealso{ \code{\link{saddle.distn}}, \code{\link{simplex}} } \examples{ # To evaluate the bootstrap distribution of the mean failure time of # air-conditioning equipment at 80 hours saddle(A = aircondit$hours/12, u = 80) # Alternatively this can be done using a conditional poisson saddle(A = cbind(aircondit$hours/12,1), u = c(80, 12), wdist = "p", type = "cond") # To use the Lugananni-Rice approximation to this saddle(A = cbind(aircondit$hours/12,1), u = c(80, 12), wdist = "p", type = "cond", LR = TRUE) # Example 9.16 of Davison and Hinkley (1997) calculates saddlepoint # approximations to the distribution of the ratio statistic for the # city data. Since the statistic is not in itself a linear combination # of random Variables, its distribution cannot be found directly. # Instead the statistic is expressed as the solution to a linear # estimating equation and hence its distribution can be found. We # get the saddlepoint approximation to the pdf and cdf evaluated at # t = 1.25 as follows. jacobian <- function(dat,t,zeta) { p <- exp(zeta*(dat$x-t*dat$u)) abs(sum(dat$u*p)/sum(p)) } city.sp1 <- saddle(A = city$x-1.25*city$u, u = 0) city.sp1$spa[1] <- jacobian(city, 1.25, city.sp1$zeta.hat) * city.sp1$spa[1] city.sp1 } \keyword{smooth} \keyword{nonparametric} % Converted by Sd2Rd version 1.15. boot/man/lines.saddle.distn.Rd0000644000176000001440000000561413245463606016013 0ustar ripleyusers\name{lines.saddle.distn} \alias{lines.saddle.distn} \title{ Add a Saddlepoint Approximation to a Plot } \description{ This function adds a line corresponding to a saddlepoint density or distribution function approximation to the current plot. } \usage{ \method{lines}{saddle.distn}(x, dens = TRUE, h = function(u) u, J = function(u) 1, npts = 50, lty = 1, \dots) } \arguments{ \item{x}{ An object of class \code{"saddle.distn"} (see \code{\link{saddle.distn.object}} representing a saddlepoint approximation to a distribution. } \item{dens}{ A logical variable indicating whether the saddlepoint density (\code{TRUE}; the default) or the saddlepoint distribution function (\code{FALSE}) should be plotted. } \item{h}{ Any transformation of the variable that is required. Its first argument must be the value at which the approximation is being performed and the function must be vectorized. } \item{J}{ When \code{dens=TRUE} this function specifies the Jacobian for any transformation that may be necessary. The first argument of \code{J} must the value at which the approximation is being performed and the function must be vectorized. If \code{h} is supplied \code{J} must also be supplied and both must have the same argument list. } \item{npts}{ The number of points to be used for the plot. These points will be evenly spaced over the range of points used in finding the saddlepoint approximation. } \item{lty}{ The line type to be used. } \item{\dots}{ Any additional arguments to \code{h} and \code{J}. } } \value{ \code{sad.d} is returned invisibly. } \section{Side Effects}{ A line is added to the current plot. } \details{ The function uses \code{smooth.spline} to produce the saddlepoint curve. When \code{dens=TRUE} the spline is on the log scale and when \code{dens=FALSE} it is on the probit scale. } \seealso{ \code{\link{saddle.distn}} } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \examples{ # In this example we show how a plot such as that in Figure 9.9 of # Davison and Hinkley (1997) may be produced. Note the large number of # bootstrap replicates required in this example. expdata <- rexp(12) vfun <- function(d, i) { n <- length(d) (n-1)/n*var(d[i]) } exp.boot <- boot(expdata,vfun, R = 9999) exp.L <- (expdata - mean(expdata))^2 - exp.boot$t0 exp.tL <- linear.approx(exp.boot, L = exp.L) hist(exp.tL, nclass = 50, probability = TRUE) exp.t0 <- c(0, sqrt(var(exp.boot$t))) exp.sp <- saddle.distn(A = exp.L/12,wdist = "m", t0 = exp.t0) # The saddlepoint approximation in this case is to the density of # t-t0 and so t0 must be added for the plot. lines(exp.sp, h = function(u, t0) u+t0, J = function(u, t0) 1, t0 = exp.boot$t0) } \keyword{aplot} \keyword{smooth} \keyword{nonparametric} boot/man/gravity.Rd0000644000176000001440000000274013245463612014005 0ustar ripleyusers\name{gravity} \alias{gravity} \alias{grav} \title{ Acceleration Due to Gravity } \description{ The \code{gravity} data frame has 81 rows and 2 columns. The \code{grav} data set has 26 rows and 2 columns. Between May 1934 and July 1935, the National Bureau of Standards in Washington D.C. conducted a series of experiments to estimate the acceleration due to gravity, \emph{g}, at Washington. Each experiment produced a number of replicate estimates of \emph{g} using the same methodology. Although the basic method remained the same for all experiments, that of the reversible pendulum, there were changes in configuration. The \code{gravity} data frame contains the data from all eight experiments. The \code{grav} data frame contains the data from the experiments 7 and 8. The data are expressed as deviations from 980.000 in centimetres per second squared. } \usage{ gravity } \format{ This data frame contains the following columns: \describe{ \item{\code{g}}{ The deviation of the estimate from 980.000 centimetres per second squared. } \item{\code{series}}{ A factor describing from which experiment the estimate was derived. }}} \source{ The data were obtained from Cressie, N. (1982) Playing safe with misweighted means. \emph{Journal of the American Statistical Association}, \bold{77}, 754--759. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/aids.Rd0000644000176000001440000000377313245463615013252 0ustar ripleyusers\name{aids} \alias{aids} \title{ Delay in AIDS Reporting in England and Wales } \description{ The \code{aids} data frame has 570 rows and 6 columns. Although all cases of AIDS in England and Wales must be reported to the Communicable Disease Surveillance Centre, there is often a considerable delay between the time of diagnosis and the time that it is reported. In estimating the prevalence of AIDS, account must be taken of the unknown number of cases which have been diagnosed but not reported. The data set here records the reported cases of AIDS diagnosed from July 1983 and until the end of 1992. The data are cross-classified by the date of diagnosis and the time delay in the reporting of the cases. } \usage{ aids } \format{ This data frame contains the following columns: \describe{ \item{\code{year}}{ The year of the diagnosis. } \item{\code{quarter}}{ The quarter of the year in which diagnosis was made. } \item{\code{delay}}{ The time delay (in months) between diagnosis and reporting. 0 means that the case was reported within one month. Longer delays are grouped in 3 month intervals and the value of \code{delay} is the midpoint of the interval (therefore a value of \code{2} indicates that reporting was delayed for between 1 and 3 months). } \item{\code{dud}}{ An indicator of censoring. These are categories for which full information is not yet available and the number recorded is a lower bound only. } \item{\code{time}}{ The time interval of the diagnosis. That is the number of quarters from July 1983 until the end of the quarter in which these cases were diagnosed. } \item{\code{y}}{ The number of AIDS cases reported. }}} \source{ The data were obtained from De Angelis, D. and Gilks, W.R. (1994) Estimating acquired immune deficiency syndrome accounting for reporting delay. \emph{Journal of the Royal Statistical Society, A}, \bold{157}, 31--40. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} boot/man/boot.Rd0000644000176000001440000004405413245463606013272 0ustar ripleyusers\name{boot} \alias{boot} \alias{boot.return} \alias{c.boot} \title{ Bootstrap Resampling } \description{ Generate \code{R} bootstrap replicates of a statistic applied to data. Both parametric and nonparametric resampling are possible. For the nonparametric bootstrap, possible resampling methods are the ordinary bootstrap, the balanced bootstrap, antithetic resampling, and permutation. For nonparametric multi-sample problems stratified resampling is used: this is specified by including a vector of strata in the call to boot. Importance resampling weights may be specified. } \usage{ boot(data, statistic, R, sim = "ordinary", stype = c("i", "f", "w"), strata = rep(1,n), L = NULL, m = 0, weights = NULL, ran.gen = function(d, p) d, mle = NULL, simple = FALSE, ..., parallel = c("no", "multicore", "snow"), ncpus = getOption("boot.ncpus", 1L), cl = NULL) } \arguments{ \item{data}{ The data as a vector, matrix or data frame. If it is a matrix or data frame then each row is considered as one multivariate observation. } \item{statistic}{ A function which when applied to data returns a vector containing the statistic(s) of interest. When \code{sim = "parametric"}, the first argument to \code{statistic} must be the data. For each replicate a simulated dataset returned by \code{ran.gen} will be passed. In all other cases \code{statistic} must take at least two arguments. The first argument passed will always be the original data. The second will be a vector of indices, frequencies or weights which define the bootstrap sample. Further, if predictions are required, then a third argument is required which would be a vector of the random indices used to generate the bootstrap predictions. Any further arguments can be passed to \code{statistic} through the \code{\dots} argument. } \item{R}{ The number of bootstrap replicates. Usually this will be a single positive integer. For importance resampling, some resamples may use one set of weights and others use a different set of weights. In this case \code{R} would be a vector of integers where each component gives the number of resamples from each of the rows of weights. } \item{sim}{ A character string indicating the type of simulation required. Possible values are \code{"ordinary"} (the default), \code{"parametric"}, \code{"balanced"}, \code{"permutation"}, or \code{"antithetic"}. Importance resampling is specified by including importance weights; the type of importance resampling must still be specified but may only be \code{"ordinary"} or \code{"balanced"} in this case. } \item{stype}{ A character string indicating what the second argument of \code{statistic} represents. Possible values of stype are \code{"i"} (indices - the default), \code{"f"} (frequencies), or \code{"w"} (weights). Not used for \code{sim = "parametric"}. } \item{strata}{ An integer vector or factor specifying the strata for multi-sample problems. This may be specified for any simulation, but is ignored when \code{sim = "parametric"}. When \code{strata} is supplied for a nonparametric bootstrap, the simulations are done within the specified strata. } \item{L}{ Vector of influence values evaluated at the observations. This is used only when \code{sim} is \code{"antithetic"}. If not supplied, they are calculated through a call to \code{empinf}. This will use the infinitesimal jackknife provided that \code{stype} is \code{"w"}, otherwise the usual jackknife is used. } \item{m}{ The number of predictions which are to be made at each bootstrap replicate. This is most useful for (generalized) linear models. This can only be used when \code{sim} is \code{"ordinary"}. \code{m} will usually be a single integer but, if there are strata, it may be a vector with length equal to the number of strata, specifying how many of the errors for prediction should come from each strata. The actual predictions should be returned as the final part of the output of \code{statistic}, which should also take an argument giving the vector of indices of the errors to be used for the predictions. } \item{weights}{ Vector or matrix of importance weights. If a vector then it should have as many elements as there are observations in \code{data}. When simulation from more than one set of weights is required, \code{weights} should be a matrix where each row of the matrix is one set of importance weights. If \code{weights} is a matrix then \code{R} must be a vector of length \code{nrow(weights)}. This parameter is ignored if \code{sim} is not \code{"ordinary"} or \code{"balanced"}. } \item{ran.gen}{ This function is used only when \code{sim = "parametric"} when it describes how random values are to be generated. It should be a function of two arguments. The first argument should be the observed data and the second argument consists of any other information needed (e.g. parameter estimates). The second argument may be a list, allowing any number of items to be passed to \code{ran.gen}. The returned value should be a simulated data set of the same form as the observed data which will be passed to \code{statistic} to get a bootstrap replicate. It is important that the returned value be of the same shape and type as the original dataset. If \code{ran.gen} is not specified, the default is a function which returns the original \code{data} in which case all simulation should be included as part of \code{statistic}. Use of \code{sim = "parametric"} with a suitable \code{ran.gen} allows the user to implement any types of nonparametric resampling which are not supported directly. } \item{mle}{ The second argument to be passed to \code{ran.gen}. Typically these will be maximum likelihood estimates of the parameters. For efficiency \code{mle} is often a list containing all of the objects needed by \code{ran.gen} which can be calculated using the original data set only. } \item{simple}{logical, only allowed to be \code{TRUE} for \code{sim = "ordinary", stype = "i", n = 0} (otherwise ignored with a warning). By default a \code{n} by \code{R} index array is created: this can be large and if \code{simple = TRUE} this is avoided by sampling separately for each replication, which is slower but uses less memory. } \item{\dots}{ Other named arguments for \code{statistic} which are passed unchanged each time it is called. Any such arguments to \code{statistic} should follow the arguments which \code{statistic} is required to have for the simulation. Beware of partial matching to arguments of \code{boot} listed above, and that arguments named \code{X} and \code{FUN} cause conflicts in some versions of \pkg{boot} (but not this one). } \item{parallel}{ The type of parallel operation to be used (if any). If missing, the default is taken from the option \code{"boot.parallel"} (and if that is not set, \code{"no"}). } \item{ncpus}{ integer: number of processes to be used in parallel operation: typically one would chose this to the number of available CPUs. } \item{cl}{ An optional \pkg{parallel} or \pkg{snow} cluster for use if \code{parallel = "snow"}. If not supplied, a cluster on the local machine is created for the duration of the \code{boot} call. } } \value{ The returned value is an object of class \code{"boot"}, containing the following components: \item{t0}{ The observed value of \code{statistic} applied to \code{data}. } \item{t}{ A matrix with \code{sum(R)} rows each of which is a bootstrap replicate of the result of calling \code{statistic}. } \item{R}{ The value of \code{R} as passed to \code{boot}. } \item{data}{ The \code{data} as passed to \code{boot}. } \item{seed}{ The value of \code{.Random.seed} when \code{boot} started work. } \item{statistic}{ The function \code{statistic} as passed to \code{boot}. } \item{sim}{ Simulation type used. } \item{stype}{ Statistic type as passed to \code{boot}. } \item{call}{ The original call to \code{boot}. } \item{strata}{ The strata used. This is the vector passed to \code{boot}, if it was supplied or a vector of ones if there were no strata. It is not returned if \code{sim} is \code{"parametric"}. } \item{weights}{ The importance sampling weights as passed to \code{boot} or the empirical distribution function weights if no importance sampling weights were specified. It is omitted if \code{sim} is not one of \code{"ordinary"} or \code{"balanced"}. } \item{pred.i}{ If predictions are required (\code{m > 0}) this is the matrix of indices at which predictions were calculated as they were passed to statistic. Omitted if \code{m} is \code{0} or \code{sim} is not \code{"ordinary"}. } \item{L}{ The influence values used when \code{sim} is \code{"antithetic"}. If no such values were specified and \code{stype} is not \code{"w"} then \code{L} is returned as consecutive integers corresponding to the assumption that data is ordered by influence values. This component is omitted when \code{sim} is not \code{"antithetic"}. } \item{ran.gen}{ The random generator function used if \code{sim} is \code{"parametric"}. This component is omitted for any other value of \code{sim}. } \item{mle}{ The parameter estimates passed to \code{boot} when \code{sim} is \code{"parametric"}. It is omitted for all other values of \code{sim}. } There are \code{c}, \code{plot} and \code{print} methods for this class. } \details{ The statistic to be bootstrapped can be as simple or complicated as desired as long as its arguments correspond to the dataset and (for a nonparametric bootstrap) a vector of indices, frequencies or weights. \code{statistic} is treated as a black box by the \code{boot} function and is not checked to ensure that these conditions are met. The first order balanced bootstrap is described in Davison, Hinkley and Schechtman (1986). The antithetic bootstrap is described by Hall (1989) and is experimental, particularly when used with strata. The other non-parametric simulation types are the ordinary bootstrap (possibly with unequal probabilities), and permutation which returns random permutations of cases. All of these methods work independently within strata if that argument is supplied. For the parametric bootstrap it is necessary for the user to specify how the resampling is to be conducted. The best way of accomplishing this is to specify the function \code{ran.gen} which will return a simulated data set from the observed data set and a set of parameter estimates specified in \code{mle}. } \section{Parallel operation}{ When \code{parallel = "multicore"} is used (not available on Windows), each worker process inherits the environment of the current session, including the workspace and the loaded namespaces and attached packages (but not the random number seed: see below). More work is needed when \code{parallel = "snow"} is used: the worker processes are newly created \R processes, and \code{statistic} needs to arrange to set up the environment it needs: often a good way to do that is to make use of lexical scoping since when \code{statistic} is sent to the worker processes its enclosing environment is also sent. (E.g. see the example for \code{\link{jack.after.boot}} where ancillary functions are nested inside the \code{statistic} function.) \code{parallel = "snow"} is primarily intended to be used on multi-core Windows machine where \code{parallel = "multicore"} is not available. For most of the \code{boot} methods the resampling is done in the master process, but not if \code{simple = TRUE} nor \code{sim = "parametric"}. In those cases (or where \code{statistic} itself uses random numbers), more care is needed if the results need to be reproducible. Resampling is done in the worker processes by \code{\link{censboot}(sim = "wierd")} and by most of the schemes in \code{\link{tsboot}} (the exceptions being \code{sim == "fixed"} and \code{sim == "geom"} with the default \code{ran.gen}). Where random-number generation is done in the worker processes, the default behaviour is that each worker chooses a separate seed, non-reproducibly. However, with \code{parallel = "multicore"} or \code{parallel = "snow"} using the default cluster, a second approach is used if \code{\link{RNGkind}("L'Ecuyer-CMRG")} has been selected. In that approach each worker gets a different subsequence of the RNG stream based on the seed at the time the worker is spawned and so the results will be reproducible if \code{ncpus} is unchanged, and for \code{parallel = "multicore"} if \code{parallel::\link{mc.reset.stream}()} is called: see the examples for \code{\link{mclapply}}. Note that loading the \pkg{parallel} namespace may change the random seed, so for maximum reproducibility this should be done before calling this function. } \references{ There are many references explaining the bootstrap and its variations. Among them are : Booth, J.G., Hall, P. and Wood, A.T.A. (1993) Balanced importance resampling for the bootstrap. \emph{Annals of Statistics}, \bold{21}, 286--298. Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Davison, A.C., Hinkley, D.V. and Schechtman, E. (1986) Efficient bootstrap simulation. \emph{Biometrika}, \bold{73}, 555--566. Efron, B. and Tibshirani, R. (1993) \emph{An Introduction to the Bootstrap}. Chapman & Hall. Gleason, J.R. (1988) Algorithms for balanced bootstrap simulations. \emph{ American Statistician}, \bold{42}, 263--266. Hall, P. (1989) Antithetic resampling for the bootstrap. \emph{Biometrika}, \bold{73}, 713--724. Hinkley, D.V. (1988) Bootstrap methods (with Discussion). \emph{Journal of the Royal Statistical Society, B}, \bold{50}, 312--337, 355--370. Hinkley, D.V. and Shi, S. (1989) Importance sampling and the nested bootstrap. \emph{Biometrika}, \bold{76}, 435--446. Johns M.V. (1988) Importance sampling for bootstrap confidence intervals. \emph{Journal of the American Statistical Association}, \bold{83}, 709--714. Noreen, E.W. (1989) \emph{Computer Intensive Methods for Testing Hypotheses}. John Wiley & Sons. } \seealso{ \code{\link{boot.array}}, \code{\link{boot.ci}}, \code{\link{censboot}}, \code{\link{empinf}}, \code{\link{jack.after.boot}}, \code{\link{tilt.boot}}, \code{\link{tsboot}}. } \examples{ \dontshow{op <- options(digits = 5)} # Usual bootstrap of the ratio of means using the city data ratio <- function(d, w) sum(d$x * w)/sum(d$u * w) boot(city, ratio, R = 999, stype = "w") # Stratified resampling for the difference of means. In this # example we will look at the difference of means between the final # two series in the gravity data. diff.means <- function(d, f) { n <- nrow(d) gp1 <- 1:table(as.numeric(d$series))[1] m1 <- sum(d[gp1,1] * f[gp1])/sum(f[gp1]) m2 <- sum(d[-gp1,1] * f[-gp1])/sum(f[-gp1]) ss1 <- sum(d[gp1,1]^2 * f[gp1]) - (m1 * m1 * sum(f[gp1])) ss2 <- sum(d[-gp1,1]^2 * f[-gp1]) - (m2 * m2 * sum(f[-gp1])) c(m1 - m2, (ss1 + ss2)/(sum(f) - 2)) } grav1 <- gravity[as.numeric(gravity[,2]) >= 7,] boot(grav1, diff.means, R = 999, stype = "f", strata = grav1[,2]) # In this example we show the use of boot in a prediction from # regression based on the nuclear data. This example is taken # from Example 6.8 of Davison and Hinkley (1997). Notice also # that two extra arguments to 'statistic' are passed through boot. nuke <- nuclear[, c(1, 2, 5, 7, 8, 10, 11)] nuke.lm <- glm(log(cost) ~ date+log(cap)+ne+ct+log(cum.n)+pt, data = nuke) nuke.diag <- glm.diag(nuke.lm) nuke.res <- nuke.diag$res * nuke.diag$sd nuke.res <- nuke.res - mean(nuke.res) # We set up a new data frame with the data, the standardized # residuals and the fitted values for use in the bootstrap. nuke.data <- data.frame(nuke, resid = nuke.res, fit = fitted(nuke.lm)) # Now we want a prediction of plant number 32 but at date 73.00 new.data <- data.frame(cost = 1, date = 73.00, cap = 886, ne = 0, ct = 0, cum.n = 11, pt = 1) new.fit <- predict(nuke.lm, new.data) nuke.fun <- function(dat, inds, i.pred, fit.pred, x.pred) { lm.b <- glm(fit+resid[inds] ~ date+log(cap)+ne+ct+log(cum.n)+pt, data = dat) pred.b <- predict(lm.b, x.pred) c(coef(lm.b), pred.b - (fit.pred + dat$resid[i.pred])) } nuke.boot <- boot(nuke.data, nuke.fun, R = 999, m = 1, fit.pred = new.fit, x.pred = new.data) # The bootstrap prediction squared error would then be found by mean(nuke.boot$t[, 8]^2) # Basic bootstrap prediction limits would be new.fit - sort(nuke.boot$t[, 8])[c(975, 25)] # Finally a parametric bootstrap. For this example we shall look # at the air-conditioning data. In this example our aim is to test # the hypothesis that the true value of the index is 1 (i.e. that # the data come from an exponential distribution) against the # alternative that the data come from a gamma distribution with # index not equal to 1. air.fun <- function(data) { ybar <- mean(data$hours) para <- c(log(ybar), mean(log(data$hours))) ll <- function(k) { if (k <= 0) 1e200 else lgamma(k)-k*(log(k)-1-para[1]+para[2]) } khat <- nlm(ll, ybar^2/var(data$hours))$estimate c(ybar, khat) } air.rg <- function(data, mle) { # Function to generate random exponential variates. # mle will contain the mean of the original data out <- data out$hours <- rexp(nrow(out), 1/mle) out } air.boot <- boot(aircondit, air.fun, R = 999, sim = "parametric", ran.gen = air.rg, mle = mean(aircondit$hours)) # The bootstrap p-value can then be approximated by sum(abs(air.boot$t[,2]-1) > abs(air.boot$t0[2]-1))/(1+air.boot$R) \dontshow{options(op)} } \keyword{nonparametric} \keyword{htest} boot/man/channing.Rd0000644000176000001440000000360613245463616014113 0ustar ripleyusers\name{channing} \alias{channing} \title{ Channing House Data } \description{ The \code{channing} data frame has 462 rows and 5 columns. Channing House is a retirement centre in Palo Alto, California. These data were collected between the opening of the house in 1964 until July 1, 1975. In that time 97 men and 365 women passed through the centre. For each of these, their age on entry and also on leaving or death was recorded. A large number of the observations were censored mainly due to the resident being alive on July 1, 1975 when the data was collected. Over the time of the study 130 women and 46 men died at Channing House. Differences between the survival of the sexes, taking age into account, was one of the primary concerns of this study. } \usage{ channing } \format{ This data frame contains the following columns: \describe{ \item{\code{sex}}{ A factor for the sex of each resident (\code{"Male"} or \code{"Female"}). } \item{\code{entry}}{ The residents age (in months) on entry to the centre } \item{\code{exit}}{ The age (in months) of the resident on death, leaving the centre or July 1, 1975 whichever event occurred first. } \item{\code{time}}{ The length of time (in months) that the resident spent at Channing House. (\code{time=exit-entry}) } \item{\code{cens}}{ The indicator of right censoring. 1 indicates that the resident died at Channing House, 0 indicates that they left the house prior to July 1, 1975 or that they were still alive and living in the centre at that date. }}} \source{ The data were obtained from Hyde, J. (1980) Testing survival with incomplete observations. \emph{Biostatistics Casebook}. R.G. Miller, B. Efron, B.W. Brown and L.E. Moses (editors), 31--46. John Wiley. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/cv.glm.Rd0000644000176000001440000001135013245463610013501 0ustar ripleyusers\name{cv.glm} \alias{cv.glm} \title{ Cross-validation for Generalized Linear Models } \description{ This function calculates the estimated K-fold cross-validation prediction error for generalized linear models. } \usage{ cv.glm(data, glmfit, cost, K) } \arguments{ \item{data}{ A matrix or data frame containing the data. The rows should be cases and the columns correspond to variables, one of which is the response. } \item{glmfit}{ An object of class \code{"glm"} containing the results of a generalized linear model fitted to \code{data}. } \item{cost}{ A function of two vector arguments specifying the cost function for the cross-validation. The first argument to \code{cost} should correspond to the observed responses and the second argument should correspond to the predicted or fitted responses from the generalized linear model. \code{cost} must return a non-negative scalar value. The default is the average squared error function. } \item{K}{ The number of groups into which the data should be split to estimate the cross-validation prediction error. The value of \code{K} must be such that all groups are of approximately equal size. If the supplied value of \code{K} does not satisfy this criterion then it will be set to the closest integer which does and a warning is generated specifying the value of \code{K} used. The default is to set \code{K} equal to the number of observations in \code{data} which gives the usual leave-one-out cross-validation. }} \value{ The returned value is a list with the following components. \item{call}{ The original call to \code{cv.glm}. } \item{K}{ The value of \code{K} used for the K-fold cross validation. } \item{delta}{ A vector of length two. The first component is the raw cross-validation estimate of prediction error. The second component is the adjusted cross-validation estimate. The adjustment is designed to compensate for the bias introduced by not using leave-one-out cross-validation. } \item{seed}{ The value of \code{.Random.seed} when \code{cv.glm} was called. }} \section{Side Effects}{ The value of \code{.Random.seed} is updated. } \details{ The data is divided randomly into \code{K} groups. For each group the generalized linear model is fit to \code{data} omitting that group, then the function \code{cost} is applied to the observed responses in the group that was omitted from the fit and the prediction made by the fitted models for those observations. When \code{K} is the number of observations leave-one-out cross-validation is used and all the possible splits of the data are used. When \code{K} is less than the number of observations the \code{K} splits to be used are found by randomly partitioning the data into \code{K} groups of approximately equal size. In this latter case a certain amount of bias is introduced. This can be reduced by using a simple adjustment (see equation 6.48 in Davison and Hinkley, 1997). The second value returned in \code{delta} is the estimate adjusted by this method. } \references{ Breiman, L., Friedman, J.H., Olshen, R.A. and Stone, C.J. (1984) \emph{Classification and Regression Trees}. Wadsworth. Burman, P. (1989) A comparative study of ordinary cross-validation, \emph{v}-fold cross-validation and repeated learning-testing methods. \emph{Biometrika}, \bold{76}, 503--514 Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Efron, B. (1986) How biased is the apparent error rate of a prediction rule? \emph{Journal of the American Statistical Association}, \bold{81}, 461--470. Stone, M. (1974) Cross-validation choice and assessment of statistical predictions (with Discussion). \emph{Journal of the Royal Statistical Society, B}, \bold{36}, 111--147. } \seealso{ \code{\link{glm}}, \code{\link{glm.diag}}, \code{\link{predict}} } \examples{ # leave-one-out and 6-fold cross-validation prediction error for # the mammals data set. data(mammals, package="MASS") mammals.glm <- glm(log(brain) ~ log(body), data = mammals) (cv.err <- cv.glm(mammals, mammals.glm)$delta) (cv.err.6 <- cv.glm(mammals, mammals.glm, K = 6)$delta) # As this is a linear model we could calculate the leave-one-out # cross-validation estimate without any extra model-fitting. muhat <- fitted(mammals.glm) mammals.diag <- glm.diag(mammals.glm) (cv.err <- mean((mammals.glm$y - muhat)^2/(1 - mammals.diag$h)^2)) # leave-one-out and 11-fold cross-validation prediction error for # the nodal data set. Since the response is a binary variable an # appropriate cost function is cost <- function(r, pi = 0) mean(abs(r-pi) > 0.5) nodal.glm <- glm(r ~ stage+xray+acid, binomial, data = nodal) (cv.err <- cv.glm(nodal, nodal.glm, cost, K = nrow(nodal))$delta) (cv.11.err <- cv.glm(nodal, nodal.glm, cost, K = 11)$delta) } \keyword{regression} boot/man/print.boot.Rd0000644000176000001440000000341113245463615014415 0ustar ripleyusers\name{print.boot} \alias{print.boot} \title{ Print a Summary of a Bootstrap Object } \description{ This is a method for the function \code{print()} for objects of the class \code{"boot"} created by a call to \code{\link{boot}}, \code{\link{censboot}}, \code{\link{tilt.boot}} or \code{\link{tsboot}}. } \usage{ \method{print}{boot}(x, digits = getOption("digits"), index = 1:ncol(boot.out$t), \dots) } \arguments{ \item{x}{ A bootstrap output object of class \code{"boot"} generated by one of the bootstrap functions. } \item{digits}{ The number of digits to be printed in the summary statistics. } \item{index}{ Indices indicating for which elements of the bootstrap output summary statistics are required. } \item{\dots}{further arguments passed to or from other methods.} } \value{ The bootstrap object is returned invisibly. } \details{ For each statistic calculated in the bootstrap the original value and the bootstrap estimates of its bias and standard error are printed. If \code{boot.out$t0} is missing (such as when it was created by a call to \code{tsboot} with \code{orig.t = FALSE}) the bootstrap mean and standard error are printed. If resampling was done using importance resampling weights, then the bootstrap estimates are reweighted as if uniform resampling had been done. The ratio importance sampling estimates are used and if there were a number of distributions then defensive mixture distributions are used. In this case an extra column with the mean of the observed bootstrap statistics is also printed. } \seealso{ \code{\link{boot}}, \code{\link{censboot}}, \code{\link{imp.moments}}, \code{\link{plot.boot}}, \code{\link{tilt.boot}}, \code{\link{tsboot}} } \keyword{nonparametric} \keyword{htest} boot/man/hirose.Rd0000644000176000001440000000167613245463610013616 0ustar ripleyusers\name{hirose} \alias{hirose} \title{ Failure Time of PET Film } \description{ The \code{hirose} data frame has 44 rows and 3 columns. PET film is used in electrical insulation. In this accelerated life test the failure times for 44 samples in gas insulated transformers. 4 different voltage levels were used. } \usage{ hirose } \format{ This data frame contains the following columns: \describe{ \item{\code{volt}}{ The voltage (in kV). } \item{\code{time}}{ The failure or censoring time in hours. } \item{\code{cens}}{ The censoring indicator; \code{1} means right-censored data. }}} \source{ The data were obtained from Hirose, H. (1993) Estimation of threshold stress in accelerated life-testing. \emph{IEEE Transactions on Reliability}, \bold{42}, 650--657. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/nodal.Rd0000644000176000001440000000423013245463610013407 0ustar ripleyusers\name{nodal} \alias{nodal} \title{ Nodal Involvement in Prostate Cancer } \description{ The \code{nodal} data frame has 53 rows and 7 columns. The treatment strategy for a patient diagnosed with cancer of the prostate depend highly on whether the cancer has spread to the surrounding lymph nodes. It is common to operate on the patient to get samples from the nodes which can then be analysed under a microscope but clearly it would be preferable if an accurate assessment of nodal involvement could be made without surgery. For a sample of 53 prostate cancer patients, a number of possible predictor variables were measured before surgery. The patients then had surgery to determine nodal involvement. It was required to see if nodal involvement could be accurately predicted from the predictor variables and which ones were most important. } \usage{ nodal } \format{ This data frame contains the following columns: \describe{ \item{\code{m}}{ A column of ones. } \item{\code{r}}{ An indicator of nodal involvement. } \item{\code{aged}}{ The patients age dichotomized into less than 60 (\code{0}) and 60 or over \code{1}. } \item{\code{stage}}{ A measurement of the size and position of the tumour observed by palpitation with the fingers via the rectum. A value of \code{1} indicates a more serious case of the cancer. } \item{\code{grade}}{ Another indicator of the seriousness of the cancer, this one is determined by a pathology reading of a biopsy taken by needle before surgery. A value of \code{1} indicates a more serious case of the cancer. } \item{\code{xray}}{ A third measure of the seriousness of the cancer taken from an X-ray reading. A value of \code{1} indicates a more serious case of the cancer. } \item{\code{acid}}{ The level of acid phosphatase in the blood serum. }}} \source{ The data were obtained from Brown, B.W. (1980) Prediction analysis for binary data. In \emph{Biostatistics Casebook}. R.G. Miller, B. Efron, B.W. Brown and L.E. Moses (editors), 3--18. John Wiley. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/cane.Rd0000644000176000001440000000274113245463611013226 0ustar ripleyusers\name{cane} \alias{cane} \title{ Sugar-cane Disease Data } \description{ The \code{cane} data frame has 180 rows and 5 columns. The data frame represents a randomized block design with 45 varieties of sugar-cane and 4 blocks.} \details{ The aim of the experiment was to classify the varieties into resistant, intermediate and susceptible to a disease called "coal of sugar-cane" (carvao da cana-de-acucar). This is a disease that is common in sugar-cane plantations in certain areas of Brazil. For each plot, fifty pieces of sugar-cane stem were put in a solution containing the disease agent and then some were planted in the plot. After a fixed period of time, the total number of shoots and the number of diseased shoots were recorded. } \usage{ cane } \format{ This data frame contains the following columns: \describe{ \item{\code{n}}{ The total number of shoots in each plot. } \item{\code{r}}{ The number of diseased shoots. } \item{\code{x}}{ The number of pieces of the stems, out of 50, planted in each plot. } \item{\code{var}}{ A factor indicating the variety of sugar-cane in each plot. } \item{\code{block}}{ A factor for the blocks. }} } \source{ The data were kindly supplied by Dr. C.G.B. Demetrio of Escola Superior de Agricultura, Universidade de Sao Paolo, Brazil. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} % Converted by Sd2Rd version 0.3-1. boot/man/control.Rd0000644000176000001440000001347713245463606014014 0ustar ripleyusers\name{control} \alias{control} \title{ Control Variate Calculations } \description{ This function will find control variate estimates from a bootstrap output object. It can either find the adjusted bias estimate using post-simulation balancing or it can estimate the bias, variance, third cumulant and quantiles, using the linear approximation as a control variate. } \usage{ control(boot.out, L = NULL, distn = NULL, index = 1, t0 = NULL, t = NULL, bias.adj = FALSE, alpha = NULL, \dots) } \arguments{ \item{boot.out}{ A bootstrap output object returned from \code{boot}. The bootstrap replicates must have been generated using the usual nonparametric bootstrap. } \item{L}{ The empirical influence values for the statistic of interest. If \code{L} is not supplied then \code{empinf} is called to calculate them from \code{boot.out}. } \item{distn}{ If present this must be the output from \code{smooth.spline} giving the distribution function of the linear approximation. This is used only if \code{bias.adj} is \code{FALSE}. Normally this would be found using a saddlepoint approximation. If it is not supplied in that case then it is calculated by \code{saddle.distn}. } \item{index}{ The index of the variable of interest in the output of \code{boot.out$statistic}. } \item{t0}{ The observed value of the statistic of interest on the original data set \code{boot.out$data}. This argument is used only if \code{bias.adj} is \code{FALSE}. The input value is ignored if \code{t} is not also supplied. The default value is is \code{boot.out$t0[index]}. } \item{t}{ The bootstrap replicate values of the statistic of interest. This argument is used only if \code{bias.adj} is \code{FALSE}. The input is ignored if \code{t0} is not supplied also. The default value is \code{boot.out$t[,index]}. } \item{bias.adj}{ A logical variable which if \code{TRUE} specifies that the adjusted bias estimate using post-simulation balance is all that is required. If \code{bias.adj} is \code{FALSE} (default) then the linear approximation to the statistic is calculated and used as a control variate in estimates of the bias, variance and third cumulant as well as quantiles. } \item{alpha}{ The alpha levels for the required quantiles if \code{bias.adj} is \code{FALSE}. } \item{\dots}{ Any additional arguments that \code{boot.out$statistic} requires. These are passed unchanged every time \code{boot.out$statistic} is called. \code{boot.out$statistic} is called once if \code{bias.adj} is \code{TRUE}, otherwise it may be called by \code{empinf} for empirical influence calculations if \code{L} is not supplied. } } \value{ If \code{bias.adj} is \code{TRUE} then the returned value is the adjusted bias estimate. If \code{bias.adj} is \code{FALSE} then the returned value is a list with the following components \item{L}{ The empirical influence values used. These are the input values if supplied, and otherwise they are the values calculated by \code{empinf}. } \item{tL}{ The linear approximations to the bootstrap replicates \code{t} of the statistic of interest. } \item{bias}{ The control estimate of bias using the linear approximation to \code{t} as a control variate. } \item{var}{ The control estimate of variance using the linear approximation to \code{t} as a control variate. } \item{k3}{ The control estimate of the third cumulant using the linear approximation to \code{t} as a control variate. } \item{quantiles}{ A matrix with two columns; the first column are the alpha levels used for the quantiles and the second column gives the corresponding control estimates of the quantiles using the linear approximation to \code{t} as a control variate. } \item{distn}{ An output object from \code{smooth.spline} describing the saddlepoint approximation to the bootstrap distribution of the linear approximation to \code{t}. If \code{distn} was supplied on input then this is the same as the input otherwise it is calculated by a call to \code{saddle.distn}. } } \details{ If \code{bias.adj} is \code{FALSE} then the linear approximation to the statistic is found and evaluated at each bootstrap replicate. Then using the equation \emph{T* = Tl*+(T*-Tl*)}, moment estimates can be found. For quantile estimation the distribution of the linear approximation to \code{t} is approximated very accurately by saddlepoint methods, this is then combined with the bootstrap replicates to approximate the bootstrap distribution of \code{t} and hence to estimate the bootstrap quantiles of \code{t}. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Davison, A.C., Hinkley, D.V. and Schechtman, E. (1986) Efficient bootstrap simulation. \emph{Biometrika}, \bold{73}, 555--566. Efron, B. (1990) More efficient bootstrap computations. \emph{Journal of the American Statistical Association}, \bold{55}, 79--89. } \seealso{ \code{\link{boot}}, \code{\link{empinf}}, \code{\link{k3.linear}}, \code{\link{linear.approx}}, \code{\link{saddle.distn}}, \code{\link{smooth.spline}}, \code{\link{var.linear}} } \examples{ # Use of control variates for the variance of the air-conditioning data mean.fun <- function(d, i) { m <- mean(d$hours[i]) n <- nrow(d) v <- (n-1)*var(d$hours[i])/n^2 c(m, v) } air.boot <- boot(aircondit, mean.fun, R = 999) control(air.boot, index = 2, bias.adj = TRUE) air.cont <- control(air.boot, index = 2) # Now let us try the variance on the log scale. air.cont1 <- control(air.boot, t0 = log(air.boot$t0[2]), t = log(air.boot$t[, 2])) } \keyword{nonparametric} boot/man/boot-practicals.Rd0000644000176000001440000000133513245463606015410 0ustar ripleyusers\name{boot-practicals} \alias{nested.corr} \alias{lik.CI} \title{ Functions for Bootstrap Practicals} \description{ Functions for use with the practicals in Davison and Hinkley (1997). } \usage{ nested.corr(data, w, t0, M) lik.CI(like, lim) } \details{ \code{nested.corr} is meant for use with the double bootstrap in practical 5.5 of Davison and Hinkley (1997). \code{lik.CI} is meant for use with practicals 10.1 and 10.2 of Davison and Hinkley (1997). } \references{ Davison, A. C. and Hinkley, D. V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \author{ Angelo J. Canty. Faster version of \code{nested.corr} for \pkg{boot} 1.3-1 by Brian Ripley. } \keyword{internal} boot/man/k3.linear.Rd0000644000176000001440000000175213245463606014113 0ustar ripleyusers\name{k3.linear} \alias{k3.linear} \title{ Linear Skewness Estimate } \description{ Estimates the skewness of a statistic from its empirical influence values. } \usage{ k3.linear(L, strata = NULL) } \arguments{ \item{L}{ Vector of the empirical influence values of a statistic. These will usually be calculated by a call to \code{empinf}. } \item{strata}{ A numeric vector or factor specifying which observations (and hence which components of \code{L}) come from which strata. }} \value{ The skewness estimate calculated from \code{L}. } \references{ Davison, A. C. and Hinkley, D. V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \seealso{ \code{\link{empinf}}, \code{\link{linear.approx}}, \code{\link{var.linear}} } \examples{ # To estimate the skewness of the ratio of means for the city data. ratio <- function(d, w) sum(d$x * w)/sum(d$u * w) k3.linear(empinf(data = city, statistic = ratio)) } \keyword{nonparametric} % Converted by Sd2Rd version 1.15. boot/man/boot.array.Rd0000644000176000001440000000562413245463606014407 0ustar ripleyusers\name{boot.array} \alias{boot.array} \title{ Bootstrap Resampling Arrays } \description{ This function takes a bootstrap object calculated by one of the functions \code{boot}, \code{censboot}, or \code{tilt.boot} and returns the frequency (or index) array for the bootstrap resamples. } \usage{ boot.array(boot.out, indices) } \arguments{ \item{boot.out}{ An object of class \code{"boot"} returned by one of the generation functions for such an object. } \item{indices}{ A logical argument which specifies whether to return the frequency array or the raw index array. The default is \code{indices=FALSE} unless \code{boot.out} was created by \code{tsboot} in which case the default is \code{indices=TRUE}. }} \value{ A matrix with \code{boot.out$R} rows and \code{n} columns where \code{n} is the number of observations in \code{boot.out$data}. If \code{indices} is \code{FALSE} then this will give the frequency of each of the original observations in each bootstrap resample. If \code{indices} is \code{TRUE} it will give the indices of the bootstrap resamples in the order in which they would have been passed to the statistic. } \section{Side Effects}{ This function temporarily resets \code{.Random.seed} to the value in \code{boot.out$seed} and then returns it to its original value at the end of the function. } \details{ The process by which the original index array was generated is repeated with the same value of \code{.Random.seed}. If the frequency array is required then \code{freq.array} is called to convert the index array to a frequency array. A resampling array can only be returned when such a concept makes sense. In particular it cannot be found for any parametric or model-based resampling schemes. Hence for objects generated by \code{censboot} the only resampling scheme for which such an array can be found is ordinary case resampling. Similarly if \code{boot.out$sim} is \code{"parametric"} in the case of \code{boot} or \code{"model"} in the case of \code{tsboot} the array cannot be found. Note also that for post-blackened bootstraps from \code{tsboot} the indices found will relate to those prior to any post-blackening and so will not be useful. Frequency arrays are used in many post-bootstrap calculations such as the jackknife-after-bootstrap and finding importance sampling weights. They are also used to find empirical influence values through the regression method. } \seealso{ \code{\link{boot}}, \code{\link{censboot}}, \code{\link{freq.array}}, \code{\link{tilt.boot}}, \code{\link{tsboot}} } \examples{ # A frequency array for a nonparametric bootstrap city.boot <- boot(city, corr, R = 40, stype = "w") boot.array(city.boot) perm.cor <- function(d,i) cor(d$x,d$u[i]) city.perm <- boot(city, perm.cor, R = 40, sim = "permutation") boot.array(city.perm, indices = TRUE) } \keyword{nonparametric} % Converted by Sd2Rd version 1.15. boot/man/cav.Rd0000644000176000001440000000216413245463610013067 0ustar ripleyusers\name{cav} \alias{cav} \title{ Position of Muscle Caveolae } \description{ The \code{cav} data frame has 138 rows and 2 columns. The data gives the positions of the individual caveolae in a square region with sides of length 500 units. This grid was originally on a 2.65mum square of muscle fibre. The data are those points falling in the lower left hand quarter of the region used for the dataset \code{caveolae.dat} in the \pkg{spatial} package by B.D. Ripley (1994). } \usage{ cav } \format{ This data frame contains the following columns: \describe{ \item{\code{x}}{ The x coordinate of the caveola's position in the region. } \item{\code{y}}{ The y coordinate of the caveola's position in the region. }}} \references{ Appleyard, S.T., Witkowski, J.A., Ripley, B.D., Shotton, D.M. and Dubowicz, V. (1985) A novel procedure for pattern analysis of features present on freeze fractured plasma membranes. \emph{Journal of Cell Science}, \bold{74}, 105--117. Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/motor.Rd0000644000176000001440000000260513245463610013456 0ustar ripleyusers\name{motor} \alias{motor} \title{ Data from a Simulated Motorcycle Accident } \description{ The \code{motor} data frame has 94 rows and 4 columns. The rows are obtained by removing replicate values of \code{time} from the dataset \code{\link{mcycle}}. Two extra columns are added to allow for strata with a different residual variance in each stratum. } \usage{ motor } \format{ This data frame contains the following columns: \describe{ \item{\code{times}}{ The time in milliseconds since impact. } \item{\code{accel}}{ The recorded head acceleration (in g). } \item{\code{strata}}{ A numeric column indicating to which of the three strata (numbered 1, 2 and 3) the observations belong. } \item{\code{v}}{ An estimate of the residual variance for the observation. \code{v} is constant within the strata but a different estimate is used for each of the three strata. }}} \source{ The data were obtained from Silverman, B.W. (1985) Some aspects of the spline smoothing approach to non-parametric curve fitting. \emph{Journal of the Royal Statistical Society, B}, \bold{47}, 1--52. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Venables, W.N. and Ripley, B.D. (1994) \emph{Modern Applied Statistics with S-Plus}. Springer-Verlag. } \seealso{ \code{\link{mcycle}} } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/tilt.boot.Rd0000644000176000001440000002006313245463606014237 0ustar ripleyusers\name{tilt.boot} \alias{tilt.boot} \title{ Non-parametric Tilted Bootstrap } \description{ This function will run an initial bootstrap with equal resampling probabilities (if required) and will use the output of the initial run to find resampling probabilities which put the value of the statistic at required values. It then runs an importance resampling bootstrap using the calculated probabilities as the resampling distribution. } \usage{ tilt.boot(data, statistic, R, sim = "ordinary", stype = "i", strata = rep(1, n), L = NULL, theta = NULL, alpha = c(0.025, 0.975), tilt = TRUE, width = 0.5, index = 1, \dots) } \arguments{ \item{data}{ The data as a vector, matrix or data frame. If it is a matrix or data frame then each row is considered as one (multivariate) observation. } \item{statistic}{ A function which when applied to data returns a vector containing the statistic(s) of interest. It must take at least two arguments. The first argument will always be \code{data} and the second should be a vector of indices, weights or frequencies describing the bootstrap sample. Any other arguments must be supplied to \code{tilt.boot} and will be passed unchanged to statistic each time it is called. } \item{R}{ The number of bootstrap replicates required. This will generally be a vector, the first value stating how many uniform bootstrap simulations are to be performed at the initial stage. The remaining values of \code{R} are the number of simulations to be performed resampling from each reweighted distribution. The first value of \code{R} must always be present, a value of 0 implying that no uniform resampling is to be carried out. Thus \code{length(R)} should always equal \code{1+length(theta)}. } \item{sim}{ This is a character string indicating the type of bootstrap simulation required. There are only two possible values that this can take: \code{"ordinary"} and \code{"balanced"}. If other simulation types are required for the initial un-weighted bootstrap then it will be necessary to run \code{boot}, calculate the weights appropriately, and run \code{boot} again using the calculated weights. } \item{stype}{ A character string indicating the type of second argument expected by \code{statistic}. The possible values that \code{stype} can take are \code{"i"} (indices), \code{"w"} (weights) and \code{"f"} (frequencies). } \item{strata}{ An integer vector or factor representing the strata for multi-sample problems. } \item{L}{ The empirical influence values for the statistic of interest. They are used only for exponential tilting when \code{tilt} is \code{TRUE}. If \code{tilt} is \code{TRUE} and they are not supplied then \code{tilt.boot} uses \code{empinf} to calculate them. } \item{theta}{ The required parameter value(s) for the tilted distribution(s). There should be one value of \code{theta} for each of the non-uniform distributions. If \code{R[1]} is 0 \code{theta} is a required argument. Otherwise \code{theta} values can be estimated from the initial uniform bootstrap and the values in \code{alpha}. } \item{alpha}{ The alpha level to which tilting is required. This parameter is ignored if \code{R[1]} is 0 or if \code{theta} is supplied, otherwise it is used to find the values of \code{theta} as quantiles of the initial uniform bootstrap. In this case \code{R[1]} should be large enough that \code{min(c(alpha, 1-alpha))*R[1] > 5}, if this is not the case then a warning is generated to the effect that the \code{theta} are extreme values and so the tilted output may be unreliable. } \item{tilt}{ A logical variable which if \code{TRUE} (the default) indicates that exponential tilting should be used, otherwise local frequency smoothing (\code{smooth.f}) is used. If \code{tilt} is \code{FALSE} then \code{R[1]} must be positive. In fact in this case the value of \code{R[1]} should be fairly large (in the region of 500 or more). } \item{width}{ This argument is used only if \code{tilt} is \code{FALSE}, in which case it is passed unchanged to \code{smooth.f} as the standardized bandwidth for the smoothing operation. The value should generally be in the range (0.2, 1). See \code{smooth.f} for for more details. } \item{index}{ The index of the statistic of interest in the output from \code{statistic}. By default the first element of the output of \code{statistic} is used. } \item{\dots}{ Any additional arguments required by \code{statistic}. These are passed unchanged to \code{statistic} each time it is called. } } \value{ An object of class \code{"boot"} with the following components \item{t0}{ The observed value of the statistic on the original data. } \item{t}{ The values of the bootstrap replicates of the statistic. There will be \code{sum(R)} of these, the first \code{R[1]} corresponding to the uniform bootstrap and the remainder to the tilted bootstrap(s). } \item{R}{ The input vector of the number of bootstrap replicates. } \item{data}{ The original data as supplied. } \item{statistic}{ The \code{statistic} function as supplied. } \item{sim}{ The simulation type used in the bootstrap(s), it can either be \code{"ordinary"} or \code{"balanced"}. } \item{stype}{ The type of statistic supplied, it is the same as the input value \code{stype}. } \item{call}{ A copy of the original call to \code{tilt.boot}. } \item{strata}{ The strata as supplied. } \item{weights}{ The matrix of weights used. If \code{R[1]} is greater than 0 then the first row will be the uniform weights and each subsequent row the tilted weights. If \code{R[1]} equals 0 then the uniform weights are omitted and only the tilted weights are output. } \item{theta}{ The values of \code{theta} used for the tilted distributions. These are either the input values or the values derived from the uniform bootstrap and \code{alpha}. } } \references{ Booth, J.G., Hall, P. and Wood, A.T.A. (1993) Balanced importance resampling for the bootstrap. \emph{Annals of Statistics}, \bold{21}, 286--298. Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Hinkley, D.V. and Shi, S. (1989) Importance sampling and the nested bootstrap. \emph{Biometrika}, \bold{76}, 435--446. } \seealso{ \code{\link{boot}}, \code{\link{exp.tilt}}, \code{\link{Imp.Estimates}}, \code{\link{imp.weights}}, \code{\link{smooth.f}} } \examples{ # Note that these examples can take a while to run. # Example 9.9 of Davison and Hinkley (1997). grav1 <- gravity[as.numeric(gravity[,2]) >= 7, ] grav.fun <- function(dat, w, orig) { strata <- tapply(dat[, 2], as.numeric(dat[, 2])) d <- dat[, 1] ns <- tabulate(strata) w <- w/tapply(w, strata, sum)[strata] mns <- as.vector(tapply(d * w, strata, sum)) # drop names mn2 <- tapply(d * d * w, strata, sum) s2hat <- sum((mn2 - mns^2)/ns) c(mns[2]-mns[1],s2hat,(mns[2]-mns[1]-orig)/sqrt(s2hat)) } grav.z0 <- grav.fun(grav1, rep(1, 26), 0) tilt.boot(grav1, grav.fun, R = c(249, 375, 375), stype = "w", strata = grav1[,2], tilt = TRUE, index = 3, orig = grav.z0[1]) # Example 9.10 of Davison and Hinkley (1997) requires a balanced # importance resampling bootstrap to be run. In this example we # show how this might be run. acme.fun <- function(data, i, bhat) { d <- data[i,] n <- nrow(d) d.lm <- glm(d$acme~d$market) beta.b <- coef(d.lm)[2] d.diag <- boot::glm.diag(d.lm) SSx <- (n-1)*var(d$market) tmp <- (d$market-mean(d$market))*d.diag$res*d.diag$sd sr <- sqrt(sum(tmp^2))/SSx c(beta.b, sr, (beta.b-bhat)/sr) } acme.b <- acme.fun(acme, 1:nrow(acme), 0) acme.boot1 <- tilt.boot(acme, acme.fun, R = c(499, 250, 250), stype = "i", sim = "balanced", alpha = c(0.05, 0.95), tilt = TRUE, index = 3, bhat = acme.b[1]) } \keyword{nonparametric} boot/man/brambles.Rd0000644000176000001440000000213213245463611014101 0ustar ripleyusers\name{brambles} \alias{brambles} \title{ Spatial Location of Bramble Canes } \description{ The \code{brambles} data frame has 823 rows and 3 columns. The location of living bramble canes in a 9m square plot was recorded. We take 9m to be the unit of distance so that the plot can be thought of as a unit square. The bramble canes were also classified by their age. } \usage{ brambles } \format{ This data frame contains the following columns: \describe{ \item{\code{x}}{ The x coordinate of the position of the cane in the plot. } \item{\code{y}}{ The y coordinate of the position of the cane in the plot. } \item{\code{age}}{ The age classification of the canes; \code{0} indicates a newly emerged cane, \code{1} indicates a one year old cane and \code{2} indicates a two year old cane. }}} \source{ The data were obtained from Diggle, P.J. (1983) \emph{Statistical Analysis of Spatial Point Patterns}. Academic Press. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/empinf.Rd0000644000176000001440000002010713245463606013576 0ustar ripleyusers\name{empinf} \alias{empinf} \title{ Empirical Influence Values } \description{ This function calculates the empirical influence values for a statistic applied to a data set. It allows four types of calculation, namely the infinitesimal jackknife (using numerical differentiation), the usual jackknife estimates, the \sQuote{positive} jackknife estimates and a method which estimates the empirical influence values using regression of bootstrap replicates of the statistic. All methods can be used with one or more samples. } \usage{ empinf(boot.out = NULL, data = NULL, statistic = NULL, type = NULL, stype = NULL ,index = 1, t = NULL, strata = rep(1, n), eps = 0.001, ...) } \arguments{ \item{boot.out}{ A bootstrap object created by the function \code{boot}. If \code{type} is \code{"reg"} then this argument is required. For any of the other types it is an optional argument. If it is included when optional then the values of \code{data}, \code{statistic}, \code{stype}, and \code{strata} are taken from the components of \code{boot.out} and any values passed to \code{empinf} directly are ignored. } \item{data}{ A vector, matrix or data frame containing the data for which empirical influence values are required. It is a required argument if \code{boot.out} is not supplied. If \code{boot.out} is supplied then \code{data} is set to \code{boot.out$data} and any value supplied is ignored. } \item{statistic}{ The statistic for which empirical influence values are required. It must be a function of at least two arguments, the data set and a vector of weights, frequencies or indices. The nature of the second argument is given by the value of \code{stype}. Any other arguments that it takes must be supplied to \code{empinf} and will be passed to \code{statistic} unchanged. This is a required argument if \code{boot.out} is not supplied, otherwise its value is taken from \code{boot.out} and any value supplied here will be ignored. } \item{type}{ The calculation type to be used for the empirical influence values. Possible values of \code{type} are \code{"inf"} (infinitesimal jackknife), \code{"jack"} (usual jackknife), \code{"pos"} (positive jackknife), and \code{"reg"} (regression estimation). The default value depends on the other arguments. If \code{t} is supplied then the default value of \code{type} is \code{"reg"} and \code{boot.out} should be present so that its frequency array can be found. It \code{t} is not supplied then if \code{stype} is \code{"w"}, the default value of \code{type} is \code{"inf"}; otherwise, if \code{boot.out} is present the default is \code{"reg"}. If none of these conditions apply then the default is \code{"jack"}. Note that it is an error for \code{type} to be \code{"reg"} if \code{boot.out} is missing or to be \code{"inf"} if \code{stype} is not \code{"w"}. } \item{stype}{ A character variable giving the nature of the second argument to \code{statistic}. It can take on three values: \code{"w"} (weights), \code{"f"} (frequencies), or \code{"i"} (indices). If \code{boot.out} is supplied the value of \code{stype} is set to \code{boot.out$stype} and any value supplied here is ignored. Otherwise it is an optional argument which defaults to \code{"w"}. If \code{type} is \code{"inf"} then \code{stype} MUST be \code{"w"}. } \item{index}{ An integer giving the position of the variable of interest in the output of \code{statistic}. } \item{t}{ A vector of length \code{boot.out$R} which gives the bootstrap replicates of the statistic of interest. \code{t} is used only when \code{type} is \code{reg} and it defaults to \code{boot.out$t[,index]}. } \item{strata}{ An integer vector or a factor specifying the strata for multi-sample problems. If \code{boot.out} is supplied the value of \code{strata} is set to \code{boot.out$strata}. Otherwise it is an optional argument which has default corresponding to the single sample situation. } \item{eps}{ This argument is used only if \code{type} is \code{"inf"}. In that case the value of epsilon to be used for numerical differentiation will be \code{eps} divided by the number of observations in \code{data}. } \item{\dots}{ Any other arguments that \code{statistic} takes. They will be passed unchanged to \code{statistic} every time that it is called. } } \section{Warning}{ All arguments to \code{empinf} must be passed using the \code{name = value} convention. If this is not followed then unpredictable errors can occur. } \value{ A vector of the empirical influence values of \code{statistic} applied to \code{data}. The values will be in the same order as the observations in data. } \details{ If \code{type} is \code{"inf"} then numerical differentiation is used to approximate the empirical influence values. This makes sense only for statistics which are written in weighted form (i.e. \code{stype} is \code{"w"}). If \code{type} is \code{"jack"} then the usual leave-one-out jackknife estimates of the empirical influence are returned. If \code{type} is \code{"pos"} then the positive (include-one-twice) jackknife values are used. If \code{type} is \code{"reg"} then a bootstrap object must be supplied. The regression method then works by regressing the bootstrap replicates of \code{statistic} on the frequency array from which they were derived. The bootstrap frequency array is obtained through a call to \code{boot.array}. Further details of the methods are given in Section 2.7 of Davison and Hinkley (1997). Empirical influence values are often used frequently in nonparametric bootstrap applications. For this reason many other functions call \code{empinf} when they are required. Some examples of their use are for nonparametric delta estimates of variance, BCa intervals and finding linear approximations to statistics for use as control variates. They are also used for antithetic bootstrap resampling. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Efron, B. (1982) \emph{The Jackknife, the Bootstrap and Other Resampling Plans}. CBMS-NSF Regional Conference Series in Applied Mathematics, \bold{38}, SIAM. Fernholtz, L.T. (1983) \emph{von Mises Calculus for Statistical Functionals}. Lecture Notes in Statistics, \bold{19}, Springer-Verlag. } \seealso{ \code{\link{boot}}, \code{\link{boot.array}}, \code{\link{boot.ci}}, \code{\link{control}}, \code{\link{jack.after.boot}}, \code{\link{linear.approx}}, \code{\link{var.linear}} } \examples{ # The empirical influence values for the ratio of means in # the city data. ratio <- function(d, w) sum(d$x *w)/sum(d$u*w) empinf(data = city, statistic = ratio) city.boot <- boot(city, ratio, 499, stype="w") empinf(boot.out = city.boot, type = "reg") # A statistic that may be of interest in the difference of means # problem is the t-statistic for testing equality of means. In # the bootstrap we get replicates of the difference of means and # the variance of that statistic and then want to use this output # to get the empirical influence values of the t-statistic. grav1 <- gravity[as.numeric(gravity[,2]) >= 7,] grav.fun <- function(dat, w) { strata <- tapply(dat[, 2], as.numeric(dat[, 2])) d <- dat[, 1] ns <- tabulate(strata) w <- w/tapply(w, strata, sum)[strata] mns <- as.vector(tapply(d * w, strata, sum)) # drop names mn2 <- tapply(d * d * w, strata, sum) s2hat <- sum((mn2 - mns^2)/ns) c(mns[2] - mns[1], s2hat) } grav.boot <- boot(grav1, grav.fun, R = 499, stype = "w", strata = grav1[, 2]) # Since the statistic of interest is a function of the bootstrap # statistics, we must calculate the bootstrap replicates and pass # them to empinf using the t argument. grav.z <- (grav.boot$t[,1]-grav.boot$t0[1])/sqrt(grav.boot$t[,2]) empinf(boot.out = grav.boot, t = grav.z) } \keyword{nonparametric} \keyword{math} boot/man/melanoma.Rd0000644000176000001440000000400113245463610014077 0ustar ripleyusers\name{melanoma} \alias{melanoma} \title{ Survival from Malignant Melanoma } \description{ The \code{melanoma} data frame has 205 rows and 7 columns. The data consist of measurements made on patients with malignant melanoma. Each patient had their tumour removed by surgery at the Department of Plastic Surgery, University Hospital of Odense, Denmark during the period 1962 to 1977. The surgery consisted of complete removal of the tumour together with about 2.5cm of the surrounding skin. Among the measurements taken were the thickness of the tumour and whether it was ulcerated or not. These are thought to be important prognostic variables in that patients with a thick and/or ulcerated tumour have an increased chance of death from melanoma. Patients were followed until the end of 1977. } \usage{ melanoma } \format{ This data frame contains the following columns: \describe{ \item{\code{time}}{ Survival time in days since the operation, possibly censored. } \item{\code{status}}{ The patients status at the end of the study. 1 indicates that they had died from melanoma, 2 indicates that they were still alive and 3 indicates that they had died from causes unrelated to their melanoma. } \item{\code{sex}}{ The patients sex; 1=male, 0=female. } \item{\code{age}}{ Age in years at the time of the operation. } \item{\code{year}}{ Year of operation. } \item{\code{thickness}}{ Tumour thickness in mm. } \item{\code{ulcer}}{ Indicator of ulceration; 1=present, 0=absent. }}} \note{ This dataset is not related to the dataset in the \pkg{lattice} package with the same name. } \source{ The data were obtained from Andersen, P.K., Borgan, O., Gill, R.D. and Keiding, N. (1993) \emph{Statistical Models Based on Counting Processes}. Springer-Verlag. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Venables, W.N. and Ripley, B.D. (1994) \emph{Modern Applied Statistics with S-Plus}. Springer-Verlag. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/capability.Rd0000644000176000001440000000175013245463610014437 0ustar ripleyusers\name{capability} \alias{capability} \title{ Simulated Manufacturing Process Data } \description{ The \code{capability} data frame has 75 rows and 1 columns. The data are simulated successive observations from a process in equilibrium. The process is assumed to have specification limits (5.49, 5.79). } \usage{ capability } \format{ This data frame contains the following column: \describe{ \item{\code{y}}{ The simulated measurements. }}} \source{ The data were obtained from Bissell, A.F. (1990) How reliable is your capability index? \emph{Applied Statistics}, \bold{39}, 331--340. } \references{ Canty, A.J. and Davison, A.C. (1996) Implementation of saddlepoint approximations to resampling distributions. To appear in \emph{Computing Science and Statistics; Proceedings of the 28th Symposium on the Interface}. Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/cloth.Rd0000644000176000001440000000123513245463611013426 0ustar ripleyusers\name{cloth} \alias{cloth} \title{ Number of Flaws in Cloth } \description{ The \code{cloth} data frame has 32 rows and 2 columns. } \usage{ cloth } \format{ This data frame contains the following columns: \describe{ \item{\code{x}}{ The length of the roll of cloth. } \item{\code{y}}{ The number of flaws found in the roll. }}} \source{ The data were obtained from Bissell, A.F. (1972) A negative binomial model with varying element size. \emph{Biometrika}, \bold{59}, 435--441. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/censboot.Rd0000644000176000001440000003224013245463615014135 0ustar ripleyusers\name{censboot} \alias{censboot} \alias{cens.return} \title{ Bootstrap for Censored Data } \description{ This function applies types of bootstrap resampling which have been suggested to deal with right-censored data. It can also do model-based resampling using a Cox regression model. } \usage{ censboot(data, statistic, R, F.surv, G.surv, strata = matrix(1,n,2), sim = "ordinary", cox = NULL, index = c(1, 2), \dots, parallel = c("no", "multicore", "snow"), ncpus = getOption("boot.ncpus", 1L), cl = NULL) } \arguments{ \item{data}{ The data frame or matrix containing the data. It must have at least two columns, one of which contains the times and the other the censoring indicators. It is allowed to have as many other columns as desired (although efficiency is reduced for large numbers of columns) except for \code{sim = "weird"} when it should only have two columns - the times and censoring indicators. The columns of \code{data} referenced by the components of \code{index} are taken to be the times and censoring indicators. } \item{statistic}{ A function which operates on the data frame and returns the required statistic. Its first argument must be the data. Any other arguments that it requires can be passed using the \code{\dots} argument. In the case of \code{sim = "weird"}, the data passed to \code{statistic} only contains the times and censoring indicator regardless of the actual number of columns in \code{data}. In all other cases the data passed to statistic will be of the same form as the original data. When \code{sim = "weird"}, the actual number of observations in the resampled data sets may not be the same as the number in \code{data}. For this reason, if \code{sim = "weird"} and \code{strata} is supplied, \code{statistic} should also take a numeric vector indicating the strata. This allows the statistic to depend on the strata if required. } \item{R}{ The number of bootstrap replicates. } \item{F.surv}{ An object returned from a call to \code{survfit} giving the survivor function for the data. This is a required argument unless \code{sim = "ordinary"} or \code{sim = "model"} and \code{cox} is missing. } \item{G.surv}{ Another object returned from a call to \code{survfit} but with the censoring indicators reversed to give the product-limit estimate of the censoring distribution. Note that for consistency the uncensored times should be reduced by a small amount in the call to \code{survfit}. This is a required argument whenever \code{sim = "cond"} or when \code{sim = "model"} and \code{cox} is supplied. } \item{strata}{ The strata used in the calls to \code{survfit}. It can be a vector or a matrix with 2 columns. If it is a vector then it is assumed to be the strata for the survival distribution, and the censoring distribution is assumed to be the same for all observations. If it is a matrix then the first column is the strata for the survival distribution and the second is the strata for the censoring distribution. When \code{sim = "weird"} only the strata for the survival distribution are used since the censoring times are considered fixed. When \code{sim = "ordinary"}, only one set of strata is used to stratify the observations, this is taken to be the first column of \code{strata} when it is a matrix. } \item{sim}{ The simulation type. Possible types are \code{"ordinary"} (case resampling), \code{"model"} (equivalent to \code{"ordinary"} if \code{cox} is missing, otherwise it is model-based resampling), \code{"weird"} (the weird bootstrap - this cannot be used if \code{cox} is supplied), and \code{"cond"} (the conditional bootstrap, in which censoring times are resampled from the conditional censoring distribution). } \item{cox}{ An object returned from \code{coxph}. If it is supplied, then \code{F.surv} should have been generated by a call of the form \code{survfit(cox)}. } \item{index}{ A vector of length two giving the positions of the columns in \code{data} which correspond to the times and censoring indicators respectively. } \item{\dots}{ Other named arguments which are passed unchanged to \code{statistic} each time it is called. Any such arguments to \code{statistic} must follow the arguments which \code{statistic} is required to have for the simulation. Beware of partial matching to arguments of \code{censboot} listed above, and that arguments named \code{X} and \code{FUN} cause conflicts in some versions of \pkg{boot} (but not this one). } \item{parallel, ncpus, cl}{ See the help for \code{\link{boot}}. } } \value{ An object of class \code{"boot"} containing the following components: \item{t0}{ The value of \code{statistic} when applied to the original data. } \item{t}{ A matrix of bootstrap replicates of the values of \code{statistic}. } \item{R}{ The number of bootstrap replicates performed. } \item{sim}{ The simulation type used. This will usually be the input value of \code{sim} unless that was \code{"model"} but \code{cox} was not supplied, in which case it will be \code{"ordinary"}. } \item{data}{ The data used for the bootstrap. This will generally be the input value of \code{data} unless \code{sim = "weird"}, in which case it will just be the columns containing the times and the censoring indicators. } \item{seed}{ The value of \code{.Random.seed} when \code{censboot} started work. } \item{statistic}{ The input value of \code{statistic}. } \item{strata}{ The strata used in the resampling. When \code{sim = "ordinary"} this will be a vector which stratifies the observations, when \code{sim = "weird"} it is the strata for the survival distribution and in all other cases it is a matrix containing the strata for the survival distribution and the censoring distribution. } \item{call}{ The original call to \code{censboot}. } } \details{ The various types of resampling are described in Davison and Hinkley (1997) in sections 3.5 and 7.3. The simplest is case resampling which simply resamples with replacement from the observations. The conditional bootstrap simulates failure times from the estimate of the survival distribution. Then, for each observation its simulated censoring time is equal to the observed censoring time if the observation was censored and generated from the estimated censoring distribution conditional on being greater than the observed failure time if the observation was uncensored. If the largest value is censored then it is given a nominal failure time of \code{Inf} and conversely if it is uncensored it is given a nominal censoring time of \code{Inf}. This is necessary to allow the largest observation to be in the resamples. If a Cox regression model is fitted to the data and supplied, then the failure times are generated from the survival distribution using that model. In this case the censoring times can either be simulated from the estimated censoring distribution (\code{sim = "model"}) or from the conditional censoring distribution as in the previous paragraph (\code{sim = "cond"}). The weird bootstrap holds the censored observations as fixed and also the observed failure times. It then generates the number of events at each failure time using a binomial distribution with mean 1 and denominator the number of failures that could have occurred at that time in the original data set. In our implementation we insist that there is a least one simulated event in each stratum for every bootstrap dataset. When there are strata involved and \code{sim} is either \code{"model"} or \code{"cond"} the situation becomes more difficult. Since the strata for the survival and censoring distributions are not the same it is possible that for some observations both the simulated failure time and the simulated censoring time are infinite. To see this consider an observation in stratum 1F for the survival distribution and stratum 1G for the censoring distribution. Now if the largest value in stratum 1F is censored it is given a nominal failure time of \code{Inf}, also if the largest value in stratum 1G is uncensored it is given a nominal censoring time of \code{Inf} and so both the simulated failure and censoring times could be infinite. When this happens the simulated value is considered to be a failure at the time of the largest observed failure time in the stratum for the survival distribution. When \code{parallel = "snow"} and \code{cl} is not supplied, \code{library(survival)} is run in each of the worker processes. } \references{ Andersen, P.K., Borgan, O., Gill, R.D. and Keiding, N. (1993) \emph{Statistical Models Based on Counting Processes}. Springer-Verlag. Burr, D. (1994) A comparison of certain bootstrap confidence intervals in the Cox model. \emph{Journal of the American Statistical Association}, \bold{89}, 1290--1302. Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Efron, B. (1981) Censored data and the bootstrap. \emph{Journal of the American Statistical Association}, \bold{76}, 312--319. Hjort, N.L. (1985) Bootstrapping Cox's regression model. Technical report NSF-241, Dept. of Statistics, Stanford University. } \seealso{ \code{\link{boot}}, \code{\link{coxph}}, \code{\link{survfit}} } \examples{ library(survival) # Example 3.9 of Davison and Hinkley (1997) does a bootstrap on some # remission times for patients with a type of leukaemia. The patients # were divided into those who received maintenance chemotherapy and # those who did not. Here we are interested in the median remission # time for the two groups. data(aml, package = "boot") # not the version in survival. aml.fun <- function(data) { surv <- survfit(Surv(time, cens) ~ group, data = data) out <- NULL st <- 1 for (s in 1:length(surv$strata)) { inds <- st:(st + surv$strata[s]-1) md <- min(surv$time[inds[1-surv$surv[inds] >= 0.5]]) st <- st + surv$strata[s] out <- c(out, md) } out } aml.case <- censboot(aml, aml.fun, R = 499, strata = aml$group) # Now we will look at the same statistic using the conditional # bootstrap and the weird bootstrap. For the conditional bootstrap # the survival distribution is stratified but the censoring # distribution is not. aml.s1 <- survfit(Surv(time, cens) ~ group, data = aml) aml.s2 <- survfit(Surv(time-0.001*cens, 1-cens) ~ 1, data = aml) aml.cond <- censboot(aml, aml.fun, R = 499, strata = aml$group, F.surv = aml.s1, G.surv = aml.s2, sim = "cond") # For the weird bootstrap we must redefine our function slightly since # the data will not contain the group number. aml.fun1 <- function(data, str) { surv <- survfit(Surv(data[, 1], data[, 2]) ~ str) out <- NULL st <- 1 for (s in 1:length(surv$strata)) { inds <- st:(st + surv$strata[s] - 1) md <- min(surv$time[inds[1-surv$surv[inds] >= 0.5]]) st <- st + surv$strata[s] out <- c(out, md) } out } aml.wei <- censboot(cbind(aml$time, aml$cens), aml.fun1, R = 499, strata = aml$group, F.surv = aml.s1, sim = "weird") # Now for an example where a cox regression model has been fitted # the data we will look at the melanoma data of Example 7.6 from # Davison and Hinkley (1997). The fitted model assumes that there # is a different survival distribution for the ulcerated and # non-ulcerated groups but that the thickness of the tumour has a # common effect. We will also assume that the censoring distribution # is different in different age groups. The statistic of interest # is the linear predictor. This is returned as the values at a # number of equally spaced points in the range of interest. data(melanoma, package = "boot") library(splines)# for ns mel.cox <- coxph(Surv(time, status == 1) ~ ns(thickness, df=4) + strata(ulcer), data = melanoma) mel.surv <- survfit(mel.cox) agec <- cut(melanoma$age, c(0, 39, 49, 59, 69, 100)) mel.cens <- survfit(Surv(time - 0.001*(status == 1), status != 1) ~ strata(agec), data = melanoma) mel.fun <- function(d) { t1 <- ns(d$thickness, df=4) cox <- coxph(Surv(d$time, d$status == 1) ~ t1+strata(d$ulcer)) ind <- !duplicated(d$thickness) u <- d$thickness[!ind] eta <- cox$linear.predictors[!ind] sp <- smooth.spline(u, eta, df=20) th <- seq(from = 0.25, to = 10, by = 0.25) predict(sp, th)$y } mel.str <- cbind(melanoma$ulcer, agec) # this is slow! mel.mod <- censboot(melanoma, mel.fun, R = 499, F.surv = mel.surv, G.surv = mel.cens, cox = mel.cox, strata = mel.str, sim = "model") # To plot the original predictor and a 95\% pointwise envelope for it mel.env <- envelope(mel.mod)$point th <- seq(0.25, 10, by = 0.25) plot(th, mel.env[1, ], ylim = c(-2, 2), xlab = "thickness (mm)", ylab = "linear predictor", type = "n") lines(th, mel.mod$t0, lty = 1) matlines(th, t(mel.env), lty = 2) } \author{Angelo J. Canty. Parallel extensions by Brian Ripley} \keyword{survival} boot/man/bigcity.Rd0000644000176000001440000000164613245463610013754 0ustar ripleyusers\name{bigcity} \alias{bigcity} \alias{city} \title{ Population of U.S. Cities } \description{ The \code{bigcity} data frame has 49 rows and 2 columns. The \code{city} data frame has 10 rows and 2 columns. The measurements are the population (in 1000's) of 49 U.S. cities in 1920 and 1930. The 49 cities are a random sample taken from the 196 largest cities in 1920. The \code{city} data frame consists of the first 10 observations in \code{bigcity}. } \usage{ bigcity } \format{ This data frame contains the following columns: \describe{ \item{\code{u}}{ The 1920 population. } \item{\code{x}}{ The 1930 population. }}} \source{ The data were obtained from Cochran, W.G. (1977) \emph{Sampling Techniques}. Third edition. John Wiley } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/cum3.Rd0000644000176000001440000000216713245463610013170 0ustar ripleyusers\name{cum3} \alias{cum3} \title{ Calculate Third Order Cumulants } \description{ Calculates an estimate of the third cumulant, or skewness, of a vector. Also, if more than one vector is specified, a product-moment of order 3 is estimated. } \usage{ cum3(a, b = a, c = a, unbiased = TRUE) } \arguments{ \item{a}{ A vector of observations. } \item{b}{ Another vector of observations, if not supplied it is set to the value of \code{a}. If supplied then it must be the same length as \code{a}. } \item{c}{ Another vector of observations, if not supplied it is set to the value of \code{a}. If supplied then it must be the same length as \code{a}. } \item{unbiased}{ A logical value indicating whether the unbiased estimator should be used. }} \value{ The required estimate. } \details{ The unbiased estimator uses a multiplier of \code{n/((n-1)*(n-2))} where \code{n} is the sample size, if \code{unbiased} is \code{FALSE} then a multiplier of \code{1/n} is used. This is multiplied by \code{sum((a-mean(a))*(b-mean(b))*(c-mean(c)))} to give the required estimate. } \keyword{math} \keyword{multivariate} % Converted by Sd2Rd version 1.15. boot/man/print.bootci.Rd0000644000176000001440000000276313245463611014736 0ustar ripleyusers\name{print.bootci} \alias{print.bootci} \title{ Print Bootstrap Confidence Intervals } \description{ This is a method for the function \code{print()} to print objects of the class \code{"bootci"}. } \usage{ \method{print}{bootci}(x, hinv = NULL, ...) } \arguments{ \item{x}{ The output from a call to \code{boot.ci}. } \item{hinv}{ A transformation to be made to the interval end-points before they are printed. } \item{\dots}{further arguments passed to or from other methods.} } \value{ The object \code{ci.out} is returned invisibly. } \details{ This function prints out the results from \code{boot.ci} in a "nice" format. It also notes whether the scale of the intervals is the original scale of the input to \code{boot.ci} or a different scale and whether the calculations were done on a transformed scale. It also looks at the order statistics that were used in calculating the intervals. If the smallest or largest values were used then it prints a message \code{Warning : Intervals used Extreme Quantiles} Such intervals should be considered very unstable and not relied upon for inferences. Even if the extreme values are not used, it is possible that the intervals are unstable if they used quantiles close to the extreme values. The function alerts the user to intervals which use the upper or lower 10 order statistics with the message \code{Some intervals may be unstable} } \seealso{ \code{\link{boot.ci}} } \keyword{print} \keyword{htest} % Converted by Sd2Rd version 0.3-1. boot/man/glm.diag.plots.Rd0000644000176000001440000001042713245463606015146 0ustar ripleyusers\name{glm.diag.plots} \alias{glm.diag.plots} \title{ Diagnostics plots for generalized linear models } \description{ Makes plot of jackknife deviance residuals against linear predictor, normal scores plots of standardized deviance residuals, plot of approximate Cook statistics against leverage/(1-leverage), and case plot of Cook statistic. } \usage{ glm.diag.plots(glmfit, glmdiag = glm.diag(glmfit), subset = NULL, iden = FALSE, labels = NULL, ret = FALSE) } \arguments{ \item{glmfit}{ \code{glm.object} : the result of a call to \code{glm()} } \item{glmdiag}{ Diagnostics of \code{glmfit} obtained from a call to \code{glm.diag}. If it is not supplied then it is calculated. } \item{subset}{ Subset of \code{data} for which \code{glm} fitting performed: should be the same as the \code{subset} option used in the call to \code{glm()} which generated \code{glmfit}. Needed only if the \code{subset=} option was used in the call to \code{glm}. } \item{iden}{ A logical argument. If \code{TRUE} then, after the plots are drawn, the user will be prompted for an integer between 0 and 4. A positive integer will select a plot and invoke \code{identify()} on that plot. After exiting \code{identify()}, the user is again prompted, this loop continuing until the user responds to the prompt with 0. If \code{iden} is \code{FALSE} (default) the user cannot interact with the plots. } \item{labels}{ A vector of labels for use with \code{identify()} if \code{iden} is \code{TRUE}. If it is not supplied then the labels are derived from \code{glmfit}. } \item{ret}{ A logical argument indicating if \code{glmdiag} should be returned. The default is \code{FALSE}. }} \value{ If \code{ret} is \code{TRUE} then the value of \code{glmdiag} is returned otherwise there is no returned value. } \details{ The diagnostics required for the plots are calculated by \code{glm.diag}. These are then used to produce the four plots on the current graphics device. The plot on the top left is a plot of the jackknife deviance residuals against the fitted values. The plot on the top right is a normal QQ plot of the standardized deviance residuals. The dotted line is the expected line if the standardized residuals are normally distributed, i.e. it is the line with intercept 0 and slope 1. The bottom two panels are plots of the Cook statistics. On the left is a plot of the Cook statistics against the standardized leverages. In general there will be two dotted lines on this plot. The horizontal line is at 8/(n-2p) where n is the number of observations and p is the number of parameters estimated. Points above this line may be points with high influence on the model. The vertical line is at 2p/(n-2p) and points to the right of this line have high leverage compared to the variance of the raw residual at that point. If all points are below the horizontal line or to the left of the vertical line then the line is not shown. The final plot again shows the Cook statistic this time plotted against case number enabling us to find which observations are influential. Use of \code{iden=T} is encouraged for proper exploration of these four plots as a guide to how well the model fits the data and whether certain observations have an unduly large effect on parameter estimates. } \section{Side Effects}{ The current device is cleared and four plots are plotted by use of \code{split.screen(c(2,2))}. If \code{iden} is \code{TRUE}, interactive identification of points is enabled. All screens are closed, but not cleared, on termination of the function. } \references{ Davison, A. C. and Hinkley, D. V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Davison, A.C. and Snell, E.J. (1991) Residuals and diagnostics. In \emph{Statistical Theory and Modelling: In Honour of Sir David Cox} D.V. Hinkley, N. Reid, and E.J. Snell (editors), 83--106. Chapman and Hall. } \seealso{ \code{\link{glm}}, \code{\link{glm.diag}}, \code{\link{identify}} } \examples{ # In this example we look at the leukaemia data which was looked at in # Example 7.1 of Davison and Hinkley (1997) data(leuk, package = "MASS") leuk.mod <- glm(time ~ ag-1+log10(wbc), family = Gamma(log), data = leuk) leuk.diag <- glm.diag(leuk.mod) glm.diag.plots(leuk.mod, leuk.diag) } \keyword{regression} \keyword{dplot} \keyword{hplot} boot/man/frets.Rd0000644000176000001440000000200713245463610013435 0ustar ripleyusers\name{frets} \alias{frets} \title{ Head Dimensions in Brothers } \description{ The \code{frets} data frame has 25 rows and 4 columns. The data consist of measurements of the length and breadth of the heads of pairs of adult brothers in 25 randomly sampled families. All measurements are expressed in millimetres. } \usage{ frets } \format{ This data frame contains the following columns: \describe{ \item{\code{l1}}{ The head length of the eldest son. } \item{\code{b1}}{ The head breadth of the eldest son. } \item{\code{l2}}{ The head length of the second son. } \item{\code{b2}}{ The head breadth of the second son. }}} \source{ The data were obtained from Frets, G.P. (1921) Heredity of head form in man. \emph{Genetica}, \bold{3}, 193. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Whittaker, J. (1990) \emph{Graphical Models in Applied Multivariate Statistics}. John Wiley. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/wool.Rd0000644000176000001440000000162413245463615013303 0ustar ripleyusers\name{wool} \alias{wool} \title{ Australian Relative Wool Prices } \description{ \code{wool} is a time series of class \code{"ts"} and contains 309 observations. Each week that the market is open the Australian Wool Corporation set a floor price which determines their policy on intervention and is therefore a reflection of the overall price of wool for the week in question. Actual prices paid can vary considerably about the floor price. The series here is the log of the ratio between the price for fine grade wool and the floor price, each market week between July 1976 and Jun 1984. } \source{ The data were obtained from Diggle, P.J. (1990) \emph{Time Series: A Biostatistical Introduction}. Oxford University Press. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/aml.Rd0000644000176000001440000000362113245463617013075 0ustar ripleyusers\name{aml} \alias{aml} \title{ Remission Times for Acute Myelogenous Leukaemia } \description{ The \code{aml} data frame has 23 rows and 3 columns. A clinical trial to evaluate the efficacy of maintenance chemotherapy for acute myelogenous leukaemia was conducted by Embury et al. (1977) at Stanford University. After reaching a stage of remission through treatment by chemotherapy, patients were randomized into two groups. The first group received maintenance chemotherapy and the second group did not. The aim of the study was to see if maintenance chemotherapy increased the length of the remission. The data here formed a preliminary analysis which was conducted in October 1974. } \usage{ aml } \format{ This data frame contains the following columns: \describe{ \item{\code{time}}{ The length of the complete remission (in weeks). } \item{\code{cens}}{ An indicator of right censoring. 1 indicates that the patient had a relapse and so \code{time} is the length of the remission. 0 indicates that the patient had left the study or was still in remission in October 1974, that is the length of remission is right-censored. } \item{\code{group}}{ The group into which the patient was randomized. Group 1 received maintenance chemotherapy, group 2 did not. }}} \source{ The data were obtained from Miller, R.G. (1981) \emph{Survival Analysis}. John Wiley. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Embury, S.H, Elias, L., Heller, P.H., Hood, C.E., Greenberg, P.L. and Schrier, S.L. (1977) Remission maintenance therapy in acute myelogenous leukaemia. \emph{Western Journal of Medicine}, \bold{126}, 267-272. } \note{ Package \pkg{survival} also has a dataset \code{aml}. It is the same data with different names and with \code{group} replaced by a factor \code{x}. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/islay.Rd0000644000176000001440000000151713245463611013441 0ustar ripleyusers\name{islay} \alias{islay} \title{ Jura Quartzite Azimuths on Islay } \description{ The \code{islay} data frame has 18 rows and 1 columns. Measurements were taken of paleocurrent azimuths from the Jura Quartzite on the Scottish island of Islay. } \usage{ islay } \format{ This data frame contains the following column: \describe{ \item{\code{theta}}{ The angle of the azimuth in degrees East of North. }}} \source{ The data were obtained from Hand, D.J., Daly, F., Lunn, A.D., McConway, K.J. and Ostrowski, E. (1994) \emph{A Handbook of Small Data Sets}, Chapman and Hall. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Till, R. (1974) \emph{Statistical Methods for the Earth Scientist}. Macmillan. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/survival.Rd0000644000176000001440000000162413245463610014171 0ustar ripleyusers\name{survival} \alias{survival} \title{ Survival of Rats after Radiation Doses } \description{ The \code{survival} data frame has 14 rows and 2 columns. The data measured the survival percentages of batches of rats who were given varying doses of radiation. At each of 6 doses there were two or three replications of the experiment. } \usage{ survival } \format{ This data frame contains the following columns: \describe{ \item{\code{dose}}{ The dose of radiation administered (rads). } \item{\code{surv}}{ The survival rate of the batches expressed as a percentage. }}} \source{ The data were obtained from Efron, B. (1988) Computer-intensive methods in statistical regression. \emph{SIAM Review}, \bold{30}, 421--449. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/exp.tilt.Rd0000644000176000001440000001253413245463615014074 0ustar ripleyusers\name{exp.tilt} \alias{exp.tilt} \title{ Exponential Tilting } \description{ This function calculates exponentially tilted multinomial distributions such that the resampling distributions of the linear approximation to a statistic have the required means. } \usage{ exp.tilt(L, theta = NULL, t0 = 0, lambda = NULL, strata = rep(1, length(L))) } \arguments{ \item{L}{ The empirical influence values for the statistic of interest based on the observed data. The length of \code{L} should be the same as the size of the original data set. Typically \code{L} will be calculated by a call to \code{empinf}. } \item{theta}{ The value at which the tilted distribution is to be centred. This is not required if \code{lambda} is supplied but is needed otherwise. } \item{t0}{ The current value of the statistic. The default is that the statistic equals 0. } \item{lambda}{ The Lagrange multiplier(s). For each value of \code{lambda} a multinomial distribution is found with probabilities proportional to \code{exp(lambda * L)}. In general \code{lambda} is not known and so \code{theta} would be supplied, and the corresponding value of \code{lambda} found. If both \code{lambda} and \code{theta} are supplied then \code{lambda} is ignored and the multipliers for tilting to \code{theta} are found. } \item{strata}{ A vector or factor of the same length as \code{L} giving the strata for the observed data and the empirical influence values \code{L}. }} \value{ A list with the following components : \item{p}{ The tilted probabilities. There will be \code{m} distributions where \code{m} is the length of \code{theta} (or \code{lambda} if supplied). If \code{m} is 1 then \code{p} is a vector of \code{length(L)} probabilities. If \code{m} is greater than 1 then \code{p} is a matrix with \code{m} rows, each of which contain \code{length(L)} probabilities. In this case the vector \code{p[i,]} is the distribution tilted to \code{theta[i]}. \code{p} is in the form required by the argument \code{weights} of the function \code{boot} for importance resampling. } \item{lambda}{ The Lagrange multiplier used in the equation to determine the tilted probabilities. \code{lambda} is a vector of the same length as \code{theta}. } \item{theta}{ The values of \code{theta} to which the distributions have been tilted. In general this will be the input value of \code{theta} but if \code{lambda} was supplied then this is the vector of the corresponding \code{theta} values. }} \details{ Exponential tilting involves finding a set of weights for a data set to ensure that the bootstrap distribution of the linear approximation to a statistic of interest has mean \code{theta}. The weights chosen to achieve this are given by \code{p[j]} proportional to \code{exp(lambda*L[j]/n)}, where \code{n} is the number of data points. \code{lambda} is then chosen to make the mean of the bootstrap distribution, of the linear approximation to the statistic of interest, equal to the required value \code{theta}. Thus \code{lambda} is defined as the solution of a nonlinear equation. The equation is solved by minimizing the Euclidean distance between the left and right hand sides of the equation using the function \code{nlmin}. If this minimum is not equal to zero then the method fails. Typically exponential tilting is used to find suitable weights for importance resampling. If a small tail probability or quantile of the distribution of the statistic of interest is required then a more efficient simulation is to centre the resampling distribution close to the point of interest and then use the functions \code{imp.prob} or \code{imp.quantile} to estimate the required quantity. Another method of achieving a similar shifting of the distribution is through the use of \code{smooth.f}. The function \code{tilt.boot} uses \code{exp.tilt} or \code{smooth.f} to find the weights for a tilted bootstrap. } \references{ Davison, A. C. and Hinkley, D. V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. Efron, B. (1981) Nonparametric standard errors and confidence intervals (with Discussion). \emph{Canadian Journal of Statistics}, \bold{9}, 139--172. } \seealso{ \code{\link{empinf}}, \code{\link{imp.prob}}, \code{\link{imp.quantile}}, \code{\link{optim}}, \code{\link{smooth.f}}, \code{\link{tilt.boot}} } \examples{ # Example 9.8 of Davison and Hinkley (1997) requires tilting the resampling # distribution of the studentized statistic to be centred at the observed # value of the test statistic 1.84. This can be achieved as follows. grav1 <- gravity[as.numeric(gravity[,2]) >=7 , ] grav.fun <- function(dat, w, orig) { strata <- tapply(dat[, 2], as.numeric(dat[, 2])) d <- dat[, 1] ns <- tabulate(strata) w <- w/tapply(w, strata, sum)[strata] mns <- as.vector(tapply(d * w, strata, sum)) # drop names mn2 <- tapply(d * d * w, strata, sum) s2hat <- sum((mn2 - mns^2)/ns) c(mns[2]-mns[1], s2hat, (mns[2]-mns[1]-orig)/sqrt(s2hat)) } grav.z0 <- grav.fun(grav1, rep(1, 26), 0) grav.L <- empinf(data = grav1, statistic = grav.fun, stype = "w", strata = grav1[,2], index = 3, orig = grav.z0[1]) grav.tilt <- exp.tilt(grav.L, grav.z0[3], strata = grav1[,2]) boot(grav1, grav.fun, R = 499, stype = "w", weights = grav.tilt$p, strata = grav1[,2], orig = grav.z0[1]) } \keyword{nonparametric} \keyword{smooth} % Converted by Sd2Rd version 1.15. boot/man/tuna.Rd0000644000176000001440000000204313245463610013261 0ustar ripleyusers\name{tuna} \alias{tuna} \title{ Tuna Sighting Data } \description{ The \code{tuna} data frame has 64 rows and 1 columns. The data come from an aerial line transect survey of Southern Bluefin Tuna in the Great Australian Bight. An aircraft with two spotters on board flies randomly allocated line transects. Each school of tuna sighted is counted and its perpendicular distance from the transect measured. The survey was conducted in summer when tuna tend to stay on the surface. } \usage{ tuna } \format{ This data frame contains the following column: \describe{ \item{\code{y}}{ The perpendicular distance, in miles, from the transect for 64 independent sightings of tuna schools. }}} \source{ The data were obtained from Chen, S.X. (1996) Empirical likelihood confidence intervals for nonparametric density estimation. \emph{Biometrika}, \bold{83}, 329--341. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \keyword{datasets} % Converted by Sd2Rd version 1.15. boot/man/norm.ci.Rd0000644000176000001440000001050213245463606013663 0ustar ripleyusers\name{norm.ci} \alias{norm.ci} \title{ Normal Approximation Confidence Intervals } \description{ Using the normal approximation to a statistic, calculate equi-tailed two-sided confidence intervals. } \usage{ norm.ci(boot.out = NULL, conf = 0.95, index = 1, var.t0 = NULL, t0 = NULL, t = NULL, L = NULL, h = function(t) t, hdot = function(t) 1, hinv = function(t) t) } \arguments{ \item{boot.out}{ A bootstrap output object returned from a call to \code{boot}. If \code{t0} is missing then \code{boot.out} is a required argument. It is also required if both \code{var.t0} and \code{t} are missing. } \item{conf}{ A scalar or vector containing the confidence level(s) of the required interval(s). } \item{index}{ The index of the statistic of interest within the output of a call to \code{boot.out$statistic}. It is not used if \code{boot.out} is missing, in which case \code{t0} must be supplied. } \item{var.t0}{ The variance of the statistic of interest. If it is not supplied then \code{var(t)} is used. } \item{t0}{ The observed value of the statistic of interest. If it is missing then it is taken from \code{boot.out} which is required in that case. } \item{t}{ Bootstrap replicates of the variable of interest. These are used to estimate the variance of the statistic of interest if \code{var.t0} is not supplied. The default value is \code{boot.out$t[,index]}. } \item{L}{ The empirical influence values for the statistic of interest. These are used to calculate \code{var.t0} if neither \code{var.t0} nor \code{boot.out} are supplied. If a transformation is supplied through \code{h} then the influence values must be for the untransformed statistic \code{t0}. } \item{h}{ A function defining a monotonic transformation, the intervals are calculated on the scale of \code{h(t)} and the inverse function \code{hinv} is applied to the resulting intervals. \code{h} must be a function of one variable only and must be vectorized. The default is the identity function. } \item{hdot}{ A function of one argument returning the derivative of \code{h}. It is a required argument if \code{h} is supplied and is used for approximating the variance of \code{h(t0)}. The default is the constant function 1. } \item{hinv}{ A function, like \code{h}, which returns the inverse of \code{h}. It is used to transform the intervals calculated on the scale of \code{h(t)} back to the original scale. The default is the identity function. If \code{h} is supplied but \code{hinv} is not, then the intervals returned will be on the transformed scale. } } \value{ If \code{length(conf)} is 1 then a vector containing the confidence level and the endpoints of the interval is returned. Otherwise, the returned value is a matrix where each row corresponds to a different confidence level. } \details{ It is assumed that the statistic of interest has an approximately normal distribution with variance \code{var.t0} and so a confidence interval of length \code{2*qnorm((1+conf)/2)*sqrt(var.t0)} is found. If \code{boot.out} or \code{t} are supplied then the interval is bias-corrected using the bootstrap bias estimate, and so the interval would be centred at \code{2*t0-mean(t)}. Otherwise the interval is centred at \code{t0}. } \note{ This function is primarily designed to be called by \code{boot.ci} to calculate the normal approximation after a bootstrap but it can also be used without doing any bootstrap calculations as long as \code{t0} and \code{var.t0} can be supplied. See the examples below. } \references{ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap Methods and Their Application}. Cambridge University Press. } \seealso{ \code{\link{boot.ci}} } \examples{ # In Example 5.1 of Davison and Hinkley (1997), normal approximation # confidence intervals are found for the air-conditioning data. air.mean <- mean(aircondit$hours) air.n <- nrow(aircondit) air.v <- air.mean^2/air.n norm.ci(t0 = air.mean, var.t0 = air.v) exp(norm.ci(t0 = log(air.mean), var.t0 = 1/air.n)[2:3]) # Now a more complicated example - the ratio estimate for the city data. ratio <- function(d, w) sum(d$x * w)/sum(d$u *w) city.v <- var.linear(empinf(data = city, statistic = ratio)) norm.ci(t0 = ratio(city,rep(0.1,10)), var.t0 = city.v) } \keyword{htest} % Converted by Sd2Rd version 1.15. boot/DESCRIPTION0000644000176000001440000000206413577111150012756 0ustar ripleyusersPackage: boot Priority: recommended Version: 1.3-24 Date: 2019-12-20 Authors@R: c(person("Angelo", "Canty", role = "aut", email = "cantya@mcmaster.ca"), person("Brian", "Ripley", role = c("aut", "trl", "cre"), email = "ripley@stats.ox.ac.uk", comment = "author of parallel support")) Maintainer: Brian Ripley Note: Maintainers are not available to give advice on using a package they did not author. Description: Functions and datasets for bootstrapping from the book "Bootstrap Methods and Their Application" by A. C. Davison and D. V. Hinkley (1997, CUP), originally written by Angelo Canty for S. Title: Bootstrap Functions (Originally by Angelo Canty for S) Depends: R (>= 3.0.0), graphics, stats Suggests: MASS, survival LazyData: yes ByteCompile: yes License: Unlimited NeedsCompilation: no Packaged: 2019-12-20 09:05:28 UTC; ripley Author: Angelo Canty [aut], Brian Ripley [aut, trl, cre] (author of parallel support) Repository: CRAN Date/Publication: 2019-12-20 09:20:40 UTC boot/tests/0000755000176000001440000000000013245463611012414 5ustar ripleyusersboot/tests/Examples/0000755000176000001440000000000013450743660014175 5ustar ripleyusersboot/tests/Examples/boot-Ex.Rout.save0000644000176000001440000022346013577107014017326 0ustar ripleyusers R Under development (unstable) (2019-12-19 r77606) -- "Unsuffered Consequences" Copyright (C) 2019 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > pkgname <- "boot" > source(file.path(R.home("share"), "R", "examples-header.R")) > options(warn = 1) > library('boot') > > base::assign(".oldSearch", base::search(), pos = 'CheckExEnv') > base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv') > cleanEx() > nameEx("Imp.Estimates") > ### * Imp.Estimates > > flush(stderr()); flush(stdout()) > > ### Name: Imp.Estimates > ### Title: Importance Sampling Estimates > ### Aliases: Imp.Estimates imp.moments imp.prob imp.quantile imp.reg > ### Keywords: htest nonparametric > > ### ** Examples > > # Example 9.8 of Davison and Hinkley (1997) requires tilting the > # resampling distribution of the studentized statistic to be centred > # at the observed value of the test statistic, 1.84. In this example > # we show how certain estimates can be found using resamples taken from > # the tilted distribution. > grav1 <- gravity[as.numeric(gravity[,2]) >= 7, ] > grav.fun <- function(dat, w, orig) { + strata <- tapply(dat[, 2], as.numeric(dat[, 2])) + d <- dat[, 1] + ns <- tabulate(strata) + w <- w/tapply(w, strata, sum)[strata] + mns <- as.vector(tapply(d * w, strata, sum)) # drop names + mn2 <- tapply(d * d * w, strata, sum) + s2hat <- sum((mn2 - mns^2)/ns) + c(mns[2] - mns[1], s2hat, (mns[2] - mns[1] - orig)/sqrt(s2hat)) + } > grav.z0 <- grav.fun(grav1, rep(1, 26), 0) > grav.L <- empinf(data = grav1, statistic = grav.fun, stype = "w", + strata = grav1[,2], index = 3, orig = grav.z0[1]) > grav.tilt <- exp.tilt(grav.L, grav.z0[3], strata = grav1[, 2]) > grav.tilt.boot <- boot(grav1, grav.fun, R = 199, stype = "w", + strata = grav1[, 2], weights = grav.tilt$p, + orig = grav.z0[1]) > # Since the weights are needed for all calculations, we shall calculate > # them once only. > grav.w <- imp.weights(grav.tilt.boot) > grav.mom <- imp.moments(grav.tilt.boot, w = grav.w, index = 3) > grav.p <- imp.prob(grav.tilt.boot, w = grav.w, index = 3, t0 = grav.z0[3]) > unlist(grav.p) t0 raw rat reg 1.8401182 1.0222447 0.9778246 0.9767292 > grav.q <- imp.quantile(grav.tilt.boot, w = grav.w, index = 3, + alpha = c(0.9, 0.95, 0.975, 0.99)) > as.data.frame(grav.q) alpha raw rat reg 1 0.900 3.048484 1.170707 5.056004 2 0.950 3.237935 1.565928 5.056004 3 0.975 3.629448 1.895876 5.056004 4 0.990 3.629448 2.258157 5.056004 > > > > cleanEx() > nameEx("abc.ci") > ### * abc.ci > > flush(stderr()); flush(stdout()) > > ### Name: abc.ci > ### Title: Nonparametric ABC Confidence Intervals > ### Aliases: abc.ci > ### Keywords: nonparametric htest > > ### ** Examples > > ## Don't show: > op <- options(digits = 5) > ## End(Don't show) > # 90% and 95% confidence intervals for the correlation > # coefficient between the columns of the bigcity data > > abc.ci(bigcity, corr, conf=c(0.90,0.95)) conf [1,] 0.90 0.95815 0.99173 [2,] 0.95 0.94937 0.99307 > > # A 95% confidence interval for the difference between the means of > # the last two samples in gravity > mean.diff <- function(y, w) + { gp1 <- 1:table(as.numeric(y$series))[1] + sum(y[gp1, 1] * w[gp1]) - sum(y[-gp1, 1] * w[-gp1]) + } > grav1 <- gravity[as.numeric(gravity[, 2]) >= 7, ] > ## IGNORE_RDIFF_BEGIN > abc.ci(grav1, mean.diff, strata = grav1$series) [1] 0.95000 -6.70758 -0.39394 > ## IGNORE_RDIFF_END > ## Don't show: > options(op) > ## End(Don't show) > > > > cleanEx() > nameEx("boot") > ### * boot > > flush(stderr()); flush(stdout()) > > ### Name: boot > ### Title: Bootstrap Resampling > ### Aliases: boot boot.return c.boot > ### Keywords: nonparametric htest > > ### ** Examples > > ## Don't show: > op <- options(digits = 5) > ## End(Don't show) > # Usual bootstrap of the ratio of means using the city data > ratio <- function(d, w) sum(d$x * w)/sum(d$u * w) > boot(city, ratio, R = 999, stype = "w") ORDINARY NONPARAMETRIC BOOTSTRAP Call: boot(data = city, statistic = ratio, R = 999, stype = "w") Bootstrap Statistics : original bias std. error t1* 1.5203 0.049024 0.21583 > > > # Stratified resampling for the difference of means. In this > # example we will look at the difference of means between the final > # two series in the gravity data. > diff.means <- function(d, f) + { n <- nrow(d) + gp1 <- 1:table(as.numeric(d$series))[1] + m1 <- sum(d[gp1,1] * f[gp1])/sum(f[gp1]) + m2 <- sum(d[-gp1,1] * f[-gp1])/sum(f[-gp1]) + ss1 <- sum(d[gp1,1]^2 * f[gp1]) - (m1 * m1 * sum(f[gp1])) + ss2 <- sum(d[-gp1,1]^2 * f[-gp1]) - (m2 * m2 * sum(f[-gp1])) + c(m1 - m2, (ss1 + ss2)/(sum(f) - 2)) + } > grav1 <- gravity[as.numeric(gravity[,2]) >= 7,] > boot(grav1, diff.means, R = 999, stype = "f", strata = grav1[,2]) STRATIFIED BOOTSTRAP Call: boot(data = grav1, statistic = diff.means, R = 999, stype = "f", strata = grav1[, 2]) Bootstrap Statistics : original bias std. error t1* -2.8462 0.007469 1.5528 t2* 16.8462 -1.475719 6.7147 > > # In this example we show the use of boot in a prediction from > # regression based on the nuclear data. This example is taken > # from Example 6.8 of Davison and Hinkley (1997). Notice also > # that two extra arguments to 'statistic' are passed through boot. > nuke <- nuclear[, c(1, 2, 5, 7, 8, 10, 11)] > nuke.lm <- glm(log(cost) ~ date+log(cap)+ne+ct+log(cum.n)+pt, data = nuke) > nuke.diag <- glm.diag(nuke.lm) > nuke.res <- nuke.diag$res * nuke.diag$sd > nuke.res <- nuke.res - mean(nuke.res) > > # We set up a new data frame with the data, the standardized > # residuals and the fitted values for use in the bootstrap. > nuke.data <- data.frame(nuke, resid = nuke.res, fit = fitted(nuke.lm)) > > # Now we want a prediction of plant number 32 but at date 73.00 > new.data <- data.frame(cost = 1, date = 73.00, cap = 886, ne = 0, + ct = 0, cum.n = 11, pt = 1) > new.fit <- predict(nuke.lm, new.data) > > nuke.fun <- function(dat, inds, i.pred, fit.pred, x.pred) + { + lm.b <- glm(fit+resid[inds] ~ date+log(cap)+ne+ct+log(cum.n)+pt, + data = dat) + pred.b <- predict(lm.b, x.pred) + c(coef(lm.b), pred.b - (fit.pred + dat$resid[i.pred])) + } > > nuke.boot <- boot(nuke.data, nuke.fun, R = 999, m = 1, + fit.pred = new.fit, x.pred = new.data) > # The bootstrap prediction squared error would then be found by > mean(nuke.boot$t[, 8]^2) [1] 0.084223 > # Basic bootstrap prediction limits would be > new.fit - sort(nuke.boot$t[, 8])[c(975, 25)] [1] 6.1488 7.2619 > > > # Finally a parametric bootstrap. For this example we shall look > # at the air-conditioning data. In this example our aim is to test > # the hypothesis that the true value of the index is 1 (i.e. that > # the data come from an exponential distribution) against the > # alternative that the data come from a gamma distribution with > # index not equal to 1. > air.fun <- function(data) { + ybar <- mean(data$hours) + para <- c(log(ybar), mean(log(data$hours))) + ll <- function(k) { + if (k <= 0) 1e200 else lgamma(k)-k*(log(k)-1-para[1]+para[2]) + } + khat <- nlm(ll, ybar^2/var(data$hours))$estimate + c(ybar, khat) + } > > air.rg <- function(data, mle) { + # Function to generate random exponential variates. + # mle will contain the mean of the original data + out <- data + out$hours <- rexp(nrow(out), 1/mle) + out + } > > air.boot <- boot(aircondit, air.fun, R = 999, sim = "parametric", + ran.gen = air.rg, mle = mean(aircondit$hours)) > > # The bootstrap p-value can then be approximated by > sum(abs(air.boot$t[,2]-1) > abs(air.boot$t0[2]-1))/(1+air.boot$R) [1] 0.446 > ## Don't show: > options(op) > ## End(Don't show) > > > > cleanEx() > nameEx("boot.array") > ### * boot.array > > flush(stderr()); flush(stdout()) > > ### Name: boot.array > ### Title: Bootstrap Resampling Arrays > ### Aliases: boot.array > ### Keywords: nonparametric > > ### ** Examples > > # A frequency array for a nonparametric bootstrap > city.boot <- boot(city, corr, R = 40, stype = "w") > boot.array(city.boot) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]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or(d$x,d$u[i]) > city.perm <- boot(city, perm.cor, R = 40, sim = "permutation") > boot.array(city.perm, indices = TRUE) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 7 8 2 6 9 5 4 3 10 1 [2,] 1 9 8 6 5 3 4 7 2 10 [3,] 10 1 6 9 4 5 2 8 3 7 [4,] 4 5 7 6 3 10 9 8 2 1 [5,] 10 3 6 7 5 2 8 9 1 4 [6,] 4 10 8 2 5 6 7 3 9 1 [7,] 5 8 10 3 2 4 7 1 6 9 [8,] 3 8 4 9 2 7 1 5 10 6 [9,] 6 5 1 3 7 2 4 10 9 8 [10,] 4 9 6 10 8 1 7 3 5 2 [11,] 5 10 1 8 6 2 3 4 9 7 [12,] 7 6 1 3 10 2 8 4 5 9 [13,] 10 8 3 6 9 7 1 5 2 4 [14,] 6 7 10 1 5 4 8 2 9 3 [15,] 9 1 5 3 2 8 6 10 7 4 [16,] 9 5 7 6 4 10 1 3 8 2 [17,] 1 8 3 10 4 5 9 7 6 2 [18,] 1 10 5 8 2 4 7 9 6 3 [19,] 8 2 7 4 9 3 10 6 5 1 [20,] 10 4 8 6 5 9 1 3 2 7 [21,] 2 1 10 4 5 7 8 3 6 9 [22,] 3 1 10 5 2 4 8 6 9 7 [23,] 8 4 1 10 9 6 2 7 5 3 [24,] 2 3 7 8 1 6 4 5 10 9 [25,] 4 8 9 5 10 6 2 7 3 1 [26,] 1 9 2 10 6 5 4 8 7 3 [27,] 9 10 7 1 3 8 6 2 4 5 [28,] 6 7 2 3 4 1 8 9 10 5 [29,] 5 2 1 9 4 8 7 6 10 3 [30,] 7 4 6 2 5 1 9 10 3 8 [31,] 8 5 1 6 7 9 4 3 2 10 [32,] 3 10 4 5 7 6 1 9 8 2 [33,] 7 4 9 10 3 5 6 1 2 8 [34,] 10 6 2 8 7 3 4 9 1 5 [35,] 7 5 6 1 10 9 2 4 3 8 [36,] 9 1 8 6 10 5 2 7 3 4 [37,] 5 6 8 2 4 10 3 9 7 1 [38,] 5 10 4 3 1 2 8 9 7 6 [39,] 6 9 7 3 5 1 10 2 8 4 [40,] 9 3 8 2 6 7 5 1 10 4 > > > > cleanEx() > nameEx("boot.ci") > ### * boot.ci > > flush(stderr()); flush(stdout()) > > ### Name: boot.ci > ### Title: Nonparametric Bootstrap Confidence Intervals > ### Aliases: boot.ci > ### Keywords: nonparametric htest > > ### ** Examples > > # confidence intervals for the city data > ratio <- function(d, w) sum(d$x * w)/sum(d$u * w) > city.boot <- boot(city, ratio, R = 999, stype = "w", sim = "ordinary") > boot.ci(city.boot, conf = c(0.90, 0.95), + type = c("norm", "basic", "perc", "bca")) BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS Based on 999 bootstrap replicates CALL : boot.ci(boot.out = city.boot, conf = c(0.9, 0.95), type = c("norm", "basic", "perc", "bca")) Intervals : Level Normal Basic 90% ( 1.116, 1.826 ) ( 1.054, 1.742 ) 95% ( 1.048, 1.894 ) ( 0.956, 1.775 ) Level Percentile BCa 90% ( 1.299, 1.987 ) ( 1.292, 1.957 ) 95% ( 1.266, 2.085 ) ( 1.254, 2.058 ) Calculations and Intervals on Original Scale > > # studentized confidence interval for the two sample > # difference of means problem using the final two series > # of the gravity data. > diff.means <- function(d, f) + { n <- nrow(d) + gp1 <- 1:table(as.numeric(d$series))[1] + m1 <- sum(d[gp1,1] * f[gp1])/sum(f[gp1]) + m2 <- sum(d[-gp1,1] * f[-gp1])/sum(f[-gp1]) + ss1 <- sum(d[gp1,1]^2 * f[gp1]) - (m1 * m1 * sum(f[gp1])) + ss2 <- sum(d[-gp1,1]^2 * f[-gp1]) - (m2 * m2 * sum(f[-gp1])) + c(m1 - m2, (ss1 + ss2)/(sum(f) - 2)) + } > grav1 <- gravity[as.numeric(gravity[,2]) >= 7, ] > grav1.boot <- boot(grav1, diff.means, R = 999, stype = "f", + strata = grav1[ ,2]) > boot.ci(grav1.boot, type = c("stud", "norm")) BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS Based on 999 bootstrap replicates CALL : boot.ci(boot.out = grav1.boot, type = c("stud", "norm")) Intervals : Level Normal Studentized 95% (-5.897, 0.190 ) (-7.370, -0.052 ) Calculations and Intervals on Original Scale > > # Nonparametric confidence intervals for mean failure time > # of the air-conditioning data as in Example 5.4 of Davison > # and Hinkley (1997) > mean.fun <- function(d, i) + { m <- mean(d$hours[i]) + n <- length(i) + v <- (n-1)*var(d$hours[i])/n^2 + c(m, v) + } > air.boot <- boot(aircondit, mean.fun, R = 999) > boot.ci(air.boot, type = c("norm", "basic", "perc", "stud")) BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS Based on 999 bootstrap replicates CALL : boot.ci(boot.out = air.boot, type = c("norm", "basic", "perc", "stud")) Intervals : Level Normal Basic 95% ( 32.2, 184.5 ) ( 21.2, 169.4 ) Level Studentized Percentile 95% ( 45.6, 295.8 ) ( 46.8, 195.0 ) Calculations and Intervals on Original Scale > > # Now using the log transformation > # There are two ways of doing this and they both give the > # same intervals. > > # Method 1 > boot.ci(air.boot, type = c("norm", "basic", "perc", "stud"), + h = log, hdot = function(x) 1/x) BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS Based on 999 bootstrap replicates CALL : boot.ci(boot.out = air.boot, type = c("norm", "basic", "perc", "stud"), h = log, hdot = function(x) 1/x) Intervals : Level Normal Basic 95% ( 4.015, 5.491 ) ( 4.093, 5.521 ) Level Studentized Percentile 95% ( 3.922, 5.808 ) ( 3.845, 5.273 ) Calculations and Intervals on Transformed Scale > > # Method 2 > vt0 <- air.boot$t0[2]/air.boot$t0[1]^2 > vt <- air.boot$t[, 2]/air.boot$t[ ,1]^2 > boot.ci(air.boot, type = c("norm", "basic", "perc", "stud"), + t0 = log(air.boot$t0[1]), t = log(air.boot$t[,1]), + var.t0 = vt0, var.t = vt) BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS Based on 999 bootstrap replicates CALL : boot.ci(boot.out = air.boot, type = c("norm", "basic", "perc", "stud"), var.t0 = vt0, var.t = vt, t0 = log(air.boot$t0[1]), t = log(air.boot$t[, 1])) Intervals : Level Normal Basic 95% ( 4.070, 5.435 ) ( 4.093, 5.521 ) Level Studentized Percentile 95% ( 3.922, 5.808 ) ( 3.845, 5.273 ) Calculations and Intervals on Original Scale > > > > cleanEx() > nameEx("censboot") > ### * censboot > > flush(stderr()); flush(stdout()) > > ### Name: censboot > ### Title: Bootstrap for Censored Data > ### Aliases: censboot cens.return > ### Keywords: survival > > ### ** Examples > > library(survival) Attaching package: ‘survival’ The following object is masked from ‘package:boot’: aml > # Example 3.9 of Davison and Hinkley (1997) does a bootstrap on some > # remission times for patients with a type of leukaemia. The patients > # were divided into those who received maintenance chemotherapy and > # those who did not. Here we are interested in the median remission > # time for the two groups. > data(aml, package = "boot") # not the version in survival. > aml.fun <- function(data) { + surv <- survfit(Surv(time, cens) ~ group, data = data) + out <- NULL + st <- 1 + for (s in 1:length(surv$strata)) { + inds <- st:(st + surv$strata[s]-1) + md <- min(surv$time[inds[1-surv$surv[inds] >= 0.5]]) + st <- st + surv$strata[s] + out <- c(out, md) + } + out + } > aml.case <- censboot(aml, aml.fun, R = 499, strata = aml$group) Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf > > # Now we will look at the same statistic using the conditional > # bootstrap and the weird bootstrap. For the conditional bootstrap > # the survival distribution is stratified but the censoring > # distribution is not. > > aml.s1 <- survfit(Surv(time, cens) ~ group, data = aml) > aml.s2 <- survfit(Surv(time-0.001*cens, 1-cens) ~ 1, data = aml) > aml.cond <- censboot(aml, aml.fun, R = 499, strata = aml$group, + F.surv = aml.s1, G.surv = aml.s2, sim = "cond") Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf > > > # For the weird bootstrap we must redefine our function slightly since > # the data will not contain the group number. > aml.fun1 <- function(data, str) { + surv <- survfit(Surv(data[, 1], data[, 2]) ~ str) + out <- NULL + st <- 1 + for (s in 1:length(surv$strata)) { + inds <- st:(st + surv$strata[s] - 1) + md <- min(surv$time[inds[1-surv$surv[inds] >= 0.5]]) + st <- st + surv$strata[s] + out <- c(out, md) + } + out + } > aml.wei <- censboot(cbind(aml$time, aml$cens), aml.fun1, R = 499, + strata = aml$group, F.surv = aml.s1, sim = "weird") Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) : no non-missing arguments to min; returning Inf > > # Now for an example where a cox regression model has been fitted > # the data we will look at the melanoma data of Example 7.6 from > # Davison and Hinkley (1997). The fitted model assumes that there > # is a different survival distribution for the ulcerated and > # non-ulcerated groups but that the thickness of the tumour has a > # common effect. We will also assume that the censoring distribution > # is different in different age groups. The statistic of interest > # is the linear predictor. This is returned as the values at a > # number of equally spaced points in the range of interest. > data(melanoma, package = "boot") > library(splines)# for ns > mel.cox <- coxph(Surv(time, status == 1) ~ ns(thickness, df=4) + strata(ulcer), + data = melanoma) > mel.surv <- survfit(mel.cox) > agec <- cut(melanoma$age, c(0, 39, 49, 59, 69, 100)) > mel.cens <- survfit(Surv(time - 0.001*(status == 1), status != 1) ~ + strata(agec), data = melanoma) > mel.fun <- function(d) { + t1 <- ns(d$thickness, df=4) + cox <- coxph(Surv(d$time, d$status == 1) ~ t1+strata(d$ulcer)) + ind <- !duplicated(d$thickness) + u <- d$thickness[!ind] + eta <- cox$linear.predictors[!ind] + sp <- smooth.spline(u, eta, df=20) + th <- seq(from = 0.25, to = 10, by = 0.25) + predict(sp, th)$y + } > mel.str <- cbind(melanoma$ulcer, agec) > > # this is slow! > mel.mod <- censboot(melanoma, mel.fun, R = 499, F.surv = mel.surv, + G.surv = mel.cens, cox = mel.cox, strata = mel.str, sim = "model") > # To plot the original predictor and a 95% pointwise envelope for it > mel.env <- envelope(mel.mod)$point > th <- seq(0.25, 10, by = 0.25) > plot(th, mel.env[1, ], ylim = c(-2, 2), + xlab = "thickness (mm)", ylab = "linear predictor", type = "n") > lines(th, mel.mod$t0, lty = 1) > matlines(th, t(mel.env), lty = 2) > > > > cleanEx() detaching ‘package:splines’, ‘package:survival’ > nameEx("control") > ### * control > > flush(stderr()); flush(stdout()) > > ### Name: control > ### Title: Control Variate Calculations > ### Aliases: control > ### Keywords: nonparametric > > ### ** Examples > > # Use of control variates for the variance of the air-conditioning data > mean.fun <- function(d, i) + { m <- mean(d$hours[i]) + n <- nrow(d) + v <- (n-1)*var(d$hours[i])/n^2 + c(m, v) + } > air.boot <- boot(aircondit, mean.fun, R = 999) > control(air.boot, index = 2, bias.adj = TRUE) [1] -11.25369 > air.cont <- control(air.boot, index = 2) > # Now let us try the variance on the log scale. > air.cont1 <- control(air.boot, t0 = log(air.boot$t0[2]), + t = log(air.boot$t[, 2])) > > > > cleanEx() > nameEx("cv.glm") > ### * cv.glm > > flush(stderr()); flush(stdout()) > > ### Name: cv.glm > ### Title: Cross-validation for Generalized Linear Models > ### Aliases: cv.glm > ### Keywords: regression > > ### ** Examples > > # leave-one-out and 6-fold cross-validation prediction error for > # the mammals data set. > data(mammals, package="MASS") > mammals.glm <- glm(log(brain) ~ log(body), data = mammals) > (cv.err <- cv.glm(mammals, mammals.glm)$delta) [1] 0.4918650 0.4916571 > (cv.err.6 <- cv.glm(mammals, mammals.glm, K = 6)$delta) [1] 0.4911574 0.4887828 > > # As this is a linear model we could calculate the leave-one-out > # cross-validation estimate without any extra model-fitting. > muhat <- fitted(mammals.glm) > mammals.diag <- glm.diag(mammals.glm) > (cv.err <- mean((mammals.glm$y - muhat)^2/(1 - mammals.diag$h)^2)) [1] 0.491865 > > > # leave-one-out and 11-fold cross-validation prediction error for > # the nodal data set. Since the response is a binary variable an > # appropriate cost function is > cost <- function(r, pi = 0) mean(abs(r-pi) > 0.5) > > nodal.glm <- glm(r ~ stage+xray+acid, binomial, data = nodal) > (cv.err <- cv.glm(nodal, nodal.glm, cost, K = nrow(nodal))$delta) [1] 0.1886792 0.1886792 > (cv.11.err <- cv.glm(nodal, nodal.glm, cost, K = 11)$delta) [1] 0.2075472 0.2057672 > > > > cleanEx() > nameEx("empinf") > ### * empinf > > flush(stderr()); flush(stdout()) > > ### Name: empinf > ### Title: Empirical Influence Values > ### Aliases: empinf > ### Keywords: nonparametric math > > ### ** Examples > > # The empirical influence values for the ratio of means in > # the city data. > ratio <- function(d, w) sum(d$x *w)/sum(d$u*w) > empinf(data = city, statistic = ratio) [1] -1.04367815 -0.58417763 -0.37092459 -0.18958996 0.03164142 0.10544878 [7] 0.09236345 0.20365074 1.02178280 0.73381132 > city.boot <- boot(city, ratio, 499, stype="w") > empinf(boot.out = city.boot, type = "reg") 1 1 1 1 1 1 -1.188052737 -0.702204565 -0.447209091 -0.378938644 0.007498044 0.162261064 1 1 1 1 0.116272627 0.242543405 1.166357773 1.021472124 > > # A statistic that may be of interest in the difference of means > # problem is the t-statistic for testing equality of means. In > # the bootstrap we get replicates of the difference of means and > # the variance of that statistic and then want to use this output > # to get the empirical influence values of the t-statistic. > grav1 <- gravity[as.numeric(gravity[,2]) >= 7,] > grav.fun <- function(dat, w) { + strata <- tapply(dat[, 2], as.numeric(dat[, 2])) + d <- dat[, 1] + ns <- tabulate(strata) + w <- w/tapply(w, strata, sum)[strata] + mns <- as.vector(tapply(d * w, strata, sum)) # drop names + mn2 <- tapply(d * d * w, strata, sum) + s2hat <- sum((mn2 - mns^2)/ns) + c(mns[2] - mns[1], s2hat) + } > > grav.boot <- boot(grav1, grav.fun, R = 499, stype = "w", + strata = grav1[, 2]) > > # Since the statistic of interest is a function of the bootstrap > # statistics, we must calculate the bootstrap replicates and pass > # them to empinf using the t argument. > grav.z <- (grav.boot$t[,1]-grav.boot$t0[1])/sqrt(grav.boot$t[,2]) > empinf(boot.out = grav.boot, t = grav.z) 1 1 1 1 1 1 1 -2.7187022 -0.9515832 -2.4507504 -1.3409041 0.6167772 -1.2768844 -1.3438236 1 1 1 1 1 1 2 -0.2313133 -1.0504975 -3.1949223 1.2809344 3.7306567 8.9310126 2.7195701 2 2 2 2 2 2 2 4.1111581 3.1632367 1.1507436 -2.2930450 -2.7667452 -2.3645554 -0.2002981 2 2 2 2 2 2.0526618 0.3615873 -1.9421623 -2.1031282 -1.8890234 > > > > cleanEx() > nameEx("envelope") > ### * envelope > > flush(stderr()); flush(stdout()) > > ### Name: envelope > ### Title: Confidence Envelopes for Curves > ### Aliases: envelope > ### Keywords: dplot htest > > ### ** Examples > > # Testing whether the final series of measurements of the gravity data > # may come from a normal distribution. This is done in Examples 4.7 > # and 4.8 of Davison and Hinkley (1997). > grav1 <- gravity$g[gravity$series == 8] > grav.z <- (grav1 - mean(grav1))/sqrt(var(grav1)) > grav.gen <- function(dat, mle) rnorm(length(dat)) > grav.qqboot <- boot(grav.z, sort, R = 999, sim = "parametric", + ran.gen = grav.gen) > grav.qq <- qqnorm(grav.z, plot.it = FALSE) > grav.qq <- lapply(grav.qq, sort) > plot(grav.qq, ylim = c(-3.5, 3.5), ylab = "Studentized Order Statistics", + xlab = "Normal Quantiles") > grav.env <- envelope(grav.qqboot, level = 0.9) > lines(grav.qq$x, grav.env$point[1, ], lty = 4) > lines(grav.qq$x, grav.env$point[2, ], lty = 4) > lines(grav.qq$x, grav.env$overall[1, ], lty = 1) > lines(grav.qq$x, grav.env$overall[2, ], lty = 1) > > > > cleanEx() > nameEx("exp.tilt") > ### * exp.tilt > > flush(stderr()); flush(stdout()) > > ### Name: exp.tilt > ### Title: Exponential Tilting > ### Aliases: exp.tilt > ### Keywords: nonparametric smooth > > ### ** Examples > > # Example 9.8 of Davison and Hinkley (1997) requires tilting the resampling > # distribution of the studentized statistic to be centred at the observed > # value of the test statistic 1.84. This can be achieved as follows. > grav1 <- gravity[as.numeric(gravity[,2]) >=7 , ] > grav.fun <- function(dat, w, orig) { + strata <- tapply(dat[, 2], as.numeric(dat[, 2])) + d <- dat[, 1] + ns <- tabulate(strata) + w <- w/tapply(w, strata, sum)[strata] + mns <- as.vector(tapply(d * w, strata, sum)) # drop names + mn2 <- tapply(d * d * w, strata, sum) + s2hat <- sum((mn2 - mns^2)/ns) + c(mns[2]-mns[1], s2hat, (mns[2]-mns[1]-orig)/sqrt(s2hat)) + } > grav.z0 <- grav.fun(grav1, rep(1, 26), 0) > grav.L <- empinf(data = grav1, statistic = grav.fun, stype = "w", + strata = grav1[,2], index = 3, orig = grav.z0[1]) > grav.tilt <- exp.tilt(grav.L, grav.z0[3], strata = grav1[,2]) > boot(grav1, grav.fun, R = 499, stype = "w", weights = grav.tilt$p, + strata = grav1[,2], orig = grav.z0[1]) STRATIFIED WEIGHTED BOOTSTRAP Call: boot(data = grav1, statistic = grav.fun, R = 499, stype = "w", strata = grav1[, 2], weights = grav.tilt$p, orig = grav.z0[1]) Bootstrap Statistics : original bias std. error mean(t*) t1* 2.846154 -0.3661063 1.705171 5.702944 t2* 2.392353 -0.3538294 1.002889 3.444050 t3* 0.000000 -0.5160619 1.314298 1.473456 > > > > cleanEx() > nameEx("glm.diag.plots") > ### * glm.diag.plots > > flush(stderr()); flush(stdout()) > > ### Name: glm.diag.plots > ### Title: Diagnostics plots for generalized linear models > ### Aliases: glm.diag.plots > ### Keywords: regression dplot hplot > > ### ** Examples > > # In this example we look at the leukaemia data which was looked at in > # Example 7.1 of Davison and Hinkley (1997) > data(leuk, package = "MASS") > leuk.mod <- glm(time ~ ag-1+log10(wbc), family = Gamma(log), data = leuk) > leuk.diag <- glm.diag(leuk.mod) > glm.diag.plots(leuk.mod, leuk.diag) > > > > cleanEx() > nameEx("jack.after.boot") > ### * jack.after.boot > > flush(stderr()); flush(stdout()) > > ### Name: jack.after.boot > ### Title: Jackknife-after-Bootstrap Plots > ### Aliases: jack.after.boot > ### Keywords: hplot nonparametric > > ### ** Examples > > # To draw the jackknife-after-bootstrap plot for the head size data as in > # Example 3.24 of Davison and Hinkley (1997) > frets.fun <- function(data, i) { + pcorr <- function(x) { + # Function to find the correlations and partial correlations between + # the four measurements. + v <- cor(x) + v.d <- diag(var(x)) + iv <- solve(v) + iv.d <- sqrt(diag(iv)) + iv <- - diag(1/iv.d) %*% iv %*% diag(1/iv.d) + q <- NULL + n <- nrow(v) + for (i in 1:(n-1)) + q <- rbind( q, c(v[i, 1:i], iv[i,(i+1):n]) ) + q <- rbind( q, v[n, ] ) + diag(q) <- round(diag(q)) + q + } + d <- data[i, ] + v <- pcorr(d) + c(v[1,], v[2,], v[3,], v[4,]) + } > frets.boot <- boot(log(as.matrix(frets)), frets.fun, R = 999) > # we will concentrate on the partial correlation between head breadth > # for the first son and head length for the second. This is the 7th > # element in the output of frets.fun so we set index = 7 > jack.after.boot(frets.boot, useJ = FALSE, stinf = FALSE, index = 7) > > > > cleanEx() > nameEx("k3.linear") > ### * k3.linear > > flush(stderr()); flush(stdout()) > > ### Name: k3.linear > ### Title: Linear Skewness Estimate > ### Aliases: k3.linear > ### Keywords: nonparametric > > ### ** Examples > > # To estimate the skewness of the ratio of means for the city data. > ratio <- function(d, w) sum(d$x * w)/sum(d$u * w) > k3.linear(empinf(data = city, statistic = ratio)) [1] 7.831452e-05 > > > > cleanEx() > nameEx("linear.approx") > ### * linear.approx > > flush(stderr()); flush(stdout()) > > ### Name: linear.approx > ### Title: Linear Approximation of Bootstrap Replicates > ### Aliases: linear.approx > ### Keywords: nonparametric > > ### ** Examples > > # Using the city data let us look at the linear approximation to the > # ratio statistic and its logarithm. We compare these with the > # corresponding plots for the bigcity data > > ratio <- function(d, w) sum(d$x * w)/sum(d$u * w) > city.boot <- boot(city, ratio, R = 499, stype = "w") > bigcity.boot <- boot(bigcity, ratio, R = 499, stype = "w") > op <- par(pty = "s", mfrow = c(2, 2)) > > # The first plot is for the city data ratio statistic. > city.lin1 <- linear.approx(city.boot) > lim <- range(c(city.boot$t,city.lin1)) > plot(city.boot$t, city.lin1, xlim = lim, ylim = lim, + main = "Ratio; n=10", xlab = "t*", ylab = "tL*") > abline(0, 1) > > # Now for the log of the ratio statistic for the city data. > city.lin2 <- linear.approx(city.boot,t0 = log(city.boot$t0), + t = log(city.boot$t)) > lim <- range(c(log(city.boot$t),city.lin2)) > plot(log(city.boot$t), city.lin2, xlim = lim, ylim = lim, + main = "Log(Ratio); n=10", xlab = "t*", ylab = "tL*") > abline(0, 1) > > # The ratio statistic for the bigcity data. > bigcity.lin1 <- linear.approx(bigcity.boot) > lim <- range(c(bigcity.boot$t,bigcity.lin1)) > plot(bigcity.lin1, bigcity.boot$t, xlim = lim, ylim = lim, + main = "Ratio; n=49", xlab = "t*", ylab = "tL*") > abline(0, 1) > > # Finally the log of the ratio statistic for the bigcity data. > bigcity.lin2 <- linear.approx(bigcity.boot,t0 = log(bigcity.boot$t0), + t = log(bigcity.boot$t)) > lim <- range(c(log(bigcity.boot$t),bigcity.lin2)) > plot(bigcity.lin2, log(bigcity.boot$t), xlim = lim, ylim = lim, + main = "Log(Ratio); n=49", xlab = "t*", ylab = "tL*") > abline(0, 1) > > par(op) > > > > graphics::par(get("par.postscript", pos = 'CheckExEnv')) > cleanEx() > nameEx("lines.saddle.distn") > ### * lines.saddle.distn > > flush(stderr()); flush(stdout()) > > ### Name: lines.saddle.distn > ### Title: Add a Saddlepoint Approximation to a Plot > ### Aliases: lines.saddle.distn > ### Keywords: aplot smooth nonparametric > > ### ** Examples > > # In this example we show how a plot such as that in Figure 9.9 of > # Davison and Hinkley (1997) may be produced. Note the large number of > # bootstrap replicates required in this example. > expdata <- rexp(12) > vfun <- function(d, i) { + n <- length(d) + (n-1)/n*var(d[i]) + } > exp.boot <- boot(expdata,vfun, R = 9999) > exp.L <- (expdata - mean(expdata))^2 - exp.boot$t0 > exp.tL <- linear.approx(exp.boot, L = exp.L) > hist(exp.tL, nclass = 50, probability = TRUE) > exp.t0 <- c(0, sqrt(var(exp.boot$t))) > exp.sp <- saddle.distn(A = exp.L/12,wdist = "m", t0 = exp.t0) > > # The saddlepoint approximation in this case is to the density of > # t-t0 and so t0 must be added for the plot. > lines(exp.sp, h = function(u, t0) u+t0, J = function(u, t0) 1, + t0 = exp.boot$t0) > > > > cleanEx() > nameEx("norm.ci") > ### * norm.ci > > flush(stderr()); flush(stdout()) > > ### Name: norm.ci > ### Title: Normal Approximation Confidence Intervals > ### Aliases: norm.ci > ### Keywords: htest > > ### ** Examples > > # In Example 5.1 of Davison and Hinkley (1997), normal approximation > # confidence intervals are found for the air-conditioning data. > air.mean <- mean(aircondit$hours) > air.n <- nrow(aircondit) > air.v <- air.mean^2/air.n > norm.ci(t0 = air.mean, var.t0 = air.v) conf [1,] 0.95 46.93055 169.2361 > exp(norm.ci(t0 = log(air.mean), var.t0 = 1/air.n)[2:3]) [1] 61.38157 190.31782 > > # Now a more complicated example - the ratio estimate for the city data. > ratio <- function(d, w) + sum(d$x * w)/sum(d$u *w) > city.v <- var.linear(empinf(data = city, statistic = ratio)) > norm.ci(t0 = ratio(city,rep(0.1,10)), var.t0 = city.v) conf [1,] 0.95 1.167046 1.873579 > > > > cleanEx() > nameEx("plot.boot") > ### * plot.boot > > flush(stderr()); flush(stdout()) > > ### Name: plot.boot > ### Title: Plots of the Output of a Bootstrap Simulation > ### Aliases: plot.boot > ### Keywords: hplot nonparametric > > ### ** Examples > > # We fit an exponential model to the air-conditioning data and use > # that for a parametric bootstrap. Then we look at plots of the > # resampled means. > air.rg <- function(data, mle) rexp(length(data), 1/mle) > > air.boot <- boot(aircondit$hours, mean, R = 999, sim = "parametric", + ran.gen = air.rg, mle = mean(aircondit$hours)) > plot(air.boot) > > # In the difference of means example for the last two series of the > # gravity data > grav1 <- gravity[as.numeric(gravity[, 2]) >= 7, ] > grav.fun <- function(dat, w) { + strata <- tapply(dat[, 2], as.numeric(dat[, 2])) + d <- dat[, 1] + ns <- tabulate(strata) + w <- w/tapply(w, strata, sum)[strata] + mns <- as.vector(tapply(d * w, strata, sum)) # drop names + mn2 <- tapply(d * d * w, strata, sum) + s2hat <- sum((mn2 - mns^2)/ns) + c(mns[2] - mns[1], s2hat) + } > > grav.boot <- boot(grav1, grav.fun, R = 499, stype = "w", strata = grav1[, 2]) > plot(grav.boot) > # now suppose we want to look at the studentized differences. > grav.z <- (grav.boot$t[, 1]-grav.boot$t0[1])/sqrt(grav.boot$t[, 2]) > plot(grav.boot, t = grav.z, t0 = 0) > > # In this example we look at the one of the partial correlations for the > # head dimensions in the dataset frets. > frets.fun <- function(data, i) { + pcorr <- function(x) { + # Function to find the correlations and partial correlations between + # the four measurements. + v <- cor(x) + v.d <- diag(var(x)) + iv <- solve(v) + iv.d <- sqrt(diag(iv)) + iv <- - diag(1/iv.d) %*% iv %*% diag(1/iv.d) + q <- NULL + n <- nrow(v) + for (i in 1:(n-1)) + q <- rbind( q, c(v[i, 1:i], iv[i,(i+1):n]) ) + q <- rbind( q, v[n, ] ) + diag(q) <- round(diag(q)) + q + } + d <- data[i, ] + v <- pcorr(d) + c(v[1,], v[2,], v[3,], v[4,]) + } > frets.boot <- boot(log(as.matrix(frets)), frets.fun, R = 999) > plot(frets.boot, index = 7, jack = TRUE, stinf = FALSE, useJ = FALSE) > > > > cleanEx() > nameEx("saddle") > ### * saddle > > flush(stderr()); flush(stdout()) > > ### Name: saddle > ### Title: Saddlepoint Approximations for Bootstrap Statistics > ### Aliases: saddle > ### Keywords: smooth nonparametric > > ### ** Examples > > # To evaluate the bootstrap distribution of the mean failure time of > # air-conditioning equipment at 80 hours > saddle(A = aircondit$hours/12, u = 80) $spa pdf cdf 0.01005866 0.24446677 $zeta.hat [1] -0.02580078 > > # Alternatively this can be done using a conditional poisson > saddle(A = cbind(aircondit$hours/12,1), u = c(80, 12), + wdist = "p", type = "cond") Warning in dpois(y, mu, log = TRUE) : non-integer x = 10.090909 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.909091 Warning in dpois(y, mu, log = TRUE) : non-integer x = 10.090909 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.909091 $spa pdf cdf 0.01005943 0.24438736 $zeta.hat A1 A2 -0.02580805 0.89261577 $zeta2.hat [1] 0.6931472 > > # To use the Lugananni-Rice approximation to this > saddle(A = cbind(aircondit$hours/12,1), u = c(80, 12), + wdist = "p", type = "cond", + LR = TRUE) Warning in dpois(y, mu, log = TRUE) : non-integer x = 10.090909 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.909091 Warning in dpois(y, mu, log = TRUE) : non-integer x = 10.090909 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.909091 $spa pdf cdf 0.01005943 0.24447362 $zeta.hat A1 A2 -0.02580805 0.89261577 $zeta2.hat [1] 0.6931472 > > # Example 9.16 of Davison and Hinkley (1997) calculates saddlepoint > # approximations to the distribution of the ratio statistic for the > # city data. Since the statistic is not in itself a linear combination > # of random Variables, its distribution cannot be found directly. > # Instead the statistic is expressed as the solution to a linear > # estimating equation and hence its distribution can be found. We > # get the saddlepoint approximation to the pdf and cdf evaluated at > # t = 1.25 as follows. > jacobian <- function(dat,t,zeta) + { + p <- exp(zeta*(dat$x-t*dat$u)) + abs(sum(dat$u*p)/sum(p)) + } > city.sp1 <- saddle(A = city$x-1.25*city$u, u = 0) > city.sp1$spa[1] <- jacobian(city, 1.25, city.sp1$zeta.hat) * city.sp1$spa[1] > city.sp1 $spa pdf cdf 0.05565040 0.02436306 $zeta.hat [1] -0.02435547 > > > > cleanEx() > nameEx("saddle.distn") > ### * saddle.distn > > flush(stderr()); flush(stdout()) > > ### Name: saddle.distn > ### Title: Saddlepoint Distribution Approximations for Bootstrap Statistics > ### Aliases: saddle.distn > ### Keywords: nonparametric smooth dplot > > ### ** Examples > > # The bootstrap distribution of the mean of the air-conditioning > # failure data: fails to find value on R (and probably on S too) > air.t0 <- c(mean(aircondit$hours), sqrt(var(aircondit$hours)/12)) > ## Not run: saddle.distn(A = aircondit$hours/12, t0 = air.t0) > > # alternatively using the conditional poisson > saddle.distn(A = cbind(aircondit$hours/12, 1), u = 12, wdist = "p", + type = "cond", t0 = air.t0) Warning in dpois(y, mu, log = TRUE) : non-integer x = 11.344718 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.655282 Warning in dpois(y, mu, log = TRUE) : non-integer x = 11.344718 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.655282 Warning in dpois(y, mu, log = TRUE) : non-integer x = 11.832240 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.167760 Warning in dpois(y, mu, log = TRUE) : non-integer x = 11.832240 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.167760 Warning in dpois(y, mu, log = TRUE) : non-integer x = 7.444538 Warning in dpois(y, mu, log = TRUE) : non-integer x = 4.555462 Warning in dpois(y, mu, log = TRUE) : non-integer x = 7.444538 Warning in dpois(y, mu, log = TRUE) : non-integer x = 4.555462 Warning in dpois(y, mu, log = TRUE) : non-integer x = 5.494449 Warning in dpois(y, mu, log = TRUE) : non-integer x = 6.505551 Warning in dpois(y, mu, log = TRUE) : non-integer x = 5.494449 Warning in dpois(y, mu, log = TRUE) : non-integer x = 6.505551 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.594269 Warning in dpois(y, mu, log = TRUE) : non-integer x = 10.405731 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.594269 Warning in dpois(y, mu, log = TRUE) : non-integer x = 10.405731 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.544359 Warning in dpois(y, mu, log = TRUE) : non-integer x = 8.455641 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.544359 Warning in dpois(y, mu, log = TRUE) : non-integer x = 8.455641 Warning in dpois(y, mu, log = TRUE) : non-integer x = 4.519404 Warning in dpois(y, mu, log = TRUE) : non-integer x = 7.480596 Warning in dpois(y, mu, log = TRUE) : non-integer x = 4.519404 Warning in dpois(y, mu, log = TRUE) : non-integer x = 7.480596 Warning in dpois(y, mu, log = TRUE) : non-integer x = 11.561394 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.438606 Warning in dpois(y, mu, log = TRUE) : non-integer x = 11.561394 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.438606 Warning in dpois(y, mu, log = TRUE) : non-integer x = 11.290549 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.709451 Warning in dpois(y, mu, log = TRUE) : non-integer x = 11.290549 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.709451 Warning in dpois(y, mu, log = TRUE) : non-integer x = 11.019703 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.980297 Warning in dpois(y, mu, log = TRUE) : non-integer x = 11.019703 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.980297 Warning in dpois(y, mu, log = TRUE) : non-integer x = 10.748857 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.251143 Warning in dpois(y, mu, log = TRUE) : non-integer x = 10.748857 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.251143 Warning in dpois(y, mu, log = TRUE) : non-integer x = 10.478011 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.521989 Warning in dpois(y, mu, log = TRUE) : non-integer x = 10.478011 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.521989 Warning in dpois(y, mu, log = TRUE) : non-integer x = 10.207165 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.792835 Warning in dpois(y, mu, log = TRUE) : non-integer x = 10.207165 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.792835 Warning in dpois(y, mu, log = TRUE) : non-integer x = 9.936320 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.063680 Warning in dpois(y, mu, log = TRUE) : non-integer x = 9.936320 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.063680 Warning in dpois(y, mu, log = TRUE) : non-integer x = 9.665474 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.334526 Warning in dpois(y, mu, log = TRUE) : non-integer x = 9.665474 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.334526 Warning in dpois(y, mu, log = TRUE) : non-integer x = 8.785225 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.214775 Warning in dpois(y, mu, log = TRUE) : non-integer x = 8.785225 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.214775 Warning in dpois(y, mu, log = TRUE) : non-integer x = 8.175822 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.824178 Warning in dpois(y, mu, log = TRUE) : non-integer x = 8.175822 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.824178 Warning in dpois(y, mu, log = TRUE) : non-integer x = 7.566419 Warning in dpois(y, mu, log = TRUE) : non-integer x = 4.433581 Warning in dpois(y, mu, log = TRUE) : non-integer x = 7.566419 Warning in dpois(y, mu, log = TRUE) : non-integer x = 4.433581 Warning in dpois(y, mu, log = TRUE) : non-integer x = 6.957016 Warning in dpois(y, mu, log = TRUE) : non-integer x = 5.042984 Warning in dpois(y, mu, log = TRUE) : non-integer x = 6.957016 Warning in dpois(y, mu, log = TRUE) : non-integer x = 5.042984 Warning in dpois(y, mu, log = TRUE) : non-integer x = 6.347613 Warning in dpois(y, mu, log = TRUE) : non-integer x = 5.652387 Warning in dpois(y, mu, log = TRUE) : non-integer x = 6.347613 Warning in dpois(y, mu, log = TRUE) : non-integer x = 5.652387 Warning in dpois(y, mu, log = TRUE) : non-integer x = 5.738210 Warning in dpois(y, mu, log = TRUE) : non-integer x = 6.261790 Warning in dpois(y, mu, log = TRUE) : non-integer x = 5.738210 Warning in dpois(y, mu, log = TRUE) : non-integer x = 6.261790 Warning in dpois(y, mu, log = TRUE) : non-integer x = 5.128807 Warning in dpois(y, mu, log = TRUE) : non-integer x = 6.871193 Warning in dpois(y, mu, log = TRUE) : non-integer x = 5.128807 Warning in dpois(y, mu, log = TRUE) : non-integer x = 6.871193 Saddlepoint Distribution Approximations Call : saddle.distn(A = cbind(aircondit$hours/12, 1), u = 12, wdist = "p", type = "cond", t0 = air.t0) Quantiles of the Distribution 0.1% 27.4 0.5% 35.4 1.0% 39.7 2.5% 46.7 5.0% 53.5 10.0% 62.5 20.0% 75.3 50.0% 104.5 80.0% 139.0 90.0% 158.8 95.0% 175.9 97.5% 191.2 99.0% 209.6 99.5% 222.4 99.9% 249.5 Smoothing spline used 20 points in the range 9.8 to 304.7. > > # Distribution of the ratio of a sample of size 10 from the bigcity > # data, taken from Example 9.16 of Davison and Hinkley (1997). > ratio <- function(d, w) sum(d$x *w)/sum(d$u * w) > city.v <- var.linear(empinf(data = city, statistic = ratio)) > bigcity.t0 <- c(mean(bigcity$x)/mean(bigcity$u), sqrt(city.v)) > Afn <- function(t, data) cbind(data$x - t*data$u, 1) > ufn <- function(t, data) c(0,10) > saddle.distn(A = Afn, u = ufn, wdist = "b", type = "cond", + t0 = bigcity.t0, data = bigcity) Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Warning in eval(family$initialize) : non-integer counts in a binomial glm! Saddlepoint Distribution Approximations Call : saddle.distn(A = Afn, u = ufn, wdist = "b", type = "cond", t0 = bigcity.t0, data = bigcity) Quantiles of the Distribution 0.1% 1.070 0.5% 1.092 1.0% 1.104 2.5% 1.122 5.0% 1.139 10.0% 1.158 20.0% 1.184 50.0% 1.237 80.0% 1.304 90.0% 1.348 95.0% 1.392 97.5% 1.436 99.0% 1.494 99.5% 1.537 99.9% 1.636 Smoothing spline used 20 points in the range 1.014 to 1.96. > > # From Example 9.16 of Davison and Hinkley (1997) again, we find the > # conditional distribution of the ratio given the sum of city$u. > Afn <- function(t, data) cbind(data$x-t*data$u, data$u, 1) > ufn <- function(t, data) c(0, sum(data$u), 10) > city.t0 <- c(mean(city$x)/mean(city$u), sqrt(city.v)) > saddle.distn(A = Afn, u = ufn, wdist = "p", type = "cond", t0 = city.t0, + data = city) Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.866400 Warning in dpois(y, mu, log = TRUE) : non-integer x = 8.511350 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.622251 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.866400 Warning in dpois(y, mu, log = TRUE) : non-integer x = 8.511350 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.622251 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.210844 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.107208 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.681949 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.210844 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.107208 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.681949 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.038622 Warning in dpois(y, mu, log = TRUE) : non-integer x = 5.809279 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.152100 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.038622 Warning in dpois(y, mu, log = TRUE) : non-integer x = 5.809279 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.152100 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.452511 Warning in dpois(y, mu, log = TRUE) : non-integer x = 7.160314 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.387175 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.452511 Warning in dpois(y, mu, log = TRUE) : non-integer x = 7.160314 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.387175 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.159455 Warning in dpois(y, mu, log = TRUE) : non-integer x = 7.835832 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.004713 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.159455 Warning in dpois(y, mu, log = TRUE) : non-integer x = 7.835832 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.004713 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.155629 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.115412 Warning in dpois(y, mu, log = TRUE) : non-integer x = 6.728960 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.155629 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.115412 Warning in dpois(y, mu, log = TRUE) : non-integer x = 6.728960 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.205022 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.133273 Warning in dpois(y, mu, log = TRUE) : non-integer x = 7.661705 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.205022 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.133273 Warning in dpois(y, mu, log = TRUE) : non-integer x = 7.661705 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.722845 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.033105 Warning in dpois(y, mu, log = TRUE) : non-integer x = 7.244049 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.722845 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.033105 Warning in dpois(y, mu, log = TRUE) : non-integer x = 7.244049 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.787431 Warning in dpois(y, mu, log = TRUE) : non-integer x = 6.388294 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.824275 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.787431 Warning in dpois(y, mu, log = TRUE) : non-integer x = 6.388294 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.824275 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.415407 Warning in dpois(y, mu, log = TRUE) : non-integer x = 4.940756 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.643837 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.415407 Warning in dpois(y, mu, log = TRUE) : non-integer x = 4.940756 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.643837 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.043383 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.493218 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.463399 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.043383 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.493218 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.463399 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.671359 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.045680 Warning in dpois(y, mu, log = TRUE) : non-integer x = 4.282961 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.671359 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.045680 Warning in dpois(y, mu, log = TRUE) : non-integer x = 4.282961 Warning in dpois(y, mu, log = TRUE) : non-integer x = 4.299336 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.598142 Warning in dpois(y, mu, log = TRUE) : non-integer x = 5.102523 Warning in dpois(y, mu, log = TRUE) : non-integer x = 4.299336 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.598142 Warning in dpois(y, mu, log = TRUE) : non-integer x = 5.102523 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.433935 Warning in dpois(y, mu, log = TRUE) : non-integer x = 4.409277 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.156788 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.433935 Warning in dpois(y, mu, log = TRUE) : non-integer x = 4.409277 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.156788 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.360158 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.271008 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.368834 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.360158 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.271008 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.368834 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.319252 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.639889 Warning in dpois(y, mu, log = TRUE) : non-integer x = 4.040859 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.319252 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.639889 Warning in dpois(y, mu, log = TRUE) : non-integer x = 4.040859 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.278346 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.008770 Warning in dpois(y, mu, log = TRUE) : non-integer x = 4.712884 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.278346 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.008770 Warning in dpois(y, mu, log = TRUE) : non-integer x = 4.712884 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.237440 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.377650 Warning in dpois(y, mu, log = TRUE) : non-integer x = 5.384909 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.237440 Warning in dpois(y, mu, log = TRUE) : non-integer x = 1.377650 Warning in dpois(y, mu, log = TRUE) : non-integer x = 5.384909 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.196534 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.746531 Warning in dpois(y, mu, log = TRUE) : non-integer x = 6.056935 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.196534 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.746531 Warning in dpois(y, mu, log = TRUE) : non-integer x = 6.056935 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.155629 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.115412 Warning in dpois(y, mu, log = TRUE) : non-integer x = 6.728960 Warning in dpois(y, mu, log = TRUE) : non-integer x = 3.155629 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.115412 Warning in dpois(y, mu, log = TRUE) : non-integer x = 6.728960 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.734728 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.299661 Warning in dpois(y, mu, log = TRUE) : non-integer x = 6.965612 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.734728 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.299661 Warning in dpois(y, mu, log = TRUE) : non-integer x = 6.965612 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.228786 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.666383 Warning in dpois(y, mu, log = TRUE) : non-integer x = 7.104831 Warning in dpois(y, mu, log = TRUE) : non-integer x = 2.228786 Warning in dpois(y, mu, log = TRUE) : non-integer x = 0.666383 Warning in dpois(y, mu, log = TRUE) : non-integer x = 7.104831 Saddlepoint Distribution Approximations Call : saddle.distn(A = Afn, u = ufn, wdist = "p", type = "cond", t0 = city.t0, data = city) Quantiles of the Distribution 0.1% 1.216 0.5% 1.236 1.0% 1.248 2.5% 1.272 5.0% 1.301 10.0% 1.340 20.0% 1.393 50.0% 1.502 80.0% 1.618 90.0% 1.680 95.0% 1.732 97.5% 1.777 99.0% 1.830 99.5% 1.866 99.9% 1.938 Smoothing spline used 20 points in the range 1.182 to 2.061. > > > > cleanEx() > nameEx("simplex") > ### * simplex > > flush(stderr()); flush(stdout()) > > ### Name: simplex > ### Title: Simplex Method for Linear Programming Problems > ### Aliases: simplex > ### Keywords: optimize > > ### ** Examples > > # This example is taken from Exercise 7.5 of Gill, Murray and Wright (1991). > enj <- c(200, 6000, 3000, -200) > fat <- c(800, 6000, 1000, 400) > vitx <- c(50, 3, 150, 100) > vity <- c(10, 10, 75, 100) > vitz <- c(150, 35, 75, 5) > simplex(a = enj, A1 = fat, b1 = 13800, A2 = rbind(vitx, vity, vitz), + b2 = c(600, 300, 550), maxi = TRUE) Linear Programming Results Call : simplex(a = enj, A1 = fat, b1 = 13800, A2 = rbind(vitx, vity, vitz), b2 = c(600, 300, 550), maxi = TRUE) Maximization Problem with Objective Function Coefficients x1 x2 x3 x4 200 6000 3000 -200 Optimal solution has the following values x1 x2 x3 x4 0.0 0.0 13.8 0.0 The optimal value of the objective function is 41400. > > > > cleanEx() > nameEx("smooth.f") > ### * smooth.f > > flush(stderr()); flush(stdout()) > > ### Name: smooth.f > ### Title: Smooth Distributions on Data Points > ### Aliases: smooth.f > ### Keywords: smooth nonparametric > > ### ** Examples > > # Example 9.8 of Davison and Hinkley (1997) requires tilting the resampling > # distribution of the studentized statistic to be centred at the observed > # value of the test statistic 1.84. In the book exponential tilting was used > # but it is also possible to use smooth.f. > grav1 <- gravity[as.numeric(gravity[, 2]) >= 7, ] > grav.fun <- function(dat, w, orig) { + strata <- tapply(dat[, 2], as.numeric(dat[, 2])) + d <- dat[, 1] + ns <- tabulate(strata) + w <- w/tapply(w, strata, sum)[strata] + mns <- as.vector(tapply(d * w, strata, sum)) # drop names + mn2 <- tapply(d * d * w, strata, sum) + s2hat <- sum((mn2 - mns^2)/ns) + c(mns[2] - mns[1], s2hat, (mns[2]-mns[1]-orig)/sqrt(s2hat)) + } > grav.z0 <- grav.fun(grav1, rep(1, 26), 0) > grav.boot <- boot(grav1, grav.fun, R = 499, stype = "w", + strata = grav1[, 2], orig = grav.z0[1]) > grav.sm <- smooth.f(grav.z0[3], grav.boot, index = 3) > > # Now we can run another bootstrap using these weights > grav.boot2 <- boot(grav1, grav.fun, R = 499, stype = "w", + strata = grav1[, 2], orig = grav.z0[1], + weights = grav.sm) > > # Estimated p-values can be found from these as follows > mean(grav.boot$t[, 3] >= grav.z0[3]) [1] 0.0240481 > imp.prob(grav.boot2, t0 = -grav.z0[3], t = -grav.boot2$t[, 3]) $t0 [1] -1.840118 $raw [1] 0.02254379 $rat [1] 0.02409135 $reg [1] 0.02224027 > > > # Note that for the importance sampling probability we must > # multiply everything by -1 to ensure that we find the correct > # probability. Raw resampling is not reliable for probabilities > # greater than 0.5. Thus > 1 - imp.prob(grav.boot2, index = 3, t0 = grav.z0[3])$raw [1] 0.08678105 > # can give very strange results (negative probabilities). > > > > cleanEx() > nameEx("tilt.boot") > ### * tilt.boot > > flush(stderr()); flush(stdout()) > > ### Name: tilt.boot > ### Title: Non-parametric Tilted Bootstrap > ### Aliases: tilt.boot > ### Keywords: nonparametric > > ### ** Examples > > # Note that these examples can take a while to run. > > # Example 9.9 of Davison and Hinkley (1997). > grav1 <- gravity[as.numeric(gravity[,2]) >= 7, ] > grav.fun <- function(dat, w, orig) { + strata <- tapply(dat[, 2], as.numeric(dat[, 2])) + d <- dat[, 1] + ns <- tabulate(strata) + w <- w/tapply(w, strata, sum)[strata] + mns <- as.vector(tapply(d * w, strata, sum)) # drop names + mn2 <- tapply(d * d * w, strata, sum) + s2hat <- sum((mn2 - mns^2)/ns) + c(mns[2]-mns[1],s2hat,(mns[2]-mns[1]-orig)/sqrt(s2hat)) + } > grav.z0 <- grav.fun(grav1, rep(1, 26), 0) > tilt.boot(grav1, grav.fun, R = c(249, 375, 375), stype = "w", + strata = grav1[,2], tilt = TRUE, index = 3, orig = grav.z0[1]) TILTED BOOTSTRAP Exponential tilting used First 249 replicates untilted, Next 375 replicates tilted to -2.648, Next 375 replicates tilted to 1.879. Call: tilt.boot(data = grav1, statistic = grav.fun, R = c(249, 375, 375), stype = "w", strata = grav1[, 2], tilt = TRUE, index = 3, orig = grav.z0[1]) Bootstrap Statistics : original bias std. error t1* 2.846154 -0.2728113 2.513218 t2* 2.392353 -0.2450416 1.187570 t3* 0.000000 -0.7305799 2.152173 > > > # Example 9.10 of Davison and Hinkley (1997) requires a balanced > # importance resampling bootstrap to be run. In this example we > # show how this might be run. > acme.fun <- function(data, i, bhat) { + d <- data[i,] + n <- nrow(d) + d.lm <- glm(d$acme~d$market) + beta.b <- coef(d.lm)[2] + d.diag <- boot::glm.diag(d.lm) + SSx <- (n-1)*var(d$market) + tmp <- (d$market-mean(d$market))*d.diag$res*d.diag$sd + sr <- sqrt(sum(tmp^2))/SSx + c(beta.b, sr, (beta.b-bhat)/sr) + } > acme.b <- acme.fun(acme, 1:nrow(acme), 0) > acme.boot1 <- tilt.boot(acme, acme.fun, R = c(499, 250, 250), + stype = "i", sim = "balanced", alpha = c(0.05, 0.95), + tilt = TRUE, index = 3, bhat = acme.b[1]) > > > > cleanEx() > nameEx("tsboot") > ### * tsboot > > flush(stderr()); flush(stdout()) > > ### Name: tsboot > ### Title: Bootstrapping of Time Series > ### Aliases: tsboot ts.return > ### Keywords: nonparametric ts > > ### ** Examples > > lynx.fun <- function(tsb) { + ar.fit <- ar(tsb, order.max = 25) + c(ar.fit$order, mean(tsb), tsb) + } > > # the stationary bootstrap with mean block length 20 > lynx.1 <- tsboot(log(lynx), lynx.fun, R = 99, l = 20, sim = "geom") > > # the fixed block bootstrap with length 20 > lynx.2 <- tsboot(log(lynx), lynx.fun, R = 99, l = 20, sim = "fixed") > > # Now for model based resampling we need the original model > # Note that for all of the bootstraps which use the residuals as their > # data, we set orig.t to FALSE since the function applied to the residual > # time series will be meaningless. > lynx.ar <- ar(log(lynx)) > lynx.model <- list(order = c(lynx.ar$order, 0, 0), ar = lynx.ar$ar) > lynx.res <- lynx.ar$resid[!is.na(lynx.ar$resid)] > lynx.res <- lynx.res - mean(lynx.res) > > lynx.sim <- function(res,n.sim, ran.args) { + # random generation of replicate series using arima.sim + rg1 <- function(n, res) sample(res, n, replace = TRUE) + ts.orig <- ran.args$ts + ts.mod <- ran.args$model + mean(ts.orig)+ts(arima.sim(model = ts.mod, n = n.sim, + rand.gen = rg1, res = as.vector(res))) + } > > lynx.3 <- tsboot(lynx.res, lynx.fun, R = 99, sim = "model", n.sim = 114, + orig.t = FALSE, ran.gen = lynx.sim, + ran.args = list(ts = log(lynx), model = lynx.model)) > > # For "post-blackening" we need to define another function > lynx.black <- function(res, n.sim, ran.args) { + ts.orig <- ran.args$ts + ts.mod <- ran.args$model + mean(ts.orig) + ts(arima.sim(model = ts.mod,n = n.sim,innov = res)) + } > > # Now we can run apply the two types of block resampling again but this > # time applying post-blackening. > lynx.1b <- tsboot(lynx.res, lynx.fun, R = 99, l = 20, sim = "fixed", + n.sim = 114, orig.t = FALSE, ran.gen = lynx.black, + ran.args = list(ts = log(lynx), model = lynx.model)) > > lynx.2b <- tsboot(lynx.res, lynx.fun, R = 99, l = 20, sim = "geom", + n.sim = 114, orig.t = FALSE, ran.gen = lynx.black, + ran.args = list(ts = log(lynx), model = lynx.model)) > > # To compare the observed order of the bootstrap replicates we > # proceed as follows. > table(lynx.1$t[, 1]) 2 3 4 5 6 7 8 10 11 13 14 16 21 41 4 3 5 3 1 3 1 1 > table(lynx.1b$t[, 1]) 2 3 4 5 6 7 9 10 11 12 13 15 16 2 5 24 3 2 8 2 3 38 8 2 1 1 > table(lynx.2$t[, 1]) 2 3 4 5 6 7 9 11 12 13 15 17 24 18 20 41 3 4 1 1 4 1 3 1 1 1 > table(lynx.2b$t[, 1]) 2 3 4 5 6 7 8 10 11 12 14 15 1 3 31 7 1 6 4 3 35 4 3 1 > table(lynx.3$t[, 1]) 2 3 4 5 6 7 8 9 10 11 12 13 14 16 4 2 11 1 3 6 3 2 2 50 7 6 1 1 > # Notice that the post-blackened and model-based bootstraps preserve > # the true order of the model (11) in many more cases than the others. > > > > cleanEx() > nameEx("var.linear") > ### * var.linear > > flush(stderr()); flush(stdout()) > > ### Name: var.linear > ### Title: Linear Variance Estimate > ### Aliases: var.linear > ### Keywords: nonparametric > > ### ** Examples > > # To estimate the variance of the ratio of means for the city data. > ratio <- function(d,w) sum(d$x * w)/sum(d$u * w) > var.linear(empinf(data = city, statistic = ratio)) [1] 0.03248701 > > > > ### *