Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

b-spline quantile regression with statsmodels

#!/usr/bin/env python3

import matplotlib.pyplot as plt
import numpy as np
import statsmodels.formula.api as smf


x = np.linspace(0, 2, 100)
y = np.sqrt(x) * np.sin(2 * np.pi * x) + np.random.random_sample(100)

mod = smf.quantreg('y ~ bs(x, df=9)', dict(x=x, y=y))
res = mod.fit(q=0.5)
print(res.summary())

plt.plot(x, y, '.')
plt.plot(x, res.predict(), 'r')
plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: airflow set ui color of operator ui_color 
Python :: comparing dict key with integer 
Python :: Fifth step Creating Advance app in python django 
Python :: python print over the same line 
Python :: len list python 
Python :: receive ouput subprocess call 
Python :: seewave python 
Python :: ytdl python check video length 
Python :: check package without importing it python 
Python :: if statement in python with sets 
Python :: text file sort by first item in each row 
Python :: Make Latest pyhton as default in mac 
Python :: print poo 
Python :: Cannot seem to use import time and import datetime in same script in Python 
Python :: mengetahui informasi statistik dari suatu dataset secara cepat. 
Python :: numpy online practice 
Python :: auto clipping path when upload image using python 
Python :: print all elements of dictionary except one in python 
Python :: crop a video opencv 
Python :: Insert Multiple Images to Excel with Python 
Python :: sum elements array with step numy 
Python :: Print Odd Even Negative Integer Count 
Python :: combine all lines with same value of a column unix 
Python :: py3 dict values 
Python :: compile and train cnn models 
Python :: get the hour of every instance of the date_time 
Python :: fibonacci sequence in python 2.7 
Python :: atan of number python 
Python :: polycarp and coins codeforces solution 
Python :: how to subset a dataframe in python based on multiple categorical values 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =