简体   繁体   中英

How to obtain analysis of variance table for a nonlinear regression model in R

Previously I used SAS to fit data into nonlinear regression model. SAS was able to produce an analysis of variance table for the model. The table displays the degrees of freedom, sums of squares, and mean squares along with the model F test.

Please refer to Table 69.4 in this pdf file.

Source: https://support.sas.com/documentation/onlinedoc/stat/132/nlin.pdf

How can I re-create something similar in R? Thanks in advance.

I'm not sure what type of nonlinear regression you're interested in- but the general approach would be to run the model and call for a summary. The typical linear model would be:

linearmodel = lm(`outcomevar` ~ `predictorvar`, data = dataset)

linearmodel #gives coefficients
summary(linearmod) # gives model fit

For nonlinear regression you would add the polynomial term. For quadratic fit it would be

y = b0 + b1(Var) + b2(Var * Var) or:

nonlinmodel = lm(`outcomevar` ~ `predictorvar` + I(`predictorvar`^2), data = dataset)

nonlinmodel
summary(nonlinmodel)

other methods here: https://data-flair.training/blogs/r-nonlinear-regression/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM