Bactrim Mrsa
SIGA Bactrim mrsa, , a public biotechnology company, recently hired CenterSpace consultants to refine their logistic modeling capabilities. Modeling a dose-response system with a logistic curve is one important special case of the more general non-linear curve fitting problem. If you are familiar with linear regression and related statistics, the non-linear case closely parallels the linear case making the jump to non-linear curve fitting easier, septra bactrim ds.
SIGA is a world leader in designing and developing novel countermeasures to prevent and treat serious infectious diseases, with an emphasis on biological warfare defense. Bactrim suspension pediatric, |
In a previous blog post, Ken outlined the techniques for using NMath to compute various common linear trend lines and non-linear trend lines linearizable via a simple variable substitution. This post extends that curve fitting article to the non-linear case, bactrim mrsa.
Non-linear Curving Fitting - The Logistic
The logistic model is a fundamental non-linear model for many systems, and is widely used in the life sciences, bactrim elixir, medicine, and environmental toxicology. Bactrim nausea,
[caption id="attachment_1989" align="aligncenter" width="450" caption="Non-linear curve fit with logistic model"] [/caption] |
This image shows a fit of a 4-parameter logistic model to the measured inhibitory response of an infectious agent to a treatment at various drug dose levels - this is a classic dose-response curve. The 4-parameter model was used here because the underlying physical process is expected to be symmetric, and is defined as:
| a - response at x = 0 |
| b - slope factor |
| c - mid-range (50%) concentration |
| d - response as x -> infinity |
The 5-parameter logistic adds an additional asymmetry parameter that allow the leading and trailing tails to have different curvatures. It is defined as:
| a - response at x = 0 |
| b - slope factor |
| c - mid-range (50%) concentration |
| d - response as x -> infinity |
| g - asymmetry factor |
Using NMath the following C# code fits the four-parameter logistic to the given data, bactrim photosensitivity. Bactrim mrsa, By extending the initial conditions vector by one element, and changing the model function delegate we could use the same code to fit the FiveParameterLogistic function.
using CenterSpace.NMath.Core;
using CenterSpace.NMath.Analysis;
public void NonlinearFitExampleCode()
{
// Make some synthetic data
DoubleVector xValues = new DoubleVector("30000 10000 3000 500 200 60 25 10");
DoubleVector yValues = new DoubleVector("112.8 115 131 118 26 1.7 -0.8 -1.4");
// This is the function delegate that the curve fitting
// class will use - any delegate can be used.
NMathFunctions.GeneralizedDoubleUnaryFunction f
= AnalysisFunctions.FourParameterLogistic;
// The starting point in the function parameter space. Bactrim net, DoubleVector start = new DoubleVector("0.1 0.1 0.1 0.1");
// Construct a curve fitting object for our function, then perform the fit.
OneVariableFunctionFitter fitter
= new OneVariableFunctionFitter(f);
DoubleVector solution = fitter.Fit(xValues, yValues, bactrim folic acid, start);
// Display solution
Console.WriteLine("4 Parameter Logistic Model Parameters: {0}", solution.ToString("0.####"));
}
The model parameters are returned in a vector, Bactrim ds generic, in the order defined above [a, b, c, d], bactrim for staph.
4 Parameter Logistic Model Parameters:
[ -0.1755 6.0556 246.8343 119.6108 ]
The fitting class OneVariableFunctionFitter is based on the Trust Region algorithm which is an extension of the Levenberg-Marquardt minimization algorithm, bactrim mrsa. As used in the example above, the partial derivatives with respect to the parameters are numerically estimated. Buy bactrim pill, In our experience numerically estimating the partials works very well. However, for improved precision and performance it is also possible to explicitly specify delegates for the partials, using the property:
NMathFunctions.GeneralizedDoubleUnaryFunction[] PartialDeriviates
If the curvature of the function surface is low, mrsa bactrim treatment, as is typically the case for the logistic model, and the local linearized estimate closely approximates the function surface during the minimization process, Bactrim bacterial vaginosis, the partial derivatives are not even evaluated for performance reasons.
Bounded Parameters
Because the
OneVariableFunctionFitter is based on the Trust Region algorithm, it is possible to place bounds on the parameters. Bactrim mrsa, This is a very powerful feature, which is frequently employed when modeling a dose-response curve with a logistic. There's an old debate between the chemists and biologists regarding the dose-response curve on whether the curve should be relative or absolute, bactrim for tooth infection. In the image above, a relative dose-response curve is shown, Septra ds bactrim, as there were no bounds placed on the four parameters. However, we can create an absolute dose-response curve by adding the constraints 100 >= a >= 0 and 0 <= d <= 100 and re-fitting the curve. This will enforce all predicted responses to be between 0% and 100%, will bactrim treat chlamydia.
[caption id="attachment_1998" align="aligncenter" width="450" caption="Logistic model fit with parameter bounds 100 >= a >= 0 and 0 <= d <= 100 "]
[/caption]
Here is a C# code example on how to do this with NMath, bactrim mrsa.
using CenterSpace.NMath.Core;
using CenterSpace.NMath.Analysis;
public void BoundedNonlinearFitExampleCode()
{
// Make some synthetic data
DoubleVector xValues = new DoubleVector("30000 10000 3000 500 200 60 25 10");
DoubleVector yValues = new DoubleVector("112.8 115 131 118 26 1.7 -0.8 -1.4");
// The starting point in the function parameter space.
DoubleVector start = new DoubleVector("0.1 0.1 0.1 100.0");
// 4-parameter bounds in the order of a, Bactrim itching, b, c, & d
DoubleVector lowerBounds = new DoubleVector("0.0 0.0 0.0 0.0");
DoubleVector upperBounds = new DoubleVector("100.0 100000.0 100000.0 100.0");
// Convert the 4-parameter logistic to a Func<>
Funcbactrim for skin infection, Double> fitFunction =
new FuncBactrim ds price, double>((double[] soln, Double x) => AnalysisFunctions.FourParameterLogisticFunction(new DoubleVector(soln), x));
// This class is not included with the current release.
FunctionFitterWithBounds fitter =
new FunctionFitterWithBounds(fitFunction, bactrim pills, lowerBounds, upperBounds);
//Now define and fit the data as shown above. Bactrim with food, DoubleVector solution = fitter.Fit(xValues, yValues, start);
// Display solution
Console.WriteLine("4 Parameter Logistic Model Parameters: {0}", solution.ToString("0.####"));
}
The bounded model parameters returned, bactrim rifampin mrsa, in the order defined above [a, b, Bactrim insomnia, c, d] are:
4 Parameter Logistic Model Parameters: [ 0 0.1652 0.787 100 ]
Note that the first and last parameters are now within the specified bounds.
The class FunctionFitterWithBounds Bactrim mrsa, is unreleased (and won't be in this form) but you can download it and use it if you have the latest release of NMath installed. The non-linear curving fitting NMath API will be extended and refined in our next NMath release, and bounded non-linear curve fitting will be more clearly accessible, bactrim prostatitis.
- Click here to download the free C#
FunctionFitterWithBoundsclass.
Goodness-Of-Fit Model Statistics
After we are done fitting our model, the fit may look good, Is bactrim safe while breastfeeding, but really how good is the fit. To better understand the goodness-of-fit of our model, we need to analyze the residuals of the fit and related statistics. The next release of NMath Stats (expected in June) will offer a new class
GoodnessOfFit that will provide a complete set of statistical measures that can be used to assess the goodness-of-fit for a non-linear model, bactrim std, including the F-Statistic, t-Statistic, and parameter confidence intervals. Please contact us if you are interested in obtaining an advanced copy of this class, bactrim mrsa.
Happy Computing,
Paul
Resources
- The five-parameter logistic: A characterization and comparison with the four-parameter logistic, Paul G. Gotschalk, John R. Dunn, Analytical Biochemistry 343 (2005) pp 54-65.
- Principles of Curve Fitting for Multiplex Sandwich Immunoassys, D. Bactrim mrsa, Davis, A. Zhang, C. Etienne, I. Huang, & M. Malit, tech note 2861.
- A brief technical introduction to Trust Region methods, by Mark S. Gockenbach
.Similar posts: Ds bactrim. Order doxycycline. Buy doryx online. Cheap vibramycin. Keflex 250mg capsules. Cephalexin 250mg capsules.
Trackbacks from: Bactrim mrsa. Bactrim mrsa. Bactrim mrsa. Bactrim mrsa. Bactrim mrsa. Bactrim mrsa.Tags: c# logistic model, curving fitting with parameter bounds, dose response C#, dose response model, goodness of fit, non-linear curve fitting, non-linear curve fitting c#


May 3rd, 2010 at 4:50 pm
[...] CenterSpace Blog » Blog Archive » Non-linear Curve Fitting [...]
June 28th, 2010 at 3:54 pm
[...] for fitting general nonlinear models with bounds on the parameters. Also see this blog article for code examples of bounded nonlinear curving [...]