Skip to contents

This example analyses a typical initial-rate experiment from start to finish: read the measurements from a CSV file, fit the Michaelis-Menten model ("MM"), and check the fit. It also compares three fitting methods and shows the data on the classic linearised plots.

Read the data

The package includes an example file with rates measured at 7 substrate concentrations, in triplicate. Your own file would be read the same way, with read.csv() or readxl::read_excel():

path <- system.file("extdata", "michaelis-menten.csv", package = "enzKinet2")
raw <- read.csv(path)
head(raw)
#>   substrate_mM rate_uM_min
#> 1         0.10        1.37
#> 2         0.10        1.27
#> 3         0.10        1.16
#> 4         0.25        2.70
#> 5         0.25        2.87
#> 6         0.25        3.05

enzKinet2 expects the columns to be named after the model’s variables. For Michaelis-Menten these are A (substrate concentration) and V (rate):

MODEL_VARIABLES[["MM"]]
#> [1] "A" "V"
data <- data.frame(A = raw$substrate_mM, V = raw$rate_uM_min)

The concentrations are in mM and the rates in µM/min, so the fitted Km will be in mM and Vmax in µM/min. Using your own data has more on preparing a file.

Look at it first

Plot the data before fitting, to check that it looks like a Michaelis-Menten curve and to choose starting values:

make_plot("MM", data.df = data, x.units = "mM", y.units = "µM/min")

The rates are still rising slowly at 8 mM, towards about 12 µM/min, and are about half of that at 1 mM. Those make good starting values for Vmax and Km.

Fit the model

fit <- fit_model("MM", data, start.params = list(Km = 1, Vmax = 12),
                 get.conf.int = TRUE, get.stats = TRUE)
fit$fitted.params
#> $Km
#> [1] 0.764187
#> 
#> $Vmax
#> [1] 11.58654
#> 
#> $Km.lb
#> [1] 0.6839159
#> 
#> $Km.ub
#> [1] 0.8534718
#> 
#> $Vmax.lb
#> [1] 11.21668
#> 
#> $Vmax.ub
#> [1] 11.97201

The example data is simulated, so the true values are known: Km = 0.8 mM and Vmax = 12 µM/min. The 95% confidence interval for Km (Km.lb to Km.ub, 0.68 to 0.85 mM) contains the true value. The interval for Vmax (11.22 to 11.97 µM/min) only just misses it. That’s expected now and then: a 95% interval misses the true value about one time in 20.

The standard errors and fit statistics are in fit$statistics:

fit$statistics[c("Km.se", "Vmax.se", "R2", "RMSE", "AIC")]
#> $Km.se
#> [1] 0.04025346
#> 
#> $Vmax.se
#> [1] 0.1798295
#> 
#> $R2
#> [1] 0.9925228
#> 
#> $RMSE
#> [1] 0.2825407
#> 
#> $AIC
#> [1] 12.51024

Plot the fit

Draw the fitted curve over the data, with the parameter uncertainty envelope from the confidence intervals:

curve <- make_curve("MM", fit$fitted.params, x.min = 0, x.max = 8, conf.int = TRUE)
make_plot("MM", data.df = data, curve.df = curve, conf.int = TRUE,
          x.units = "mM", y.units = "µM/min")

The envelope shows how far the curve moves with each parameter at the edge of its confidence interval. It isn’t a confidence band for the curve: Fitting and confidence intervals explains the difference.

Check the residuals

make_residual_plot("MM", fit$fitted.params, data, x.units = "mM", y.units = "µM/min")

The residuals scatter around zero with no trend, so the model describes the data well.

The noise in this data is 5% of each rate, so it’s larger at higher rates. Unweighted least squares, which fit_model() uses, treats every point as equally reliable. With noise like this the estimates are still sound, just not the most precise possible.

Compare fitting methods

For Michaelis-Menten only, fit_model() has three non-iterative methods besides nonlinear least squares. They need no starting values:

methods <- c("nls", "ss.calc", "nonparametric")
estimates <- lapply(methods, function(m) {
    start <- if (m == "nls") list(Km = 1, Vmax = 12) else NULL
    fit_model("MM", data, start.params = start, fit.method = m)$fitted.params
})
data.frame(method = methods,
           Km = sapply(estimates, function(p) round(p$Km, 3)),
           Vmax = sapply(estimates, function(p) round(p$Vmax, 2)))
#>          method    Km  Vmax
#> 1           nls 0.764 11.59
#> 2       ss.calc 0.788 11.71
#> 3 nonparametric 0.779 11.75

All three agree closely here:

  • "nls": unweighted nonlinear least squares.
  • "ss.calc": a weighted least-squares fit of the Lineweaver-Burk line. Its weights suit noise proportional to the rate, as in this data.
  • "nonparametric": the medians of the estimates from every pair of points, as in the direct linear plot.

Only "nls" gives confidence intervals and statistics. The fourth method, "recursive", is experimental. Fitting models has the details.

Linearised plots

The same data and fitted curve on the Lineweaver-Burk (1/v against 1/a) and Hanes (a/v against a) plots:

curve <- make_curve("MM", fit$fitted.params, x.min = 0.1, x.max = 8)
make_plot("MM", data.df = data, curve.df = curve, plot.transformation = "lineweaver",
          x.units = "mM", y.units = "µM/min")

make_plot("MM", data.df = data, curve.df = curve, plot.transformation = "hanes",
          x.units = "mM", y.units = "µM/min")

The curve starts at 0.1 mM here, because 1/a is infinite at a = 0. On the Lineweaver-Burk plot, the points at the lowest concentrations are spread out the most. Taking reciprocals magnifies their errors, which is why fitting is always done on the untransformed data.

The direct linear plot draws each point as a line in (Km, Vmax) space. The lines cross near the best estimates:

make_plot("MM", data.df = data, plot.transformation = "direct")

Plot types explains what each plot shows and when it helps.