本文整理汇总了Python中scipy.stats.norm方法的典型用法代码示例。如果您正苦于以下问题:Python stats.norm方法的具体用法?Python stats.norm怎么用?Python stats.norm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块scipy.stats的用法示例。
在下文中一共展示了stats.norm方法的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
点赞 6
# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import norm [as 别名]
def __init__(self,
nbases,
Xdim,
mean=Parameter(norm_dist(), Bound()),
lenscale=Parameter(gamma(1.), Positive()),
regularizer=None,
random_state=None
):
"""See this class's docstring."""
self.random_state = random_state # for repr
self._random = check_random_state(random_state)
self._init_dims(nbases, Xdim)
self._params = [self._init_param(mean),
self._init_param(lenscale)]
self._init_matrices()
super(_LengthScaleBasis, self).__init__(regularizer)
开发者ID:NICTA,项目名称:revrand,代码行数:18,
示例2: conf_int
点赞 6
# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import norm [as 别名]
def conf_int(self, alpha=.05):
"""
Returns the confidence intervals of the marginal effects
Parameters
----------
alpha : float
Number between 0 and 1. The confidence intervals have the
probability 1-alpha.
Returns
-------
conf_int : ndarray
An array with lower, upper confidence intervals for the marginal
effects.
"""
_check_at_is_all(self.margeff_options)
me_se = self.margeff_se
q = stats.norm.ppf(1 - alpha / 2)
lower = self.margeff - q * me_se
upper = self.margeff + q * me_se
return np.asarray(lzip(lower, upper))
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:24,
示例3: test_mixture_rvs_fixed
点赞 6
# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import norm [as 别名]
def test_mixture_rvs_fixed(self):
mix = MixtureDistribution()
np.random.seed(1234)
res = mix.rvs([.15,.85], 50, dist=[stats.norm, stats.norm], kwargs =
(dict(loc=1,scale=.5),dict(loc=-1,scale=.5)))
npt.assert_almost_equal(
res,
np.array([-0.5794956 , -1.72290504, -1.70098664, -1.0504591 ,
-1.27412122,-1.07230975, -0.82298983, -1.01775651,
-0.71713085,-0.2271706 ,-1.48711817, -1.03517244,
-0.84601557, -1.10424938, -0.48309963,-2.20022682,
0.01530181, 1.1238961 , -1.57131564, -0.89405831,
-0.64763969, -1.39271761, 0.55142161, -0.76897013,
-0.64788589,-0.73824602, -1.46312716, 0.00392148,
-0.88651873, -1.57632955,-0.68401028, -0.98024366,
-0.76780384, 0.93160258,-2.78175833,-0.33944719,
-0.92368472, -0.91773523, -1.21504785, -0.61631563,
1.0091446 , -0.50754008, 1.37770699, -0.86458208,
-0.3040069 ,-0.96007884, 1.10763429, -1.19998229,
-1.51392528, -1.29235911]))
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:22,
示例4: test_compare
点赞 6
# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import norm [as 别名]
def test_compare(self):
xx = self.res1.support
kde_vals = [self.res1.evaluate(xi) for xi in xx]
kde_vals = np.squeeze(kde_vals) #kde_vals is a "column_list"
mask_valid = np.isfinite(kde_vals)
# TODO: nans at the boundaries
kde_vals[~mask_valid] = 0
npt.assert_almost_equal(self.res1.density, kde_vals,
self.decimal_density)
# regression test, not compared to another package
nobs = len(self.res1.endog)
kern = self.res1.kernel
v = kern.density_var(kde_vals, nobs)
v_direct = kde_vals * kern.L2Norm / kern.h / nobs
npt.assert_allclose(v, v_direct, rtol=1e-10)
ci = kern.density_confint(kde_vals, nobs)
crit = 1.9599639845400545 #stats.norm.isf(0.05 / 2)
hw = kde_vals - ci[:, 0]
npt.assert_allclose(hw, crit * np.sqrt(v), rtol=1e-10)
hw = ci[:, 1] - kde_vals
npt.asser