On Mon, Apr 16, 2012 at 6:02 PM, Allan Sikk <a.s...@ucl.ac.uk> wrote: > Hi, > > Is it possible in R to fit two equations simultaneously: > > y1 = a1 - b1*t and > y2 = a2 - b2*t > > so that the following constraint applies: a1/b1 = a2/b2 ? >
Try this: set.seed(123) # simulated data a2 <- 2; b1 <- 3; b2 <- 4; a1 <- b1 * a2/b2 y <- rnorm( 100, c(a1 - b1 * seq(50), a1 - b2 * seq(50)) ) # fit it g <- gl(2, 50) sq <- c(seq(50), seq(50)) lm(y ~ g / sq + 0) -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.