日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程语言 > python >内容正文

python

python绘制dca曲线_Python数据处理从零开始----第四章(可视化)(9)线性相关曲线...

發(fā)布時(shí)間:2024/3/24 python 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python绘制dca曲线_Python数据处理从零开始----第四章(可视化)(9)线性相关曲线... 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

原文:Python數(shù)據(jù)處理從零開(kāi)始----第四章(可視化)(9)線性相關(guān)曲線?www.jianshu.com

===============================================

通過(guò)python我們可以繪制兩個(gè)變量的相關(guān)圖,我所使用的是皮爾森相關(guān),主要的參數(shù)是:①r相關(guān)系數(shù)②P值。一般對(duì)P值的評(píng)判標(biāo)準(zhǔn)是P< 0.05簡(jiǎn)單的相關(guān)系數(shù)的分類

0.8-1.0 極強(qiáng)相關(guān)

0.6-0.8 強(qiáng)相關(guān)

0.4-0.6 中等程度相關(guān)

0.2-0.4 弱相關(guān)

0.0-0.2 極弱相關(guān)或無(wú)相關(guān)

r描述的是兩個(gè)變量間線性相關(guān)強(qiáng)弱的程度。r的取值在-1與+1之間,若r>0,表明兩個(gè)變量是正相關(guān),即一個(gè)變量的值越大,另一個(gè)變量的值也會(huì)越大;若r<0,表明兩個(gè)變量是負(fù)相關(guān),即一個(gè)變量的值越大另一個(gè)變量的值反而會(huì)越小。r 的絕對(duì)值越大表明相關(guān)性越強(qiáng),要注意的是這里并不存在因果關(guān)系。

基礎(chǔ)擬合曲線繪制

# -*- coding: utf-8 -*- """ Created on Mon Nov 19 00:57:53 2018 @author: czh """ # In[*] #導(dǎo)入各種需要的包# import numpy as np import matplotlib.pyplot as plt from scipy import optimize import seaborn as sns sns.set() # In[*] import seaborn as sns sns.set(style="darkgrid") tips = sns.load_dataset("tips") g = sns.jointplot("total_bill", "tip", data=tips, kind="reg", xlim=(0, 60), ylim=(0, 12), color="m", height=7)

這是通過(guò)python語(yǔ)言繪制的線性相關(guān)曲線擬合圖,感覺(jué)比R語(yǔ)言在代碼上更簡(jiǎn)潔,且圖片能展示的信息更多。

多分組擬合曲線繪制

# -*- coding: utf-8 -*- """ Created on Mon Nov 19 00:57:53 2018 @author: czh """ # In[*] #導(dǎo)入各種需要的包# import numpy as np import matplotlib.pyplot as plt from scipy import optimize import seaborn as sns sns.set() # In[*] # Load the iris dataset iris = sns.load_dataset("iris") # Plot sepal with as a function of sepal_length across days g = sns.lmplot(x="sepal_length", y="sepal_width",hue='species', truncate=True, height=5, data=iris) # Use more informative axis labels than are provided by default g.set_axis_labels("Sepal length (mm)", "Sepal width (mm)")

多變量子圖擬合曲線繪制

# -*- coding: utf-8 -*- """ Created on Wed Dec 26 11:17:56 2018 @author: czh """ %reset -f %clear # In[*] from matplotlib import pyplot as plt import numpy as np import pandas as pd import lifelines as ll from IPython.display import HTML %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns import plotly.plotly as py import plotly.tools as tls from plotly.graph_objs import * import os from scipy import stats from lifelines.estimation import KaplanMeierFitter kmf = KaplanMeierFitter() from lifelines.statistics import logrank_test from sklearn.preprocessing import StandardScaler os.chdir("D:\\Rwork\\third\\Fig2") # In[*] # Import Data df = pd.read_csv("https://raw.githubusercontent.com/selva86/datasets/master/mpg_ggplot2.csv") df_select = df.loc[df.cyl.isin([4,8]), :] # Each line in its own column sns.set_style("white") gridobj = sns.lmplot(x="displ", y="hwy", data=df_select, height=7, robust=True, palette='Set1', col="cyl", scatter_kws=dict(s=60, linewidths=.7, edgecolors='black')) # Decorations gridobj.set(xlim=(0.5, 7.5), ylim=(0, 50)) plt.show()

總結(jié)

以上是生活随笔為你收集整理的python绘制dca曲线_Python数据处理从零开始----第四章(可视化)(9)线性相关曲线...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。