接下来
说明非线性判别
. discrimlda price mpg weight length,group(clus5)
Linear discriminant analysis
Resubstitution classification summary
+---------+ | Key | |---------| | Number | | Percent | +---------+
| Classified True clus5 | 1 2 3 | Total -------------+------------------------+-------
1 | 59 0 0 | 59 | 100.00 0.00 0.00 | 100.00 | | 2 | 0 10 0 | 10 | 0.00 100.00 0.00 | 100.00 | | 3 | 0 0 5 | 5 | 0.00 0.00 100.00 | 100.00 -------------+------------------------+-------
Total | 59 10 5 | 74 | 79.73 13.51 6.76 | 100.00
| | Priors | 0.3333 0.3333 0.3333 | 三类有两个判别函数 前文皆在此成立 . estat loadings
Standardized canonical discriminant function coefficients
| function1 function2 -------------+---------------------- price | .9994096 .0619517 mpg | .1147418 .3214297 weight | .7125425 -2.05314 length | -.6690039 2.838476
多元方程分析 . estat loadings
Standardized canonical discriminant function coefficients
| function1 function2 -------------+---------------------- price | .9994096 .0619517 mpg | .1147418 .3214297 weight | .7125425 -2.05314 length | -.6690039 2.838476
. estatgrsum
Estimation sample discrimlda Summarized by clus5
| clus5 Mean | 1 2 3 | Total -------------+---------------------------------+----------
price | 4846.746 9981.5 14091.2 | 6165.257 mpg | 22.49153 17.4 15 | 21.2973 weight | 2824.746 3662 4032 | 3019.459 length | 183.4576 205.2 206.2 | 187.9324 -------------+---------------------------------+----------
N | 59 10 5 | 74
. estatmanova
Number of obs = 74
W = Wilks' lambda L = Lawley-Hotelling trace
P = Pillai's trace R = Roy's largest root
Source | Statisticdf F(df1, df2) = F Prob>F -----------+--------------------------------------------------
clus5 | W 0.1043 2 8.0 136.0 35.63 0.0000 e
| P 0.9304 8.0 138.0 15.00 0.0000 a
| L 8.2507 8.0 134.0 69.10 0.0000 a
| R 8.2102 4.0 69.0 141.63 0.0000 u
|--------------------------------------------------
Residual | 71
-----------+-------------------------------------------------- Total | 73
--------------------------------------------------------------
e = exact, a = approximate, u = upper bound on F .
两次判别qta提高判别率
. discrimqda price mpg weight length, group(foreign)
Quadratic discriminant analysis
Resubstitution classification summary
+---------+ | Key | |---------| | Number | | Percent | +---------+
| Classified True foreign | Domestic Foreign | Total -------------+--------------------+---------
Domestic | 45 7 | 52
| 86.54(提高啦!!!!) | | Foreign | 0 22 | 22 | 0.00 100.00 | 100.00 -------------+--------------------+---------
Total | 45 29 | 74 | 60.81 39.19 | 100.00 | | Priors | 0.5000 0.5000 | 原来的——判别之后的类别及概率 .. estat list
+------------------------------------------------+
| | Classification | Probabilities |
| | | | Obs.| True Class. | Domestic Foreign | |-----+----------------------+-------------------|
| 1 | Domestic Domestic | 1.0000 0.0000 | | 2 | Domestic Domestic | 1.0000 0.0000 | | 3 | Domestic Domestic | 0.9935 0.0065 | | 4 | Domestic Domestic | 1.0000 0.0000 |
13.46 | | 100.00 | 5 | Domestic Domestic | 1.0000 0.0000 | |-----+----------------------+-------------------|
| 6 | Domestic Domestic | 1.0000 0.0000 | | 7 | Domestic Foreign * | 0.2235 0.7765 | | 8 | Domestic Domestic | 1.0000 0.0000 | | 9 | Domestic Domestic | 1.0000 0.0000 | | 10 | Domestic Domestic | 1.0000 0.0000 | |-----+----------------------+-------------------|
| 11 | Domestic Domestic | 1.0000 0.0000 | | 12 | Domestic Domestic | 0.8931 0.1069 | | 13 | Domestic Domestic | 1.0000 0.0000 | | 14 | Domestic Foreign * | 0.2789 0.7211 | | 15 | Domestic Domestic | 1.0000 0.0000 |
总体错判率 . estaterrorrate
Error rate estimated by error count
| foreign
| Domestic Foreign | Total
-------------+----------------------+----------
Error rate | .1346154 (降低了!!!) 0 | .0673077 -------------+----------------------+----------
Priors | .5 .5 |【实际上不一样】 . sum foreign
Variable | Obs Mean Std. Dev. Min -------------+--------------------------------------------------------
foreign | 74 .29729730.3 .4601885 0 改变线性概率再检验
. discrimlda price mpg weight length, group(foreign) priors(0.7,0.3)
Linear discriminant analysis
Resubstitution classification summary
+---------+ | Key | |---------| | Number | | Percent | +---------+
| Classified True foreign | Domestic Foreign | Total
Max 1 -------------+--------------------+---------
Domestic | 44 8 | 52 | 84.62 15.38 | 100.00 | | Foreign | 1 21 | 22 | 4.55 95.45 | 100.00 -------------+--------------------+---------
Total | 45 29 | 74 | 60.81 39.19 | 100.00 | | Priors | 0.7000 0.3000 |
主成份分析
对数据进行降维处理PCA选几个变量出来几个主成份 . pca price mpg weight length turn
Principal components/correlation Number of obs = 74
Number of comp. = 5
Trace = 5
Rotation: (unrotated = principal) Rho = 1.0000
--------------------------------------------------------------------------
Component | Eigenvalue Difference Proportion Cumulative
-------------+------------------------------------------------------------
Comp1 | 3.77621 3.01112 0.7552 0.7552
Comp2 | .76509 .488796 0.1530【两个占总体的90%以上,故选这两个】 0.9083
Comp3 | .276294 .139261 0.0553 0.9635
Comp4 | .137033 .0916582 0.0274 0.9909
Comp5 | .0453749 . 0.0091 1.0000 --------------------------------------------------------------------------
Principal components (eigenvectors)
------------------------------------------------------------------------------
Variable | Comp1 Comp2 Comp3 Comp4 Comp5 | Unexplained
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库stata课堂命令讲解(4)在线全文阅读。
相关推荐: