The loglinear model is fitted to a multiway table with probabilities
estimated by svymean
and with the sample size equal to the
observed sample size, treating the resulting table as if it came from iid
multinomial sampling, as described by Rao and Scott. The
variance-covariance matrix does not include the intercept term, and so
by default neither does the coef
method. A Newton-Raphson
algorithm is used, rather than iterative proportional fitting, so
starting values are not needed.
The anova
method computes the quantities that would be the score
(Pearson) and likelihood ratio chi-squared statistics if the data were
an iid sample. It computes four p-values for each of these, based on the
exact asymptotic distribution (see pchisqsum
), a
saddlepoint approximateion to this distribution, a scaled
chi-squared distribution, and a scaled F-distribution. When testing the
two-way interaction model against the main-effects model in a two-way
table the score statistic and p-values match the Rao-Scott tests
computed by svychisq
.
The anova
method can only compare two models if they are for
exactly the same multiway table (same variables and same order). The
update
method will help with this. It is also much faster to use
update
than svyloglin
for a large data set: its time
complexity depends only on the size of the model, not on the size of the
data set.
It is not possible to fit a model using a variable created inline, eg
I(x<10)
, since the multiway table is based on all variables used
in the formula.