国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > Python > 正文

python 實現(xiàn)檢驗33品種數(shù)據(jù)是否是正態(tài)分布

2024-09-09 19:03:12
字體:
來源:轉載
供稿:網友

我就廢話不多說了,直接上代碼吧!

# -*- coding: utf-8 -*-"""Created on Thu Jun 22 17:03:16 2017@author: yunjinqi  E-mail:yunjinqi@qq.com  Differentiate yourself in the world from anyone else."""import pandas as pdimport numpy as npimport matplotlib.pyplot as pltimport statsmodels.tsa.stattools as tsimport statsmodels.api as smfrom statsmodels.graphics.api import qqplotfrom statsmodels.sandbox.stats.runs import runstest_1sampimport scipy.stats as sts  namelist=['cu','al','zn','pb','sn','au','ag','rb','hc','bu','ru','m9','y9','a9',    'p9','c9','cs','jd','l9','v9','pp','j9','jm','i9','sr','cf',    'zc','fg','ta','ma','oi','rm','sm']j=0for i in namelist:  filename='C:/Users/HXWD/Desktop/數(shù)據(jù)/'+i+'.csv' data=pd.read_csv(filename,encoding='gbk') data.columns=['date','open','high','low','close','amt','opi'] data.head() data=np.log(data['close']) r=data-data.shift(1) r=r.dropna() #print(r) rate = np.array(list(r)) print('品種{}數(shù)據(jù)長度{}均值{}標準差{}方差{}偏度{}峰度{}'.format(i,len(rate),   rate.mean(),rate.std(),rate.var(),sts.skew(rate),   sts.kurtosis(rate)))
#結果品種cu數(shù)據(jù)長度4976均值0.00012152573153376814標準差0.014276535327917023方差0.0002038194609692628偏度-0.16028824462338614峰度2.642455989417427品種al數(shù)據(jù)長度5406均值-2.3195089066551237e-05標準差0.009053990835143359方差8.197475004285994e-05偏度-0.34748915595295604峰度5.083890815632417品種zn數(shù)據(jù)長度2455均值-0.00011823058103745542標準差0.016294570963077237方差0.00026551304287075983偏度-0.316153612624431峰度1.7208737518119293品種pb數(shù)據(jù)長度1482均值-9.866770650275384e-05標準差0.011417348325010642方差0.0001303558427746233偏度-0.21599833469407717峰度5.878332673854807品種sn數(shù)據(jù)長度510均值0.00034131697514080907標準差0.013690993291257949方差0.00018744329730127014偏度0.024808842588775293峰1.072347367872859品種au數(shù)據(jù)長度2231均值0.0001074021979121701標準差0.012100456199756058方差0.00014642104024221482偏度-0.361814930575112峰度4.110915875328322品種ag數(shù)據(jù)長度1209均值-0.0003262089978362889標準差0.014853094655086982方差0.00022061442083297348偏度-0.2248883178719188峰度4.296247290616826品種rb數(shù)據(jù)長度1966均值-6.984154093694264e-05標準差0.013462363746262961方差0.00018123523763669528偏度0.07827546016742666峰度5.198115698123077品種hc數(shù)據(jù)長度758均值-7.256339078572361e-05標準差0.01710980071993581方差0.000292745280675916偏度-0.08403481899486816峰度3.6250669416786323品種bu數(shù)據(jù)長度864均值-0.0006258998207218544標準差0.01716581014361468方差0.0002946650378866246偏度-0.41242405508236435峰度2.437556911829674品種ru數(shù)據(jù)長度4827均值5.17426767764321e-05標準差0.016747187916000945方差0.00028046830309384806偏度-0.1986573449586119峰度1.736876616149547品種m9數(shù)據(jù)長度4058均值8.873778774208505e-05標準差0.012812626470272115方差0.0001641633970667177偏度-0.12119836197638824峰度2.159984922606264品種y9數(shù)據(jù)長度2748均值4.985975458693667e-05標準差0.012855191360434762方差0.00016525594491339655偏度-0.33456507243405786峰度2.566586342814616品種a9數(shù)據(jù)長度5392均值9.732600802295795e-05標準差0.010601259945310599方差0.00011238671242804687偏度-0.08768586026629852峰度3.898562231789457品種p9數(shù)據(jù)長度2311均值-0.00021108840931287863標準差0.014588073181583774方差0.00021281187915124373偏度-0.2881364812318466峰度1.693401619226936品種c9數(shù)據(jù)長度3075均值0.00010060972262212708標準差0.007206853641314312方差5.1938739407325355e-05偏度-5.204419912904765e-05峰6.074899127691497品種cs數(shù)據(jù)長度573均值-0.0006465907683602394標準差0.011237570390237955方差0.00012628298827555283偏度0.10170996173895988峰度1.176384982024672品種jd數(shù)據(jù)長度847均值-9.035290965408637e-05標準差0.01167344224455134方差0.00013626925383687581偏度-0.0682866825422671峰度2.0899893901516133品種l9數(shù)據(jù)長度2370均值-0.00014710186232216803標準差0.014902467199956509方差0.00022208352864577958偏度-0.2105262196327885峰度1.8796065573836品種v9數(shù)據(jù)長度1927均值-5.190379527562386e-05標準差0.010437020362123387方差0.00010893139403937818偏度-0.050531345744352064峰度3.47595007264211品種pp數(shù)據(jù)長度773均值-0.0003789841804842144標準差0.01439578332841083方差0.00020723857763855122偏度0.05479337073436029峰度1.3397870170464232品種j9數(shù)據(jù)長度1468均值-0.00021854062264841954標準差0.01639429047795793方差0.000268772760275662偏度-0.10048542944058193峰度5.156597958913997品種jm數(shù)據(jù)長度997均值-0.00011645794468155402標準差0.01792430947223131方差0.000321280870056321偏度0.0010592028961588294峰度3.743159578760195品種i9數(shù)據(jù)長度862均值-0.0007372124442033161標準差0.021187573227350754方差0.0004489132592643504偏度0.00014411506989559858峰度1.585951370650品種sr數(shù)據(jù)長度2749均值0.00012213466321006727標準差0.012183745931527473方差0.00014844366492401223偏度-0.038613285961243735峰度2.520231613626品種cf數(shù)據(jù)長度3142均值2.2008517526768612e-05標準差0.010657271857464626方差0.00011357744344390753偏度-0.034412876065561426峰度5.6421501855702品種zc數(shù)據(jù)長度475均值0.00041282070613302206標準差0.015170141171075784方差0.00023013318315036853偏度-0.1393361750238265峰度1.2533894316392926品種fg數(shù)據(jù)長度1068均值-1.57490340832121e-05標準差0.013148411070446203方差0.00017288071367743227偏度0.008980132282547534峰度1.9028507879273144品種ta數(shù)據(jù)長度2518均值-0.00023122774877981512標準差0.013637519813532077方差0.00018598194666447998偏度-0.9126347458178135峰度10.954670464918品種ma數(shù)據(jù)長度700均值-0.00024988691257348835標準差0.015328611435734359方差0.00023496632854772616偏度0.0164362832185746峰度1.1736088397060品種oi數(shù)據(jù)長度1098均值-0.0004539513793265549標準差0.009589990427720812方差9.196791640377678e-05偏度-0.28987574371279706峰度3.871322266527967品種rm數(shù)據(jù)長度1049均值1.458523923966432e-05標準差0.013432556545527753方差0.00018043357534880047偏度-0.053300026893851014峰度1.3938292783638品種sm數(shù)據(jù)長度548均值-3.179600698107184e-05標準差0.020018458278106444方差0.00040073867183228846偏度-2.6734390275887647峰度31.533801188366837#正態(tài)分布的偏度應該是0,峰度是3,所以,不滿者這些的都是非標準正態(tài)分布
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 文安县| 格尔木市| 河间市| 福建省| 个旧市| 阿拉尔市| 新兴县| 本溪市| 宕昌县| 泊头市| 康保县| 简阳市| 天水市| 黄冈市| 遵义市| 盐边县| 页游| 交口县| 稷山县| 牙克石市| 银川市| 灵川县| 安达市| 横山县| 潮安县| 张家川| 丰城市| 霍城县| 五莲县| 蓝田县| 酉阳| 台东市| 保定市| 铜山县| 新营市| 城口县| 安新县| 平潭县| 田东县| 富宁县| 龙胜|