aboutsummaryrefslogblamecommitdiff
path: root/docs/reference/plot.mixed.mmkin.html
blob: 9ec5d65a8d30ce5346f436773307f68c7c419195 (plain) (tree)
1
2
3
4
5
6
7
8
               
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          

                                                                               

                                                                          
    
 









                                                                                                                                                                                
 


                                                                  
     


























                                                                                                                                                                                                
     








                                                                                                                                                                                                                     


      









                                                                                                                                                                                   

          
                                                


                                                                                                

                                                                                             





                                                                                                                                                                                                                                                                                                                                             

                                                                                                                                                                                                                                                                                                  


                                                                                                                                                                                                                                                                                                                                       
                                                                                   















                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
          
 

                                                                                                 

                                                                                                                                                       

 


                                                                                       

 

                                                                
                                                                       
                                

 


                                                                 

 













                                                                                 

                                     

 

                                          

 


                                                           

 

                                                         
                                                                     

                                                                      

 


                                                                                                              

 


                                                                                 

 

                                                                                 
                                                    

 

                                                                                 
                                                    

 

                                               

 


                                                                    

 

                                                      

 

                                                   

 

                                                              

 

                                                          

 

                                                         

 


                                                                         

 

                                                                

 

                                                         

 

                                                                                                                                               
 
           

                                                                                     


                                                  
          

                                                                                  

                                                                                

                                                                                        
                         
          
 

                                                                                                      







                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
                                                                                                 





                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
                                                                                                 


                                                                                                                                                                                                                                                                                                               
                                                                                                 


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
                                                                                                                                               
                                                                                                                                                                                                                                     
                                                                                                                                                       






                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
                                                                                                 
                                                                  

                   

                                                                    

 
                                             
                                            

      
                                  
                                                                                                             

      
                   


  
  
 
                
 
<!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, shrink-to-fit=no"><meta name="description" content="Plot predictions from a fitted nonlinear mixed model obtained via an mmkin row object"><title>Plot predictions from a fitted nonlinear mixed model obtained via an mmkin row object — plot.mixed.mmkin • mkin</title><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.2.2/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.2.2/bootstrap.bundle.min.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"><!-- bootstrap-toc --><script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@v1.0.1/dist/bootstrap-toc.min.js" integrity="sha256-4veVQbu7//Lk5TSmc7YV48MxtMy98e26cf5MrgZYnwo=" 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><!-- 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><!-- search --><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Plot predictions from a fitted nonlinear mixed model obtained via an mmkin row object — plot.mixed.mmkin"><meta property="og:description" content="Plot predictions from a fitted nonlinear mixed model obtained via an mmkin row object"><!-- 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>
    <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
    

    <nav class="navbar fixed-top navbar-default navbar-expand-lg bg-light"><div class="container">
    
    <a class="navbar-brand me-2" href="../index.html">mkin</a>

    <small class="nav-text text-default me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Released version">1.2.6</small>

    
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div id="navbar" class="collapse navbar-collapse ms-3">
      <ul class="navbar-nav me-auto"><li class="active nav-item">
  <a class="nav-link" href="../reference/index.html">Reference</a>
</li>
<li class="nav-item dropdown">
  <a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true" id="dropdown-articles">Articles</a>
  <div class="dropdown-menu" aria-labelledby="dropdown-articles">
    <a class="dropdown-item" href="../articles/mkin.html">Introduction to mkin</a>
    <div class="dropdown-divider"></div>
    <h6 class="dropdown-header" data-toc-skip>Example evaluations with (generalised) nonlinear least squares</h6>
    <a class="dropdown-item" href="../articles/FOCUS_D.html">Example evaluation of FOCUS Example Dataset D</a>
    <a class="dropdown-item" href="../articles/FOCUS_L.html">Example evaluation of FOCUS Laboratory Data L1 to L3</a>
    <a class="dropdown-item" href="../articles/web_only/FOCUS_Z.html">Example evaluation of FOCUS Example Dataset Z</a>
    <div class="dropdown-divider"></div>
    <h6 class="dropdown-header" data-toc-skip>Example evaluations with hierarchical models (nonlinear mixed-effects models)</h6>
    <a class="dropdown-item" href="../articles/prebuilt/2022_dmta_parent.html">Testing hierarchical parent degradation kinetics with residue data on dimethenamid and dimethenamid-P</a>
    <a class="dropdown-item" href="../articles/prebuilt/2022_dmta_pathway.html">Testing hierarchical pathway kinetics with residue data on dimethenamid and dimethenamid-P</a>
    <a class="dropdown-item" href="../articles/prebuilt/2023_mesotrione_parent.html">Testing covariate modelling in hierarchical parent degradation kinetics with residue data on mesotrione</a>
    <a class="dropdown-item" href="../articles/prebuilt/2022_cyan_pathway.html">Testing hierarchical pathway kinetics with residue data on cyantraniliprole</a>
    <a class="dropdown-item" href="../articles/web_only/dimethenamid_2018.html">Comparison of saemix and nlme evaluations of dimethenamid data from 2018</a>
    <a class="dropdown-item" href="../articles/web_only/multistart.html">Short demo of the multistart method</a>
    <div class="dropdown-divider"></div>
    <h6 class="dropdown-header" data-toc-skip>Performance</h6>
    <a class="dropdown-item" href="../articles/web_only/compiled_models.html">Performance benefit by using compiled model definitions in mkin</a>
    <a class="dropdown-item" href="../articles/web_only/benchmarks.html">Benchmark timings for mkin</a>
    <a class="dropdown-item" href="../articles/web_only/saem_benchmarks.html">Benchmark timings for saem.mmkin</a>
    <div class="dropdown-divider"></div>
    <h6 class="dropdown-header" data-toc-skip>Miscellaneous</h6>
    <a class="dropdown-item" href="../articles/twa.html">Calculation of time weighted average concentrations with mkin</a>
    <a class="dropdown-item" href="../articles/web_only/NAFTA_examples.html">Example evaluation of NAFTA SOP Attachment examples</a>
  </div>
</li>
<li class="nav-item">
  <a class="nav-link" href="../news/index.html">News</a>
</li>
      </ul><form class="form-inline my-2 my-lg-0" role="search">
        <input type="search" class="form-control me-sm-2" aria-label="Toggle navigation" name="search-input" data-search-index="../search.json" id="search-input" placeholder="Search for" autocomplete="off"></form>

      <ul class="navbar-nav"><li class="nav-item">
  <a class="external-link nav-link" href="https://github.com/jranke/mkin/" aria-label="github">
    <span class="fab fa fab fa-github fa-lg"></span>
     
  </a>
</li>
      </ul></div>

    
  </div>
</nav><div class="container template-reference-topic">
<div class="row">
  <main id="main" class="col-md-9"><div class="page-header">
      <img src="" class="logo" alt=""><h1>Plot predictions from a fitted nonlinear mixed model obtained via an mmkin row object</h1>
      <small class="dont-index">Source: <a href="https://github.com/jranke/mkin/blob/HEAD/R/plot.mixed.mmkin.R" class="external-link"><code>R/plot.mixed.mmkin.R</code></a></small>
      <div class="d-none name"><code>plot.mixed.mmkin.Rd</code></div>
    </div>

    <div class="ref-description section level2">
    <p>Plot predictions from a fitted nonlinear mixed model obtained via an mmkin row object</p>
    </div>

    <div class="section level2">
    <h2 id="ref-usage">Usage<a class="anchor" aria-label="anchor" href="#ref-usage"></a></h2>
    <div class="sourceCode"><pre class="sourceCode r"><code><span><span class="co"># S3 method for mixed.mmkin</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span></span>
<span>  <span class="va">x</span>,</span>
<span>  i <span class="op">=</span> <span class="fl">1</span><span class="op">:</span><span class="fu"><a href="https://rdrr.io/r/base/nrow.html" class="external-link">ncol</a></span><span class="op">(</span><span class="va">x</span><span class="op">$</span><span class="va">mmkin</span><span class="op">)</span>,</span>
<span>  obs_vars <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="va">x</span><span class="op">$</span><span class="va">mkinmod</span><span class="op">$</span><span class="va">map</span><span class="op">)</span>,</span>
<span>  standardized <span class="op">=</span> <span class="cn">TRUE</span>,</span>
<span>  covariates <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  covariate_quantiles <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="fl">0.5</span>, <span class="fl">0.05</span>, <span class="fl">0.95</span><span class="op">)</span>,</span>
<span>  xlab <span class="op">=</span> <span class="st">"Time"</span>,</span>
<span>  xlim <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/range.html" class="external-link">range</a></span><span class="op">(</span><span class="va">x</span><span class="op">$</span><span class="va">data</span><span class="op">$</span><span class="va">time</span><span class="op">)</span>,</span>
<span>  resplot <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">"predicted"</span>, <span class="st">"time"</span><span class="op">)</span>,</span>
<span>  pop_curves <span class="op">=</span> <span class="st">"auto"</span>,</span>
<span>  pred_over <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  test_log_parms <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span>  conf.level <span class="op">=</span> <span class="fl">0.6</span>,</span>
<span>  default_log_parms <span class="op">=</span> <span class="cn">NA</span>,</span>
<span>  ymax <span class="op">=</span> <span class="st">"auto"</span>,</span>
<span>  maxabs <span class="op">=</span> <span class="st">"auto"</span>,</span>
<span>  ncol.legend <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/ifelse.html" class="external-link">ifelse</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/length.html" class="external-link">length</a></span><span class="op">(</span><span class="va">i</span><span class="op">)</span> <span class="op">&lt;=</span> <span class="fl">3</span>, <span class="fu"><a href="https://rdrr.io/r/base/length.html" class="external-link">length</a></span><span class="op">(</span><span class="va">i</span><span class="op">)</span> <span class="op">+</span> <span class="fl">1</span>, <span class="fu"><a href="https://rdrr.io/r/base/ifelse.html" class="external-link">ifelse</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/length.html" class="external-link">length</a></span><span class="op">(</span><span class="va">i</span><span class="op">)</span> <span class="op">&lt;=</span> <span class="fl">8</span>, <span class="fl">3</span>, <span class="fl">4</span><span class="op">)</span><span class="op">)</span>,</span>
<span>  nrow.legend <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/Round.html" class="external-link">ceiling</a></span><span class="op">(</span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/length.html" class="external-link">length</a></span><span class="op">(</span><span class="va">i</span><span class="op">)</span> <span class="op">+</span> <span class="fl">1</span><span class="op">)</span><span class="op">/</span><span class="va">ncol.legend</span><span class="op">)</span>,</span>
<span>  rel.height.legend <span class="op">=</span> <span class="fl">0.02</span> <span class="op">+</span> <span class="fl">0.07</span> <span class="op">*</span> <span class="va">nrow.legend</span>,</span>
<span>  rel.height.bottom <span class="op">=</span> <span class="fl">1.1</span>,</span>
<span>  pch_ds <span class="op">=</span> <span class="fl">1</span><span class="op">:</span><span class="fu"><a href="https://rdrr.io/r/base/length.html" class="external-link">length</a></span><span class="op">(</span><span class="va">i</span><span class="op">)</span>,</span>
<span>  col_ds <span class="op">=</span> <span class="va">pch_ds</span> <span class="op">+</span> <span class="fl">1</span>,</span>
<span>  lty_ds <span class="op">=</span> <span class="va">col_ds</span>,</span>
<span>  frame <span class="op">=</span> <span class="cn">TRUE</span>,</span>
<span>  <span class="va">...</span></span>
<span><span class="op">)</span></span></code></pre></div>
    </div>

    <div class="section level2">
    <h2 id="arguments">Arguments<a class="anchor" aria-label="anchor" href="#arguments"></a></h2>
    <dl><dt>x</dt>
<dd><p>An object of class <a href="mixed.html">mixed.mmkin</a>, <a href="saem.html">saem.mmkin</a> or <a href="nlme.mmkin.html">nlme.mmkin</a></p></dd>


<dt>i</dt>
<dd><p>A numeric index to select datasets for which to plot the individual predictions,
in case plots get too large</p></dd>


<dt>obs_vars</dt>
<dd><p>A character vector of names of the observed variables for
which the data and the model should be plotted. Defauls to all observed
variables in the model.</p></dd>


<dt>standardized</dt>
<dd><p>Should the residuals be standardized? Only takes effect if
<code>resplot = "time"</code>.</p></dd>


<dt>covariates</dt>
<dd><p>Data frame with covariate values for all variables in
any covariate models in the object. If given, it overrides 'covariate_quantiles'.
Each line in the data frame will result in a line drawn for the population.
Rownames are used in the legend to label the lines.</p></dd>


<dt>covariate_quantiles</dt>
<dd><p>This argument only has an effect if the fitted
object has covariate models. If so, the default is to show three population
curves, for the 5th percentile, the 50th percentile and the 95th percentile
of the covariate values used for fitting the model.</p></dd>


<dt>xlab</dt>
<dd><p>Label for the x axis.</p></dd>


<dt>xlim</dt>
<dd><p>Plot range in x direction.</p></dd>


<dt>resplot</dt>
<dd><p>Should the residuals plotted against time or against
predicted values?</p></dd>


<dt>pop_curves</dt>
<dd><p>Per default, one population curve is drawn in case
population parameters are fitted by the model, e.g. for saem objects.
In case there is a covariate model, the behaviour depends on the value
of 'covariates'</p></dd>


<dt>pred_over</dt>
<dd><p>Named list of alternative predictions as obtained
from <a href="mkinpredict.html">mkinpredict</a> with a compatible <a href="mkinmod.html">mkinmod</a>.</p></dd>


<dt>test_log_parms</dt>
<dd><p>Passed to <a href="mean_degparms.html">mean_degparms</a> in the case of an
<a href="mixed.html">mixed.mmkin</a> object</p></dd>


<dt>conf.level</dt>
<dd><p>Passed to <a href="mean_degparms.html">mean_degparms</a> in the case of an
<a href="mixed.html">mixed.mmkin</a> object</p></dd>


<dt>default_log_parms</dt>
<dd><p>Passed to <a href="mean_degparms.html">mean_degparms</a> in the case of an
<a href="mixed.html">mixed.mmkin</a> object</p></dd>


<dt>ymax</dt>
<dd><p>Vector of maximum y axis values</p></dd>


<dt>maxabs</dt>
<dd><p>Maximum absolute value of the residuals. This is used for the
scaling of the y axis and defaults to "auto".</p></dd>


<dt>ncol.legend</dt>
<dd><p>Number of columns to use in the legend</p></dd>


<dt>nrow.legend</dt>
<dd><p>Number of rows to use in the legend</p></dd>


<dt>rel.height.legend</dt>
<dd><p>The relative height of the legend shown on top</p></dd>


<dt>rel.height.bottom</dt>
<dd><p>The relative height of the bottom plot row</p></dd>


<dt>pch_ds</dt>
<dd><p>Symbols to be used for plotting the data.</p></dd>


<dt>col_ds</dt>
<dd><p>Colors used for plotting the observed data and the
corresponding model prediction lines for the different datasets.</p></dd>


<dt>lty_ds</dt>
<dd><p>Line types to be used for the model predictions.</p></dd>


<dt>frame</dt>
<dd><p>Should a frame be drawn around the plots?</p></dd>


<dt>...</dt>
<dd><p>Further arguments passed to <code><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></code>.</p></dd>

</dl></div>
    <div class="section level2">
    <h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
    

<p>The function is called for its side effect.</p>
    </div>
    <div class="section level2">
    <h2 id="note">Note<a class="anchor" aria-label="anchor" href="#note"></a></h2>
    <p>Covariate models are currently only supported for saem.mmkin objects.</p>
    </div>
    <div class="section level2">
    <h2 id="author">Author<a class="anchor" aria-label="anchor" href="#author"></a></h2>
    <p>Johannes Ranke</p>
    </div>

    <div class="section level2">
    <h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
    <div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="va">ds</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/lapply.html" class="external-link">lapply</a></span><span class="op">(</span><span class="va">experimental_data_for_UBA_2019</span><span class="op">[</span><span class="fl">6</span><span class="op">:</span><span class="fl">10</span><span class="op">]</span>,</span></span>
<span class="r-in"><span> <span class="kw">function</span><span class="op">(</span><span class="va">x</span><span class="op">)</span> <span class="va">x</span><span class="op">$</span><span class="va">data</span><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">"name"</span>, <span class="st">"time"</span>, <span class="st">"value"</span><span class="op">)</span><span class="op">]</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="va">ds</span><span class="op">)</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/paste.html" class="external-link">paste0</a></span><span class="op">(</span><span class="st">"ds "</span>, <span class="fl">6</span><span class="op">:</span><span class="fl">10</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">dfop_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">"DFOP"</span>, <span class="st">"A1"</span><span class="op">)</span>,</span></span>
<span class="r-in"><span>  A1 <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>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="co"># \dontrun{</span></span></span>
<span class="r-in"><span><span class="va">f</span> <span class="op">&lt;-</span> <span class="fu"><a href="mmkin.html">mmkin</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span><span class="st">"DFOP-SFO"</span> <span class="op">=</span> <span class="va">dfop_sfo</span><span class="op">)</span>, <span class="va">ds</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/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">f</span><span class="op">[</span>, <span class="fl">3</span><span class="op">:</span><span class="fl">4</span><span class="op">]</span>, standardized <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-plt img"><img src="plot.mixed.mmkin-1.png" alt="" width="700" height="433"></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># For this fit we need to increase pnlsMaxiter, and we increase the</span></span></span>
<span class="r-in"><span><span class="co"># tolerance in order to speed up the fit for this example evaluation</span></span></span>
<span class="r-in"><span><span class="co"># It still takes 20 seconds to run</span></span></span>
<span class="r-in"><span><span class="va">f_nlme</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/pkg/nlme/man/nlme.html" class="external-link">nlme</a></span><span class="op">(</span><span class="va">f</span>, control <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span>pnlsMaxIter <span class="op">=</span> <span class="fl">120</span>, tolerance <span class="op">=</span> <span class="fl">1e-3</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">f_nlme</span><span class="op">)</span></span></span>
<span class="r-plt img"><img src="plot.mixed.mmkin-2.png" alt="" width="700" height="433"></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="va">f_saem</span> <span class="op">&lt;-</span> <span class="fu"><a href="saem.html">saem</a></span><span class="op">(</span><span class="va">f</span>, transformations <span class="op">=</span> <span class="st">"saemix"</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">f_saem</span><span class="op">)</span></span></span>
<span class="r-plt img"><img src="plot.mixed.mmkin-3.png" alt="" width="700" height="433"></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="va">f_obs</span> <span class="op">&lt;-</span> <span class="fu"><a href="mmkin.html">mmkin</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span><span class="st">"DFOP-SFO"</span> <span class="op">=</span> <span class="va">dfop_sfo</span><span class="op">)</span>, <span class="va">ds</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span>, error_model <span class="op">=</span> <span class="st">"obs"</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">f_nlmix</span> <span class="op">&lt;-</span> <span class="fu">nlmix</span><span class="op">(</span><span class="va">f_obs</span><span class="op">)</span></span></span>
<span class="r-err co"><span class="r-pr">#&gt;</span> <span class="error">Error in nlmix(f_obs):</span> could not find function "nlmix"</span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">f_nlmix</span><span class="op">)</span></span></span>
<span class="r-err co"><span class="r-pr">#&gt;</span> <span class="error">Error in eval(expr, envir, enclos):</span> object 'f_nlmix' not found</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># We can overlay the two variants if we generate predictions</span></span></span>
<span class="r-in"><span><span class="va">pred_nlme</span> <span class="op">&lt;-</span> <span class="fu"><a href="mkinpredict.html">mkinpredict</a></span><span class="op">(</span><span class="va">dfop_sfo</span>,</span></span>
<span class="r-in"><span>  <span class="va">f_nlme</span><span class="op">$</span><span class="va">bparms.optim</span><span class="op">[</span><span class="op">-</span><span class="fl">1</span><span class="op">]</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>parent <span class="op">=</span> <span class="va">f_nlme</span><span class="op">$</span><span class="va">bparms.optim</span><span class="op">[[</span><span class="fl">1</span><span class="op">]</span><span class="op">]</span>, A1 <span class="op">=</span> <span class="fl">0</span><span class="op">)</span>,</span></span>
<span class="r-in"><span>  <span class="fu"><a href="https://rdrr.io/r/base/seq.html" class="external-link">seq</a></span><span class="op">(</span><span class="fl">0</span>, <span class="fl">180</span>, by <span class="op">=</span> <span class="fl">0.2</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">f_saem</span>, pred_over <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span>nlme <span class="op">=</span> <span class="va">pred_nlme</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-plt img"><img src="plot.mixed.mmkin-4.png" alt="" width="700" height="433"></span>
<span class="r-in"><span><span class="co"># }</span></span></span>
</code></pre></div>
    </div>
  </main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>
    </nav></aside></div>


    <footer><div class="pkgdown-footer-left">
  <p></p><p>Developed by Johannes Ranke.</p>
</div>

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

    </footer></div>

  

  

  </body></html>

Contact - Imprint