<?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 regression simulation - inducing mean difference in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Logistic-regression-simulation-inducing-mean-difference/m-p/253322#M13361</link>
    <description>&lt;P&gt;I can'tthink of any reason why the results would be different in 9.2 versus 9.4, but I'm glad you were able to resolve the issue.&lt;/P&gt;</description>
    <pubDate>Tue, 01 Mar 2016 01:10:08 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2016-03-01T01:10:08Z</dc:date>
    <item>
      <title>Logistic regression simulation - inducing mean difference</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Logistic-regression-simulation-inducing-mean-difference/m-p/253286#M13358</link>
      <description>&lt;P&gt;Hi all, in the code below I would like to simulate a data based on logistic regression model. My primary goal is to create the simluated data and retreive the coefficinets on the log scale, making sure predictor means by the binary outcome variable differ by, say ~ 0.5 standard deviation. When I employ proc logistic on the simulated data coefficients are off on the log scale. In addition trying many samples, I found the mean of the predictor by the binary outcome are very close to each other regardless of the magnitude of&amp;nbsp;beta coefficients. Something is wrong, and I can't seem to pinpoint the problem. Please help. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let N=200;
proc iml;
	t = J(&amp;amp;N, 1);
	X = J(&amp;amp;N, 2);
	call randseed(4321);
	call RANDGEN(X, "NORMAL", 0, 1);
		beta = {1.40, -0.60, -0.40};
		Xb = J(&amp;amp;N,1,1)||X; 
	  	eta = Xb*beta;
	  	mu = LOGISTIC(eta);
	call RANDGEN(t, "BERNOULLI", mu);
	tempdata = t||x;
	create logdata from tempdata[colname={'t' 'x1' 'x2'}];
	append from tempdata;
	close logdata;
quit;
proc logistic data=logdata;
	model t = x1 x2;
run;
proc means data = logdata;
	class t;
	var x1 x2;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Feb 2016 21:00:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Logistic-regression-simulation-inducing-mean-difference/m-p/253286#M13358</guid>
      <dc:creator>MetinBulus</dc:creator>
      <dc:date>2016-02-29T21:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Logistic regression simulation - inducing mean difference</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Logistic-regression-simulation-inducing-mean-difference/m-p/253293#M13359</link>
      <description>&lt;P&gt;It's always helpful to provide a reference. This code appears to have come from the article &lt;A href="http://blogs.sas.com/content/iml/2014/06/25/simulate-logistic-data.html" target="_self"&gt;"Simulate data for a logistic model"&lt;/A&gt;&amp;nbsp;except that your code uses different values for the beta coefficients and you changed a few variable names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you read to the end of the article, you will see that the MODEL statement uses (Event='1'), whereas you are using the default event='0'.&amp;nbsp; Change your MODEL statement to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;model&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; t(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;event&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'1'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;) = x1 x2 / &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;clparm&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=wald;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and you will see that your parameter estimates are close to the population parameters from the simulation.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 21:18:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Logistic-regression-simulation-inducing-mean-difference/m-p/253293#M13359</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-02-29T21:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: Logistic regression simulation - inducing mean difference</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Logistic-regression-simulation-inducing-mean-difference/m-p/253307#M13360</link>
      <description>&lt;P&gt;Thanks Rick! Modeling the data based on (event='0') or (event='1') shouldn't make a difference, as it only changes the sign. I also could not induce mean difference on x1 or x2, between t=1 and t=0 groups. But the code suprisingly works using SAS university edition on my laptop, whereas it consistently underestimated coefficients almost by half with no mean difference induced on my office PC. That's weird, SAS on the PC may need some update, I believe it was v9.2!&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 22:05:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Logistic-regression-simulation-inducing-mean-difference/m-p/253307#M13360</guid>
      <dc:creator>MetinBulus</dc:creator>
      <dc:date>2016-02-29T22:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: Logistic regression simulation - inducing mean difference</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Logistic-regression-simulation-inducing-mean-difference/m-p/253322#M13361</link>
      <description>&lt;P&gt;I can'tthink of any reason why the results would be different in 9.2 versus 9.4, but I'm glad you were able to resolve the issue.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2016 01:10:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Logistic-regression-simulation-inducing-mean-difference/m-p/253322#M13361</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-03-01T01:10:08Z</dc:date>
    </item>
  </channel>
</rss>

