Description Usage Arguments Value See Also Examples
kinfit is for fitting a biosensor kinetic data.
| 1 2 | 
| par | The initial parameters to be fitted. | 
| dat | A data frame. The first column in the data frame is "Time" followed by the response (nm) recorded from a biosensor experiment or from a simulation at the corresponding concentration of the ligand. | 
| concs | The oncentrations. It is usally a series of two-times dilution of the ligand concentration. | 
| t2 | The beggining of dissociation. | 
| model | The model. Choose the model from "simple1to1" or "dimer". | 
| jac | A function to return the Jacobian for the fn function.
see  | 
| control | An optional list of control settings.
See  | 
| bound | The upper and lower limits of the parameters used in fitting. It should match with the corresponding parameters of par. | 
A list with components returned from minpack.lm::nls.lm, including par,
hessian, fvec, info, message, diag, niter, rsstrace and deviance.
see nls.lm.
The par component also includes "concs", "t2", and "time", which is taken from the input variables.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | # Simulation  ----------------------------------------------------------
Do a simulation first before the perform the following fitting.
\code{\link{kinsim}}
# Fit the simulated data into the corresponding model--------------------
# Prepare fitting parameters
initPar_test = list(kon =1, koff = 1, rmax = 1)
t2  = par$t2 # t2 is the beginning of the diassociation.
concs        = par$concs
dat          = xySimulated
fit <- kinfit(par = initPar_test, dat = dat, concs = concs, t2 = t2, model = "simple1to1")
names(fit)
cbind(simulation= par, init = initPar_test, fitting = fit$par)
# Predict  -------------------------------------------------------------
predFit <- kinsim(par = fit$par, model = model, noise = 0)
# Plot -----------------------------------------------------------------
# Plotting the simulation
xy <-reshape2::melt(data = xySimulated,
id.vars = "Time",
measure.vars = rev(1:6),
variable.name = "Conc")
g <- ggplot()  + xlab("Time (sec)") + ylab("Response (nm)") +
    labs(linetype= 'title') +
   ylim(-0.025,1) +
   theme_classic() +
   theme(legend.position=c(0.9, 0.65),
         legend.text=element_text(size = rel(1)),
         legend.key.size=unit(0.9,"line"));
g <- g + geom_line(data = xy, aes(x = Time, y = value, color = Conc));
print(g)
# Plotting the prediction from the fitted parameters
predFit <- reshape2::melt(predFit, id.vars = "Time")
g + geom_line(data=predFit, aes(x = Time, y = value, group = variable) )
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.