cbmod {chainbinomial} | R Documentation |
Fitting models for Secondary Attack Rate with Chain Binomial response
Description
Fitting models for Secondary Attack Rate with Chain Binomial response
Usage
cbmod(
y,
s0,
x = NULL,
i0 = 1,
generations = Inf,
link = "identity",
optim_method = "BFGS"
)
Arguments
y |
numeric, the number of infected cases. |
s0 |
numeric, the number of initial susceptibles. |
x |
matrix of predictors (design matrix). |
i0 |
numeric, number of initial infected. Default is 1. |
generations |
numeric. |
link |
Link function. Default is 'identity'. |
optim_method |
Optimization method used by optim. |
Details
The following link functions are available: identity
, log
, logit
, and cloglog
.
Value
A list of class cbmod
with the following components:
-
parameters
The point estimate of the regression coefficients. -
se
Standard error of the regression coefficient estimates. -
vcov
Variance-Covariance matrix of the regression coefficient estimates. -
p_values
P-values of the null hypothesis that the regression regression coefficient estimate is 0. -
loglikelihood
the log likelihood value at the point estimate. -
npar
Number of parameters. -
sar_hat
Vector of fitted secondary attack rates. -
fitted_values
Vector of expected outbreak size (final attack rate). -
link
Link function used by the regression model. -
null_model
= Null model, fitted withestimate_sar()
. This is equivalent to an intercept only model. -
warnings
Warning_messages, -
est_time
: Time used to fit the model. -
omitted_values
Vector indicating data points that were ignored during estimation because of missing values.
See Also
Methods for cbmod
objects:
Examples
set.seed(234)
mydata <- data.frame(infected = rchainbinom(n = 15, s0 = 5, sar = 0.2,
i0 = 1, generations = Inf),
s0 = 5, i0 = 1, generations = Inf)
xmat <- model.matrix(~ 1, data = mydata)
res <- cbmod(y = mydata$infected, s0 = mydata$s0, x = xmat, i0 = mydata$i0,
generations = mydata$generations)
summary(res)