联合分析
联合分析所要解决的是,在研究的产品或服务中,具有哪些特征的产品最能得到消费者的欢迎。一件产品通常拥有许多特征如价格、颜色、款式以及产品的特有功能等,那么在这些特性之中,每个特性对消费者的重要程度如何?在同样的(机会)成本下,产品具有哪些特性最能赢得消费者的满意?
基于度量的联合分析
基于度量的联合分析将会涉及多层次的回归嵌套的问题,分层线性模型将能有效的解决这一问题。
分层模型假设每个受访者有一组偏好系数,这些系数来自更大的分布,而这个更大分布决定了个体可能的偏好值。
基于度量的联合分析的分层线性模型要解决:
- 基于用户对于产品不同特征的评分,获得每个特征对总评分的贡献。
- 使用HLM来估计用户对于产品总体固定的效应和个体水平随机的效应。
cja_1 <- read.csv("http://r-marketing.r-forge.r-project.org/data/rintro-chapter9conjoint.csv")
cja_1$speed <- factor(cja_1$speed)
cja_1$height <- factor(cja_1$height)
summary(cja_1)
resp.id rating speed height const theme
Min. : 1.00 Min. : 1.000 40: 800 200:1400 Steel:1400 Dragon:1600
1st Qu.: 50.75 1st Qu.: 3.000 50:1200 300:1200 Wood :1800 Eagle :1600
Median :100.50 Median : 5.000 60: 800 400: 600
Mean :100.50 Mean : 5.268 70: 400
3rd Qu.:150.25 3rd Qu.: 7.000
Max. :200.00 Max. :10.000
可以看出,数据由四个特征变量对于一个评分范围为1~10的水平变量。
特征贡献模型
cja_lm <- lm(rating ~ speed + height + const + theme, data = cja_1)
summary(cja_lm)
结果输出:
Call:
lm(formula = rating ~ speed + height + const + theme, data = cja_1)
Residuals:
Min 1Q Median 3Q Max
-5.8394 -1.3412 -0.0186 1.2798 6.9269
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.07307 0.08102 37.932 < 2e-16 ***
speed50 0.82077 0.10922 7.515 7.35e-14 ***
speed60 1.57443 0.12774 12.326 < 2e-16 ***
speed70 4.48697 0.15087 29.740 < 2e-16 ***
height300 2.94551 0.09077 32.452 < 2e-16 ***
height400 1.44738 0.12759 11.344 < 2e-16 ***
constWood -0.11826 0.11191 -1.057 0.291
themeEagle -0.75454 0.11186 -6.745 1.81e-11 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.967 on 3192 degrees of freedom
Multiple R-squared: 0.5039, Adjusted R-squared: 0.5029
F-statistic: 463.2 on 7 and 3192 DF, p-value: < 2.2e-16
通过特征贡献模型可知,截距(包含了未显示的constSteel和themeDragon)+ speed70 +height300的组合的评分是最高的。
但这一模型只是解决了总体性的偏好水平,但并不意味着大部分人喜欢这一组合,cja_lm模型仅有固定效应,这就需要分层线性模型来解决总体平均偏好和组内个体偏好。
截距分层线性模型
library(lme4)
#「(1 | resp.id)」是hlm()中指定随机效应变量的方式,其中「1」代表截距,「|」是指定符,「resp.id」则表示该模型希望看到个体层面的效应,其标准表达式为「(predictor | group)」。
cja_hlm1 <- lmer(rating ~ speed + height + const + theme + (1 | resp.id), data = cja_1)
summary(cja_hlm1)
结果输出:
Linear mixed model fit by REML ['lmerMod']
Formula: rating ~ speed + height + const + theme + (1 | resp.id)
Data: cja_1
REML criterion at convergence: 13324.2
Scaled residuals:
Min