MCPcopy Create free account
hub / github.com/Apress/python-for-matlab-development / slope_intercept

Function slope_intercept

code/matlab_py/bridge_WLS.py:33–44  ·  view source on GitHub ↗
(X, Y, W)

Source from the content-addressed store, hash-verified

31import sys
32import statsmodels.api as stats
33def slope_intercept(X, Y, W):
34 if sys.platform == 'win32':
35 os.environ['KMP_DUPLICATE_LIB_OK'] = 'TRUE'
36 Xb = stats.add_constant(X,0)
37 wls = stats.WLS(Y, Xb, weight=W).fit()
38 m_ls, b_ls = wls.params
39 Y_pred = wls.predict(Xb)
40 if sys.platform == 'win32':
41 del os.environ['KMP_DUPLICATE_LIB_OK']
42 return { 'm' : m_ls,
43 'b' : b_ls,
44 'Y_predict' : Y_pred }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected