|
|
@ -240,6 +240,158 @@
|
|
|
|
"<img src=\"assets/20201122173755.png\" width=\"50%\">"
|
|
|
|
"<img src=\"assets/20201122173755.png\" width=\"50%\">"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
|
|
|
"metadata": {},
|
|
|
|
|
|
|
|
"source": [
|
|
|
|
|
|
|
|
"## 方差分析中的多重比较\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"### 两组比较\n",
|
|
|
|
|
|
|
|
"**实例:**\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"在评价某药物耐受性及安全性的期临床试验中,对符合纳入标准的30名健康自愿者随机分为3组每组10名,各组注射剂量分别为0.5U、1U、2U,观察48小时部分凝血活酶时间(s)试问不同剂量的部分凝血活酶时间有无不同?\n",
|
|
|
|
|
|
|
|
"<img src=\"assets/20201122181401.png\" width=\"30%\">\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"提出假设:H0:μ1=μ2=μ3; H1:μ1,p2,μ3不全相同,显著水平a=0.05\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"<img src=\"assets/20201122181607.png\" width=\"30%\">\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"F0.05(2,26)=2.52, F>F0.05(2,26), P<0.05\n",
|
|
|
|
|
|
|
|
"拒绝H0。三种不同剂量48小时部分凝血活酶时间不全相同。\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"### 多重比较\n",
|
|
|
|
|
|
|
|
"<ul>\n",
|
|
|
|
|
|
|
|
" <li>通过对总体均值之间的配对比较来进一步检验到底哪些均值之间存在差异\n",
|
|
|
|
|
|
|
|
" <li>可采用 Fisher提出的最小显著差异方法,简写为LSD\n",
|
|
|
|
|
|
|
|
" <li>LSD方法是对检验两个总体均值是否相等的t检验方法的总体方差估计而得到的\n",
|
|
|
|
|
|
|
|
"</ul>\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"**LSD方法**\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"对k组中的两组的平均数进行比较,当两组样本容量分别为ni,nj都为时,有\n",
|
|
|
|
|
|
|
|
"<img src=\"assets/20201122182006.png\" width=\"20%\">\n",
|
|
|
|
|
|
|
|
"<img src=\"assets/20201122182022.png\" width=\"20%\">\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"则认为μ1与μ2有显著差异,\n",
|
|
|
|
|
|
|
|
"否则认为它们之间没有显著差异\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"**实例:颜色对销售额的影响**\n",
|
|
|
|
|
|
|
|
"<img src=\"assets/20201122182123.png\" width=\"40%\">\n",
|
|
|
|
|
|
|
|
"<img src=\"assets/20201122182214.png\" width=\"50%\">\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"<img src=\"assets/20201122182231.png\" width=\"30%\">\n",
|
|
|
|
|
|
|
|
"<img src=\"assets/20201122182249.png\" width=\"30%\">\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"<img src=\"assets/20201122182324.png\" width=\"30%\">\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"依据上面结果可得出影响效果\n",
|
|
|
|
|
|
|
|
"\n"
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
|
|
|
"metadata": {},
|
|
|
|
|
|
|
|
"source": [
|
|
|
|
|
|
|
|
"## 多因素方差分析\n",
|
|
|
|
|
|
|
|
"<ul>\n",
|
|
|
|
|
|
|
|
" <li>无交互效应的多因素方差分析\n",
|
|
|
|
|
|
|
|
" <li>有交互效应的多因素方差分析\n",
|
|
|
|
|
|
|
|
"</ul>\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"**主效应与交互效应**\n",
|
|
|
|
|
|
|
|
"<ul>\n",
|
|
|
|
|
|
|
|
" <li>主效应( main effect):各个因素对观测变量的单独影响称为主效应\n",
|
|
|
|
|
|
|
|
" <li>交互效应( interaction effect):各个因素不同水平的搭配所产生的新的影响称为交互效应\n",
|
|
|
|
|
|
|
|
"</ul>\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"**双因素方差分析的类型**\n",
|
|
|
|
|
|
|
|
"<ul>\n",
|
|
|
|
|
|
|
|
" <li>双因素方差分析中因素A和B对结果的影响相互独立时称为无交互效应的双因素方差分析\n",
|
|
|
|
|
|
|
|
" <li>如果除了A和B对结果的单独影响外还存在交互效应,这时的双因素方差分析称为有交互效应的双因素方差分析\n",
|
|
|
|
|
|
|
|
"</ul>\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"**无交互效应的双因素方差分析模型**\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"离差平方和的分解\n",
|
|
|
|
|
|
|
|
"<img src=\"assets/20201122185025.png\" width=\"40%\">\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"<img src=\"assets/20201122184827.png\" width=\"20%\">\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"**有交互效应的双因素方差分析模型**\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"离差平方和的分解\n",
|
|
|
|
|
|
|
|
"<img src=\"assets/20201122184938.png\" width=\"40%\">\n",
|
|
|
|
|
|
|
|
"<img src=\"assets/20201122185044.png\" width=\"20%\">\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"<img src=\"assets/20201122185058.png\" width=\"30%\">\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"**双因素方差分析的步骤**\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"**提出假设**\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"要说明因素A有无显著影响,就是检验如下假设:\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
" Ho:因素A不同水平下观测变量的总体均值无显著差异。\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
" H1:因素A不同水平下观测变量的总体均值存在显著差异。\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"要说明因素B有无显著影响,就是检验如下假设\n",
|
|
|
|
|
|
|
|
" Ho:因素B不同水平下观测变量的总体均值无显著差异\n",
|
|
|
|
|
|
|
|
" \n",
|
|
|
|
|
|
|
|
" H1:因素B不同水平下观测变量的总体均值存在显著差异。\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"在有交互效应的双因素方差中,要说明两个因素的交互效应是否显著,还要检验第三组零假设和备择假设\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
" Ho:因素A和因素B的交互效应对观测变量的总体均值无显著差异。\n",
|
|
|
|
|
|
|
|
" \n",
|
|
|
|
|
|
|
|
" H1:因素A和因素B的交互效应对观测变量的总体均值存在显著差异。\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"**构造统计量**\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"在原假设成立的情况下,三个统计量分别服从自由度为(r-1,rs(m-1))、(s-1,rs(m-1))、(r-1)(s-1)rs(m-1)的F分布\n",
|
|
|
|
|
|
|
|
"<img src=\"assets/20201122185659.png\" width=\"20%\">\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"利用原假设和样本数据分别计算3个F统计量的值和其对应的p值对比p值和α,结合原假设作出推断。若p<a,则拒绝关于这个因素的原假设,得出此因素不同水平下观测变量各总体均值存在显著差异的结论。\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"**实例:**\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"有四个品牌的彩电在五个地区销售,为分析彩电的品牌(品牌因素)和销售地区(地区因素)对销售量是否有影响,对每个品牌在各地区的销售量取得以下数据。试分品牌和销售地区对彩电的销售量是否有显著影响?(q=0.05)\n",
|
|
|
|
|
|
|
|
"<img src=\"assets/20201122185904.png\" width=\"40%\">\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"提出假设对行因素提出的假设为:\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
" HO: μ1=μ2=...=μi=...=μk(μi为第个水平的均值)H1:μi(i=1,2,…,k)不全相等\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"对列因素提出的假设为:\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
" HO: H1=μ1=μ2=...=μj=...=μr(mj为第j个水平的均值)H1:μj(j=1,2,...,r)不全相等\n",
|
|
|
|
|
|
|
|
" \n",
|
|
|
|
|
|
|
|
"**计算各平方和**\n",
|
|
|
|
|
|
|
|
"<img src=\"assets/20201122190203.png\" width=\"40%\">\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"**计算均方**\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"误差平方和除以相应的自由度\n",
|
|
|
|
|
|
|
|
"<ul>\n",
|
|
|
|
|
|
|
|
" <li>总离差平方和SST的自由度为kr-1\n",
|
|
|
|
|
|
|
|
" <li>行因素的离差平方和SSR的自由度为k-1\n",
|
|
|
|
|
|
|
|
" <li>列因素的离差平方和SSc的自由度为r-1\n",
|
|
|
|
|
|
|
|
" <li>随机误差平方和SSE的自由度为(k-1)x(-1)\n",
|
|
|
|
|
|
|
|
"</ul>\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"**计算检验统计量(F)**\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"计算检验统计量(F)\n",
|
|
|
|
|
|
|
|
"<img src=\"assets/20201122190305.png\" width=\"03%\">\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"检验列因素的统计量\n",
|
|
|
|
|
|
|
|
"<img src=\"assets/20201122190448.png\" width=\"20%\">\n",
|
|
|
|
|
|
|
|
"<img src=\"assets/20201122190458.png\" width=\"20%\">\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"FA=18.10777>Fα=34903,拒绝原假设H0,说明彩电的品牌对销售量有显著影响\n",
|
|
|
|
|
|
|
|
"FB=2.100846<Fα=32592,接受原假设H0,说明销售地区对彩电的销售量没有显著影响"
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"execution_count": null,
|
|
|
|