jeudi 2 avril 2015

How to enter cross-table into R for nominal logistic regression?


Vote count:

0




I would like to conduct nominal logistic regression analysis using mlogit in R. However, I could not manage to enter the data into R in the correct format. My code is below and any help would be greatly appreciated.



house.type <- c(rep(1,6),rep(2,6),rep(3,6))
contact <- c(1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2)
satisfaction <- c(1,1,2,2,3,3,1,1,2,2,3,3,1,1,2,2,3,3)
frequency <- c(65,34,54,47,100,100,130,141,76,116,111,191,67,130,48,105,62,104)


My covariates are house.type, contact and satisfaction.


When I try to create a cross table, I see that the data are not as in the book.



with(data, table(house.type, satisfaction,contact))


Therefore, the code below produces incorrect results



install.packages("nnet")

multinom(satisfaction ~ contact + house.type)


asked 33 secs ago







How to enter cross-table into R for nominal logistic regression?

Aucun commentaire:

Enregistrer un commentaire