getFit: Fit Infectivity Results with Binomial GLM Model

View source: R/getFit.R

getFitR Documentation

Fit Infectivity Results with Binomial GLM Model

Description

Fit the results in a data.frame produced by either tally or score.

Usage

getFit(obj, by)

Arguments

obj

a data.frame produced by tally or by score.

by

the name of the variable in the results data.frame that will be used to split the results before fitting (see details.)

Details

This function will fit a GLM binomial model using a two-column response where the fit is weighted by the total numbers of cases. Data are fit by the glm function using the binomial family with either the default "logit" or the complementary log-log "cloglog" link function. The "logit" link is appropriate for symmetrical data. The "cloglog" link is better for asymmetrical data. The best fit will be chosen Akaike's criteria.

If the parameter by is specified, the data frame will first be split by this variable after coercion to a factor. In previous versions, this option only accepted "columns" or "rows" as a potential variable.

The argument obj must be produced either by tally or by score. If a variable named "positive" is present, data are assumed to have been produced by score and the function tally will be called before proceeding. If variables named "pos" and "neg" are present, the data are assumed to be the product of tally. In the case of a data frame produced by score, the data must have a variable named "moi" or "x" representing the multiplicity of infection. If both "x" and "moi" are present, an attempt will be made to choose the more informative value and a warning will be issued. Data produced by tally will always have a variable named "x" as the independent variable representing the multiplicity in the glm model.

Value

A fitted glm model or list of such models. Each fitted model has the unit of measure attached as an attribute with the text value from unit. The link function will either be "logit" or "cloglog" and can be identified with the family function. Note that the fitted model uses the log of the moi values for fitting.


ornelles/virustiter documentation built on Sept. 18, 2024, 10:50 a.m.