# How to calculate average importance of factors (attributes) correctly in "conjoint" package (R)?

First, load conjoint package:

library(conjoint)


Then, I load chocolate data:

data(chocolate)

#cprof (profiles - cards)

#cpref (preferences - stack shape)

#cprefm (preferences - unstack shape)

#clevn (levels into attributes)

#csimp (simulation importance matrix)


ShowAllUtilities(x = cprof, y = cpref, z = clevn, y.type = "score")


Consider this part of the output:

[1] "Part worths (utilities) of levels (model parameters for whole sample):"
levnms    utls
1   intercept  8,6849
2        milk -1,0891
3      walnut -0,7328
4  delicaties -0,9224
5        dark  2,7443
6         low -0,5709
7     average  0,1188
8        high  0,4521
9   paperback -0,0287
10   hardback  0,0287
11      light -0,1686
12     middle  0,1734
13      heavy -0,0048
14     little -0,6466
15       much  0,6466


I calculate the average importance of utilities manually:

First, kind attribute:

2        milk -1,0891
3      walnut -0,7328
4  delicaties -0,9224
5        dark  2,7443

2,7443 - (-1,0891) = 3,8334


Price:

6         low -0,5709
7     average  0,1188
8        high  0,4521

0,4521 - (-0,5709) = 1,0230


Packing:

9   paperback -0,0287
10   hardback  0,0287

0,0287 - (-0,0287) = 0,0574


Weight:

11      light -0,1686
12     middle  0,1734
13      heavy -0,0048

0,1734 - (-0,1686) = 0,3420


Calories:

14     little -0,6466
15       much  0,6466

0,6466 - (-0,6466) = 1,2932


Where the sum is 6,5490

And calculate the average importances for each attribute:

First, kind attribute importance:

3,8334/6,5490 = 0,5853*100 = 58,53


Price

1,0230/6,5490 = 0,1562*100 = 15,62


Packing:

0,0574/6,5490 = 0,0088*100 = 0,8765


Weight:

0,3420/6,5490 = 0,0522*100 = 5,22


Calories:

1,2932/6,5490 = 0,1975*100 = 19,74


But, the output Average importance of factors (attributes) is:

56,79 16,42  5,43 10,61 10,75
Sum of average importance:  100


What is the explanation for this inaccuracy?

Can you improve your answer, please. There are several mistakes, such as in the first attribute calculation. Also, what is y,type = "score" supposed to be?

Usually you should be able to calculate importance the way you did. But it seems the part worths are displayed in a non-standard way. I am not familiar with the conjoint package, so I do not no why, but there is probably a good reason for it.

Anyway, running normal regression:

library(conjoint)
data(chocolate)
pref <- pivot_longer(cprefm, 1:16, names_to = "profile", values_to = "rating")
cprof <- t(apply(cprof, 1, as.factor))
pref2 <- cbind(pref, cprof)
summary(lm(rating ~ kind + price + packing + weight + calorie, data = pref2))


Gives:

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)  8.68487    0.12648  68.667  < 2e-16 ***
kind1       -1.08908    0.19815  -5.496 4.62e-08 ***
kind2       -0.73276    0.19815  -3.698 0.000226 ***
kind3       -0.92241    0.19815  -4.655 3.55e-06 ***
price1      -0.57088    0.15254  -3.743 0.000190 ***
price2       0.11877    0.17887   0.664 0.506777
packing1    -0.02874    0.11440  -0.251 0.801714
weight1     -0.16858    0.15254  -1.105 0.269272
weight2      0.17337    0.17887   0.969 0.332575
calorie1    -0.64655    0.11440  -5.652 1.93e-08 ***


Coefficients look the same, but this time they are correct. If there is an intercept, then the missing attribute level is the base line. This means it has a value of 0. So kind4 should be 0, but in your case it is 2.7443.

When using radiant, the correct result is displayed (kind4 is 0):

library(radiant)
summary(conjoint(pref2, rvar = "rating",
evar = c("kind", "price", "packing", "weight", "calorie")))

Conjoint part-worths:
Attributes Levels     PW
kind              1 -1.089
kind              2 -0.733
kind              3 -0.922
kind              4  0.000
price             1 -0.571
price             2  0.119
price             3  0.000
packing           1 -0.029
packing           2  0.000
weight            1 -0.169
weight            2  0.173
weight            3  0.000
calorie           1 -0.647
calorie           2  0.000
Base utility      ~  8.685


And the importance weights are different to yours and to the conjoint package:

Conjoint importance weights:
Attributes    IW
kind    0.390
price   0.247
packing 0.010
weight  0.122
calorie 0.231


I do not really know why the conjoint package gives a different result. Still, the lm-approach should be correct.

Note that there many different ways to standardize in conjoint analysis. So it is hard to say what is going on here. I guess the program developer/maintainer knows best, so you can contact him (info from CRAN): Tomasz Bartlomowicz [email protected]