当前位置:网站首页>SAS判别分析(Bayes准则和proc discrim过程)
SAS判别分析(Bayes准则和proc discrim过程)
2022-06-11 00:18:00 【我的思路很明确】
下表给出了两类公司的有关金融数据,一类是破产公司,表中数据是这些公司在破产前两年的四个年金融指标。一类是未破产公司和破产公司大约相同时期的四个相同的金融指标。这四个指标是

各公司的数据如下表(表中最后一列的“0”表示破产公司,“1”表示非破产公司)
| number | x1 | x2 | x3 | x4 | group |
| 1 | -0.45 | -0.41 | 1.09 | 0.45 | 0 |
| 2 | -0.56 | -0.31 | 1.51 | 0.16 | 0 |
| 3 | 0.06 | 0.02 | 1.01 | 0.4 | 0 |
| 4 | -0.07 | -0.09 | 1.45 | 0.26 | 0 |
| 5 | -0.1 | -0.09 | 1.56 | 0.67 | 0 |
| 6 | -0.14 | -0.07 | 0.71 | 0.28 | 0 |
| 7 | 0.04 | 0.01 | 1.5 | 0.71 | 0 |
| 8 | -0.06 | -0.06 | 1.37 | 0.4 | 0 |
| 9 | 0.07 | -0.01 | 1.37 | 0.34 | 0 |
| 10 | -0.13 | -0.14 | 1.42 | 0.44 | 0 |
| 11 | -0.23 | -0.3 | 0.33 | 0.18 | 0 |
| 12 | 0.07 | 0.02 | 1.31 | 0.25 | 0 |
| 13 | 0.01 | 0 | 2.15 | 0.7 | 0 |
| 14 | -0.28 | -0.23 | 1.19 | 0.66 | 0 |
| 15 | 0.15 | 0.05 | 1.88 | 0.27 | 0 |
| 16 | 0.37 | 0.11 | 1.99 | 0.38 | 0 |
| 17 | -0.08 | -0.08 | 1.51 | 0.42 | 0 |
| 18 | 0.05 | 0.03 | 1.68 | 0.95 | 0 |
| 19 | 0.01 | 0 | 1.26 | 0.6 | 0 |
| 20 | 0.12 | 0.11 | 1.14 | 0.17 | 0 |
| 21 | -0.28 | -0.27 | 1.27 | 0.51 | 0 |
| 1 | 0.51 | 0.1 | 2.49 | 0.54 | 1 |
| 2 | 0.08 | 0.02 | 2.01 | 0.53 | 1 |
| 3 | 0.38 | 0.11 | 3.27 | 0.35 | 1 |
| 4 | 0.19 | 0.05 | 2.25 | 0.33 | 1 |
| 5 | 0.32 | 0.07 | 4.24 | 0.63 | 1 |
| 6 | 0.31 | 0.05 | 4.45 | 0.69 | 1 |
| 7 | 0.12 | 0.05 | 2.52 | 0.69 | 1 |
| 8 | -0.02 | 0.02 | 2.05 | 0.35 | 1 |
| 9 | 0.22 | 0.08 | 2.35 | 0.4 | 1 |
| 10 | 0.17 | 0.07 | 1.8 | 0.52 | 1 |
| 11 | 0.15 | 0.05 | 2.17 | 0.55 | 1 |
| 12 | -0.1 | -0.01 | 2.5 | 0.58 | 1 |
| 13 | 0.14 | -0.03 | 0.46 | 0.26 | 1 |
| 14 | 0.14 | 0.07 | 2.61 | 0.52 | 1 |
| 15 | 0.15 | 0.06 | 2.23 | 0.56 | 1 |
| 16 | 0.16 | 0.05 | 2.31 | 0.2 | 1 |
| 17 | 0.29 | 0.06 | 1.84 | 0.38 | 1 |
| 18 | 0.54 | 0.11 | 2.33 | 0.48 | 1 |
| 19 | -0.33 | -0.09 | 3.01 | 0.47 | 1 |
| 20 | 0.48 | 0.09 | 1.24 | 0.18 | 1 |
| 21 | 0.56 | 0.11 | 4.29 | 0.45 | 1 |
| 22 | 0.2 | 0.08 | 1.99 | 0.3 | 1 |
| 23 | 0.47 | 0.16 | 2.92 | 0.45 | 1 |
| 24 | 0.17 | 0.04 | 2.45 | 0.14 | 1 |
| 25 | 0.58 | 0.04 | 5.06 | 0.13 | 1 |

实验代码:
proc import out=temp1
datafile="C:\Users\86166\Desktop\IT\SAS实验\实验9\1.xls"
DBMS=EXCEL2000 replace;
run;
/*1、2、3*/
proc discrim data=temp1 wcov simple pool=no manova method=normal crosslisterr listerr;
class group;
var x1-x2;
priors equal;
run;
/*4*/
proc discrim data=temp1 pool=no manova method=normal crosslisterr listerr;
class group;
var x1-x2;
priors '0'=0.05 '1'=0.95;
run;
/*5*/
proc discrim data=temp1 pool=yes manova method=normal crosslisterr listerr;
class group;
var x1-x2;
priors equal;
run;
/*6*/
proc discrim data=temp1 wcov simple pool=no manova method=normal crosslisterr listerr;
class group;
var x1 x3;
priors equal;
run;
proc discrim data=temp1 pool=no manova method=normal crosslisterr listerr;
class group;
var x1 x3;
priors '0'=0.05 '1'=0.95;
run;
proc discrim data=temp1 wcov simple pool=no manova method=normal crosslisterr listerr;
class group;
var x1 x4;
priors equal;
run;
proc discrim data=temp1 pool=no manova method=normal crosslisterr listerr;
class group;
var x1 x4;
priors '0'=0.05 '1'=0.95;
run;
/*7*/
proc discrim data=temp1 wcov simple pool=no manova method=normal crosslisterr listerr;
class group;
var x1-x4;
priors equal;
run;
proc discrim data=temp1 pool=no manova method=normal crosslisterr listerr;
class group;
var x1-x4;
priors '0'=0.05 '1'=0.95;
run;实验结果:——》判别分析代码图片结果和数据集
分析实验结果:





实验中存在的问题及解决的办法:
问题:怎么判定不同先验概率条件下得到的结果更可靠?
解决:目前直接用的是误判概率大小来比较
实验体会(结论、评价、感想与建议)
- simple获取均值等简单统计量,wcov获取组内协方差,pool=yes/no/test分别对应使用联合协方差矩阵,组内协方差矩阵,组内协方差矩阵的齐性检验。manova得到4个统计量,Wilks'lambda用来衡量组内平方和与总平方和之比,Wilks'lambda值大,表示各个组的均值基本相等,在判别分析中,只有组均值不等时,判别分析才有意义。
- crosslisterr listerr分别采用最大后验概率,刀切法求误判概率,method=normal指定了总体是正态分布的,priors equal指定先验概率是相等,也可以按分类的内容指定不同类的先验概率。
- 当总体属于正态分布时,若总体之间的协方差矩阵不相等,则采用组内协方差矩阵,pool=no,method=normal,priors可以相等,也可以按频数或者特殊值指定;若总体之间的协方差矩阵相等,则采用联合协方差矩阵,pool=yes,method=normal,priors可以相等,也可以按频数或者特殊值指定。一般小样本优先推荐用联合协方差矩阵,先验概率一般指定相等。当总体不属于正态分布时method=npar,采用非参数法进行判别。
- 总体和每个类的均值向量可以由simple得到
wcov得到组内协方差,也就是样本协方差
pcov得到合并协方差,这两种协方差的对应的使用条件与pool关联
pool为yes的时候采用合并协方差矩阵,意味着对应的总体协方差矩阵不相同
为no的时候采用组内协方差矩阵,意味着对应的总体均服从协方差矩阵相等的正态总体
为test的时候对组内协方差矩阵进行齐性的似然比检验修正,和slpool用来指定齐性检验水平,默认0.1
method为normal表示类服从多元正态分布,为npar即不服从该分布采用非参数方法
crosslisterr以交叉表的形式输出回判结果,用的是刀切法
listerr由后验概率产生的回判错误信息,要求按距离准则得到判别结果
priors为equal表示先验概率相等,为proportional表示先验概率等于样本频率,也可以指定分类标志的先验概率,但总和为1
比较判别准则的好坏,看误判结果的Total选项,一般来说谁更小则谁的准则更好
边栏推荐
猜你喜欢

【VBA脚本】提取word文档中所有批注的信息和待解决状态

Summary of pytorch classification problems

网络基础(1)-----认识网络

IRS application release 16: H5 application design guide
![[persistent problems of NVIDIA driver] - - /dev/sdax:clean, xxx/xxx files, xxx/xxx blocks - the most complete solution](/img/0e/8c79f7c77f61dfa9a155ab33b77081.png)
[persistent problems of NVIDIA driver] - - /dev/sdax:clean, xxx/xxx files, xxx/xxx blocks - the most complete solution

Team management | how to improve the thinking skills of technical leaders?

Why can't Google search page infinite?

zabbix离线安装

Why is the digital transformation of small and medium-sized enterprises so difficult?
![[paper reading] fixmatch: simplifying semi supervised learning with consistency and confidence](/img/86/72726f933deef6944b62149759b7d5.png)
[paper reading] fixmatch: simplifying semi supervised learning with consistency and confidence
随机推荐
87. (leaflet house) leaflet military plotting - straight arrow modification
Solution to prompt "network initialization failed operation failed" in PD virtual machine installation system
Blend for visual studio overview
[paper reading] boostmis: boosting medical image semi supervised learning with adaptive pseudolabeling
Centos7 actual deployment mysql8 (binary mode)
2022北京怀柔区新技术新产品(服务)认定要求
程序员应对压力的几个小窍门
OTA升级
cosine 相似度计算总结
【NVIDIA驱动的顽固问题】---- /dev/sdax:clean,xxx/xxx files,xxx/xxx blocks ---- 最全解决方法
The best creative drum tool: groove agent 5
深圳中国专利奖政策支持介绍,补贴100万
简述自定义注解
Support standard for cultivation of high-tech enterprises in Miyun District, Beijing, with a subsidy of 100000 yuan
dma_buf_export
北京昌平区高新技术企业培育支持标准,补贴10万
WSL automatically updates the IP hosts file
部分 力扣 LeetCode 中的SQL刷题整理
Oracle relational tables with XY field values are synchronized to PG database and converted to geometric fields
Configurable custom implementation 1 Implementation interface, 2 Custom configuration 3 Default configuration