| 1 | 0 | 0 | 0 | 0 | 10.8 | 8.1 | 6.1 | 7.9 | weight |
| 1 | 0 | 0 | 0 | 0 | 10.8 | 9.8 | 6.4 | 7.5 | dannon |
| 1 | 0 | 0 | 0 | 0 | 10.8 | 9.8 | 6.1 | 8.6 | dannon |
| 1 | 0 | 0 | 0 | 0 | 10.8 | 9.8 | 6.1 | 8.6 | dannon |
| 1 | 0 | 0 | 0 | 0 | 12.5 | 9.8 | 4.9 | 7.9 | dannon |
| 1 | 0 | 0 | 0 | 0 | 10.8 | 9.2 | 5.0 | 7.9 | dannon |
| 1 | 0 | 0 | 0 | 0 | 10.3 | 8.1 | 4.9 | 7.9 | dannon |
| 1 | 0 | 0 | 0 | 0 | 10.8 | 8.6 | 5.4 | 7.9 | weight |
| 2 | 0 | 0 | 0 | 0 | 10.8 | 9.8 | 5.0 | 7.9 | yoplait |
| 2 | 0 | 0 | 0 | 0 | 10.8 | 9.8 | 5.0 | 7.9 | yoplait |
Projet II
Dix premières lignes du tableau de données brutes Yogurt.
Histogramme des prix par marque
Le tableau I de l’article : statistique descriptive ( parts de marché, existence ou non de publicité, prix moyens des achats et écarts types associés)
| Variable | Marque | Moyenne | Ecart_type |
|---|---|---|---|
| Parts de marché | Yoplait | 0.33914 | 0.47351 |
| (Proportions) | Dannon | 0.40216 | 0.49043 |
| Weight | 0.22927 | 0.42045 | |
| Hiland | 0.02944 | 0.16906 | |
| Feature | Yoplait | 0.05597 | 0.22991 |
| (Proportions) | Dannon | 0.03773 | 0.19058 |
| Weight | 0.03773 | 0.19058 | |
| Hiland | 0.03690 | 0.18855 | |
| Prix | Yoplait | 10.68213 | 1.90626 |
| ($ per Oz) | Dannon | 8.16347 | 1.06289 |
| Weight | 7.94909 | 0.77350 | |
| Hiland | 5.36294 | 0.80539 | |
| Nombre d'observations | 2412 | ||
| Nombre de ménages | 100 |
Affichage d’un diagramme circulaire représentant les parts de marché sur les 2412 achats de yaourts du paquetage “Yogurt”.
Le tableau II de l’article : statistique descriptive ( parts de marché, existence ou non de publicité, prix moyens des achats et écarts types associés)
Le tableau II
# Charger le package nécessaire
library(mlogit)
# Restructurer les données pour mlogit
mlogit_data <- mlogit.data(Yogurt, choice = "choice", shape = "wide", varying = 2:9, sep = ".")
# Estimer le modèle logit multinomial avec 'hiland' comme référence
mnl_model <- mlogit(choice ~ price + feat, data = mlogit_data, reflevel = "hiland")
# Afficher le résumé du modèle
summary(mnl_model)
Call:
mlogit(formula = choice ~ price + feat, data = mlogit_data, reflevel = "hiland",
method = "nr")
Frequencies of alternatives:choice
hiland dannon weight yoplait
0.029436 0.402156 0.229270 0.339138
nr method
6 iterations, 0h:0m:0s
g'(-H)^-1g = 0.000763
successive function values within tolerance limits
Coefficients :
Estimate Std. Error z-value Pr(>|z|)
(Intercept):dannon 3.715595 0.145419 25.5510 < 2.2e-16 ***
(Intercept):weight 3.074411 0.145384 21.1468 < 2.2e-16 ***
(Intercept):yoplait 4.450166 0.187118 23.7827 < 2.2e-16 ***
price -0.366584 0.024366 -15.0449 < 2.2e-16 ***
feat 0.491433 0.120063 4.0931 4.256e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Log-Likelihood: -2656.9
McFadden R^2: 0.062142
Likelihood ratio test : chisq = 352.09 (p.value = < 2.22e-16)
| Estimate | Std. Error | z-value | Pr(>|z|) | |
|---|---|---|---|---|
| (Intercept):hiland | -3.7155950 | 0.1454190 | -25.550959 | 0.00e+00 |
| (Intercept):weight | -0.6411843 | 0.0544983 | -11.765222 | 0.00e+00 |
| (Intercept):yoplait | 0.7345712 | 0.0806442 | 9.108791 | 0.00e+00 |
| Price | -36.6584451 | 2.4366066 | -15.044876 | 0.00e+00 |
| Feat | 0.4914334 | 0.1200630 | 4.093129 | 4.26e-05 |