Hello all, I found the following code worked.
code require(boot) function.fit2 <- function(data,i){ d <- data[i,] # select obs. in bootstrap sample fit2 <-lm(logDIS~logBMN+I(logBMN^2), data=dataN) coefficients(fit2) # return coefficient vector } boot.fit2 <- boot(dataN, function.fit2, 1000) On Mon, May 6, 2013 at 7:36 AM, Elaine Kuo <elaine.kuo...@gmail.com> wrote: > Hello, > > I want to know if two quadratic regressions are significantly different. > I was advised to make the test using > step 1 bootstrapping both quadratic regressions and get their slope > coefficients. > (Let's call the slope coefficient *â*^1 and *â*^2) > step 2 use the slope difference *â*^1-*â*^2 and bootstrap the slope > coefficent > step 3 find out the sampling distribution above and calculate the % =0 > step 4 multiple the % by 2 > > However, I am new to the package boot. > I wrote a code for step 1 and got a error message. > > Please kindly advise how to modify it and thank you. > > Elaine > > code > require(boot) > function.fit2 <- function(data){ > #data <- data[indices,] # select obs. in bootstrap > sample > fit2 <-lm(logDIS~logBMN+I(logBMN^2)) > coefficients(fit2) # return coefficient vector > } > > boot.fit2 <- boot(dataN, function.fit2, 1000) > > error > > fit2.boot <- boot(dataN, fun.fit2, 1000) > Error in statistic(data, original, ...) : unused argument (original) > > [[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.