本文整理汇总了Python中org.meteoinfo.data.ArrayMath.lineRegress方法的典型用法代码示例。如果您正苦于以下问题:Python ArrayMath.lineRegress方法的具体用法?Python ArrayMath.lineRegress怎么用?Python ArrayMath.lineRegress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.meteoinfo.data.ArrayMath
的用法示例。
在下文中一共展示了ArrayMath.lineRegress方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: linregress
# 需要导入模块: from org.meteoinfo.data import ArrayMath [as 别名]
# 或者: from org.meteoinfo.data.ArrayMath import lineRegress [as 别名]
def linregress(x, y, outvdn=False):
'''
Calculate a linear least-squares regression for two sets of measurements.
:param x, y: (*array_like*) Two sets of measurements. Both arrays should have the same length.
:param outvdn: (*boolean*) Output validate data number or not. Default is False.
:returns: Result slope, intercept, relative coefficient, two-sided p-value for a hypothesis test
whose null hypothesis is that the slope is zero, standard error of the estimated gradient,
validate data number (remove NaN values).
'''
if isinstance(x, list):
x = MIArray(ArrayUtil.array(x))
if isinstance(y, list):
y = MIArray(ArrayUtil.array(y))
r = ArrayMath.lineRegress(x.asarray(), y.asarray())
if outvdn:
return r[0], r[1], r[2], r[3], r[4], r[5]
else:
return r[0], r[1], r[2], r[3], r[4]