Hi Diviya, Take a look at the lrtest function in the lmtest package:
install.packages('lmtest) require(lmtest) ?lrtest HTH, Jorge On Sun, Jun 12, 2011 at 1:16 PM, Diviya Smith <> wrote: > Hello there, > > I want to perform a likelihood ratio test to check if a single exponential > or a sum of 2 exponentials provides the best fit to my data. I am new to R > programming and I am not sure if there is a direct function for doing this > and whats the best way to go about it? > > #data > x <- c(1 ,10, 20, 30, 40, 50, 60, 70, 80, 90, 100) > y <- c(0.033823, 0.014779, 0.004698, 0.001584, -0.002017, -0.003436, > -0.000006, -0.004626, -0.004626, -0.004626, -0.004626) > > data <- data.frame(x,y) > > Specifically, I would like to test if the model1 or model2 provides the > best > fit to the data- > model 1: y = a*exp(-m*x) + c > model 2: y = a*exp(-(m1+m2)*x) + c > > Likelihood ratio test = L(data| model1)/ L(data | model2) > > Any help would be most appreciated. Thanks in advance. > > Diviya > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. > [[alternative HTML version deleted]] ______________________________________________ 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.