<?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: How to impute values below the LOD as random values in a log-normal distribution of 0-LOD using in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-impute-values-below-the-LOD-as-random-values-in-a-log/m-p/732338#M228208</link>
    <description>&lt;P&gt;Since you have different limits for each subject, and at least as shown, a very small sample of LOD values I'm not sure what you would actually mean by "mle" in this case.&lt;/P&gt;
&lt;P&gt;From the range 0 to LOD is easy:&lt;/P&gt;
&lt;PRE&gt;data biomarkers; 
   input id abovelod lod concentration;
   if not(abovelod) then do;
      concentration = rand('uniform');
      if concentration &amp;gt; lod then do until (concentration le lod);
         concentration = rand('uniform');
      end;
   end;
datalines;
1 1 0.5	0.6
2 0 0.6	.
3 1 0.4 1.2
4 1 0.8	0.9
5 0 0.2 .
6 0 0.7	.
7 1 0.4 1.5
8 1 0.3 0.8
9 1 0.2 1.1
10 1 0.5 0.7
;&lt;/PRE&gt;</description>
    <pubDate>Thu, 08 Apr 2021 19:59:02 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-04-08T19:59:02Z</dc:date>
    <item>
      <title>How to impute values below the LOD as random values in a log-normal distribution of 0-LOD using MLE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-impute-values-below-the-LOD-as-random-values-in-a-log/m-p/732287#M228201</link>
      <description>&lt;P&gt;Hi all. I have a data set with measured concentrations of biomarkers in serum. For values below the limit of detection (LOD), I would like to impute random values from the distribution of 0-LOD using maximum likelihood estimation. The LOD changes with each observation (based on amount of serum available). I've read some SAS blog posts on computing MLEs but this is all a bit over my head (statistics does not come easily to me!).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is some example data. "abovelod' is a binary indicator of if the concentration is above the LOD or not. "lod" is the LOD value for each person. "concentration" is the value I'd like to impute.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data biomarkers; input id abovelod lod concentration;
datalines;
1 1 0.5	0.6
2 0	0.6	.
3 1 0.4 1.2
4 1 0.8	0.9
5 0 0.2 .
6 0 0.7	.
7 1 0.4 1.5
8 1 0.3 0.8
9 1 0.2 1.1
10 1 0.5 0.7
;
run;
data biomarkers; set biomarkers;
ln_concentration=log(concentration);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Any direction appreciated, I know this is a larger ask.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I would appreciate keeping the discussion away from how to handle values below the LOD. Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: Variable "concentration" can be assumed to be log normal.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Apr 2021 18:28:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-impute-values-below-the-LOD-as-random-values-in-a-log/m-p/732287#M228201</guid>
      <dc:creator>kpberger</dc:creator>
      <dc:date>2021-04-08T18:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to impute values below the LOD as random values in a log-normal distribution of 0-LOD using</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-impute-values-below-the-LOD-as-random-values-in-a-log/m-p/732338#M228208</link>
      <description>&lt;P&gt;Since you have different limits for each subject, and at least as shown, a very small sample of LOD values I'm not sure what you would actually mean by "mle" in this case.&lt;/P&gt;
&lt;P&gt;From the range 0 to LOD is easy:&lt;/P&gt;
&lt;PRE&gt;data biomarkers; 
   input id abovelod lod concentration;
   if not(abovelod) then do;
      concentration = rand('uniform');
      if concentration &amp;gt; lod then do until (concentration le lod);
         concentration = rand('uniform');
      end;
   end;
datalines;
1 1 0.5	0.6
2 0 0.6	.
3 1 0.4 1.2
4 1 0.8	0.9
5 0 0.2 .
6 0 0.7	.
7 1 0.4 1.5
8 1 0.3 0.8
9 1 0.2 1.1
10 1 0.5 0.7
;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Apr 2021 19:59:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-impute-values-below-the-LOD-as-random-values-in-a-log/m-p/732338#M228208</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-08T19:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to impute values below the LOD as random values in a log-normal distribution of 0-LOD using</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-impute-values-below-the-LOD-as-random-values-in-a-log/m-p/732373#M228218</link>
      <description>&lt;P&gt;Back in the reptilian part of my brain, I thought there was more to "rand('uniform'".&amp;nbsp; I checked. And there is: you can use the 2nd and 3rd argument of "rand('uniform',...,...)" to replace the do group&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;if not(abovelod) then do;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;with&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  id not(abovelod) then concentration=rand('uniform',0,lod);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Apr 2021 23:39:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-impute-values-below-the-LOD-as-random-values-in-a-log/m-p/732373#M228218</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-04-08T23:39:23Z</dc:date>
    </item>
  </channel>
</rss>

