<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: simulation of binary exposure, disease, and confounder to explain the concept of confounder. in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/simulation-of-binary-exposure-disease-and-confounder-to-explain/m-p/234830#M1170</link>
    <description>&lt;P&gt;You could play with something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
length C D E $16;
call streamInit(8685);

exposedEffect = 1; /* No difference in exposure effect */
unexposedEffect = 1;
confoundEffect = 10; /* Effect mostly due to confounding factor */

probC_Exposed = 0.7; /* Confounding probability in exposed group */
probC_Unexposed = 0.1; /* Confounding probability in unexposed group */

groupSize = 100;

/* Unexposed group */
E = "Unexposed";
do i = 1 to groupSize;
    id + 1;
    if rand("BERNOULLI", probC_Unexposed) then C = "Confounded";
    else C = "Unconfounded";
    if rand("BERNOULLI", logistic(unexposedEffect+(C="Confounded")*confoundEffect)) 
        then D = "Sick";
    else D = "Not sick";
    output;
    end;

/* Exposed group */
E = "Exposed";
do i = 1 to groupSize;
    id + 1;
    if rand("BERNOULLI", probC_Exposed) then C = "Confounded";
    else C = "Unconfounded";
    if rand("BERNOULLI", logistic(ExposedEffect+(C="Confounded")*confoundEffect)) 
        then D = "Sick";
    else D = "Not sick";
    output;
    end;

keep id C D E;
run;

/* Exposure effect shows up as significant when confounding is ignored */

proc freq data=test;
tables E*D / chisq;
run;

proc logistic data=test;
class E;
model D(event="Sick") = E;
run;

/* Etc... */&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 16 Nov 2015 04:23:29 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2015-11-16T04:23:29Z</dc:date>
    <item>
      <title>simulation of binary exposure, disease, and confounder to explain the concept of confounder.</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/simulation-of-binary-exposure-disease-and-confounder-to-explain/m-p/234821#M1169</link>
      <description>&lt;P&gt;When we are talk about confouders in statistics, we usually say that the distribution of confounders is not equal in Expousre and Disease and the confounders also correlate with disease and expousre.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is very easy to simulate confounder's effect in continuous variable and test it by regression by creating a random varaible on confouder and multiply it with plus one error term to get the x and y.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, the correlation between X and Y is due to confounder.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I am confused when I try to simulate in binary variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can everyone shows me how to do it in E, D, and Confounder all are binary variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Nov 2015 19:05:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/simulation-of-binary-exposure-disease-and-confounder-to-explain/m-p/234821#M1169</guid>
      <dc:creator>ffgsdf</dc:creator>
      <dc:date>2015-11-15T19:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: simulation of binary exposure, disease, and confounder to explain the concept of confounder.</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/simulation-of-binary-exposure-disease-and-confounder-to-explain/m-p/234830#M1170</link>
      <description>&lt;P&gt;You could play with something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
length C D E $16;
call streamInit(8685);

exposedEffect = 1; /* No difference in exposure effect */
unexposedEffect = 1;
confoundEffect = 10; /* Effect mostly due to confounding factor */

probC_Exposed = 0.7; /* Confounding probability in exposed group */
probC_Unexposed = 0.1; /* Confounding probability in unexposed group */

groupSize = 100;

/* Unexposed group */
E = "Unexposed";
do i = 1 to groupSize;
    id + 1;
    if rand("BERNOULLI", probC_Unexposed) then C = "Confounded";
    else C = "Unconfounded";
    if rand("BERNOULLI", logistic(unexposedEffect+(C="Confounded")*confoundEffect)) 
        then D = "Sick";
    else D = "Not sick";
    output;
    end;

/* Exposed group */
E = "Exposed";
do i = 1 to groupSize;
    id + 1;
    if rand("BERNOULLI", probC_Exposed) then C = "Confounded";
    else C = "Unconfounded";
    if rand("BERNOULLI", logistic(ExposedEffect+(C="Confounded")*confoundEffect)) 
        then D = "Sick";
    else D = "Not sick";
    output;
    end;

keep id C D E;
run;

/* Exposure effect shows up as significant when confounding is ignored */

proc freq data=test;
tables E*D / chisq;
run;

proc logistic data=test;
class E;
model D(event="Sick") = E;
run;

/* Etc... */&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Nov 2015 04:23:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/simulation-of-binary-exposure-disease-and-confounder-to-explain/m-p/234830#M1170</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-11-16T04:23:29Z</dc:date>
    </item>
  </channel>
</rss>

