aboutsummaryrefslogtreecommitdiff
path: root/docs/reference/mkinfit.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/reference/mkinfit.html')
-rw-r--r--docs/reference/mkinfit.html531
1 files changed, 531 insertions, 0 deletions
diff --git a/docs/reference/mkinfit.html b/docs/reference/mkinfit.html
new file mode 100644
index 00000000..d1441f8b
--- /dev/null
+++ b/docs/reference/mkinfit.html
@@ -0,0 +1,531 @@
+<!-- Generated by pkgdown: do not edit by hand -->
+<!DOCTYPE html>
+<html>
+ <head>
+ <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>mkinfit. mkin</title>
+
+<!-- jquery -->
+<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script>
+
+<!-- Bootstrap -->
+<link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/cerulean/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
+
+<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
+
+<!-- Font Awesome icons -->
+<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">
+
+
+<!-- pkgdown -->
+<link href="../pkgdown.css" rel="stylesheet">
+<script src="../pkgdown.js"></script>
+
+<!-- mathjax -->
+<script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></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>
+ <div class="container">
+ <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">
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+ <a class="navbar-brand" href="../index.html">mkin</a>
+ </div>
+ <div id="navbar" class="navbar-collapse collapse">
+ <ul class="nav navbar-nav">
+ <li>
+ <a href="../index.html">Home</a>
+</li>
+<li>
+ <a href="../reference/index.html">Reference</a>
+</li>
+ </ul>
+ <ul class="nav navbar-nav navbar-right">
+ <li>
+ <a href="https://github.com/jranke/mkin">
+ <span class="fa fa-github fa-lg"></span>
+
+ </a>
+</li>
+ </ul>
+ </div><!--/.nav-collapse -->
+ </div><!--/.container -->
+</div><!--/.navbar -->
+
+ </header>
+
+ <div class="page-header">
+ <h1>
+</h1>
+</div>
+
+<div class="row">
+ <div class="col-md-9">
+
+ <p>This function uses the Flexible Modelling Environment package
+ <code>FME</code> to create a function calculating the model cost, i.e. the
+ deviation between the kinetic model and the observed data. This model cost is
+ then minimised using the Port algorithm <code>nlminb</code>,
+ using the specified initial or fixed parameters and starting values.
+ Per default, parameters in the kinetic models are internally transformed in order
+ to better satisfy the assumption of a normal distribution of their estimators.
+ In each step of the optimsation, the kinetic model is solved using the
+ function <code>mkinpredict</code>. The variance of the residuals for each
+ observed variable can optionally be iteratively reweighted until convergence
+ using the argument <code>reweight.method = &quot;obs&quot;</code>.</p>
+
+
+ <pre><span class='fu'>mkinfit</span>(<span class='no'>mkinmod</span>, <span class='no'>observed</span>,
+ <span class='kw'>parms.ini</span> <span class='kw'>=</span> <span class='st'>"auto"</span>,
+ <span class='kw'>state.ini</span> <span class='kw'>=</span> <span class='st'>"auto"</span>,
+ <span class='kw'>fixed_parms</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>fixed_initials</span> <span class='kw'>=</span> <span class='fu'>names</span>(<span class='no'>mkinmod</span>$<span class='no'>diffs</span>)[-<span class='fl'>1</span>],
+ <span class='kw'>from_max_mean</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
+ <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='fu'>c</span>(<span class='st'>"auto"</span>, <span class='st'>"analytical"</span>, <span class='st'>"eigen"</span>, <span class='st'>"deSolve"</span>),
+ <span class='kw'>method.ode</span> <span class='kw'>=</span> <span class='st'>"lsoda"</span>,
+ <span class='kw'>use_compiled</span> <span class='kw'>=</span> <span class='st'>"auto"</span>,
+ <span class='kw'>method.modFit</span> <span class='kw'>=</span> <span class='fu'>c</span>(<span class='st'>"Port"</span>, <span class='st'>"Marq"</span>, <span class='st'>"SANN"</span>, <span class='st'>"Nelder-Mead"</span>, <span class='st'>"BFGS"</span>, <span class='st'>"CG"</span>, <span class='st'>"L-BFGS-B"</span>),
+ <span class='kw'>maxit.modFit</span> <span class='kw'>=</span> <span class='st'>"auto"</span>,
+ <span class='kw'>control.modFit</span> <span class='kw'>=</span> <span class='fu'>list</span>(),
+ <span class='kw'>transform_rates</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
+ <span class='kw'>transform_fractions</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
+ <span class='kw'>plot</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='kw'>err</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>weight</span> <span class='kw'>=</span> <span class='st'>"none"</span>,
+ <span class='kw'>scaleVar</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
+ <span class='kw'>atol</span> <span class='kw'>=</span> <span class='fl'>1e-8</span>, <span class='kw'>rtol</span> <span class='kw'>=</span> <span class='fl'>1e-10</span>, <span class='kw'>n.outtimes</span> <span class='kw'>=</span> <span class='fl'>100</span>,
+ <span class='kw'>reweight.method</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
+ <span class='kw'>reweight.tol</span> <span class='kw'>=</span> <span class='fl'>1e-8</span>, <span class='kw'>reweight.max.iter</span> <span class='kw'>=</span> <span class='fl'>10</span>,
+ <span class='kw'>trace_parms</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='no'>...</span>)</pre>
+
+ <h2>Arguments</h2>
+ <dl class="dl-horizontal">
+ <dt>mkinmod</dt>
+ <dd>
+ A list of class <code>mkinmod</code>, containing the kinetic model to be
+ fitted to the data, or one of the shorthand names (&quot;SFO&quot;, &quot;FOMC&quot;, &quot;DFOP&quot;,
+ &quot;HS&quot;, &quot;SFORB&quot;). If a shorthand name is given, a parent only degradation
+ model is generated for the variable with the highest value in
+ <code>observed</code>.
+ </dd>
+ <dt>observed</dt>
+ <dd>
+ The observed data. It has to be in the long format as described in
+ <code>modFit</code>, i.e. the first column called &quot;name&quot; must contain the
+ name of the observed variable for each data point. The second column must
+ contain the times of observation, named &quot;time&quot;. The third column must be
+ named &quot;value&quot; and contain the observed values. Optionally, a further column
+ can contain weights for each data point. Its name must be passed as a
+ further argument named <code>err</code> which is then passed on to
+ <code>modFit</code>.
+ </dd>
+ <dt>parms.ini</dt>
+ <dd>
+ A named vector of initial values for the parameters, including parameters
+ to be optimised and potentially also fixed parameters as indicated by
+ <code>fixed_parms</code>. If set to &quot;auto&quot;, initial values for rate constants
+ are set to default values. Using parameter names that are not in the model
+ gives an error.
+
+ It is possible to only specify a subset of the parameters that the model
+ needs. You can use the parameter lists &quot;bparms.ode&quot; from a previously
+ fitted model, which contains the differential equation parameters from this
+ model. This works nicely if the models are nested. An example is given
+ below.
+ </dd>
+ <dt>state.ini</dt>
+ <dd>
+ A named vector of initial values for the state variables of the model. In
+ case the observed variables are represented by more than one model
+ variable, the names will differ from the names of the observed variables
+ (see <code>map</code> component of <code>mkinmod</code>). The default is to set
+ the initial value of the first model variable to the mean of the time zero
+ values for the variable with the maximum observed value, and all others to 0.
+ If this variable has no time zero observations, its initial value is set to 100.
+ </dd>
+ <dt>fixed_parms</dt>
+ <dd>
+ The names of parameters that should not be optimised but rather kept at the
+ values specified in <code>parms.ini</code>.
+ </dd>
+ <dt>fixed_initials</dt>
+ <dd>
+ The names of model variables for which the initial state at time 0 should
+ be excluded from the optimisation. Defaults to all state variables except
+ for the first one.
+ </dd>
+ <dt>from_max_mean</dt>
+ <dd>
+ If this is set to TRUE, and the model has only one observed variable, then
+ data before the time of the maximum observed value (after averaging for each
+ sampling time) are discarded, and this time is subtracted from all
+ remaining time values, so the time of the maximum observed mean value is
+ the new time zero.
+ </dd>
+ <dt>solution_type</dt>
+ <dd>
+ If set to &quot;eigen&quot;, the solution of the system of differential equations is
+ based on the spectral decomposition of the coefficient matrix in cases that
+ this is possible. If set to &quot;deSolve&quot;, a numerical ode solver from package
+ <code>deSolve</code> is used. If set to &quot;analytical&quot;, an analytical
+ solution of the model is used. This is only implemented for simple
+ degradation experiments with only one state variable, i.e. with no
+ metabolites. The default is &quot;auto&quot;, which uses &quot;analytical&quot; if possible,
+ otherwise &quot;eigen&quot; if the model can be expressed using eigenvalues and
+ eigenvectors, and finally &quot;deSolve&quot; for the remaining models (time
+ dependence of degradation rates and metabolites). This argument is passed
+ on to the helper function <code>mkinpredict</code>.
+ </dd>
+ <dt>method.ode</dt>
+ <dd>
+ The solution method passed via <code>mkinpredict</code> to
+ <code>ode</code> in case the solution type is &quot;deSolve&quot;. The default
+ &quot;lsoda&quot; is performant, but sometimes fails to converge.
+ </dd>
+ <dt>use_compiled</dt>
+ <dd>
+ If set to <code>FALSE</code>, no compiled version of the <code>mkinmod</code>
+ model is used, in the calls to <code>mkinpredict</code> even if
+ a compiled verion is present.
+ </dd>
+ <dt>method.modFit</dt>
+ <dd>
+ The optimisation method passed to <code>modFit</code>.
+
+ In order to optimally deal with problems where local minima occur, the
+ &quot;Port&quot; algorithm is now used per default as it is less prone to get trapped
+ in local minima and depends less on starting values for parameters than
+ the Levenberg Marquardt variant selected by &quot;Marq&quot;. However, &quot;Port&quot; needs
+ more iterations.
+
+ The former default &quot;Marq&quot; is the Levenberg Marquardt algorithm
+ <code>nls.lm</code> from the package <code>minpack.lm</code> and usually needs
+ the least number of iterations.
+
+ The &quot;Pseudo&quot; algorithm is not included because it needs finite parameter bounds
+ which are currently not supported.
+
+ The &quot;Newton&quot; algorithm is not included because its number of iterations
+ can not be controlled by <code>control.modFit</code> and it does not appear
+ to provide advantages over the other algorithms.
+ </dd>
+ <dt>maxit.modFit</dt>
+ <dd>
+ Maximum number of iterations in the optimisation. If not &quot;auto&quot;, this will
+ be passed to the method called by <code>modFit</code>, overriding
+ what may be specified in the next argument <code>control.modFit</code>.
+ </dd>
+ <dt>control.modFit</dt>
+ <dd>
+ Additional arguments passed to the optimisation method used by
+ <code>modFit</code>.
+ </dd>
+ <dt>transform_rates</dt>
+ <dd>
+ Boolean specifying if kinetic rate constants should be transformed in the
+ model specification used in the fitting for better compliance with the
+ assumption of normal distribution of the estimator. If TRUE, also
+ alpha and beta parameters of the FOMC model are log-transformed, as well
+ as k1 and k2 rate constants for the DFOP and HS models and the break point
+ tb of the HS model.
+ If FALSE, zero is used as a lower bound for the rates in the optimisation.
+ </dd>
+ <dt>transform_fractions</dt>
+ <dd>
+ Boolean specifying if formation fractions constants should be transformed in the
+ model specification used in the fitting for better compliance with the
+ assumption of normal distribution of the estimator. The default (TRUE) is
+ to do transformations. If TRUE, the g parameter of the DFOP and HS
+ models are also transformed, as they can also be seen as compositional
+ data. The transformation used for these transformations is the
+ <code>ilr</code> transformation.
+ </dd>
+ <dt>plot</dt>
+ <dd>
+ Should the observed values and the numerical solutions be plotted at each
+ stage of the optimisation?
+ </dd>
+ <dt>quiet</dt>
+ <dd>
+ Suppress printing out the current model cost after each improvement?
+ </dd>
+ <dt>err </dt>
+ <dd>either <code>NULL</code>, or the name of the column with the
+ <em>error</em> estimates, used to weigh the residuals (see details of
+ <code>modCost</code>); if <code>NULL</code>, then the residuals are not weighed.
+ </dd>
+ <dt>weight</dt>
+ <dd>
+ only if <code>err</code>=<code>NULL</code>: how to weight the residuals, one of &quot;none&quot;,
+ &quot;std&quot;, &quot;mean&quot;, see details of <code>modCost</code>.
+ </dd>
+ <dt>scaleVar</dt>
+ <dd>
+ Will be passed to <code>modCost</code>. Default is not to scale Variables
+ according to the number of observations.
+ </dd>
+ <dt>atol</dt>
+ <dd>
+ Absolute error tolerance, passed to <code>ode</code>. Default is 1e-8,
+ lower than in <code>lsoda</code>.
+ </dd>
+ <dt>rtol</dt>
+ <dd>
+ Absolute error tolerance, passed to <code>ode</code>. Default is 1e-10,
+ much lower than in <code>lsoda</code>.
+ </dd>
+ <dt>n.outtimes</dt>
+ <dd>
+ The length of the dataseries that is produced by the model prediction
+ function <code>mkinpredict</code>. This impacts the accuracy of
+ the numerical solver if that is used (see <code>solution_type</code> argument.
+ The default value is 100.
+ </dd>
+ <dt>reweight.method</dt>
+ <dd>
+ The method used for iteratively reweighting residuals, also known
+ as iteratively reweighted least squares (IRLS). Default is NULL,
+ the other method implemented is called &quot;obs&quot;, meaning that each
+ observed variable is assumed to have its own variance, this is
+ estimated from the fit and used for weighting the residuals
+ in each iteration until convergence of this estimate up to
+ <code>reweight.tol</code> or up to the maximum number of iterations
+ specified by <code>reweight.max.iter</code>.
+ </dd>
+ <dt>reweight.tol</dt>
+ <dd>
+ Tolerance for convergence criterion for the variance components
+ in IRLS fits.
+ </dd>
+ <dt>reweight.max.iter</dt>
+ <dd>
+ Maximum iterations in IRLS fits.
+ </dd>
+ <dt>trace_parms</dt>
+ <dd>
+ Should a trace of the parameter values be listed?
+ </dd>
+ <dt>&amp;#8230;</dt>
+ <dd>
+ Further arguments that will be passed to <code>modFit</code>.
+ </dd>
+ </dl>
+
+ <div class="Value">
+ <h2>Value</h2>
+
+ <p>A list with &quot;mkinfit&quot; and &quot;modFit&quot; in the class attribute.
+ A summary can be obtained by <code>summary.mkinfit</code>.</p>
+ </div>
+
+ <div class="See also">
+ <h2>See also</h2>
+
+ <p>Plotting methods <code>plot.mkinfit</code> and
+ <code>mkinparplot</code>.</p>
+ <p>Fitting of several models to several datasets in a single call to
+ <code>mmkin</code>.</p>
+ </div>
+
+ <div class="Note">
+ <h2>Note</h2>
+
+ <p>The implementation of iteratively reweighted least squares is inspired by the
+ work of the KinGUII team at Bayer Crop Science (Walter Schmitt and Zhenglei
+ Gao). A similar implemention can also be found in CAKE 2.0, which is the
+ other GUI derivative of mkin, sponsored by Syngenta.</p>
+ </div>
+
+ <div class="Note">
+ <h2>Note</h2>
+
+ <p>When using the &quot;IORE&quot; submodel for metabolites, fitting with
+ &quot;transform_rates = TRUE&quot; (the default) often leads to failures of the
+ numerical ODE solver. In this situation it may help to switch off the
+ internal rate transformation.</p>
+ </div>
+
+ <h2 id="examples">Examples</h2>
+ <pre class="examples"><div class='input'><span class='co'># Use shorthand notation for parent only degradation</span>
+<span class='no'>fit</span> <span class='kw'>&lt;-</span> <span class='fu'>mkinfit</span>(<span class='st'>"FOMC"</span>, <span class='no'>FOCUS_2006_C</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)
+<span class='fu'>summary</span>(<span class='no'>fit</span>)</div><div class='output co'>#&gt; mkin version: 0.9.44.9000
+#&gt; R version: 3.3.1
+#&gt; Date of fit: Thu Oct 6 09:17:59 2016
+#&gt; Date of summary: Thu Oct 6 09:17:59 2016
+#&gt;
+#&gt; Equations:
+#&gt; d_parent = - (alpha/beta) * 1/((time/beta) + 1) * parent
+#&gt;
+#&gt; Model predictions using solution type analytical
+#&gt;
+#&gt; Fitted with method Port using 64 model solutions performed in 0.153 s
+#&gt;
+#&gt; Weighting: none
+#&gt;
+#&gt; Starting values for parameters to be optimised:
+#&gt; value type
+#&gt; parent_0 85.1 state
+#&gt; alpha 1.0 deparm
+#&gt; beta 10.0 deparm
+#&gt;
+#&gt; Starting values for the transformed parameters actually optimised:
+#&gt; value lower upper
+#&gt; parent_0 85.100000 -Inf Inf
+#&gt; log_alpha 0.000000 -Inf Inf
+#&gt; log_beta 2.302585 -Inf Inf
+#&gt;
+#&gt; Fixed parameter values:
+#&gt; None
+#&gt;
+#&gt; Optimised, transformed parameters with symmetric confidence intervals:
+#&gt; Estimate Std. Error Lower Upper
+#&gt; parent_0 85.87000 2.2460 80.38000 91.3700
+#&gt; log_alpha 0.05192 0.1605 -0.34080 0.4446
+#&gt; log_beta 0.65100 0.2801 -0.03452 1.3360
+#&gt;
+#&gt; Parameter correlation:
+#&gt; parent_0 log_alpha log_beta
+#&gt; parent_0 1.0000 -0.2033 -0.3624
+#&gt; log_alpha -0.2033 1.0000 0.9547
+#&gt; log_beta -0.3624 0.9547 1.0000
+#&gt;
+#&gt; Residual standard error: 2.275 on 6 degrees of freedom
+#&gt;
+#&gt; Backtransformed parameters:
+#&gt; Confidence intervals for internally transformed parameters are asymmetric.
+#&gt; t-test (unrealistically) based on the assumption of normal distribution
+#&gt; for estimators of untransformed parameters.
+#&gt; Estimate t value Pr(&gt;t) Lower Upper
+#&gt; parent_0 85.870 38.230 1.069e-08 80.3800 91.370
+#&gt; alpha 1.053 6.231 3.953e-04 0.7112 1.560
+#&gt; beta 1.917 3.570 5.895e-03 0.9661 3.806
+#&gt;
+#&gt; Chi2 error levels in percent:
+#&gt; err.min n.optim df
+#&gt; All data 6.657 3 6
+#&gt; parent 6.657 3 6
+#&gt;
+#&gt; Estimated disappearance times:
+#&gt; DT50 DT90 DT50back
+#&gt; parent 1.785 15.15 4.56
+#&gt;
+#&gt; Data:
+#&gt; time variable observed predicted residual
+#&gt; 0 parent 85.1 85.875 -0.7749
+#&gt; 1 parent 57.9 55.191 2.7091
+#&gt; 3 parent 29.9 31.845 -1.9452
+#&gt; 7 parent 14.6 17.012 -2.4124
+#&gt; 14 parent 9.7 9.241 0.4590
+#&gt; 28 parent 6.6 4.754 1.8460
+#&gt; 63 parent 4.0 2.102 1.8977
+#&gt; 91 parent 3.9 1.441 2.4590
+#&gt; 119 parent 0.6 1.092 -0.4919
+#&gt; </div><div class='input'>
+<span class='co'># One parent compound, one metabolite, both single first order.</span>
+<span class='co'># Use mkinsub for convenience in model formulation. Pathway to sink included per default.</span>
+<span class='no'>SFO_SFO</span> <span class='kw'>&lt;-</span> <span class='fu'>mkinmod</span>(
+ <span class='kw'>parent</span> <span class='kw'>=</span> <span class='fu'>mkinsub</span>(<span class='st'>"SFO"</span>, <span class='st'>"m1"</span>),
+ <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fu'>mkinsub</span>(<span class='st'>"SFO"</span>))</div><div class='output'><strong class='text-info'>Successfully compiled differential equation model from auto-generated C code.</strong></div><div class='input'><span class='co'># Fit the model to the FOCUS example dataset D using defaults</span>
+<span class='fu'>print</span>(<span class='fu'>system.time</span>(<span class='no'>fit</span> <span class='kw'>&lt;-</span> <span class='fu'>mkinfit</span>(<span class='no'>SFO_SFO</span>, <span class='no'>FOCUS_2006_D</span>,
+ <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"eigen"</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)))</div><div class='output co'>#&gt; user system elapsed
+#&gt; 1.252 1.176 0.914
+#&gt; </div><div class='input'><span class='fu'>coef</span>(<span class='no'>fit</span>)</div><div class='output co'>#&gt; parent_0 log_k_parent_sink log_k_parent_m1 log_k_m1_sink
+#&gt; 99.59848 -3.03822 -2.98030 -5.24750
+#&gt; </div><div class='input'><span class='fu'>endpoints</span>(<span class='no'>fit</span>)</div><div class='output co'>#&gt; $ff
+#&gt; parent_sink parent_m1 m1_sink
+#&gt; 0.485524 0.514476 1.000000
+#&gt;
+#&gt; $SFORB
+#&gt; logical(0)
+#&gt;
+#&gt; $distimes
+#&gt; DT50 DT90
+#&gt; parent 7.022929 23.32967
+#&gt; m1 131.760712 437.69961
+#&gt;
+#&gt; </div><div class='input'><span class='co'>## Not run: ------------------------------------</span>
+<span class='co'># # deSolve is slower when no C compiler (gcc) was available during model generation</span>
+<span class='co'># print(system.time(fit.deSolve &lt;- mkinfit(SFO_SFO, FOCUS_2006_D, </span>
+<span class='co'># solution_type = "deSolve")))</span>
+<span class='co'># coef(fit.deSolve)</span>
+<span class='co'># endpoints(fit.deSolve)</span>
+<span class='co'>## ---------------------------------------------</span>
+
+<span class='co'># Use stepwise fitting, using optimised parameters from parent only fit, FOMC</span>
+<span class='co'>## Not run: ------------------------------------</span>
+<span class='co'># FOMC_SFO &lt;- mkinmod(</span>
+<span class='co'># parent = mkinsub("FOMC", "m1"),</span>
+<span class='co'># m1 = mkinsub("SFO"))</span>
+<span class='co'># # Fit the model to the FOCUS example dataset D using defaults</span>
+<span class='co'># fit.FOMC_SFO &lt;- mkinfit(FOMC_SFO, FOCUS_2006_D)</span>
+<span class='co'># # Use starting parameters from parent only FOMC fit</span>
+<span class='co'># fit.FOMC = mkinfit("FOMC", FOCUS_2006_D, plot=TRUE)</span>
+<span class='co'># fit.FOMC_SFO &lt;- mkinfit(FOMC_SFO, FOCUS_2006_D, </span>
+<span class='co'># parms.ini = fit.FOMC$bparms.ode, plot=TRUE)</span>
+<span class='co'># </span>
+<span class='co'># # Use stepwise fitting, using optimised parameters from parent only fit, SFORB</span>
+<span class='co'># SFORB_SFO &lt;- mkinmod(</span>
+<span class='co'># parent = list(type = "SFORB", to = "m1", sink = TRUE),</span>
+<span class='co'># m1 = list(type = "SFO"))</span>
+<span class='co'># # Fit the model to the FOCUS example dataset D using defaults</span>
+<span class='co'># fit.SFORB_SFO &lt;- mkinfit(SFORB_SFO, FOCUS_2006_D)</span>
+<span class='co'># fit.SFORB_SFO.deSolve &lt;- mkinfit(SFORB_SFO, FOCUS_2006_D, solution_type = "deSolve")</span>
+<span class='co'># # Use starting parameters from parent only SFORB fit (not really needed in this case)</span>
+<span class='co'># fit.SFORB = mkinfit("SFORB", FOCUS_2006_D)</span>
+<span class='co'># fit.SFORB_SFO &lt;- mkinfit(SFORB_SFO, FOCUS_2006_D, parms.ini = fit.SFORB$bparms.ode)</span>
+<span class='co'>## ---------------------------------------------</span>
+
+<span class='co'>## Not run: ------------------------------------</span>
+<span class='co'># # Weighted fits, including IRLS</span>
+<span class='co'># SFO_SFO.ff &lt;- mkinmod(parent = mkinsub("SFO", "m1"),</span>
+<span class='co'># m1 = mkinsub("SFO"), use_of_ff = "max")</span>
+<span class='co'># f.noweight &lt;- mkinfit(SFO_SFO.ff, FOCUS_2006_D)</span>
+<span class='co'># summary(f.noweight)</span>
+<span class='co'># f.irls &lt;- mkinfit(SFO_SFO.ff, FOCUS_2006_D, reweight.method = "obs")</span>
+<span class='co'># summary(f.irls)</span>
+<span class='co'># f.w.mean &lt;- mkinfit(SFO_SFO.ff, FOCUS_2006_D, weight = "mean")</span>
+<span class='co'># summary(f.w.mean)</span>
+<span class='co'># f.w.value &lt;- mkinfit(SFO_SFO.ff, subset(FOCUS_2006_D, value != 0), err = "value")</span>
+<span class='co'># summary(f.w.value)</span>
+<span class='co'>## ---------------------------------------------</span>
+
+<span class='co'>## Not run: ------------------------------------</span>
+<span class='co'># # Manual weighting</span>
+<span class='co'># dw &lt;- FOCUS_2006_D</span>
+<span class='co'># errors &lt;- c(parent = 2, m1 = 1)</span>
+<span class='co'># dw$err.man &lt;- errors[FOCUS_2006_D$name]</span>
+<span class='co'># f.w.man &lt;- mkinfit(SFO_SFO.ff, dw, err = "err.man")</span>
+<span class='co'># summary(f.w.man)</span>
+<span class='co'># f.w.man.irls &lt;- mkinfit(SFO_SFO.ff, dw, err = "err.man",</span>
+<span class='co'># reweight.method = "obs")</span>
+<span class='co'># summary(f.w.man.irls)</span>
+<span class='co'>## ---------------------------------------------</span></div></pre>
+ </div>
+ <div class="col-md-3">
+ <h2>Author</h2>
+
+ Johannes Ranke
+
+ </div>
+</div>
+
+ <footer>
+ <p>Built by <a href="http://hadley.github.io/pkgdown/">pkgdown</a>. Styled with <a href="http://getbootstrap.com">Bootstrap 3</a>.</p>
+ </footer>
+ </div>
+
+ </body>
+</html>

Contact - Imprint