<?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 Simulating a logistic regression model with a random effect in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulating-a-logistic-regression-model-with-a-random-effect/m-p/206424#M2163</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Hello all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I wish to simulate data from a logistic regression model, with the following elements:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;1. A binary response ( 1 = Success, 0 = Failure)&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;2. A binary independent variable (1 = Treatment, 0 = Control)&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;3. For each subject in the sample, there are 2 observations (like two ears if it's ear drops, for example), which are assumed to be correlated, or at least can't be assumed not to be.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;The purpose is to do a power analysis for a given sample size. Before I try the power analysis with the looping, I am not sure how to simulate a single data set of that kind.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I have a copy of Rick Wicklin's book on simulations, I saw the code for logistic regression. The independent variables there are continuous (I think), and there is no correlation (no clusters), the clusters comes later with a normal dependent variable. I am not sure how to merge the two examples.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;One more comment, I would prefer to do it using the data step and not IML, if possible .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Any assistant will be very appreciated !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;(when helping you can make up any correlation and proportion you like, I can always change it later as part of a simulation).&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Thank you in advance !&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;P.S. I have posted this on the data step forum and was suggested to move it here, the previous one shall be ignored and removed if an admin sees this comment. Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Jul 2015 13:08:57 GMT</pubDate>
    <dc:creator>BlueNose</dc:creator>
    <dc:date>2015-07-20T13:08:57Z</dc:date>
    <item>
      <title>Simulating a logistic regression model with a random effect</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulating-a-logistic-regression-model-with-a-random-effect/m-p/206424#M2163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Hello all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I wish to simulate data from a logistic regression model, with the following elements:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;1. A binary response ( 1 = Success, 0 = Failure)&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;2. A binary independent variable (1 = Treatment, 0 = Control)&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;3. For each subject in the sample, there are 2 observations (like two ears if it's ear drops, for example), which are assumed to be correlated, or at least can't be assumed not to be.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;The purpose is to do a power analysis for a given sample size. Before I try the power analysis with the looping, I am not sure how to simulate a single data set of that kind.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I have a copy of Rick Wicklin's book on simulations, I saw the code for logistic regression. The independent variables there are continuous (I think), and there is no correlation (no clusters), the clusters comes later with a normal dependent variable. I am not sure how to merge the two examples.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;One more comment, I would prefer to do it using the data step and not IML, if possible .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Any assistant will be very appreciated !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;(when helping you can make up any correlation and proportion you like, I can always change it later as part of a simulation).&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Thank you in advance !&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;P.S. I have posted this on the data step forum and was suggested to move it here, the previous one shall be ignored and removed if an admin sees this comment. Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2015 13:08:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulating-a-logistic-regression-model-with-a-random-effect/m-p/206424#M2163</guid>
      <dc:creator>BlueNose</dc:creator>
      <dc:date>2015-07-20T13:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: Simulating a logistic regression model with a random effect</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulating-a-logistic-regression-model-with-a-random-effect/m-p/206425#M2164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The easiest way to do this is to think of it as two steps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Step 1, create the explanatory variables by using the techniques described throughout the book. Since you have a repeated measures term, pay paticular attention to section 12.3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After you have the explanatory variables modeled to your satisfaction, Step 2 is to add the response variable as in section 12.2:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data LogisticData;&lt;/P&gt;&lt;P&gt;set Explanatory;&amp;nbsp;&amp;nbsp; /* all BY groups and explanatory variables (including random effect) in here */&lt;/P&gt;&lt;P&gt;eta = b0 + b1*treatment + randomEffect; /* specify linear model of treatment + random effect */&lt;/P&gt;&lt;P&gt;p = logistic(eta);&amp;nbsp;&amp;nbsp;&amp;nbsp; /* convert to probability via logistic transformation */&lt;/P&gt;&lt;P&gt;y = rand("Bernoulli", p);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2015 13:45:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulating-a-logistic-regression-model-with-a-random-effect/m-p/206425#M2164</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-07-20T13:45:34Z</dc:date>
    </item>
  </channel>
</rss>

