第六周课 多元统计分析
Manova检验
H0:各个总体的均值相同
均类分析 (平均法)
. clusteraveragelinkage price mpg weight length cluster name: _clus_1 . edit - preserve
. cluster list _clus_1
_clus_1 (type: hierarchical, method: average, dissimilarity: L2) vars: _clus_1_id (id variable)
_clus_1_ord (order variable) _clus_1_hgt (height variable)
other: cmd: cluster averagelinkage price mpg weight length varlist: price mpg weight length range: 0 .
. list _clus_1_id _clus_1_ord _clus_1_hgt 用分析谱系图(不超过50个样本)来分析 clusterdendrogram _clus_1
cluster dendrogram _clus_1 ,horizontal【水平版本】 另一种结构,产生差异结果的话说明数据本身不稳健。 . clusterwardslinkage price mpg weight length cluster name: _clus_2
. cluster wardslinkage price mpg weight length, name(class1)#自己命名生成的变量class#
. clusterdendrogram class1
生成相似矩阵ma1,希望在此基础上进行矩阵分析 . matrix dissimilarity ma1=price mpg weight length 构造简单链接singlelinkage . clear
.clustermatsinglelinkage ma1 obs was 0, now 74 cluster name: _clus_1
. clusterdendrogram _clus_1
在谱系图的基础上,分成k()类命名为class2等选项,研究样本个体具体的属类情况。
clusterkmeans price mpg weight length, k(4) name (class2)
. list class2
+--------+ | class2 | |--------| 1. | 1 | 2. | 4 | 3. | 1 | 4. | 4 | 5. | 3 | |--------| 6. | 4 | 7. | 1 | 8. | 4 | 9. | 2 | 10. | 1 | |--------| 11. | 2 | 12. | 2 | 13. | 2 | 14. | 1 | 15. | 4 | |--------| 16. | 1 | 17. | 4 | 18. | 1 | 19. | 1 | 20. | 1 | |--------| 21. | 1 | 22. | 4 | 23. | 4 | 24. | 1 | 25. | 1 | |--------| 26. | 2 | 27. | 2 | 28. | 2 | 29. | 1 | 30. | 4 |
|--------| 31. | 4 | 32. | 1 | 33. | 4 | 34. | 1 | 35. | 3 | |--------| 36. | 4 | 37. | 4 | 38. | 4 | 39. | 1 | 40. | 1 | |--------| 41. | 2 | 42. | 1 | 43. | 1 | 44. | 1 | 45. | 4 | |--------| 46. | 1 | 47. | 4 | 48. | 4 | 49. | 4 | 50. | 4 | |--------| 51. | 1 | 52. | 1 | 53. | 3 | 54. | 4 | 55. | 3 | |--------| 56. | 4 | 57. | 1 | 58. | 1 | 59. | 3 | 60. | 1 | |--------| 61. | 4 | 62. | 1 | 63. | 1 | 64. | 2 | 65. | 1 | |--------| 66. | 1 |
67. | 4 | 68. | 1 | 69. | 4 | 70. | 3 | |--------| 71. | 4 | 72. | 1 | 73. | 3 | 74. | 2 | +--------+
. list price lass2
variable lass2 not found r(111);
. list price class2
+-----------------+ | price class2 | |-----------------| 1. | 4,099 1 | 2. | 4,749 4 | 3. | 3,799 1 | 4. | 4,816 4 | 5. | 7,827 3 | |-----------------| 6. | 5,788 4 | 7. | 4,453 1 | 8. | 5,189 4 | 9. | 10,372 2 | 10. | 4,082 1 | |-----------------| 11. | 11,385 2 | 12. | 14,500 2 | 13. | 15,906 2 | 14. | 3,299 1 | 15. | 5,705 4 | |-----------------| 16. | 4,504 1 | 17. | 5,104 4 | 18. | 3,667 1 | 19. | 3,955 1 | 20. | 3,984 1 | |-----------------|
21. | 4,010 1 | 22. | 5,886 4 | 23. | 6,342 4 | 24. | 4,389 1 | 25. | 4,187 1 | |-----------------| 26. | 11,497 2 | 27. | 13,594 2 | 28. | 13,466 2 | 29. | 3,829 1 | 30. | 5,379 4 | |-----------------| 31. | 6,165 4 | 32. | 4,516 1 | 33. | 6,303 4 | 34. | 3,291 1 | 35. | 8,814 3 | |-----------------| 36. | 5,172 4 | 37. | 4,733 4 | 38. | 4,890 4 | 39. | 4,181 1 | 40. | 4,195 1 | |-----------------| 41. | 10,371 2 | 42. | 4,647 1 | 43. | 4,425 1 | 44. | 4,482 1 | 45. | 6,486 4 | |-----------------| 46. | 4,060 1 | 47. | 5,798 4 | 48. | 4,934 4 | 49. | 5,222 4 | 50. | 4,723 4 | |-----------------| 51. | 4,424 1 | 52. | 4,172 1 | 53. | 9,690 3 | 54. | 6,295 4 | 55. | 9,735 3 | |-----------------| 56. | 6,229 4 | 57. | 4,589 1 |
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库stata课堂命令讲解在线全文阅读。
相关推荐: