Professor Ripley,
Thanks very much. You comments were very helpful. I've got it (almost) all figured out now. My model is for discrete data (discrete response AND predictors). The issue I'm stuck on is that my saturated model does NOT predict exactly; the constant is ~1874.052.
Here is an example of my model with much less data, showing how the saturated model does not predict exactly (constant ~ 440.6375).
library(nnet)
fem.labs<- factor(c("Fem1","Fem2","Fem3","Fem4","Fem5","Fem6"),levels=c("Fem1","Fem 2","Fem3","Fem4","Fem5","Fem6"))
site.labs<-factor(c("Site01","Site02","Site03","Site04"))
dyad.labs<-factor(c("M","H","U"),levels=c("M","H","U"))
data.table<-expand.grid(Site=site.labs, Female=fem.labs,Dyad=dyad.labs)
data<- c(20,16,21,16,13,11,15,13,27,27,30,19,24,25,29,23,24,20,25,25,24,18,26,2 0,2,0,2,2,1,1,0,1,3,3,3,6,4,3,2,4,2,1,3,1,3,4,1,1,5,11,4,9,1,3,0,1,3,3,0 ,8,4,4,1,5,6,11,4,6,3,8,3,9)
data.table<-structure(.Data=data.table[rep(1: nrow(data.table),data),],row.names=1:length(data))
fit.saturated.model<-multinom(Dyad~Female*Site,data=data.table)
fit.saturated.model$deviance # Why is this NONZERO?
Am I setting up the regression for the saturated model incorrectly??
Thanks in advance. . .
- Brooks
---------------------------- Brooks Miner Research Scientist Laird Lab UW Biology 206.616.9385 http://protist.biology.washington.edu/Lairdlab/
On May 13, 2005, at 10:41 PM, Prof Brian Ripley wrote:
By definition, the deviance is minus twice the maximized log-likelihood plus a const. In any of these models for discrete data, the saturated model predicts exactly, so the const is zero.
There are worked examples in MASS4, the book multinom() supports.
On Fri, 13 May 2005, Brooks Miner wrote:
Hi all,
I'm working on a multinomial (or "polytomous") logistic regression using R and have made great progress using multinom() from the nnet library. My response variable has three categories, and there are two different possible predictors. I'd like to use the likelihoods of certain models (ie, saturated, fitteds, and null) to calculate Nagelkerke R-squared values for various fitted models.
My question today is simple: once I have fitted a model using multinom(), how do I find the likelihood (or log likelihood) of my fitted model? I understand that this value must be part of the $deviance or $AIC components of the fitted model, but my understanding is too limited at this point for me to know how to calculate the likelihood of my fitted model from either of these outputs.
Thanks in advance to any assistance offered. I'd be happy to provide an example of my data and multinom() entries if that would help.
Gratefully,
- Brooks ---------------------------- Brooks Miner Research Scientist Laird Lab UW Biology 206.616.9385 http://protist.biology.washington.edu/Lairdlab/
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
-- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
