getFit | R Documentation |
Fit the results in a data.frame
produced by either tally
or
score
.
getFit(obj, by)
obj |
a |
by |
the name of the variable in the results |
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.
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.