分类调查的分析方法

时间:2017-04-05 21:25:44

标签: python excel pandas data-analysis

我的调查回复如下:

Q1              Q2                              Q3

Very satisfied  Much shorter than I expected    10
Very satisfied  About what I expected           10
Very satisfied  About what I expected           8
Very satisfied  Much shorter than I expected    10
Satisfied       About what I expected           4
Very satisfied  Much shorter than I expected    10
Satisfied       About what I expected           8
Satisfied       Much shorter than I expected    10
Very satisfied  Shorter than I expected         9
Very satisfied  Much shorter than I expected    10
Satisfied       Shorter than I expected         8
Satisfied       About what I expected           8
Satisfied       Shorter than I expected         5
Very satisfied  Shorter than I expected         10
Very satisfied  Much shorter than I expected    9
Very satisfied  Much shorter than I expected    10
Satisfied       Much shorter than I expected    9
Very satisfied  About what I expected           9
Very satisfied  About what I expected           10
Very satisfied  Shorter than I expected         10
Very satisfied  Much shorter than I expected    10
Very satisfied  About what I expected           10
Neutral         Shorter than I expected         8
Very satisfied  Shorter than I expected         6
Satisfied       About what I expected           8
Very satisfied  Much shorter than I expected    10
Very satisfied  Shorter than I expected         9
Unsatisfied     About what I expected           3
Very satisfied  Much shorter than I expected    10
Satisfied       Shorter than I expected         9
Neutral         Shorter than I expected         6
Unsatisfied     Did not receive a response      1
Very satisfied  Much shorter than I expected    10
Very unsatisfied    About what I expected       1
Very satisfied  Shorter than I expected         10
Very satisfied  Shorter than I expected         8

回答以下问题的最佳方法是:如果响应者回答Q2并且#34;比预期的短得多"那么Q3的概率是10。

我正在寻找明确的答案或如何指导我将来可以学会这样做。我想在excel或pandas中实现这一目标。

我可以使用Logistic回归并为Q2分配虚拟变量吗?我可以以某种方式创建一个相关矩阵,看看Q2的响应与Q3的相关性如何?

1 个答案:

答案 0 :(得分:1)

您可以使用以下公式计算:

=(COUNTIFS($B$2:$B$37,"Much shorter than I expected",$C$2:$C$37,10)/COUNTIF($B42:$B$37,"Much shorter than I expected"))*100

我们给它范围B2:B37以检查答案"比我预期的短得多"

当我们找到它时,我们检查他们是否给了Q3的10。

然后我们将它所在的数字乘以它们回答的总次数#34;比我预期的短得多",乘以100并舍入到2位小数。

公式示例:

Formula

您还可以修改此公式以接受不同的参数:

=(COUNTIFS($B$2:$B$37,E2,$C$2:$C$37,F2)/COUNTIF($B$2:$B$37,E2))*100

Example2

如果您只是想知道计算概率的数学,请按以下步骤操作:

  1. 定义您的活动和结果。
  2. 将事件数除以可能的结果数。
  3. 将答案乘以100,使其成为百分比。
  4. 使用百分比作为答案。
  5. http://www.wikihow.com/Calculate-Probability