<?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: logistic/Logit Moderation/Regression - Adding Code for Covaritate/control variables to existing in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/logistic-Logit-Moderation-Regression-Adding-Code-for-Covaritate/m-p/614713#M76909</link>
    <description>&lt;P&gt;Since there are no responses; for anyone with similar problem, Hayes' PROCESS now supports dichotomous DV in moderation, so no point trying to use SAS or change code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code is for 2x2 design, which is dichotomous IV, M, and DV. I think I will have an easier time using SPSS PROCESS than trying to mess around with SAS.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Jan 2020 08:47:36 GMT</pubDate>
    <dc:creator>Cammy</dc:creator>
    <dc:date>2020-01-02T08:47:36Z</dc:date>
    <item>
      <title>logistic/Logit Moderation/Regression - Adding Code for Covaritate/control variables to existing code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/logistic-Logit-Moderation-Regression-Adding-Code-for-Covaritate/m-p/614708#M76907</link>
      <description>&lt;P&gt;Happy new year!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Context: I am conducting moderation analysis with binary outcome variable (DV). [Medication use(time1/dichotomous) moderating the effect of X(time1/continuous) on Y(time2/dichotomous)], but I am using a little-known statistical method to reduce problems associated with binary data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like help to add some control variables ("gender", "conduct problems") to Hess et al.'s* test of moderation in logistic regression (code below), but I am very new to SAS, coming from SPSS. I could run it as is with no controls (two analyses of male and female), but I would like to try it with gender and conduct problems included in the model if possible.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#000000"&gt;Could somebody please help me to code in the control variables (say "gender" and "conduct problems") without changing the moderating nature of the code below?&amp;nbsp;&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#000000"&gt;Less important question: I am unsure what "&lt;CODE class=" language-sas"&gt;values of the parameters to be estimated" means. How would I go about deciding if I should change these values or not?&amp;nbsp;&lt;/CODE&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;*Source of Hess et al.'s code and description:&amp;nbsp;&lt;A href="https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2393725" target="_blank"&gt;https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2393725&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry if my terminology is poor, I have background in psychology not statistics.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For ease of access to code without annotations:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data test;&lt;BR /&gt;input n k X1 X2;&lt;BR /&gt;datalines;&lt;BR /&gt;30 7 0 0&lt;BR /&gt;33 4 0 1&lt;BR /&gt;33 23 1 0&lt;BR /&gt;28 6 1 1&lt;BR /&gt;run;&lt;BR /&gt;proc nlmixed data=test DF=120;&lt;BR /&gt;parms b0=0.1 b1=0.1 b2=0.1 b12=0.1;&lt;BR /&gt;u = b0 + b1*X1 + b2*X2 + b12*X1*X2;&lt;BR /&gt;p = exp(u)/(1+exp(u));&lt;BR /&gt;model k ~ binomial(n,p);&lt;BR /&gt;estimate 'phi12' exp(b0+b1+b2+b12)/(1+exp(b0+b1+b2+b12)) + exp(b0)/(1+exp(b0)) - exp(b0+b1)/(1+exp(b0+b1)) - exp(b0+b2)/(1+exp(b0+b2));&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Annotated SAS Code for Testing Moderation Effects in a 2x2 Experiment with a Binary Dependent Variable

/*---------------------------------------------------------------------------
 SAS code for two-way interaction effects in binary data using logistic regression. The following code will run “as is” for any 2x2 experiment, changing only the data and DF value.
---------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------
   this is the test dataset (named “test”)
   n is the number of subjects in a treatment condition, 
   k is the number of subjects choosing “1” in that treatment condition,
   X1 and X2 are the dummy variables for the two treatment conditions
--------------------------------------------------------------------------*/

data test; 
   input n k X1 X2; 
   datalines; 
   30   7 0 0
   33   4 0 1
   33  23 1 0
   28   6 1 1
run;

/* call proc nlmixed, specifying the degree of freedom (DF) to be n-k 
where n is the number of observations and k is the number of parameters */
proc nlmixed data=test DF=120;

  /* parms specifies the initial values of the parameters to be estimated
  for a 2x2 experiment; these can be set at any value, here are set at 0.1
       b0 is the intercept, 
       b1 and b2 are the coefficients for main effects, 
       b12 is the interaction coefficient */
  parms b0=0.1 b1=0.1 b2=0.1 b12=0.1; 

  /* specifying the basic utility model for a 2x2 experiment */
  u = b0 + b1*X1 + b2*X2 + b12*X1*X2; 

  /* the next 2 lines formulate a logit model; these can be used as is
  even if the research design is modified from 2x2 */
  p = exp(u)/(1+exp(u));
  model k ~ binomial(n,p); 

  /* estimating the moderation effect between X1 and X2 for a 
  2x2 experiment */
  estimate 'phi12' exp(b0+b1+b2+b12)/(1+exp(b0+b1+b2+b12)) + exp(b0)/(1+exp(b0)) - exp(b0+b1)/(1+exp(b0+b1)) - exp(b0+b2)/(1+exp(b0+b2)); 
run;

/* end of code */&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2020 06:44:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/logistic-Logit-Moderation-Regression-Adding-Code-for-Covaritate/m-p/614708#M76907</guid>
      <dc:creator>Cammy</dc:creator>
      <dc:date>2020-01-02T06:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: logistic/Logit Moderation/Regression - Adding Code for Covaritate/control variables to existing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/logistic-Logit-Moderation-Regression-Adding-Code-for-Covaritate/m-p/614713#M76909</link>
      <description>&lt;P&gt;Since there are no responses; for anyone with similar problem, Hayes' PROCESS now supports dichotomous DV in moderation, so no point trying to use SAS or change code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code is for 2x2 design, which is dichotomous IV, M, and DV. I think I will have an easier time using SPSS PROCESS than trying to mess around with SAS.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2020 08:47:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/logistic-Logit-Moderation-Regression-Adding-Code-for-Covaritate/m-p/614713#M76909</guid>
      <dc:creator>Cammy</dc:creator>
      <dc:date>2020-01-02T08:47:36Z</dc:date>
    </item>
  </channel>
</rss>

