update.cab: Update method for objects of class cab

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/update.cab.R

Description

An update method for objects created by mcexact when method = 'cab'.

Usage

1
2
3
4
5
6
7
8
## S3 method for class 'cab'
update(object, ...)
cab(args,
    nosim = NULL,
    batchsize = NULL,
    savechain = FALSE,
    p = NULL,
    flush = FALSE)

Arguments

object

Output from mcexact

...

Alternative arguments for the update

args

Output from mcexact

nosim

The number of simulations to be performed in the update

batchsize

A new batchsize

savechain

Saves the chain of goodness-of-fit statistics

p

An updated proportion of simulated tables left fixed.

flush

Should the previous information be discarded? flush should be set to true if the batchsize is changed.

Details

The method update.cab calls the function cab, which is the engine for mcexact when method = 'cab'.

Value

A list of the form outputted from mcexact

Author(s)

Brian S. Caffo

See Also

mcexact

Examples

1
2
3
4
5
6
7
8
9
data(residence.dat)
mcx <- mcexact(y ~ res.1985 + res.1980 + factor(sym.pair),
               data = residence.dat,
               method = "cab",
               p = .5,
               batchsize = 100) 
summary(mcx)
mcx <- update(mcx, nosim = 10 ^ 4)
summary(mcx)

Example output

$conde1
      15       14       10 
294.8800 166.8939 238.3175 

$condv1
                              
  56.78443 -39.34468  36.79749
 -39.34468  51.14382 -39.59345
  36.79749 -39.59345  59.74533

$dens
function (y) 
sum(-lgamma(y + 1))
<environment: namespace:exactLoglinTest>

$dobs
[1] 2.985962 2.981987

$mu.hat
         15          14          10          16          13          12 
  294.87999   166.89392   238.31746 10192.00000    63.22609   261.12001 
         11           9           8           7           6           5 
17819.00000   167.56253   311.10608   501.68254 13677.00000    91.21138 
          4           3           2           1 
  123.77391   370.43747    95.78862 11607.00000 

$n
[1] 16

$n1
[1] 3

$nosim
[1] 1000

$s
                   [,1]
(Intercept)       55981
res.1985NE        11929
res.1985S         18986
res.1985W         10888
res.1980NE        12197
res.1980S         18486
res.1980W         10717
factor(sym.pair)2   187
factor(sym.pair)3   538
factor(sym.pair)4   187
factor(sym.pair)5 13677
factor(sym.pair)6   740
factor(sym.pair)8 17819

$stat
function (y = NULL, mu = NULL, rowlabels = FALSE) 
{
    if (rowlabels) 
        c("deviance", "Pearson")
    else {
        temp <- y != 0
        c(2 * sum(y[temp] * log(y[temp]/mu[temp])), sum((y - 
            mu)^2/mu))
    }
}
<environment: namespace:exactLoglinTest>

$tdf
[1] 3

$x
   (Intercept) res.1985NE res.1985S res.1985W res.1980NE res.1980S res.1980W
15           1          0         1         0          0         0         1
14           1          0         0         0          0         0         1
10           1          0         0         0          0         1         0
16           1          0         0         1          0         0         1
13           1          1         0         0          0         0         1
12           1          0         0         1          0         1         0
11           1          0         1         0          0         1         0
9            1          1         0         0          0         1         0
8            1          0         0         1          0         0         0
7            1          0         1         0          0         0         0
6            1          0         0         0          0         0         0
5            1          1         0         0          0         0         0
4            1          0         0         1          1         0         0
3            1          0         1         0          1         0         0
2            1          0         0         0          1         0         0
1            1          1         0         0          1         0         0
   factor(sym.pair)2 factor(sym.pair)3 factor(sym.pair)4 factor(sym.pair)5
15                 0                 0                 0                 0
14                 0                 0                 0                 0
10                 0                 0                 0                 0
16                 0                 0                 0                 0
13                 0                 0                 1                 0
12                 0                 0                 0                 0
11                 0                 0                 0                 0
9                  0                 1                 0                 0
8                  0                 0                 0                 0
7                  0                 0                 0                 0
6                  0                 0                 0                 1
5                  1                 0                 0                 0
4                  0                 0                 1                 0
3                  0                 1                 0                 0
2                  1                 0                 0                 0
1                  0                 0                 0                 0
   factor(sym.pair)6 factor(sym.pair)8
15                 0                 0
14                 0                 0
10                 1                 0
16                 0                 0
13                 0                 0
12                 0                 0
11                 0                 1
9                  0                 0
8                  0                 0
7                  1                 0
6                  0                 0
5                  0                 0
4                  0                 0
3                  0                 0
2                  0                 0
1                  0                 0

$x1
   (Intercept) res.1985NE res.1985S res.1985W res.1980NE res.1980S res.1980W
15           1          0         1         0          0         0         1
14           1          0         0         0          0         0         1
10           1          0         0         0          0         1         0
   factor(sym.pair)2 factor(sym.pair)3 factor(sym.pair)4 factor(sym.pair)5
15                 0                 0                 0                 0
14                 0                 0                 0                 0
10                 0                 0                 0                 0
   factor(sym.pair)6 factor(sym.pair)8
15                 0                 0
14                 0                 0
10                 1                 0

$x2invt
   (Intercept) res.1985NE res.1985S res.1985W res.1980NE res.1980S res.1980W
16          -1        0.5         0         1        0.5         0         1
13           1       -0.5         0        -1       -0.5         0         0
12           0        0.0         1         0        0.0         1         0
11           0        0.0         0         0        0.0         0         0
9            0        0.0        -1         0        0.0         0         0
8            2       -1.0        -1        -1       -1.0        -1        -1
7            0        0.0         0         0        0.0         0         0
6            0        0.0         0         0        0.0         0         0
5           -1        1.0         1         1        0.0         0         0
4           -1        0.5         0         1        0.5         0         0
3            0        0.0         1         0        0.0         0         0
2            1       -1.0        -1        -1        0.0         0         0
1            0        0.5         0         0        0.5         0         0
   factor(sym.pair)2 factor(sym.pair)3 factor(sym.pair)4 factor(sym.pair)5
16               0.5               0.5              -0.5                 1
13              -0.5              -0.5               0.5                -1
12               0.0              -1.0               0.0                 0
11               0.0               0.0               0.0                 0
9                0.0               1.0               0.0                 0
8               -1.0               0.0               0.0                -2
7                0.0               0.0               0.0                 0
6                0.0               0.0               0.0                 1
5                1.0               0.0               0.0                 1
4                0.5               0.5               0.5                 1
3                0.0               0.0               0.0                 0
2                0.0               0.0               0.0                -1
1               -0.5              -0.5              -0.5                 0
   factor(sym.pair)6 factor(sym.pair)8
16                 1                 1
13                -1                -1
12                -1                -2
11                 0                 1
9                  1                 1
8                 -1                 0
7                  1                 0
6                  0                 0
5                  0                 0
4                  1                 1
3                 -1                -1
2                  0                 0
1                  0                 0

$y
   15    14    10    16    13    12    11     9     8     7     6     5     4 
  286   176   225 10192    63   270 17819   172   302   515 13677    87   124 
    3     2     1 
  366   100 11607 

$ord
 [1] 15 14 10 16 13 12 11  9  8  7  6  5  4  3  2  1

$glm.fit

Call:  glm(formula = formula, family = poisson, data = data, x = TRUE, 
    y = TRUE)

Coefficients:
       (Intercept)          res.1985NE           res.1985S           res.1985W  
            1.6281              3.8411              0.5692              4.1120  
        res.1980NE           res.1980S           res.1980W   factor(sym.pair)2  
            3.8901             -0.1752              3.4892             -0.9561  
 factor(sym.pair)3   factor(sym.pair)4   factor(sym.pair)5   factor(sym.pair)6  
           -0.1728             -4.8118              7.8953              4.0206  
 factor(sym.pair)7   factor(sym.pair)8   factor(sym.pair)9  factor(sym.pair)10  
                NA              7.7658                  NA                  NA  

Degrees of Freedom: 15 Total (i.e. Null);  3 Residual
Null Deviance:	    131000 
Residual Deviance: 2.986 	AIC: 159.2

$p
[1] 0.5

$batchsize
[1] 100

$startiter
[1] 1001

$mhap
[1] 529

$current.batchmean
[1] 1 1

$bmsq
[1] 2.0717 2.0584

$nobatches
[1] 10

$phat
[1] 0.440 0.439

$mcse
[1] 0.03683748 0.03622016

$y1.start
[1] 289 182 228

$perpos
[1] 0.996

attr(,"class")
[1] "cabSummary"
$conde1
      15       14       10 
294.8800 166.8939 238.3175 

$condv1
                              
  56.78443 -39.34468  36.79749
 -39.34468  51.14382 -39.59345
  36.79749 -39.59345  59.74533

$dens
function (y) 
sum(-lgamma(y + 1))
<environment: namespace:exactLoglinTest>

$dobs
[1] 2.985962 2.981987

$mu.hat
         15          14          10          16          13          12 
  294.87999   166.89392   238.31746 10192.00000    63.22609   261.12001 
         11           9           8           7           6           5 
17819.00000   167.56253   311.10608   501.68254 13677.00000    91.21138 
          4           3           2           1 
  123.77391   370.43747    95.78862 11607.00000 

$n
[1] 16

$n1
[1] 3

$nosim
[1] 10000

$s
                   [,1]
(Intercept)       55981
res.1985NE        11929
res.1985S         18986
res.1985W         10888
res.1980NE        12197
res.1980S         18486
res.1980W         10717
factor(sym.pair)2   187
factor(sym.pair)3   538
factor(sym.pair)4   187
factor(sym.pair)5 13677
factor(sym.pair)6   740
factor(sym.pair)8 17819

$stat
function (y = NULL, mu = NULL, rowlabels = FALSE) 
{
    if (rowlabels) 
        c("deviance", "Pearson")
    else {
        temp <- y != 0
        c(2 * sum(y[temp] * log(y[temp]/mu[temp])), sum((y - 
            mu)^2/mu))
    }
}
<environment: namespace:exactLoglinTest>

$tdf
[1] 3

$x
   (Intercept) res.1985NE res.1985S res.1985W res.1980NE res.1980S res.1980W
15           1          0         1         0          0         0         1
14           1          0         0         0          0         0         1
10           1          0         0         0          0         1         0
16           1          0         0         1          0         0         1
13           1          1         0         0          0         0         1
12           1          0         0         1          0         1         0
11           1          0         1         0          0         1         0
9            1          1         0         0          0         1         0
8            1          0         0         1          0         0         0
7            1          0         1         0          0         0         0
6            1          0         0         0          0         0         0
5            1          1         0         0          0         0         0
4            1          0         0         1          1         0         0
3            1          0         1         0          1         0         0
2            1          0         0         0          1         0         0
1            1          1         0         0          1         0         0
   factor(sym.pair)2 factor(sym.pair)3 factor(sym.pair)4 factor(sym.pair)5
15                 0                 0                 0                 0
14                 0                 0                 0                 0
10                 0                 0                 0                 0
16                 0                 0                 0                 0
13                 0                 0                 1                 0
12                 0                 0                 0                 0
11                 0                 0                 0                 0
9                  0                 1                 0                 0
8                  0                 0                 0                 0
7                  0                 0                 0                 0
6                  0                 0                 0                 1
5                  1                 0                 0                 0
4                  0                 0                 1                 0
3                  0                 1                 0                 0
2                  1                 0                 0                 0
1                  0                 0                 0                 0
   factor(sym.pair)6 factor(sym.pair)8
15                 0                 0
14                 0                 0
10                 1                 0
16                 0                 0
13                 0                 0
12                 0                 0
11                 0                 1
9                  0                 0
8                  0                 0
7                  1                 0
6                  0                 0
5                  0                 0
4                  0                 0
3                  0                 0
2                  0                 0
1                  0                 0

$x1
   (Intercept) res.1985NE res.1985S res.1985W res.1980NE res.1980S res.1980W
15           1          0         1         0          0         0         1
14           1          0         0         0          0         0         1
10           1          0         0         0          0         1         0
   factor(sym.pair)2 factor(sym.pair)3 factor(sym.pair)4 factor(sym.pair)5
15                 0                 0                 0                 0
14                 0                 0                 0                 0
10                 0                 0                 0                 0
   factor(sym.pair)6 factor(sym.pair)8
15                 0                 0
14                 0                 0
10                 1                 0

$x2invt
   (Intercept) res.1985NE res.1985S res.1985W res.1980NE res.1980S res.1980W
16          -1        0.5         0         1        0.5         0         1
13           1       -0.5         0        -1       -0.5         0         0
12           0        0.0         1         0        0.0         1         0
11           0        0.0         0         0        0.0         0         0
9            0        0.0        -1         0        0.0         0         0
8            2       -1.0        -1        -1       -1.0        -1        -1
7            0        0.0         0         0        0.0         0         0
6            0        0.0         0         0        0.0         0         0
5           -1        1.0         1         1        0.0         0         0
4           -1        0.5         0         1        0.5         0         0
3            0        0.0         1         0        0.0         0         0
2            1       -1.0        -1        -1        0.0         0         0
1            0        0.5         0         0        0.5         0         0
   factor(sym.pair)2 factor(sym.pair)3 factor(sym.pair)4 factor(sym.pair)5
16               0.5               0.5              -0.5                 1
13              -0.5              -0.5               0.5                -1
12               0.0              -1.0               0.0                 0
11               0.0               0.0               0.0                 0
9                0.0               1.0               0.0                 0
8               -1.0               0.0               0.0                -2
7                0.0               0.0               0.0                 0
6                0.0               0.0               0.0                 1
5                1.0               0.0               0.0                 1
4                0.5               0.5               0.5                 1
3                0.0               0.0               0.0                 0
2                0.0               0.0               0.0                -1
1               -0.5              -0.5              -0.5                 0
   factor(sym.pair)6 factor(sym.pair)8
16                 1                 1
13                -1                -1
12                -1                -2
11                 0                 1
9                  1                 1
8                 -1                 0
7                  1                 0
6                  0                 0
5                  0                 0
4                  1                 1
3                 -1                -1
2                  0                 0
1                  0                 0

$y
   15    14    10    16    13    12    11     9     8     7     6     5     4 
  286   176   225 10192    63   270 17819   172   302   515 13677    87   124 
    3     2     1 
  366   100 11607 

$ord
 [1] 15 14 10 16 13 12 11  9  8  7  6  5  4  3  2  1

$glm.fit

Call:  glm(formula = formula, family = poisson, data = data, x = TRUE, 
    y = TRUE)

Coefficients:
       (Intercept)          res.1985NE           res.1985S           res.1985W  
            1.6281              3.8411              0.5692              4.1120  
        res.1980NE           res.1980S           res.1980W   factor(sym.pair)2  
            3.8901             -0.1752              3.4892             -0.9561  
 factor(sym.pair)3   factor(sym.pair)4   factor(sym.pair)5   factor(sym.pair)6  
           -0.1728             -4.8118              7.8953              4.0206  
 factor(sym.pair)7   factor(sym.pair)8   factor(sym.pair)9  factor(sym.pair)10  
                NA              7.7658                  NA                  NA  

Degrees of Freedom: 15 Total (i.e. Null);  3 Residual
Null Deviance:	    131000 
Residual Deviance: 2.986 	AIC: 159.2

$p
[1] 0.5

$batchsize
[1] 100

$startiter
[1] 11001

$mhap
[1] 5744

$current.batchmean
[1] 1 1

$bmsq
[1] 18.8783 18.8835

$nobatches
[1] 110

$phat
[1] 0.3956364 0.3958182

$mcse
[1] 0.01171354 0.01167598

$y1.start
[1] 312 149 240

$perpos
[1] 0.9983

attr(,"class")
[1] "cabSummary"

exactLoglinTest documentation built on May 1, 2019, 9:58 p.m.