R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 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. 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 a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("exactLoglinTest-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('exactLoglinTest') > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "czech.dat" > > ### * czech.dat > > flush(stderr()); flush(stdout()) > > ### Name: czech.dat > ### Title: Czech auto workers data > ### Aliases: czech.dat > ### Keywords: datasets > > ### ** Examples > > data(czech.dat) > > > > cleanEx(); ..nameEx <- "gof" > > ### * gof > > flush(stderr()); flush(stdout()) > > ### Name: gof > ### Title: Goodness-of-fit function for Poisson log-linear models > ### Aliases: gof > ### Keywords: htest > > ### ** Examples > > #data(residence) > #get fitted values > #mu <- glm(residence$y ~ residence$x, family = poisson)$fit > #gof(residence$y, mu) > #gof(rowlabels = TRUE) > > > > cleanEx(); ..nameEx <- "hyper" > > ### * hyper > > flush(stderr()); flush(stdout()) > > ### Name: hyper > ### Title: Generalized hypergeometric distribution on the log scale > ### Aliases: hyper > ### Keywords: htest > > ### ** Examples > > > > > cleanEx(); ..nameEx <- "mcexact" > > ### * mcexact > > flush(stderr()); flush(stdout()) > > ### Name: mcexact > ### Title: Computes Monte Carlo exact P-values for general log-linear > ### models. > ### Aliases: mcexact build.mcx.obj > ### Keywords: htest > > ### ** Examples > > #library(mcexact) > set.seed(1) > > #importance sampling > data(residence.dat) > mcx <- mcexact(y ~ res.1985 + res.1980 + factor(sym.pair), data = residence.dat) > summary(mcx) Number of iterations = 999 T degrees of freedom = 3 Number of counts = 16 df = 3 Next update has nosim = 1000 Next update has maxiter = 1000 Proportion of valid tables = 0.999 deviance Pearson observed.stat 2.98596233 2.98198696 pvalue 0.39860742 0.39730277 mcse 0.01157211 0.01156110 > > #mcmc > data(pathologist.dat) > mcx <- mcexact(y ~ factor(A) + factor(B) + I(A * B), + data = pathologist.dat, + method = "cab", + p = .5, + nosim = 10 ^ 4, + batchsize = 100) > summary(mcx) Number of iterations = 10000 T degrees of freedom = 3 Number of counts = 25 df = 15 Number of batches = 100 Batchsize = 100 Next update has nosim = 10000 Proportion of valid tables = 0.7361 deviance Pearson observed.stat 16.21453493 14.72927892 pvalue 0.06490000 0.16140000 mcse 0.01013558 0.01469899 > > > > cleanEx(); ..nameEx <- "mcexact.utils" > > ### * mcexact.utils > > flush(stderr()); flush(stdout()) > > ### Name: mcexact.internals > ### Title: Internal functions for mcexact > ### Aliases: errorcheck rounded.tprob > ### Keywords: htest > > ### ** Examples > > > > > cleanEx(); ..nameEx <- "print.mcexact" > > ### * print.mcexact > > flush(stderr()); flush(stdout()) > > ### Name: print.mcexact > ### Title: Print utilities for mcexact > ### Aliases: print.bab print.cab summary.bab summary.cab > ### Keywords: htest > > ### ** Examples > > #data(residence) > #resid.mcx <- mcexact(residence$y ~ residence$x, nosim = 10 ^ 2, maxiter = 10 ^ 4) > #resid.mcx #calls print.bab > #print(resid.mcx) #calls print.bab > #summary(resid.mcx) #calls summary.bab > > > > cleanEx(); ..nameEx <- "simulate.conditional" > > ### * simulate.conditional > > flush(stderr()); flush(stdout()) > > ### Name: simulate.conditional > ### Title: Simulates from the conditional distribution of a log-linear > ### model > ### Aliases: simulate.conditional simtable.bab simtable.cab > ### Keywords: htest > > ### ** Examples > > data(czech.dat) > chain2 <- simulate.conditional(y ~ (A + B + C + D + E + F) ^ 2, + data = czech.dat, + method = "cab", + nosim = 10 ^ 3, + p = .4, + dens = function(y) 0) > > > > cleanEx(); ..nameEx <- "titanic.dat" > > ### * titanic.dat > > flush(stderr()); flush(stdout()) > > ### Name: titanic.dat > ### Title: Titanic Survival Data > ### Aliases: titanic.dat > ### Keywords: datasets > > ### ** Examples > > data(titanic.dat) > > > > cleanEx(); ..nameEx <- "update.bab" > > ### * update.bab > > flush(stderr()); flush(stdout()) > > ### Name: update.bab > ### Title: Update method for objects of class bab > ### Aliases: update.bab bab > ### Keywords: htest > > ### ** Examples > > data(residence.dat) > mcx <- mcexact(y ~ res.1985 + res.1980 + factor(sym.pair), data = residence.dat) > summary(mcx) Number of iterations = 999 T degrees of freedom = 3 Number of counts = 16 df = 3 Next update has nosim = 1000 Next update has maxiter = 1000 Proportion of valid tables = 0.999 deviance Pearson observed.stat 2.98596233 2.98198696 pvalue 0.39860742 0.39730277 mcse 0.01157211 0.01156110 > mcx <- update(mcx, nosim = 10 ^ 4, maxiter = 10 ^ 6) > summary(mcx) Number of iterations = 10999 T degrees of freedom = 3 Number of counts = 16 df = 3 Next update has nosim = 10000 Next update has maxiter = 1e+06 Proportion of valid tables = 1 deviance Pearson observed.stat 2.985962330 2.981986964 pvalue 0.397957288 0.397544994 mcse 0.003450774 0.003449621 > > > > cleanEx(); ..nameEx <- "update.cab" > > ### * update.cab > > flush(stderr()); flush(stdout()) > > ### Name: update.cab > ### Title: Update method for objects of class cab > ### Aliases: update.cab cab > ### Keywords: htest > > ### ** Examples > > data(residence.dat) > mcx <- mcexact(y ~ res.1985 + res.1980 + factor(sym.pair), + data = residence.dat, + method = "cab", + p = .5, + batchsize = 100) > summary(mcx) Number of iterations = 1000 T degrees of freedom = 3 Number of counts = 16 df = 3 Number of batches = 10 Batchsize = 100 Next update has nosim = 1000 Proportion of valid tables = 0.999 deviance Pearson observed.stat 2.98596233 2.98198696 pvalue 0.37200000 0.37200000 mcse 0.01864403 0.01864403 > mcx <- update(mcx, nosim = 10 ^ 4) > summary(mcx) Number of iterations = 11000 T degrees of freedom = 3 Number of counts = 16 df = 3 Number of batches = 110 Batchsize = 100 Next update has nosim = 10000 Proportion of valid tables = 0.9989 deviance Pearson observed.stat 2.98596233 2.981986964 pvalue 0.38654545 0.386181818 mcse 0.00791738 0.007845599 > > > > ### *