Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import pylab as plt
- import statsmodels.api as sm
- x = np.linspace(0,2*np.pi,100)
- y = np.sin(x) + np.random.random(100) * 0.2
- lowess = sm.nonparametric.lowess(y, x, frac=0.1)
- plt.plot(x, y, '+')
- plt.plot(lowess[:, 0], lowess[:, 1])
- plt.show()
- import numpy as np
- import pylab as plt
- import statsmodels.api as sm
- x = np.linspace(0,2*np.pi,100)
- y = np.sin(x) + np.random.random(100) * 0.4
- l = loess(x,y)
- l.fit()
- pred = l.predict(x, stderror=True)
- conf = pred_obj.confidence()
- lowess = pred_obj.values
- ll = conf.lower
- ul = conf.upper
- plt.plot(x, y, '+')
- plt.plot(x, lowess)
- plt.fill_between(x,ll,ul,alpha=.33)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement