Hello all,

I need to fit a nonlinear model to several data sets simultaneously. The model has the same functional form for all sets, and the values of some model parameters are the same for all sets (in the following example, r and e), but the values of at least one parameter is different for each set (in the following example, a).

For example, three decay curves might have the same decay constant (r) and asymptotic value (e) but a different amplitude for each data set. The global fit to all three curves would produce one decay constant (r) and asymptotic value (e) and three amplitudes.

What is the best way to do this in R? (Apologizing in advance for a novice question!)

```
library(tidyverse)
a <- seq(90, 30, length = 3)
r <- .2
e <- 10
# model: y ~ a*(1-r)^(x-1)+e
x <- c(1:30)
d1 <- tibble(x) %>%
mutate(a = a[1], y = a*(1-r)^(x-1)+e, ynorm = rnorm(length(x), y, 1))
d2 <- tibble(x) %>%
mutate(a = a[2], y = a*(1-r)^(x-1)+e, ynorm = rnorm(length(x), y, 1))
d3 <- tibble(x) %>%
mutate(a = a[3], y = a*(1-r)^(x-1)+e, ynorm = rnorm(length(x), y, 1))
d <- rbind(d1, d2, d3)
library(ggplot2)
ggplot(d, aes(x = x, y = y, colour = as.character(a))) +
geom_line() +
geom_point(aes(y = ynorm, colour = as.character(a)))
```