Hi

I am trying to estimate stated preferences for Tv sets by using mlogit. The
choice set is designed as with 4 attributes: [ brand(has 4 levels),
technology(has two levels), class[has 4 levels), price(has 4 levels)]

There are 16 choice sets with 4 alternatives each one (i.e. each respondent
has evaluated 64 cards in total). Therefore, there are 64 rows in the table
below.

The data in csv file looks like this:


         Mode                        Brand        Technology         Class
                                Price  0 1 1 1 1  1 2 1 2 2  0 3 2 3 3  0 4
2 4 4  0 2 2 4 2  0 1 1 3 1  1 4 1 2 4  0 3 2 1 3  0 3 2 2 3  1 4 1 3 4  0 2
2 1 2  0 1 1 4 1  0 4 1 3 4  1 3 1 2 3  0 2 2 1 2  0 1 2 4 1  1 1 1 1 4  0 3
2 3 2  0 4 2 4 3  0 2 1 2 1  0 2 1 4 3  0 4 2 2 1  1 3 1 1 4  0 1 2 3 2  0 3
1 4 2  0 1 2 2 4  1 2 1 3 1  0 4 2 1 3  0 4 1 1 1  1 2 2 3 3  0 1 2 2 2  0 3
1 4 4  0 1 1 1 3  0 4 2 4 2  1 2 1 2 4  0 3 2 3 1  1 2 2 4 4  0 3 2 1 1  0 1
1 3 3  0 4 1 2 2  0 3 2 2 1  1 2 2 1 4  0 1 1 4 3  0 4 1 3 2  0 4 1 3 2  0 1
2 4 3  0 3 1 2 1  1 2 2 1 4  0 3 2 3 4  0 1 1 1 2  0 4 2 4 1  1 2 1 2 3  0 4
2 2 3  0 2 1 4 1  0 1 2 3 4  1 3 1 1 2  0 1 2 2 2  0 3 1 4 4  0 4 2 1 1  1 2
1 3 3  0 2 2 3 1  1 4 1 1 3  0 3 1 4 2  0 1 2 2 4


R has already read and save the data,but when I come to the line:

DataR$mode.ids<-factor(rep(1:64,1),labels=c("brand","technology","class","price"))


I get the following error: Error in factor(rep(1:64, 1), labels =
c("brand", "technology", "class",


I guess it has to do with the setting up of my file or the coding in R. How
can I do it right? Each respondent chose 16 times among 4 different cards
every time..

Kind regards,

Andrea

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to