零对数正态总体均值比的同时cis
LN0SCIs的Python项目详细描述
LN0SCIS
jing xu,李新民,华良
简介
这个python包基于xu等人的关于对数正态总体均值与零之比的同时置信区间的论文。给出了多零点对数正态总体均值比的同时置信区间的构造方法。最后,我们选择了4种基于广义关键量和两步移动区间的最优方法。为了使用方便,我们制作了一个名为ln0scis的python包,它在cran上还有一个r版本的包:https://CRAN.R-project.org/package=LN0SCIs
- 如果您是r用户,可以通过github在r内核中安装:
- devtools::安装github('dataxujing/ln0scis')
- 或者也可以通过cran安装:
- 安装.packages('ln0scis')
- 如果您是python用户,则可以
- pip安装ln0scis
方法
我们在ln0scis包中提供了四个主要函数:fgw()、fgh()、moverw()和moverh(),如果您想深入了解这四种方法,可以阅读我们的论文:带零对数正态总体平均数比的同时置信区间。我们信任github的代码。如果你想知道如何实现它们,你可以阅读源代码。
示例
- fgw()
from LN0SCIs import * #Example1: alpha = 0.05 p = np.array([0.2,0.2,0.2]) n = np.array([30,30,30]) mu = np.array([0,0,0]) sigma = np.array([1,1,1]) N = 1000 FGW(n,p,mu,sigma,N) #Example2: p = np.array([0.1,0.1,0.1,0.1]) n = np.array([30,30,30,30]) mu = np.array([0,0,0,0]) sigma = np.array([1,1,1,1]) C2 = np.array([[-1,1,0,0],[-1,0,1,0],[-1,0,0,1],[0,-1,1,0],[0,-1,0,1],[0,0,-1,1]]) N = 1000 FGW(n,p,mu,sigma,N,C2 = C2)
====================Method: FGW===================== The Simultaneous Confidence Intervals are: The1th CIs The2th CIs The3th CIs 0 【-0.843638,0.789044】 【-0.629208,1.075959】 【-0.604469,1.158544】 **********************Time************************** The cost time is:0 secs ====================Method: FGW===================== The Simultaneous Confidence Intervals are: The1th CIs The2th CIs The3th CIs \ 0 【-0.912169,1.578679】 【-1.02404,0.812882】 【-0.83778,1.382352】 The4th CIs The5th CIs The6th CIs 0 【-1.597962,0.650222】 【-1.337939,1.203199】 【-0.546039,1.25945】 **********************Time************************** The cost time is:0 secs
- fgh()
alpha = 0.05 p = np.array([0.2,0.2,0.2]) n = np.array([30,30,30]) mu = np.array([0,0,0]) sigma = np.array([1,1,1]) N = 1000 FGH(n,p,mu,sigma,N) #Example2: p = np.array([0.1,0.1,0.1,0.1]) n = np.array([30,30,30,30]) mu = np.array([0,0,0,0]) sigma = np.array([1,1,1,1]) C2 = np.array([[-1,1,0,0],[-1,0,1,0],[-1,0,0,1],[0,-1,1,0],[0,-1,0,1],[0,0,-1,1]]) N = 1000 FGH(n,p,mu,sigma,N,C2 = C2)
====================Method: FGH===================== The Simultaneous Confidence Intervals are: The1th CIs The2th CIs The3th CIs 0 【-0.992276,1.455247】 【-0.703231,1.372774】 【-1.005873,1.124758】 **********************Time************************** The cost time is:0 secs ====================Method: FGH===================== The Simultaneous Confidence Intervals are: The1th CIs The2th CIs The3th CIs \ 0 【-1.62426,0.624984】 【-1.514528,0.553936】 【-1.565943,0.911157】 The4th CIs The5th CIs The6th CIs 0 【-0.66646,1.010746】 【-0.829753,1.269381】 【-0.762683,1.07889】 **********************Time************************** The cost time is:0 secs
- moverw()
alpha = 0.05 p = np.array([0.2,0.2,0.2]) n = np.array([30,30,30]) mu = np.array([0,0,0]) sigma = np.array([1,1,1]) N = 1000 MOVERW(n,p,mu,sigma,N) #Example2: p = np.array([0.1,0.1,0.1,0.1]) n = np.array([30,30,30,30]) mu = np.array([0,0,0,0]) sigma = np.array([1,1,1,1]) C2 = np.array([[-1,1,0,0],[-1,0,1,0],[-1,0,0,1],[0,-1,1,0],[0,-1,0,1],[0,0,-1,1]]) N = 1000 MOVERW(n,p,mu,sigma,N,C2 = C2)
====================Method: FGH===================== The Simultaneous Confidence Intervals are: The1th CIs The2th CIs The3th CIs 0 【-1.103496,1.211033】 【-1.030952,0.888781】 【-1.314926,1.059975】 **********************Time************************** The cost time is:0 secs ====================Method: FGH===================== The Simultaneous Confidence Intervals are: The1th CIs The2th CIs The3th CIs \ 0 【-1.68825,0.349316】 【-1.270833,1.236153】 【-1.304731,1.053776】 The4th CIs The5th CIs The6th CIs 0 【-0.349427,1.679719】 【-0.364992,1.484843】 【-1.294225,1.071433】 **********************Time************************** The cost time is:0 secs
- 移动右侧()
alpha = 0.05 p = np.array([0.2,0.2,0.2]) n = np.array([30,30,30]) mu = np.array([0,0,0]) sigma = np.array([1,1,1]) N = 1000 MOVERH(n,p,mu,sigma,N) #Example2: p = np.array([0.1,0.1,0.1,0.1]) n = np.array([30,30,30,30]) mu = np.array([0,0,0,0]) sigma = np.array([1,1,1,1]) C2 = np.array([[-1,1,0,0],[-1,0,1,0],[-1,0,0,1],[0,-1,1,0],[0,-1,0,1],[0,0,-1,1]]) N = 1000 MOVERH(n,p,mu,sigma,N,C2 = C2)
====================Method: FGH===================== The Simultaneous Confidence Intervals are: The1th CIs The2th CIs The3th CIs 0 【-1.013305,0.765726】 【-1.152934,0.823283】 【-0.914194,0.8239】 **********************Time************************** The cost time is:0 secs ====================Method: FGH===================== The Simultaneous Confidence Intervals are: The1th CIs The2th CIs The3th CIs \ 0 【-0.681666,1.693927】 【-0.750657,1.458978】 【-1.21012,0.855608】 The4th CIs The5th CIs The6th CIs 0 【-1.302431,1.003355】 【-1.762379,0.407925】 【-1.527028,0.467458】 **********************Time************************** The cost time is:0 secs
支持
在Python2.7、3.5、3.6上测试
- pip安装ln0scis
- 下载:https://pypi.python.org/pypi/LN0SCIs
- 文档:https://github.com/DataXujing/LN0SCIs
- 它有一个我们已经创建的r包版本,您可以看到详细信息:https://CRAN.R-project.org/package=LN0SCIs
你可以登录徐静的主页https://dataxujing.coding.me或https://dataxujing.github.io找到作者,如果你想了解更多关于混合分布同时置信区间的知识,你应该读一读徐静、李新民、华亮的论文《零对数正态总体均值比的模拟置信区间》。