aboutsummaryrefslogblamecommitdiff
path: root/docs/dev/reference/confint.mkinfit.html
blob: 16bd388b4efe2b22f39b96dc8b84ef8140fce671 (plain) (tree)
1
2
3
4
5
6
7
8
9
               
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            




                                                                            
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
                                                                               
                                                              
 
                                                    
                                                                                    








                                                                                                                               
                                                                                                                                        


                                                      
                                     

                                                          
                                                                                                                           


                               
                                            







                                                                                                 


                                                                                                                                                      



                                                                                                                             

                                                                                                   




                                                                                                                
                                                                                   
         


                                                                                              

                                       
                                                                  
                                             

      
                                       



                           
                                

                                                                   
                                                                                                                                                                               












                                                                                





































                                                                                                                                                                                                                                                                               
                                                                         



                                                                     

                                                                       








                                                                                
                                                                   








                                                                      
                                                                     




                                                                         
 











                                                                     




                                                                                            
          
 














































































































































































                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
                                                                 
                                                                                      

      
                                            

                     
                                                                                                             
      
                     


  
  
 
                
 
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Confidence intervals for parameters of mkinfit objects — confint.mkinfit • mkin</title><!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous"><script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css"><script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous"><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"><script src="../pkgdown.js"></script><meta property="og:title" content="Confidence intervals for parameters of mkinfit objects — confint.mkinfit"><meta property="og:description" content="The default method 'quadratic' is based on the quadratic approximation of
the curvature of the likelihood function at the maximum likelihood parameter
estimates.
The alternative method 'profile' is based on the profile likelihood for each
parameter. The 'profile' method uses two nested optimisations and can take a
very long time, even if parallelized by specifying 'cores' on unixoid
platforms. The speed of the method could likely be improved by using the
method of Venzon and Moolgavkar (1988)."><meta name="robots" content="noindex"><!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--></head><body data-spy="scroll" data-target="#toc">
    

    <div class="container template-reference-topic">
      <header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <span class="navbar-brand">
        <a class="navbar-link" href="../index.html">mkin</a>
        <span class="version label label-info" data-toggle="tooltip" data-placement="bottom" title="In-development version">1.2.2</span>
      </span>
    </div>

    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav"><li>
  <a href="../reference/index.html">Functions and data</a>
</li>
<li class="dropdown">
  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
    Articles
     
    <span class="caret"></span>
  </a>
  <ul class="dropdown-menu" role="menu"><li>
      <a href="../articles/mkin.html">Introduction to mkin</a>
    </li>
    <li>
      <a href="../articles/FOCUS_D.html">Example evaluation of FOCUS Example Dataset D</a>
    </li>
    <li>
      <a href="../articles/FOCUS_L.html">Example evaluation of FOCUS Laboratory Data L1 to L3</a>
    </li>
    <li>
      <a href="../articles/web_only/dimethenamid_2018.html">Example evaluations of dimethenamid data from 2018 with nonlinear mixed-effects models</a>
    </li>
    <li>
      <a href="../articles/web_only/multistart.html">Short demo of the multistart method</a>
    </li>
    <li>
      <a href="../articles/web_only/compiled_models.html">Performance benefit by using compiled model definitions in mkin</a>
    </li>
    <li>
      <a href="../articles/web_only/FOCUS_Z.html">Example evaluation of FOCUS Example Dataset Z</a>
    </li>
    <li>
      <a href="../articles/twa.html">Calculation of time weighted average concentrations with mkin</a>
    </li>
    <li>
      <a href="../articles/web_only/NAFTA_examples.html">Example evaluation of NAFTA SOP Attachment examples</a>
    </li>
    <li>
      <a href="../articles/web_only/benchmarks.html">Benchmark timings for mkin</a>
    </li>
    <li>
      <a href="../articles/web_only/saem_benchmarks.html">Benchmark timings for saem.mmkin</a>
    </li>
  </ul></li>
<li>
  <a href="../news/index.html">News</a>
</li>
      </ul><ul class="nav navbar-nav navbar-right"><li>
  <a href="https://github.com/jranke/mkin/" class="external-link">
    <span class="fab fa-github fa-lg"></span>
     
  </a>
</li>
      </ul></div><!--/.nav-collapse -->
  </div><!--/.container -->
</div><!--/.navbar -->

      

      </header><div class="row">
  <div class="col-md-9 contents">
    <div class="page-header">
    <h1>Confidence intervals for parameters of mkinfit objects</h1>
    <small class="dont-index">Source: <a href="https://github.com/jranke/mkin/blob/HEAD/R/confint.mkinfit.R" class="external-link"><code>R/confint.mkinfit.R</code></a></small>
    <div class="hidden name"><code>confint.mkinfit.Rd</code></div>
    </div>

    <div class="ref-description">
    <p>The default method 'quadratic' is based on the quadratic approximation of
the curvature of the likelihood function at the maximum likelihood parameter
estimates.
The alternative method 'profile' is based on the profile likelihood for each
parameter. The 'profile' method uses two nested optimisations and can take a
very long time, even if parallelized by specifying 'cores' on unixoid
platforms. The speed of the method could likely be improved by using the
method of Venzon and Moolgavkar (1988).</p>
    </div>

    <div id="ref-usage">
    <div class="sourceCode"><pre class="sourceCode r"><code><span><span class="co"># S3 method for mkinfit</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span></span>
<span>  <span class="va">object</span>,</span>
<span>  <span class="va">parm</span>,</span>
<span>  level <span class="op">=</span> <span class="fl">0.95</span>,</span>
<span>  alpha <span class="op">=</span> <span class="fl">1</span> <span class="op">-</span> <span class="va">level</span>,</span>
<span>  <span class="va">cutoff</span>,</span>
<span>  method <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"quadratic"</span>, <span class="st">"profile"</span><span class="op">)</span>,</span>
<span>  transformed <span class="op">=</span> <span class="cn">TRUE</span>,</span>
<span>  backtransform <span class="op">=</span> <span class="cn">TRUE</span>,</span>
<span>  cores <span class="op">=</span> <span class="fu">parallel</span><span class="fu">::</span><span class="fu"><a href="https://rdrr.io/r/parallel/detectCores.html" class="external-link">detectCores</a></span><span class="op">(</span><span class="op">)</span>,</span>
<span>  rel_tol <span class="op">=</span> <span class="fl">0.01</span>,</span>
<span>  quiet <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span>  <span class="va">...</span></span>
<span><span class="op">)</span></span></code></pre></div>
    </div>

    <div id="arguments">
    <h2>Arguments</h2>
    <dl><dt>object</dt>
<dd><p>An <code><a href="mkinfit.html">mkinfit</a></code> object</p></dd>


<dt>parm</dt>
<dd><p>A vector of names of the parameters which are to be given
confidence intervals. If missing, all parameters are considered.</p></dd>


<dt>level</dt>
<dd><p>The confidence level required</p></dd>


<dt>alpha</dt>
<dd><p>The allowed error probability, overrides 'level' if specified.</p></dd>


<dt>cutoff</dt>
<dd><p>Possibility to specify an alternative cutoff for the difference
in the log-likelihoods at the confidence boundary. Specifying an explicit
cutoff value overrides arguments 'level' and 'alpha'</p></dd>


<dt>method</dt>
<dd><p>The 'quadratic' method approximates the likelihood function at
the optimised parameters using the second term of the Taylor expansion,
using a second derivative (hessian) contained in the object.
The 'profile' method searches the parameter space for the
cutoff of the confidence intervals by means of a likelihood ratio test.</p></dd>


<dt>transformed</dt>
<dd><p>If the quadratic approximation is used, should it be
applied to the likelihood based on the transformed parameters?</p></dd>


<dt>backtransform</dt>
<dd><p>If we approximate the likelihood in terms of the
transformed parameters, should we backtransform the parameters with
their confidence intervals?</p></dd>


<dt>cores</dt>
<dd><p>The number of cores to be used for multicore processing.
On Windows machines, cores &gt; 1 is currently not supported.</p></dd>


<dt>rel_tol</dt>
<dd><p>If the method is 'profile', what should be the accuracy
of the lower and upper bounds, relative to the estimate obtained from
the quadratic method?</p></dd>


<dt>quiet</dt>
<dd><p>Should we suppress the message "Profiling the likelihood"</p></dd>


<dt>...</dt>
<dd><p>Not used</p></dd>

</dl></div>
    <div id="value">
    <h2>Value</h2>
    

<p>A matrix with columns giving lower and upper confidence limits for
each parameter.</p>
    </div>
    <div id="references">
    <h2>References</h2>
    <p>Bates DM and Watts GW (1988) Nonlinear regression analysis &amp; its applications</p>
<p>Pawitan Y (2013) In all likelihood - Statistical modelling and
inference using likelihood. Clarendon Press, Oxford.</p>
<p>Venzon DJ and Moolgavkar SH (1988) A Method for Computing
Profile-Likelihood Based Confidence Intervals, Applied Statistics, 37,
87–94.</p>
    </div>

    <div id="ref-examples">
    <h2>Examples</h2>
    <div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="va">f</span> <span class="op">&lt;-</span> <span class="fu"><a href="mkinfit.html">mkinfit</a></span><span class="op">(</span><span class="st">"SFO"</span>, <span class="va">FOCUS_2006_C</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f</span>, method <span class="op">=</span> <span class="st">"quadratic"</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                2.5%      97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0 71.8242430 93.1600766</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent  0.2109541  0.4440528</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma     1.9778868  7.3681380</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># \dontrun{</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f</span>, method <span class="op">=</span> <span class="st">"profile"</span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Profiling the likelihood</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                2.5%      97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0 73.0641834 92.1392181</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent  0.2170293  0.4235348</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma     3.1307772  8.0628314</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># Set the number of cores for the profiling method for further examples</span></span></span>
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/identical.html" class="external-link">identical</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/Sys.getenv.html" class="external-link">Sys.getenv</a></span><span class="op">(</span><span class="st">"NOT_CRAN"</span><span class="op">)</span>, <span class="st">"true"</span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span>  <span class="va">n_cores</span> <span class="op">&lt;-</span> <span class="fu">parallel</span><span class="fu">::</span><span class="fu"><a href="https://rdrr.io/r/parallel/detectCores.html" class="external-link">detectCores</a></span><span class="op">(</span><span class="op">)</span> <span class="op">-</span> <span class="fl">1</span></span></span>
<span class="r-in"><span><span class="op">}</span> <span class="kw">else</span> <span class="op">{</span></span></span>
<span class="r-in"><span>  <span class="va">n_cores</span> <span class="op">&lt;-</span> <span class="fl">1</span></span></span>
<span class="r-in"><span><span class="op">}</span></span></span>
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/Sys.getenv.html" class="external-link">Sys.getenv</a></span><span class="op">(</span><span class="st">"TRAVIS"</span><span class="op">)</span> <span class="op">!=</span> <span class="st">""</span><span class="op">)</span> <span class="va">n_cores</span> <span class="op">=</span> <span class="fl">1</span></span></span>
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/Sys.info.html" class="external-link">Sys.info</a></span><span class="op">(</span><span class="op">)</span><span class="op">[</span><span class="st">"sysname"</span><span class="op">]</span> <span class="op">==</span> <span class="st">"Windows"</span><span class="op">)</span> <span class="va">n_cores</span> <span class="op">=</span> <span class="fl">1</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="va">SFO_SFO</span> <span class="op">&lt;-</span> <span class="fu"><a href="mkinmod.html">mkinmod</a></span><span class="op">(</span>parent <span class="op">=</span> <span class="fu"><a href="mkinmod.html">mkinsub</a></span><span class="op">(</span><span class="st">"SFO"</span>, <span class="st">"m1"</span><span class="op">)</span>, m1 <span class="op">=</span> <span class="fu"><a href="mkinmod.html">mkinsub</a></span><span class="op">(</span><span class="st">"SFO"</span><span class="op">)</span>,</span></span>
<span class="r-in"><span>  use_of_ff <span class="op">=</span> <span class="st">"min"</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">SFO_SFO.ff</span> <span class="op">&lt;-</span> <span class="fu"><a href="mkinmod.html">mkinmod</a></span><span class="op">(</span>parent <span class="op">=</span> <span class="fu"><a href="mkinmod.html">mkinsub</a></span><span class="op">(</span><span class="st">"SFO"</span>, <span class="st">"m1"</span><span class="op">)</span>, m1 <span class="op">=</span> <span class="fu"><a href="mkinmod.html">mkinsub</a></span><span class="op">(</span><span class="st">"SFO"</span><span class="op">)</span>,</span></span>
<span class="r-in"><span>  use_of_ff <span class="op">=</span> <span class="st">"max"</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">f_d_1</span> <span class="op">&lt;-</span> <span class="fu"><a href="mkinfit.html">mkinfit</a></span><span class="op">(</span><span class="va">SFO_SFO</span>, <span class="fu"><a href="https://rdrr.io/r/base/subset.html" class="external-link">subset</a></span><span class="op">(</span><span class="va">FOCUS_2006_D</span>, <span class="va">value</span> <span class="op">!=</span> <span class="fl">0</span><span class="op">)</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/system.time.html" class="external-link">system.time</a></span><span class="op">(</span><span class="va">ci_profile</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f_d_1</span>, method <span class="op">=</span> <span class="st">"profile"</span>, cores <span class="op">=</span> <span class="fl">1</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>    user  system elapsed </span>
<span class="r-out co"><span class="r-pr">#&gt;</span>   3.811   0.004   3.815 </span>
<span class="r-in"><span><span class="co"># Using more cores does not save much time here, as parent_0 takes up most of the time</span></span></span>
<span class="r-in"><span><span class="co"># If we additionally exclude parent_0 (the confidence of which is often of</span></span></span>
<span class="r-in"><span><span class="co"># minor interest), we get a nice performance improvement if we use at least 4 cores</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/system.time.html" class="external-link">system.time</a></span><span class="op">(</span><span class="va">ci_profile_no_parent_0</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f_d_1</span>, method <span class="op">=</span> <span class="st">"profile"</span>,</span></span>
<span class="r-in"><span>  <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"k_parent_sink"</span>, <span class="st">"k_parent_m1"</span>, <span class="st">"k_m1_sink"</span>, <span class="st">"sigma"</span><span class="op">)</span>, cores <span class="op">=</span> <span class="va">n_cores</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Profiling the likelihood</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>    user  system elapsed </span>
<span class="r-out co"><span class="r-pr">#&gt;</span>   2.313   0.004   2.318 </span>
<span class="r-in"><span><span class="va">ci_profile</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                       2.5%        97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0      96.456003640 1.027703e+02</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_sink  0.040762501 5.549764e-02</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_m1    0.046786482 5.500879e-02</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1_sink      0.003892605 6.702778e-03</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma          2.535612399 3.985263e+00</span>
<span class="r-in"><span><span class="va">ci_quadratic_transformed</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f_d_1</span>, method <span class="op">=</span> <span class="st">"quadratic"</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">ci_quadratic_transformed</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                       2.5%        97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0      96.403841640 1.027931e+02</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_sink  0.041033378 5.596269e-02</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_m1    0.046777902 5.511931e-02</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1_sink      0.004012217 6.897547e-03</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma          2.396089689 3.854918e+00</span>
<span class="r-in"><span><span class="va">ci_quadratic_untransformed</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f_d_1</span>, method <span class="op">=</span> <span class="st">"quadratic"</span>, transformed <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">ci_quadratic_untransformed</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                       2.5%        97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0      96.403841645 102.79312449</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_sink  0.040485331   0.05535491</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_m1    0.046611582   0.05494364</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1_sink      0.003835483   0.00668582</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma          2.396089689   3.85491806</span>
<span class="r-in"><span><span class="co"># Against the expectation based on Bates and Watts (1988), the confidence</span></span></span>
<span class="r-in"><span><span class="co"># intervals based on the internal parameter transformation are less</span></span></span>
<span class="r-in"><span><span class="co"># congruent with the likelihood based intervals. Note the superiority of the</span></span></span>
<span class="r-in"><span><span class="co"># interval based on the untransformed fit for k_m1_sink</span></span></span>
<span class="r-in"><span><span class="va">rel_diffs_transformed</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/MathFun.html" class="external-link">abs</a></span><span class="op">(</span><span class="op">(</span><span class="va">ci_quadratic_transformed</span> <span class="op">-</span> <span class="va">ci_profile</span><span class="op">)</span><span class="op">/</span><span class="va">ci_profile</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">rel_diffs_untransformed</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/MathFun.html" class="external-link">abs</a></span><span class="op">(</span><span class="op">(</span><span class="va">ci_quadratic_untransformed</span> <span class="op">-</span> <span class="va">ci_profile</span><span class="op">)</span><span class="op">/</span><span class="va">ci_profile</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">rel_diffs_transformed</span> <span class="op">&lt;</span> <span class="va">rel_diffs_untransformed</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                2.5% 97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0      FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_sink  TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_m1    TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1_sink     FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma         FALSE FALSE</span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/Round.html" class="external-link">signif</a></span><span class="op">(</span><span class="va">rel_diffs_transformed</span>, <span class="fl">3</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                   2.5%    97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0      0.000541 0.000222</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_sink 0.006650 0.008380</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_m1   0.000183 0.002010</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1_sink     0.030700 0.029100</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma         0.055000 0.032700</span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/Round.html" class="external-link">signif</a></span><span class="op">(</span><span class="va">rel_diffs_untransformed</span>, <span class="fl">3</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                   2.5%    97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0      0.000541 0.000222</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_sink 0.006800 0.002570</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_m1   0.003740 0.001180</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1_sink     0.014700 0.002530</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma         0.055000 0.032700</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># Investigate a case with formation fractions</span></span></span>
<span class="r-in"><span><span class="va">f_d_2</span> <span class="op">&lt;-</span> <span class="fu"><a href="mkinfit.html">mkinfit</a></span><span class="op">(</span><span class="va">SFO_SFO.ff</span>, <span class="fu"><a href="https://rdrr.io/r/base/subset.html" class="external-link">subset</a></span><span class="op">(</span><span class="va">FOCUS_2006_D</span>, <span class="va">value</span> <span class="op">!=</span> <span class="fl">0</span><span class="op">)</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">ci_profile_ff</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f_d_2</span>, method <span class="op">=</span> <span class="st">"profile"</span>, cores <span class="op">=</span> <span class="va">n_cores</span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Profiling the likelihood</span>
<span class="r-in"><span><span class="va">ci_profile_ff</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                        2.5%        97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0       96.456003640 1.027703e+02</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent        0.090911032 1.071578e-01</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1            0.003892606 6.702775e-03</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> f_parent_to_m1  0.471328495 5.611550e-01</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma           2.535612399 3.985263e+00</span>
<span class="r-in"><span><span class="va">ci_quadratic_transformed_ff</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f_d_2</span>, method <span class="op">=</span> <span class="st">"quadratic"</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">ci_quadratic_transformed_ff</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                        2.5%        97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0       96.403833578 102.79311649</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent        0.090823771   0.10725430</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1            0.004012219   0.00689755</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> f_parent_to_m1  0.469118824   0.55959615</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma           2.396089689   3.85491806</span>
<span class="r-in"><span><span class="va">ci_quadratic_untransformed_ff</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f_d_2</span>, method <span class="op">=</span> <span class="st">"quadratic"</span>, transformed <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">ci_quadratic_untransformed_ff</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                        2.5%        97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0       96.403833583 1.027931e+02</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent        0.090491913 1.069035e-01</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1            0.003835485 6.685823e-03</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> f_parent_to_m1  0.469113477 5.598387e-01</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma           2.396089689 3.854918e+00</span>
<span class="r-in"><span><span class="va">rel_diffs_transformed_ff</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/MathFun.html" class="external-link">abs</a></span><span class="op">(</span><span class="op">(</span><span class="va">ci_quadratic_transformed_ff</span> <span class="op">-</span> <span class="va">ci_profile_ff</span><span class="op">)</span><span class="op">/</span><span class="va">ci_profile_ff</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">rel_diffs_untransformed_ff</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/MathFun.html" class="external-link">abs</a></span><span class="op">(</span><span class="op">(</span><span class="va">ci_quadratic_untransformed_ff</span> <span class="op">-</span> <span class="va">ci_profile_ff</span><span class="op">)</span><span class="op">/</span><span class="va">ci_profile_ff</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="co"># While the confidence interval for the parent rate constant is closer to</span></span></span>
<span class="r-in"><span><span class="co"># the profile based interval when using the internal parameter</span></span></span>
<span class="r-in"><span><span class="co"># transformation, the interval for the metabolite rate constant is 'better</span></span></span>
<span class="r-in"><span><span class="co"># without internal parameter transformation.</span></span></span>
<span class="r-in"><span><span class="va">rel_diffs_transformed_ff</span> <span class="op">&lt;</span> <span class="va">rel_diffs_untransformed_ff</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                 2.5% 97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0       FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent        TRUE  TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1           FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> f_parent_to_m1  TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma           TRUE FALSE</span>
<span class="r-in"><span><span class="va">rel_diffs_transformed_ff</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                        2.5%        97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0       0.0005408690 0.0002217233</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent       0.0009598532 0.0009001864</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1           0.0307283041 0.0290588361</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> f_parent_to_m1 0.0046881769 0.0027780063</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma          0.0550252516 0.0327066836</span>
<span class="r-in"><span><span class="va">rel_diffs_untransformed_ff</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                        2.5%        97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0       0.0005408689 0.0002217232</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent       0.0046102156 0.0023732281</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1           0.0146740690 0.0025291820</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> f_parent_to_m1 0.0046995211 0.0023457712</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma          0.0550252516 0.0327066836</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># The profiling for the following fit does not finish in a reasonable time,</span></span></span>
<span class="r-in"><span><span class="co"># therefore we use the quadratic approximation</span></span></span>
<span class="r-in"><span><span class="va">m_synth_DFOP_par</span> <span class="op">&lt;-</span> <span class="fu"><a href="mkinmod.html">mkinmod</a></span><span class="op">(</span>parent <span class="op">=</span> <span class="fu"><a href="mkinmod.html">mkinsub</a></span><span class="op">(</span><span class="st">"DFOP"</span>, <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"M1"</span>, <span class="st">"M2"</span><span class="op">)</span><span class="op">)</span>,</span></span>
<span class="r-in"><span>  M1 <span class="op">=</span> <span class="fu"><a href="mkinmod.html">mkinsub</a></span><span class="op">(</span><span class="st">"SFO"</span><span class="op">)</span>,</span></span>
<span class="r-in"><span>  M2 <span class="op">=</span> <span class="fu"><a href="mkinmod.html">mkinsub</a></span><span class="op">(</span><span class="st">"SFO"</span><span class="op">)</span>,</span></span>
<span class="r-in"><span>  use_of_ff <span class="op">=</span> <span class="st">"max"</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">DFOP_par_c</span> <span class="op">&lt;-</span> <span class="va">synthetic_data_for_UBA_2014</span><span class="op">[[</span><span class="fl">12</span><span class="op">]</span><span class="op">]</span><span class="op">$</span><span class="va">data</span></span></span>
<span class="r-in"><span><span class="va">f_tc_2</span> <span class="op">&lt;-</span> <span class="fu"><a href="mkinfit.html">mkinfit</a></span><span class="op">(</span><span class="va">m_synth_DFOP_par</span>, <span class="va">DFOP_par_c</span>, error_model <span class="op">=</span> <span class="st">"tc"</span>,</span></span>
<span class="r-in"><span>  error_model_algorithm <span class="op">=</span> <span class="st">"direct"</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f_tc_2</span>, method <span class="op">=</span> <span class="st">"quadratic"</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                        2.5%        97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0       94.596039609 106.19954892</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_M1            0.037605368   0.04490762</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_M2            0.008568731   0.01087676</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> f_parent_to_M1  0.021462489   0.62023882</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> f_parent_to_M2  0.015165617   0.37975348</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k1              0.273897348   0.33388101</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k2              0.018614554   0.02250378</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> g               0.671943411   0.73583305</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma_low       0.251283495   0.83992077</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> rsd_high        0.040411024   0.07662008</span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f_tc_2</span>, <span class="st">"parent_0"</span>, method <span class="op">=</span> <span class="st">"quadratic"</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>              2.5%    97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0 94.59604 106.1995</span>
<span class="r-in"><span><span class="co"># }</span></span></span>
</code></pre></div>
    </div>
  </div>
  <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
    <nav id="toc" data-toggle="toc" class="sticky-top"><h2 data-toc-skip>Contents</h2>
    </nav></div>
</div>


      <footer><div class="copyright">
  <p></p><p>Developed by Johannes Ranke.</p>
</div>

<div class="pkgdown">
  <p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.6.</p>
</div>

      </footer></div>

  


  

  </body></html>

Contact - Imprint