Usage (original) (raw)
Model fitting
Model fitting is done with a function called sclr
. It is used in the same way as other fitting functions like lm
.
Expected protection
The predict
method will return the point estimate and a confidence interval of \(\beta_0 + \beta_1X_1 + ... + \beta_kX_k\) where \(k\) is the number of covariates. It will also apply the inverse logit transformation to these estimates and interval bounds to get the point estimate and the interval for the probability of protection on the original scale.
# One-titre fit
preddata1 <- data.frame(logHI = seq(0, 8, length.out = 101))
pred1 <- predict(fit1, preddata1)
head(pred1[, c("logHI", "prot_l", "prot_point", "prot_u")])
#> # A tibble: 6 x 4
#> logHI prot_l prot_point prot_u
#> <dbl> <dbl> <dbl> <dbl>
#> 1 0 0.00159 0.00438 0.0120
#> 2 0.08 0.00194 0.00520 0.0139
#> 3 0.16 0.00236 0.00617 0.0160
#> 4 0.24 0.00288 0.00732 0.0185
#> 5 0.32 0.00351 0.00868 0.0213
#> 6 0.4 0.00427 0.0103 0.0246
# Two-titre fit
preddata2 <- data.frame(logHI = seq(0, 8, length.out = 101), logNI = 1)
pred2 <- predict(fit2, preddata2)
head(pred2[, c("logHI", "logNI", "prot_l", "prot_point", "prot_u")])
#> # A tibble: 6 x 5
#> logHI logNI prot_l prot_point prot_u
#> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 0 1 0.00432 0.00983 0.0222
#> 2 0.08 1 0.00527 0.0117 0.0258
#> 3 0.16 1 0.00643 0.0139 0.0299
#> 4 0.24 1 0.00785 0.0166 0.0347
#> 5 0.32 1 0.00957 0.0197 0.0402
#> 6 0.4 1 0.0117 0.0235 0.0466
Protective titres
To get the estimated titre (and the confidence interval) that corresponds to a particular protection level (eg. 50%), use the get_protection_level
function. Its interface is similar to that of predict
.