Methods for Function as.matrix in Package prevalence

Share:

Description

Convert objects of class prev to matrix

Usage

1
2
## S4 method for signature 'prev'
as.matrix(x, iters = FALSE, chains = FALSE)

Arguments

x

An object of class prev

iters

Logical flag, indicating whether a column should be added for iteration number; defaults to FALSE

chains

Logical flag, indicating whether a column should be added for chain number; defaults to FALSE

Methods

signature(x = "prev")

Convert objects of class prev to matrix

See Also

prev-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Not run: 

## Taenia solium cysticercosis 1-test model
cysti <-
truePrev(x = 142, n = 742,
         SE = ~dunif(0.60, 1.00), SP = ~dunif(0.75, 1.00))

head(as.matrix(cysti))


## Campylobacter 2-test model
campy <-
truePrevMulti(
  x = c(113, 46, 156, 341),
  n = 656,
  prior = {
    theta[1] ~ dunif(0.45, 0.80)
    theta[2] ~ dunif(0.24, 0.50)
    theta[3] <- 1
    theta[4] ~ dbeta(30, 12)
    theta[5] ~ dbeta(1, 1)
    theta[6] <- 1
    theta[7] <- 1
  }
)

head(as.matrix(campy, iters = TRUE, chains = TRUE))

## End(Not run)