简体   繁体   English

如何在 R 中获取非线性回归 model 的方差分析表

[英]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 将数据拟合到非线性回归 model 中。 SAS was able to produce an analysis of variance table for the model. SAS 能够为 model 生成方差分析表。 The table displays the degrees of freedom, sums of squares, and mean squares along with the model F test.该表显示了自由度、平方和和均方以及 model F 检验。

Please refer to Table 69.4 in this pdf file.请参阅此 pdf 文件中的表 69.4。

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

How can I re-create something similar in R?如何在 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.我不确定您对哪种类型的非线性回归感兴趣-但一般方法是运行 model 并要求汇总。 The typical linear model would be:典型的线性 model 将是:

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: y = b0 + b1(Var) + b2(Var * Var) 或:

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

nonlinmodel
summary(nonlinmodel)

other methods here: https://data-flair.training/blogs/r-nonlinear-regression/这里的其他方法: https://data-flair.training/blogs/r-nonlinear-regression/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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