[R] how to build a saturated model for logistic regression?

Rolf Turner r.turner at auckland.ac.nz
Thu Nov 22 21:45:30 CET 2007


On 23/11/2007, at 8:36 AM, Wensui Liu wrote:

> Dear Listers,
> Sorry for bothering you on Thxgiving.

	This is a world-wide list, not just a U.S. one.  Many of us
	are not particularly ``bothered''!

> I am just curious how to build a saturated model for logistic
> regression or other kinds of regression.

	It is not clear what you are asking.  A saturated model is
	by definition pretty simple to ``build''; by definition it has
	one parameter per observation; the fitted values are equal to the
	observed values and the residuals are all 0.

	To fit, explicitly, such a model using glm() you could do something
	like

		a <- factor(1:length(y))
		fit <- glm(y~a,family=binomial)

	where ``y'' is your vector of (Bernoulli) observations.

	You will get a residual deviance of (effectively) 0, on 0
	degrees of freedom.  The fitted values (from fitted(fit))
	will be equal to y, to within numerical noise.

	Does this answer your question?
			cheers,

				Rolf Turner


######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}



More information about the R-help mailing list