《数据分析描述性统计分析过程课件.ppt》由会员分享,可在线阅读,更多相关《数据分析描述性统计分析过程课件.ppt(33页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、数据分析描述性统计分析过程第1页,此课件共33页哦几种描述性统计分析的SAS过程和作图过程proc means proc univariate proc corr proc plot/proc gplot proc capability第2页,此课件共33页哦proc means(1)Means过程的语句格式过程的语句格式Means过程的主要控制语句如下:proc means 输入数据集名 ;var变量列表;class 变量列表;byfreq变量列表;变量;weight 变量;id变量列表 ;output ;run;第3页,此课件共33页哦proc means(2)var语句语句规定要求计算简
2、单描述性统计量的数规定要求计算简单描述性统计量的数值变量的次序。by语句语句按按by语句定义的变量进行分组计算其相语句定义的变量进行分组计算其相应的简单统计量,要求输入数据集已按by变量排序。class语句语句与与by语句一样,可用语句一样,可用class变量定义变量定义观测组,分别计算各组观测的描述统计量。输出格式与by不同且事先不需要按class变量排序。freq语句语句指定一个数值型的指定一个数值型的freq变量,它的值变量,它的值表示输入数据集中相应观测出现的频数。weight语句语句规定一个规定一个weight变量,它的值表示变量,它的值表示相应观测的权数。id语句语句在输出数据集中
3、增加一个或几个附加变在输出数据集中增加一个或几个附加变量,目的在于识别输出数据集里的观测。其值为生成这个观测的输入数据集中相应观测组里id变量具有的最大值。第4页,此课件共33页哦ntcvproc means(3)proc means语句中可用的统计量关键字语句中可用的统计量关键字统计量名称含义统计量名称 含义未丢失的观测个数mode众数,出现频数最高的数nmissmeanstderrsumstdvarusscssskewnesskurtosis丢失的观测个数算术平均均值的标准误差加权和标准偏差方差变异系数的百分数加权平方和关于均值偏差的加权平方和对称性的度量偏度对尾部陡平的度量峰度sumwg
4、tmaxminrangemedianprtclmlclmuclm权数和最大值最小值极差,maxmin中间值总体均值等于0的t统计量t分布的双尾p值置信度上限和下限置信度下限置信度上限第5页,此课件共33页哦proc means(4)output语句中的选项。语句中的选项。输出数据集输出数据集名。统计量关键字=变量名列表规定在输出数据集中要包含的统计量并规定这些统计量在新数据集中的变量名。means过程对过程对output语句的次数没有语句的次数没有限制,可以使用几个output语句来创建内容不同的多个数据集。第6页,此课件共33页哦Nproc means(5)SAS程序程序data examp
5、1;input x;cards;70.4 72.0 76.5 74.3 76.5 77.6 67.3 72.0 75.0 74.373.5 79.5 73.5 74.7 65.0 76.5 81.6 75.4 72.7 72.767.2 76.5 72.7 70.4 77.2 68.8 67.3 67.3 67.3 72.775.8 73.5 75.0 72.7 73.5 73.5 72.7 81.6 70.3 74.373.5 79.5 70.4 76.5 72.7 77.2 84.3 75.0 76.5 70.4;proc means data=examp1 n mean cv skewn
6、ess kurtosis range median;var x;run;输出The MEANS ProcedureAnalysis Variable:xMeanVariationSkewnessKurtosisRangeMedian50 73.7460000 5.4083794 0.1540111 0.3581179 19.300000073.5000000第7页,此课件共33页哦proc univariate(1)单变量统计分析对一组单指标实验数据进行分析常采用两种方法:图示法包括茎叶图、盒型图和正态概率图。描述统计量包括矩、分位数、极端值和頻数分布表。第8页,此课件共33页哦proc un
7、ivariate(2)Univariate过程的主要控制语句如下:过程的主要控制语句如下:proc univariate 输入数据集名 ;varbyfreqweightid变量列表变量列表变量 ;变量 ;变量列表;output ;run;第9页,此课件共33页哦proc univariate(3)Univariate过程的主要控制语句如下:过程的主要控制语句如下:proc univariate 输入数据集名 ;varbyfreqweightid变量列表变量列表变量 ;变量 ;变量列表;output ;run;第10页,此课件共33页哦教材1.1例题 examp1_1(SAS程序)data ex
8、amp1_1;input x;cards;74.3 78.8 68.8 78.0 70.4 80.5 80.5 69.7 71.2 73.579.5 75.6 75.0 78.8 72.0 72.0 72.0 74.3 71.2 72.075.0 73.5 78.8 74.3 75.8 65.0 74.3 71.2 69.7 68.073.5 75.0 72.0 64.3 75.8 80.3 69.7 74.3 73.5 73.575.8 75.8 68.8 76.5 70.4 71.2 81.2 75.0 70.4 68.070.4 72.0 76.5 74.3 76.5 77.6 67.3
9、 72.0 75.0 74.373.5 79.5 73.5 74.7 65.0 76.5 81.6 75.4 72.7 72.767.2 76.5 72.7 70.4 77.2 68.8 67.3 67.3 67.3 72.775.8 73.5 75.0 72.7 73.5 73.5 72.7 81.6 70.3 74.373.5 79.5 70.4 76.5 72.7 77.2 84.3 75.0 76.5 70.4;proc univariate data=examp1_1;var x;run;第11页,此课件共33页哦教材1.1例题 examp1_1(SAS结果1)The UNIVARI
10、ATE ProcedureVariable:xMomentsNMeanStd DeviationSkewness100 Sum Weights73.66 Sum Observations3.94008153 Variance0.06007521 Kurtosis100736615.52424240.03386864Uncorrected SS544116.46 Corrected SS1536.9Coeff Variation 5.34901103 Std Error MeanBasic Statistical Measures0.39400815LocationVariabilityMean
11、 73.66000 Std DeviationMedian 73.50000 VarianceMode 73.50000 Range3.9400815.5242420.00000Interquartile Range4.60000第12页,此课件共33页哦教材1.1例题 examp1_1(SAS结果2)The UNIVARIATE ProcedureQuantiles(Definition 5)Quantile100%Max99%95%90%75%Q3Estimate84.3082.9580.5079.1575.8050%Median25%Q110%73.5071.2068.405%1%0%M
12、in67.3064.6564.30第13页,此课件共33页哦proc capability(能力分析过程)PROC CAPABILITY is designed for processcapability analysis,including:Histograms(直方图)and comparative histograms.Cumulative distribution function plots(cdf plots)(累积分布函数).Quantile-quantile plots(Q-Q plots),probabilityplots,and probability-probabilit
13、y plots(P-P plots).These plots facilitate the comparison of a datadistribution with various theoretical distributions.Goodness-of-fit(拟合优度)tests for a variety ofdistributions including the normal.Statistical intervals(prediction,tolerance,andconfidence intervals)for a normal population.第14页,此课件共33页哦
14、教材1.2例题 examp1_4(SAS程序)data examp1_4;input x;cards;74.3 78.8 68.8 78.0 70.4 80.5 80.5 69.7 71.2 73.579.5 75.6 75.0 78.8 72.0 72.0 72.0 74.3 71.2 72.075.0 73.5 78.8 74.3 75.8 65.0 74.3 71.2 69.7 68.073.5 75.0 72.0 64.3 75.8 80.3 69.7 74.3 73.5 73.575.8 75.8 68.8 76.5 70.4 71.2 81.2 75.0 70.4 68.070.4
15、 72.0 76.5 74.3 76.5 77.6 67.3 72.0 75.0 74.373.5 79.5 73.5 74.7 65.0 76.5 81.6 75.4 72.7 72.767.2 76.5 72.7 70.4 77.2 68.8 67.3 67.3 67.3 72.775.8 73.5 75.0 72.7 73.5 73.5 72.7 81.6 70.3 74.373.5 79.5 70.4 76.5 72.7 77.2 84.3 75.0 76.5 70.4;proc capability data=examp1_4;histogram x/normal(mu=est si
16、gma=est);cdfplot/normal(mu=est sigma=est);qqplot x/normal(mu=est sigma=est);run;第15页,此课件共33页哦教材1.2例题 examp1_4(SAS结果)The CAPABILITY ProcedureFitted Normal Distribution for xParameters for Normal DistributionParameter Symbol EstimateMeanMu73.66Std Dev Sigma 3.940082Quantiles for Normal Distribution-Qu
17、antile-Percent Observed Estimated1.0 64.6500 64.49405.0 67.3000 67.179110.0 68.4000 68.610625.0 71.2000 71.002550.0 73.5000 73.660075.0 75.8000 76.317590.0 79.1500 78.709495.0 80.5000 80.140999.0 82.9500 82.8260第16页,此课件共33页哦教材1.2例题 examp1_4(SAS直方图)第17页,此课件共33页哦教材1.2例题 examp1_4(SAS分布函数图)第18页,此课件共33页哦
18、教材1.2例题 examp1_4(SAS qq图)第19页,此课件共33页哦教材1.2例题 examp1_6(SAS程序)data examp1_6;input x;cards;74.3 78.8 68.8 78.0 70.4 80.5 80.5 69.7 71.2 73.579.5 75.6 75.0 78.8 72.0 72.0 72.0 74.3 71.2 72.075.0 73.5 78.8 74.3 75.8 65.0 74.3 71.2 69.7 68.073.5 75.0 72.0 64.3 75.8 80.3 69.7 74.3 73.5 73.575.8 75.8 68.8
19、76.5 70.4 71.2 81.2 75.0 70.4 68.070.4 72.0 76.5 74.3 76.5 77.6 67.3 72.0 75.0 74.373.5 79.5 73.5 74.7 65.0 76.5 81.6 75.4 72.7 72.767.2 76.5 72.7 70.4 77.2 68.8 67.3 67.3 67.3 72.775.8 73.5 75.0 72.7 73.5 73.5 72.7 81.6 70.3 74.373.5 79.5 70.4 76.5 72.7 77.2 84.3 75.0 76.5 70.4;proc univariate data
20、=examp1_6 plot;var x;run;第20页,此课件共33页哦#4教材1.2例题 examp1_6(SAS结果)Stem LeafBoxplot84 3838281 26680 35579 55578 088877 22676 555555575 0000000468888874 33333333773 5555555555572 0000000777777771 222270 3444444469 77768 0088867 233336665 0064 3133343714911148355210|+-+|*-+-*|+-+|0第21页,此课件共33页哦教材1.2例题 exa
21、mp1_8(SAS程序)data examp1_8;input x;cards;25 45 50 54 55 61 64 68 72 75 75 78 79 81 83 8484 84 85 86 86 86 87 89 89 89 90 91 91 92 100;proc univariate data=examp1_8 normal;run;proc capability data=examp1_8 graphics noprint;histogram x/weibull vscale=proportion;run;data delmin;set examp1_8;if x=25 then
22、 delete;run;proc capability data=delmin graphics noprint;histogram x/weibull vscale=proportion;cdfplot x/weibull;run;第22页,此课件共33页哦2教材1.2例题 examp1_8(SAS结果1)Tests for NormalityTest-Statistic-p Value-Shapiro-WilkW 0.863287Pr D W-Sq A-Sq W-Sq A-Sq Chi-Sq W-Sq 0.013Pr A-Sq Chi-Sq 0.073结论:对于删去25的数据集,接受Wei
23、bull分布的假设第23页,此课件共33页哦教材1.2例题 examp1_8(SAS结果2)第24页,此课件共33页哦proc corr(1)proc corr(相关分析过程)用于计算变量之间的相关系数,包括Pearson(皮尔逊)的乘积矩相关和加权乘积矩相关。还能产生三个非参数的关联测量:Spearman的秩相关,Kendall的tau-b和Hoeffding的相关性度量D。proc corr语句调用corr过程,且是唯一必须的语句。如果只使用proc corr这一条的语句,过程计算输入数据集中所有数值变量之间的相关系数。其余语句是供选择的。第25页,此课件共33页哦proc corr(2)
24、proc corr过程一般由下列语句控制:proc corrvarwithpartialweightfreqByrun;data=数据集;变量列表;变量列表 ;变量列表;变量 ;变量 ;变量列表 ;第26页,此课件共33页哦教材1.3例题 examp1_9(SAS程序)data examp1_9;input x y;cards;68 971 63 892 70 1125 6 8265 931 9 112 10 162 12 32120 315 30 375 33 462 27 35221 305 5 84 14 229 27 33217 185 53 703 62 872 65 740;run
25、;proc corr data=examp1_9 pearson spearman cov;run;run;第27页,此课件共33页哦xyNxy教材1.3例题 examp1_9(SAS结果1)The CORR Procedure2 Variables:xyCovariance Matrix,DF=19x570.45007845.0789y7845.0789112404.2632Simple StatisticsVariable20Mean33.85000Std Dev23.88410Median27.00000Minimum5.00000Maximum70.0000020477.5000033
26、5.26745 342.00000 82.000001125第28页,此课件共33页哦xyxy教材1.3例题 examp1_9(SAS结果2)The CORR ProcedurePearson Correlation Coefficients,N=20Prob|r|under H0:Rho=0 x1.000000.97971y0.97971.00011.00000|r|under H0:Rho=0 x1.000000.97366.0001y0.97366|r|under H0:Rho=0 x1x2x3x4x5x6x1x2x3x4x5x61.000000.87024.0001-0.365760.
27、1128-0.389690.0894-0.493080.0272-0.226300.33740.87024|r|under H0:Rho=0 x1x2x3x4x5x6x1x2x3x4x5x61.000000.81423.0001-0.370700.1076-0.380200.0982-0.577740.0076-0.199020.40020.81423.00011.00000-0.237700.3129-0.541900.0136-0.724730.0003-0.199400.3993-0.370700.1076-0.237700.31291.000000.136620.56570.179240.44960.098410.6798-0.380200.0982-0.541900.01360.136620.56571.000000.656200.00170.322630.1653-0.577740.0076-0.724730.00030.179240.44960.656200.00171.000000.695210.0007-0.199020.4002-0.199400.39930.098410.67980.322630.16530.695210.00071.00000问题:变量之间的相关性如何?第33页,此课件共33页哦
限制150内