[R] Problem with multinom ?
Marc Girondot
marc.girondot at ese.u-psud.fr
Sat Jun 11 10:06:20 CEST 2005
Thanks for your response.
OK, multinom() is a more logical in this context.
But similar problem occurs:
Let these data to be analyzed using classical glm with binomial error:
m f factor m theo f theo
-Ln L model -Ln L full interecept
f
10 12 1.2 0.452494473 0.547505527
1.778835688 1.778648963 2.632455675
-2.034882223
14 14 1.3 0.503222759 0.496777241 1.901401922 1.900820284
15 12 1.4 0.553884782 0.446115218 1.877062369 1.876909821
Sum -Ln L
5.557299979 5.556379068 Residual deviance
Deviance
11.11459996 11.11275814 0.001841823
If I try to use multinom() function to analyze
these data, the fitted parameters are correct but
the residual deviance not.
> dt<-read.table('/try.txt'. header=T)
> dt
output factor n
1 m 1.2 10
2 f 1.2 12
3 m 1.3 14
4 f 1.3 14
5 m 1.4 15
6 f 1.4 12
> dt.plr <- multinom(output ~ factor. data=dt. weights=n. maxit=1000)
# weights: 3 (2 variable)
initial value 53.372333
iter 10 value 53.115208
iter 10 value 53.115208
iter 10 value 53.115208
final value 53.115208
converged
> dt.plr
Call:
multinom(formula = output ~ factor. data = dt. weights = n. maxit = 1000)
Coefficients:
(Intercept) factor
-2.632443 2.034873
Residual Deviance: 106.2304
AIC: 110.2304
> dt.pr1<-predict(dt.plr. . type="probs")
> dt.pr1
1 2 3 4 5 6
0.4524948 0.4524948 0.5032229 0.5032229 0.5538846 0.5538846
Probability for 2. 4 and 6 are not correct and
its explain the non-correct residual deviance
obtained in R.
Probably the problem I have is due to an
incorrect data format... could someone help me...
Thanks
(I know there is a simple way to analyze binomial
data. but in fine I want to use multinom() for 5
categories of outputs.
Thanks a lot
Marc
--
__________________________________________________________
Marc Girondot, Pr
Laboratoire Ecologie, Systématique et Evolution
Equipe de Conservation des Populations et des Communautés
CNRS, ENGREF et Université Paris-Sud 11 , UMR 8079
Bâtiment 362
91405 Orsay Cedex, France
Tel: 33 1 (0)1.69.15.72.30 Fax: 33 1 (0)1 69
15 56 96 e-mail: marc.girondot at ese.u-psud.fr
Web: http://www.ese.u-psud.fr/epc/conservation/Marc.html
Skype: girondot
Fax in US: 1-425-732-6934
More information about the R-help
mailing list