Skip to content

Commit

Permalink
Changed the analysis for the percentage of valid investigations
Browse files Browse the repository at this point in the history
Was using proc genmod. At Doug's recommendation I changed it to proc surveyfreq with a cluster statement. The results were essentially identical.
  • Loading branch information
mbcann01 committed Apr 3, 2019
1 parent d1f8696 commit 920b23e
Show file tree
Hide file tree
Showing 4 changed files with 308 additions and 186 deletions.
Binary file removed .DS_Store
Binary file not shown.
Binary file removed sas/.DS_Store
Binary file not shown.
247 changes: 154 additions & 93 deletions sas/.ipynb_checkpoints/analysis_main_effects-checkpoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1314,7 +1314,7 @@
"<IPython.core.display.HTML object>"
]
},
"execution_count": 8,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -1335,7 +1335,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -2443,129 +2443,190 @@
"<p><span class=\"c systemtitle\">The SAS System</span> </p>\r\n",
"</div>\r\n",
"<div class=\"proc_title_group\">\r\n",
"<p class=\"c proctitle\">The GENMOD Procedure</p>\r\n",
"<p class=\"c proctitle\">The SURVEYFREQ Procedure</p>\r\n",
"</div>\r\n",
"<div style=\"padding-bottom: 8px; padding-top: 1px\">\r\n",
"<table class=\"table\" style=\"border-spacing: 0\" aria-label=\"Analysis Of GEE Parameter Estimates - Empirical Std Errors\">\r\n",
"<caption aria-label=\"Analysis Of GEE Parameter Estimates - Empirical Std Errors\"></caption>\r\n",
"<colgroup><col/><col/><col/><col/><col/><col/><col/></colgroup>\r\n",
"<table class=\"table\" style=\"border-spacing: 0\" aria-label=\"Data Summary\">\r\n",
"<caption aria-label=\"Data Summary\"></caption>\r\n",
"<colgroup><col/><col/></colgroup>\r\n",
"<thead>\r\n",
"<tr>\r\n",
"<th class=\"c b header\" colspan=\"7\" scope=\"colgroup\">Analysis Of GEE Parameter Estimates</th>\r\n",
"</tr>\r\n",
"<tr>\r\n",
"<th class=\"c b header\" colspan=\"7\" scope=\"colgroup\">Empirical Standard Error Estimates</th>\r\n",
"</tr>\r\n",
"<tr>\r\n",
"<th class=\"b header\" scope=\"col\">Parameter</th>\r\n",
"<th class=\"r b header\" scope=\"col\">Estimate</th>\r\n",
"<th class=\"r b header\" scope=\"col\">Standard<br/>Error</th>\r\n",
"<th class=\"c b header\" colspan=\"2\" scope=\"colgroup\">95% Confidence Limits</th>\r\n",
"<th class=\"r b header\" scope=\"col\">Z</th>\r\n",
"<th class=\"r b header\" scope=\"col\">Pr&#160;&gt;&#160;|Z|</th>\r\n",
"<th class=\"c b header\" colspan=\"2\" scope=\"colgroup\">Data Summary</th>\r\n",
"</tr>\r\n",
"</thead>\r\n",
"<tbody>\r\n",
"<tr>\r\n",
"<th class=\"rowheader\" scope=\"row\">Intercept</th>\r\n",
"<td class=\"r data\">0.8298</td>\r\n",
"<td class=\"r data\">0.0388</td>\r\n",
"<td class=\"r data\">0.7538</td>\r\n",
"<td class=\"r data\">0.9058</td>\r\n",
"<td class=\"r data\">21.41</td>\r\n",
"<td class=\"r data\">&lt;.0001</td>\r\n",
"<th class=\"rowheader\" scope=\"row\">Number of Clusters</th>\r\n",
"<td class=\"r data\">326</td>\r\n",
"</tr>\r\n",
"<tr>\r\n",
"<th class=\"rowheader\" scope=\"row\">detect</th>\r\n",
"<td class=\"r data\" style=\"white-space: nowrap\">-0.0060</td>\r\n",
"<td class=\"r data\">0.0461</td>\r\n",
"<td class=\"r data\" style=\"white-space: nowrap\">-0.0964</td>\r\n",
"<td class=\"r data\">0.0844</td>\r\n",
"<td class=\"r data\" style=\"white-space: nowrap\">-0.13</td>\r\n",
"<td class=\"r data\">0.8962</td>\r\n",
"<th class=\"rowheader\" scope=\"row\">Number of Observations</th>\r\n",
"<td class=\"r data\">327</td>\r\n",
"</tr>\r\n",
"</tbody>\r\n",
"</table>\r\n",
"</div>\r\n",
"<div id=\"IDX1\" style=\"padding-bottom: 8px; padding-top: 1px\">\r\n",
"<table class=\"table\" style=\"border-spacing: 0\" aria-label=\"ESTIMATE Statement Results\">\r\n",
"<caption aria-label=\"ESTIMATE Statement Results\"></caption>\r\n",
"<colgroup><col/></colgroup><colgroup><col/><col/><col/><col/><col/><col/><col/><col/><col/><col/></colgroup>\r\n",
"<div style=\"padding-bottom: 8px; padding-top: 1px\">\r\n",
"<table class=\"table\" style=\"border-spacing: 0\" aria-label=\"CrossTabulation Table\">\r\n",
"<caption aria-label=\"CrossTabulation Table\"></caption>\r\n",
"<colgroup><col/><col/></colgroup><colgroup><col/><col/><col/><col/><col/><col/><col/><col/><col/></colgroup>\r\n",
"<thead>\r\n",
"<tr>\r\n",
"<th class=\"c b header\" colspan=\"11\" scope=\"colgroup\">Contrast Estimate Results</th>\r\n",
"</tr>\r\n",
"<tr>\r\n",
"<th class=\"b header\" rowspan=\"2\" scope=\"col\">Label</th>\r\n",
"<th class=\"r b header\" rowspan=\"2\" scope=\"col\">Mean Estimate</th>\r\n",
"<th class=\"c b header\" colspan=\"2\" scope=\"colgroup\">Mean</th>\r\n",
"<th class=\"r b header\" rowspan=\"2\" scope=\"col\">L&apos;Beta Estimate</th>\r\n",
"<th class=\"r b header\" rowspan=\"2\" scope=\"col\">Standard<br/>Error</th>\r\n",
"<th class=\"r b header\" rowspan=\"2\" scope=\"col\">Alpha</th>\r\n",
"<th class=\"c b header\" colspan=\"2\" scope=\"colgroup\">L&apos;Beta</th>\r\n",
"<th class=\"r b header\" rowspan=\"2\" scope=\"col\">Chi-Square</th>\r\n",
"<th class=\"r b header\" rowspan=\"2\" scope=\"col\">Pr&#160;&gt;&#160;ChiSq</th>\r\n",
"<th class=\"c b header\" colspan=\"11\" scope=\"colgroup\">Table of detect by any_valid</th>\r\n",
"</tr>\r\n",
"<tr>\r\n",
"<th class=\"c b header\" colspan=\"2\" scope=\"colgroup\">Confidence Limits</th>\r\n",
"<th class=\"c b header\" colspan=\"2\" scope=\"colgroup\">Confidence Limits</th>\r\n",
"<th class=\"b header\" scope=\"col\">detect</th>\r\n",
"<th class=\"b header\" scope=\"col\">any_valid</th>\r\n",
"<th class=\"r b header\" scope=\"col\">Frequency</th>\r\n",
"<th class=\"r b header\" scope=\"col\">Percent</th>\r\n",
"<th class=\"r b header\" scope=\"col\">Std Err of<br/>Percent</th>\r\n",
"<th class=\"c b header\" colspan=\"2\" scope=\"colgroup\">95% Confidence Limits<br/>for Percent</th>\r\n",
"<th class=\"r b header\" scope=\"col\">Row<br/>Percent</th>\r\n",
"<th class=\"r b header\" scope=\"col\">Std Err of<br/>Row Percent</th>\r\n",
"<th class=\"c b header\" colspan=\"2\" scope=\"colgroup\">95% Confidence Limits<br/>for Row Percent</th>\r\n",
"</tr>\r\n",
"</thead>\r\n",
"<tbody>\r\n",
"<tr>\r\n",
"<th class=\"rowheader\" scope=\"row\">Proportion valid when detect = 0</th>\r\n",
"<td class=\"r data\">0.8298</td>\r\n",
"<td class=\"r data\">0.7538</td>\r\n",
"<td class=\"r data\">0.9058</td>\r\n",
"<td class=\"r data\">0.8298</td>\r\n",
"<td class=\"r data\">0.0388</td>\r\n",
"<td class=\"r data\">0.05</td>\r\n",
"<td class=\"r data\">0.7538</td>\r\n",
"<td class=\"r data\">0.9058</td>\r\n",
"<td class=\"r data\">458.25</td>\r\n",
"<td class=\"r data\">&lt;.0001</td>\r\n",
"<th class=\"rowheader\" scope=\"row\">0</th>\r\n",
"<th class=\"rowheader\" scope=\"row\">0</th>\r\n",
"<td class=\"r data\">16</td>\r\n",
"<td class=\"r data\">4.8930</td>\r\n",
"<td class=\"r data\">1.1950</td>\r\n",
"<td class=\"r data\">2.5421</td>\r\n",
"<td class=\"r data\">7.2438</td>\r\n",
"<td class=\"r data\">17.0213</td>\r\n",
"<td class=\"r data\">3.8822</td>\r\n",
"<td class=\"r data\">9.3838</td>\r\n",
"<td class=\"r data\">24.6588</td>\r\n",
"</tr>\r\n",
"<tr>\r\n",
"<th class=\"rowheader\" scope=\"row\">&#160;</th>\r\n",
"<th class=\"rowheader\" scope=\"row\">1</th>\r\n",
"<td class=\"r data\">78</td>\r\n",
"<td class=\"r data\">23.8532</td>\r\n",
"<td class=\"r data\">2.3627</td>\r\n",
"<td class=\"r data\">19.2051</td>\r\n",
"<td class=\"r data\">28.5013</td>\r\n",
"<td class=\"r data\">82.9787</td>\r\n",
"<td class=\"r data\">3.8822</td>\r\n",
"<td class=\"r data\">75.3412</td>\r\n",
"<td class=\"r data\">90.6162</td>\r\n",
"</tr>\r\n",
"<tr>\r\n",
"<th class=\"rowheader\" scope=\"row\">&#160;</th>\r\n",
"<th class=\"rowheader\" scope=\"row\">Total</th>\r\n",
"<td class=\"r data\">94</td>\r\n",
"<td class=\"r data\">28.7462</td>\r\n",
"<td class=\"r data\">2.5097</td>\r\n",
"<td class=\"r data\">23.8089</td>\r\n",
"<td class=\"r data\">33.6835</td>\r\n",
"<td class=\"r data\">100.0000</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"</tr>\r\n",
"<tr>\r\n",
"<th class=\"rowheader\" scope=\"row\">Proportion valid when detect = 1</th>\r\n",
"<td class=\"r data\">0.8238</td>\r\n",
"<td class=\"r data\">0.7748</td>\r\n",
"<td class=\"r data\">0.8728</td>\r\n",
"<td class=\"r data\">0.8238</td>\r\n",
"<td class=\"r data\">0.0250</td>\r\n",
"<td class=\"r data\">0.05</td>\r\n",
"<td class=\"r data\">0.7748</td>\r\n",
"<td class=\"r data\">0.8728</td>\r\n",
"<td class=\"r data\">1086.4</td>\r\n",
"<td class=\"r data\">&lt;.0001</td>\r\n",
"<th class=\"rowheader\" scope=\"row\">1</th>\r\n",
"<th class=\"rowheader\" scope=\"row\">0</th>\r\n",
"<td class=\"r data\">41</td>\r\n",
"<td class=\"r data\">12.5382</td>\r\n",
"<td class=\"r data\">1.8349</td>\r\n",
"<td class=\"r data\">8.9285</td>\r\n",
"<td class=\"r data\">16.1480</td>\r\n",
"<td class=\"r data\">17.5966</td>\r\n",
"<td class=\"r data\">2.5008</td>\r\n",
"<td class=\"r data\">12.6768</td>\r\n",
"<td class=\"r data\">22.5163</td>\r\n",
"</tr>\r\n",
"<tr>\r\n",
"<th class=\"rowheader\" scope=\"row\">&#160;</th>\r\n",
"<th class=\"rowheader\" scope=\"row\">1</th>\r\n",
"<td class=\"r data\">192</td>\r\n",
"<td class=\"r data\">58.7156</td>\r\n",
"<td class=\"r data\">2.7327</td>\r\n",
"<td class=\"r data\">53.3395</td>\r\n",
"<td class=\"r data\">64.0916</td>\r\n",
"<td class=\"r data\">82.4034</td>\r\n",
"<td class=\"r data\">2.5008</td>\r\n",
"<td class=\"r data\">77.4837</td>\r\n",
"<td class=\"r data\">87.3232</td>\r\n",
"</tr>\r\n",
"<tr>\r\n",
"<th class=\"rowheader\" scope=\"row\">&#160;</th>\r\n",
"<th class=\"rowheader\" scope=\"row\">Total</th>\r\n",
"<td class=\"r data\">233</td>\r\n",
"<td class=\"r data\">71.2538</td>\r\n",
"<td class=\"r data\">2.5097</td>\r\n",
"<td class=\"r data\">66.3165</td>\r\n",
"<td class=\"r data\">76.1911</td>\r\n",
"<td class=\"r data\">100.0000</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"</tr>\r\n",
"<tr>\r\n",
"<th class=\"rowheader\" scope=\"row\">Total</th>\r\n",
"<th class=\"rowheader\" scope=\"row\">0</th>\r\n",
"<td class=\"r data\">57</td>\r\n",
"<td class=\"r data\">17.4312</td>\r\n",
"<td class=\"r data\">2.1025</td>\r\n",
"<td class=\"r data\">13.2949</td>\r\n",
"<td class=\"r data\">21.5675</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"</tr>\r\n",
"<tr>\r\n",
"<th class=\"rowheader\" scope=\"row\">&#160;</th>\r\n",
"<th class=\"rowheader\" scope=\"row\">1</th>\r\n",
"<td class=\"r data\">270</td>\r\n",
"<td class=\"r data\">82.5688</td>\r\n",
"<td class=\"r data\">2.1025</td>\r\n",
"<td class=\"r data\">78.4325</td>\r\n",
"<td class=\"r data\">86.7051</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"</tr>\r\n",
"<tr>\r\n",
"<th class=\"rowheader\" scope=\"row\">&#160;</th>\r\n",
"<th class=\"rowheader\" scope=\"row\">Total</th>\r\n",
"<td class=\"r data\">327</td>\r\n",
"<td class=\"r data\">100.0000</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"<td class=\"r data\">&#160;</td>\r\n",
"</tr>\r\n",
"</tbody>\r\n",
"</table>\r\n",
"</div>\r\n",
"</div>\r\n",
"</div>\r\n",
"</body>\r\n",
"</html>\r\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 9,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"* Percentage valid for EMS in medstar_service area during and not during detect;\n",
"proc genmod data = full_data;\n",
"proc surveyfreq data = full_data;\n",
" where total_allegations_investigated > 0 & ems = 1 & medstar_service_area = 1;\n",
" class case;\n",
" model any_valid = detect / link = id;\n",
" repeated subject = case / type = CS;\n",
" \n",
" estimate \"Proportion valid when detect = 0\" INTERCEPT 1;\n",
" estimate \"Proportion valid when detect = 1\" INTERCEPT 1 detect 1;\n",
" \n",
" ods select GEEEmpPEst Estimates;\n",
" table detect*any_valid / row cl;\n",
" cluster case;\n",
"run;"
]
},
Expand All @@ -2578,7 +2639,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 12,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -3834,7 +3895,7 @@
"<IPython.core.display.HTML object>"
]
},
"execution_count": 10,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -3859,7 +3920,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 13,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -5506,7 +5567,7 @@
"<IPython.core.display.HTML object>"
]
},
"execution_count": 11,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -5534,7 +5595,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 14,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -7142,7 +7203,7 @@
"<IPython.core.display.HTML object>"
]
},
"execution_count": 12,
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -7172,7 +7233,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 15,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -8895,7 +8956,7 @@
"<IPython.core.display.HTML object>"
]
},
"execution_count": 13,
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -8923,7 +8984,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 16,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -10583,7 +10644,7 @@
"<IPython.core.display.HTML object>"
]
},
"execution_count": 14,
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
Expand Down
Loading

0 comments on commit 920b23e

Please sign in to comment.