矩估计

极大似然估计

中心极限定理

假设检验

假设检验均值[样本_,检验目标_,方差_:None]:=Block[
{mean,目标值,n,Z,t,S},
mean=Mean@样本;
Echo[mean,"平均值=="];
目标值=Last@检验目标;
Echo[目标值,"目标值=="];
n=Length@样本;
Echo[n,"n=="];
Echo[方差,"方差=="];
Which[
NumericQ[方差] &&Head@检验目标===Equal,(*双侧 ,有方差,Z 统计量，done*)
{
Echo["使用 Z 统计量,双侧检验"];
Z=((mean-目标值)/(方差/Sqrt[n]));
Echo[Z,"Z=="];
Echo[Hold[((OverBar[X]-(Subscript[µ, 0]))/(σ/Sqrt[n]))]==Z];
Echo[Abs@InverseCDF[NormalDistribution[],0.025]];
If[Abs@Z<Abs@InverseCDF[NormalDistribution[],0.025],Echo["在拒绝域外，可以接受"],Echo["在拒绝域内，不接受"]]
},
方差==None &&Head@检验目标===Equal,(*双侧 ,无方差,t 统计量,done*)
{
S=Variance@样本;
Echo[S,"S=="];
 Echo["使用 t 统计量,双侧检验"];
t=((mean-目标值)/(S/Sqrt[n]));
Echo[Hold[((OverBar[X]-(Subscript[µ, 0]))/(S/Sqrt[n]))]==t];
Echo[Abs@InverseCDF[StudentTDistribution[n-1],0.05],"(Subscript[t, 0.05])("<>ToString[n-1]<>")=="];
If[Abs@t<Abs@InverseCDF[StudentTDistribution[n-1],0.025],Echo["在拒绝域外，可以接受"],Echo["在拒绝域内，不接受"]];
},
NumericQ[方差] && (Head@检验目标=!=Equal),(*单侧 ,有方差,Z 统计量*)
{
 Echo["使用 Z 统计量,单侧检验"];
Z=((mean-目标值)/(方差/Sqrt[n]));

Echo[Hold[((OverBar[X]-(Subscript[µ, 0]))/(σ/Sqrt[n]))]==Z];
Echo[Abs@InverseCDF[NormalDistribution[],0.05]];
If[Abs@Z<Abs@InverseCDF[NormalDistribution[],0.05],Echo["在拒绝域外，可以接受"],Echo["在拒绝域内，不接受"]]
},
方差==None ,(*单侧 ,无方差,t 统计量*)
{
S=Variance@样本;
Echo[S,"S=="];
 Echo["使用 t 统计量,单侧检验"];
t=((mean-目标值)/(S/Sqrt[n]));
Echo[Hold[((OverBar[X]-(Subscript[µ, 0]))/(S/Sqrt[n]))]==t];
Echo[Abs@InverseCDF[StudentTDistribution[n-1],0.05],"(Subscript[t, 0.05])("<>ToString[n-1]<>")=="];
If[Abs@t<Abs@InverseCDF[StudentTDistribution[n-1],0.05],Echo["在拒绝域外，可以接受"],Echo["在拒绝域内，不接受"]]
}
];
];
假设检验均值[{159,280,101,212,224,379,179,264,222,362,168,250,149,260,485,170},寿命>=225,50]
假设检验均值[{159,280,101,212,224,379,179,264,222,362,168,250,149,260,485,170},寿命<=225]
假设检验均值[{159,280,101,212,224,379,179,264,222,362,168,250,149,260,485,170},寿命==225,50]
假设检验均值[{159,280,101,212,224,379,179,264,222,362,168,250,149,260,485,170},寿命==225]

t≥7

t==7//Head//#===Equal&

InverseCDF[[],0.025]