分数估算超出界限

我进行了一项调查,要求人们以1到7的等级对餐厅进行评分,并使用系数的个体回归结果来估算两个新餐厅的得分。

results<- NULL #Set a new variable to stack
for(i in 1:6){
  results<-rbind(results,coef(lm(score~alcohol+type+price,d1[d1$id==i,])))
}

导致

     (Intercept) alcoholY typericenoodle price12000
[1,]        3.50     3.00  -5.000000e-01       1.00
[2,]        2.50     3.00   5.000000e-01       1.50
[3,]        4.25     1.00  -5.000000e-01       1.00
[4,]        4.50    -0.50  -1.030373e-16       1.50
[5,]        7.00    -0.50  -5.000000e-01      -2.50
[6,]        4.25    -1.75  -2.500000e-01       2.75

我想利用这个

case1<-c(1,1,1) #First option
case2<-c(1,0) #Second option
pred_score <- cbind(results%*%case1,results%*%case2)
results
head(pred_score,n=6) #CheckData,we can see the predicted scores 
for each individual
summary(pred_score)
apply(pred_score,which.max)
table(apply(pred_score,which.max))/6 #table for market share . 
prediction
barplot(table(apply(pred_score,which.max))/6,main='Market . 
Share',ylab='Share') #Bar plot for market share prediction

但是结果(个人的估计分数)超出了1到7的范围。

     [,1] [,2]
[1,] 7.00 3.50
[2,] 7.50 2.50
[3,] 5.75 4.25
[4,] 5.50 4.50
[5,] 3.50 7.00
[6,] 5.00 4.25

任何帮助都会很棒!

t572786188 回答:分数估算超出界限

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3147841.html

大家都在问