{"id":73,"date":"2023-07-22T09:39:03","date_gmt":"2023-07-22T09:39:03","guid":{"rendered":"https:\/\/ungdung.hotronghiencuu.com\/open\/?p=73"},"modified":"2023-07-22T16:39:03","modified_gmt":"2023-07-22T09:39:03","slug":"cac-lenh-tren-stata-phan-1","status":"publish","type":"post","link":"https:\/\/ungdung.hotronghiencuu.com\/open\/cac-lenh-tren-stata-phan-1","title":{"rendered":"C\u00e1c l\u1ec7nh tr\u00ean Stata- Ph\u1ea7n 1: H\u1ed3i quy tuy\u1ebfn t\u00ednh v\u00e0 h\u1ed3i quy nh\u1ecb ph\u00e2n"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_40 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" area-label=\"ez-toc-toggle-icon-1\"><label for=\"item-6b1378b46c2b7\" aria-label=\"Table of Content\"><span style=\"display: flex;align-items: center;width: 35px;height: 30px;justify-content: center;direction:ltr;\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/label><input  type=\"checkbox\" id=\"item-6b1378b46c2b7\"><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ungdung.hotronghiencuu.com\/open\/cac-lenh-tren-stata-phan-1\/#Cac_lenh_hoi_quy_tuyen_tinh_trong_stata\" title=\"C\u00e1c l\u1ec7nh h\u1ed3i quy tuy\u1ebfn t\u00ednh trong stata\">C\u00e1c l\u1ec7nh h\u1ed3i quy tuy\u1ebfn t\u00ednh trong stata<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ungdung.hotronghiencuu.com\/open\/cac-lenh-tren-stata-phan-1\/#Cac_lenh_hoi_quy_nhi_phan_trong_stata\" title=\"C\u00e1c l\u1ec7nh h\u1ed3i quy nh\u1ecb ph\u00e2n trong stata\">C\u00e1c l\u1ec7nh h\u1ed3i quy nh\u1ecb ph\u00e2n trong stata<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Cac_lenh_hoi_quy_tuyen_tinh_trong_stata\"><\/span>C\u00e1c l\u1ec7nh h\u1ed3i quy tuy\u1ebfn t\u00ednh trong stata<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Tr\u00ean Stata, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng c\u00e1c l\u1ec7nh sau \u0111\u1ec3 th\u1ef1c hi\u1ec7n h\u1ed3i quy tuy\u1ebfn t\u00ednh:<\/p>\n<ol>\n<li>L\u1ec7nh &#8220;regress&#8221;: \u0110\u00e2y l\u00e0 l\u1ec7nh c\u01a1 b\u1ea3n \u0111\u1ec3 th\u1ef1c hi\u1ec7n h\u1ed3i quy tuy\u1ebfn t\u00ednh \u0111\u01a1n bi\u1ebfn ho\u1eb7c \u0111a bi\u1ebfn. V\u00ed d\u1ee5:\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md\"><\/div>\n<\/div>\n<\/li>\n<\/ol>\n<ul>\n<li>\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs\">regress y x1 x2 x3<br \/>\n<\/code><\/div>\n<\/div>\n<p>Trong \u0111\u00f3, &#8220;y&#8221; l\u00e0 bi\u1ebfn ph\u1ee5 thu\u1ed9c v\u00e0 &#8220;x1&#8221;, &#8220;x2&#8221;, &#8220;x3&#8221; l\u00e0 c\u00e1c bi\u1ebfn \u0111\u1ed9c l\u1eadp.<\/li>\n<\/ul>\n<p>**********<\/p>\n<ul>\n<li>L\u1ec7nh &#8220;xi&#8221;: \u0110\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 x\u1eed l\u00fd bi\u1ebfn nh\u1ecb ph\u00e2n ho\u1eb7c bi\u1ebfn \u0111\u1ecbnh t\u00ednh trong h\u1ed3i quy tuy\u1ebfn t\u00ednh. V\u00ed d\u1ee5:\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md\">vbnet<\/div>\n<\/div>\n<\/li>\n<li>\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-vbnet\"><span class=\"hljs-symbol\">xi:<\/span> regress y i.<span class=\"hljs-keyword\">group<\/span> x1 x2<br \/>\n<\/code><\/div>\n<\/div>\n<p>Trong \u0111\u00f3, &#8220;i.group&#8221; l\u00e0 bi\u1ebfn nh\u1ecb ph\u00e2n.<\/li>\n<\/ul>\n<p>***********<\/p>\n<ul>\n<li>L\u1ec7nh &#8220;areg&#8221;: S\u1eed d\u1ee5ng cho h\u1ed3i quy tuy\u1ebfn t\u00ednh v\u1edbi bi\u1ebfn c\u1ed1 \u0111\u1ecbnh (fixed effects regression) ho\u1eb7c h\u1ed3i quy \u0111a c\u1ea5p (multilevel regression). V\u00ed d\u1ee5:\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md\">scss<\/div>\n<\/div>\n<\/li>\n<li>\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-scss\">areg y x1 x2, <span class=\"hljs-built_in\">absorb<\/span>(group)<br \/>\n<\/code><\/div>\n<\/div>\n<p>Trong \u0111\u00f3, &#8220;group&#8221; l\u00e0 bi\u1ebfn \u0111\u1ecbnh t\u00ednh \u0111\u1ea1i di\u1ec7n cho c\u00e1c nh\u00f3m.<\/li>\n<\/ul>\n<p>**********<\/p>\n<ul>\n<li>L\u1ec7nh &#8220;robust&#8221;: D\u00f9ng \u0111\u1ec3 t\u00ednh to\u00e1n c\u00e1c sai s\u1ed1 chu\u1ea9n \u0111\u01b0\u1ee3c \u0111i\u1ec1u ch\u1ec9nh cho vi\u1ec7c kh\u00f4ng tu\u00e2n th\u1ee7 c\u00e1c gi\u1ea3 \u0111\u1ecbnh c\u1ee7a h\u1ed3i quy tuy\u1ebfn t\u00ednh. V\u00ed d\u1ee5:\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md\"><\/div>\n<\/div>\n<\/li>\n<\/ul>\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs\">regress y x1 x2, robust<br \/>\n<\/code><\/div>\n<div>**********<\/div>\n<\/div>\n<ul>\n<li>L\u1ec7nh &#8220;cluster&#8221;: S\u1eed d\u1ee5ng khi d\u1eef li\u1ec7u c\u00f3 t\u00ednh ph\u00e2n c\u1ee5m, trong \u0111\u00f3 c\u00e1c quan s\u00e1t trong c\u00f9ng m\u1ed9t nh\u00f3m c\u00f3 th\u1ec3 c\u00f3 s\u1ef1 t\u01b0\u01a1ng quan v\u1edbi nhau. V\u00ed d\u1ee5:\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md\">scss<\/div>\n<\/div>\n<\/li>\n<\/ul>\n<ol>\n<li value=\"5\">\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-scss\">regress y x1 x2, <span class=\"hljs-built_in\">cluster<\/span>(group)<br \/>\n<\/code><\/div>\n<\/div>\n<p>Trong \u0111\u00f3, &#8220;group&#8221; l\u00e0 bi\u1ebfn \u0111\u1ecbnh danh cho c\u00e1c nh\u00f3m.<\/li>\n<\/ol>\n<p>\u0110\u00e2y ch\u1ec9 l\u00e0 m\u1ed9t s\u1ed1 l\u1ec7nh ph\u1ed5 bi\u1ebfn \u0111\u1ec3 th\u1ef1c hi\u1ec7n h\u1ed3i quy tuy\u1ebfn t\u00ednh tr\u00ean Stata. Stata cung c\u1ea5p nhi\u1ec1u l\u1ef1a ch\u1ecdn v\u00e0 t\u00f9y ch\u1ecdn kh\u00e1c cho h\u1ed3i quy tuy\u1ebfn t\u00ednh, t\u00f9y thu\u1ed9c v\u00e0o m\u1ee5c ti\u00eau nghi\u00ean c\u1ee9u c\u1ee7a b\u1ea1n. B\u1ea1n c\u0169ng c\u00f3 th\u1ec3 t\u00ecm hi\u1ec3u th\u00eam v\u1ec1 c\u00e1c l\u1ec7nh kh\u00e1c v\u00e0 c\u00e1c t\u00f9y ch\u1ecdn b\u1ed5 sung trong t\u00e0i li\u1ec7u h\u01b0\u1edbng d\u1eabn c\u1ee7a Stata.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Cac_lenh_hoi_quy_nhi_phan_trong_stata\"><\/span>C\u00e1c l\u1ec7nh h\u1ed3i quy nh\u1ecb ph\u00e2n trong stata<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Tr\u00ean Stata, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng c\u00e1c l\u1ec7nh sau \u0111\u1ec3 th\u1ef1c hi\u1ec7n h\u1ed3i quy nh\u1ecb ph\u00e2n:<\/p>\n<ol>\n<li>L\u1ec7nh &#8220;logit&#8221;: \u0110\u00e2y l\u00e0 l\u1ec7nh c\u01a1 b\u1ea3n \u0111\u1ec3 th\u1ef1c hi\u1ec7n h\u1ed3i quy nh\u1ecb ph\u00e2n (logistic regression). V\u00ed d\u1ee5:\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md\"><\/div>\n<\/div>\n<\/li>\n<\/ol>\n<ul>\n<li>\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs\">logit y x1 x2 x3<br \/>\n<\/code><\/div>\n<\/div>\n<p>Trong \u0111\u00f3, &#8220;y&#8221; l\u00e0 bi\u1ebfn ph\u1ee5 thu\u1ed9c nh\u1ecb ph\u00e2n v\u00e0 &#8220;x1&#8221;, &#8220;x2&#8221;, &#8220;x3&#8221; l\u00e0 c\u00e1c bi\u1ebfn \u0111\u1ed9c l\u1eadp.<\/li>\n<\/ul>\n<p>**********<\/p>\n<ul>\n<li>L\u1ec7nh &#8220;probit&#8221;: S\u1eed d\u1ee5ng \u0111\u1ec3 th\u1ef1c hi\u1ec7n h\u1ed3i quy nh\u1ecb ph\u00e2n v\u1edbi m\u00f4 h\u00ecnh h\u00e0m \u0111\u1ed3ng ph\u00e2n (probit regression). V\u00ed d\u1ee5:\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md\"><\/div>\n<\/div>\n<\/li>\n<\/ul>\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs\">probit y x1 x2 x3<\/code><\/div>\n<div class=\"p-4 overflow-y-auto\">**********<code class=\"!whitespace-pre hljs\"><\/code><\/div>\n<\/div>\n<ul>\n<li>L\u1ec7nh &#8220;mlogit&#8221;: D\u00f9ng cho h\u1ed3i quy nh\u1ecb ph\u00e2n \u0111a l\u1ef1a ch\u1ecdn (multinomial logistic regression), khi bi\u1ebfn ph\u1ee5 thu\u1ed9c c\u00f3 nhi\u1ec1u h\u01a1n hai ph\u00e2n l\u1edbp. V\u00ed d\u1ee5:\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md\"><\/div>\n<\/div>\n<\/li>\n<\/ul>\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs\">mlogit y x1 x2 x3<\/code><\/div>\n<div>**********<\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs\"><\/code><\/div>\n<\/div>\n<ul>\n<li>L\u1ec7nh &#8220;clogit&#8221;: S\u1eed d\u1ee5ng cho h\u1ed3i quy nh\u1ecb ph\u00e2n c\u00f3 y\u1ebfu t\u1ed1 c\u1ed1 \u0111\u1ecbnh (conditional logistic regression), khi d\u1eef li\u1ec7u c\u00f3 y\u1ebfu t\u1ed1 nh\u00f3m ho\u1eb7c gh\u00e9p c\u1eb7p. V\u00ed d\u1ee5:\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md\">scss<\/div>\n<\/div>\n<\/li>\n<\/ul>\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-scss\">clogit y x1 x2 x3 <span class=\"hljs-selector-attr\">[aweight=weight]<\/span>, <span class=\"hljs-built_in\">group<\/span>(id)<br \/>\n<\/code><\/div>\n<\/div>\n<p>Trong \u0111\u00f3, &#8220;id&#8221; l\u00e0 bi\u1ebfn \u0111\u1ecbnh danh cho c\u00e1c nh\u00f3m ho\u1eb7c gh\u00e9p c\u1eb7p, v\u00e0 &#8220;weight&#8221; l\u00e0 tr\u1ecdng s\u1ed1 cho m\u1ed7i quan s\u00e1t.<\/p>\n<p>**********<\/p>\n<ul>\n<li>L\u1ec7nh &#8220;ologit&#8221;: S\u1eed d\u1ee5ng cho h\u1ed3i quy nh\u1ecb ph\u00e2n \u0111a c\u1ea5p (ordinal logistic regression), khi bi\u1ebfn ph\u1ee5 thu\u1ed9c c\u00f3 c\u00e1c ph\u00e2n l\u1edbp c\u00f3 th\u1ee9 t\u1ef1. V\u00ed d\u1ee5:\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md\"><\/div>\n<\/div>\n<\/li>\n<\/ul>\n<ol>\n<li value=\"5\">\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs\">ologit y x1 x2 x3<br \/>\n<\/code><\/div>\n<\/div>\n<\/li>\n<\/ol>\n<p>\u0110\u00e2y ch\u1ec9 l\u00e0 m\u1ed9t s\u1ed1 l\u1ec7nh ph\u1ed5 bi\u1ebfn \u0111\u1ec3 th\u1ef1c hi\u1ec7n h\u1ed3i quy nh\u1ecb ph\u00e2n tr\u00ean Stata. Stata cung c\u1ea5p nhi\u1ec1u l\u1ef1a ch\u1ecdn v\u00e0 t\u00f9y ch\u1ecdn kh\u00e1c cho h\u1ed3i quy nh\u1ecb ph\u00e2n, t\u00f9y thu\u1ed9c v\u00e0o m\u1ee5c ti\u00eau nghi\u00ean c\u1ee9u c\u1ee7a b\u1ea1n. B\u1ea1n c\u0169ng c\u00f3 th\u1ec3 t\u00ecm hi\u1ec3u th\u00eam v\u1ec1 c\u00e1c l\u1ec7nh v\u00e0 t\u00f9y ch\u1ecdn b\u1ed5 sung trong t\u00e0i li\u1ec7u h\u01b0\u1edbng d\u1eabn c\u1ee7a Stata.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>C\u00e1c l\u1ec7nh h\u1ed3i quy tuy\u1ebfn t\u00ednh trong stata Tr\u00ean Stata, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng c\u00e1c l\u1ec7nh sau \u0111\u1ec3 th\u1ef1c hi\u1ec7n h\u1ed3i quy tuy\u1ebfn t\u00ednh: L\u1ec7nh &#8220;regress&#8221;:&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[8],"class_list":["post-73","post","type-post","status-publish","format-standard","hentry","category-su-dung-phan-mem","tag-stata"],"_links":{"self":[{"href":"https:\/\/ungdung.hotronghiencuu.com\/open\/wp-json\/wp\/v2\/posts\/73","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ungdung.hotronghiencuu.com\/open\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ungdung.hotronghiencuu.com\/open\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ungdung.hotronghiencuu.com\/open\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ungdung.hotronghiencuu.com\/open\/wp-json\/wp\/v2\/comments?post=73"}],"version-history":[{"count":5,"href":"https:\/\/ungdung.hotronghiencuu.com\/open\/wp-json\/wp\/v2\/posts\/73\/revisions"}],"predecessor-version":[{"id":84,"href":"https:\/\/ungdung.hotronghiencuu.com\/open\/wp-json\/wp\/v2\/posts\/73\/revisions\/84"}],"wp:attachment":[{"href":"https:\/\/ungdung.hotronghiencuu.com\/open\/wp-json\/wp\/v2\/media?parent=73"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ungdung.hotronghiencuu.com\/open\/wp-json\/wp\/v2\/categories?post=73"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ungdung.hotronghiencuu.com\/open\/wp-json\/wp\/v2\/tags?post=73"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}