Description Usage Arguments Examples
View source: R/anova_nlslist.R
Applies an F-test to a non-linear regression model that includes a grouping variable (fit with nlsList
), comparing it to a model without a grouping variable. This is a convenient way to test whether there is an overall effect of the grouping variable on the non-linear relationship.
1 | anova_nlslist(nlsfull, nlsreduc)
|
nlsfull |
The full model, an object returned by |
nlsreduc |
The reduced model, which is identical to the full model except the grouping variable has been removed, and it was fit with |
1 2 3 4 5 6 7 8 9 10 11 | chick <- as.data.frame(ChickWeight)
# Fit a simple model with nls
fit0 <- nls(weight ~ a*Time^b, data=chick, start=list(a=10, b=1.1))
# Fit an nlsList model, with a grouping variable (Diet)
fit1 <- nlsList(weight ~ a*Time^b | Diet, data=chick, start=list(a=10, b=1.1))
# Using an F-test, test whether the fit is significantly better when adding
# a grouping variable
anova_nlslist(fit1, fit0)
|
Loading required package: nlme
Loading required package: broom
Loading required package: dplyr
Attaching package: 'dplyr'
The following object is masked from 'package:nlme':
collapse
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
Loading required package: mgcv
This is mgcv 1.8-20. For overview type 'help("mgcv-package")'.
Loading required package: magicaxis
Loading required package: MASS
Attaching package: 'MASS'
The following object is masked from 'package:dplyr':
select
Loading required package: plotrix
Loading required package: sm
Package 'sm', version 2.2-5.4: type help(sm) for summary information
Attaching package: 'sm'
The following object is masked from 'package:MASS':
muscle
Loading required package: mapproj
Loading required package: maps
Loading required package: celestial
Loading required package: RANN
Loading required package: NISTunits
Loading required package: pracma
Attaching package: 'pracma'
The following object is masked from 'package:sm':
nile
The following object is masked from 'package:mgcv':
magic
Analysis of Variance Table
Model 1: weight ~ a * Time^b
Model 2: weight ~ a * Time^b | Diet
Res.Df Res.Sum Sq Df Sum Sq F value Pr(>F)
1 576 962777
2 570 747641 6 215137 27.337 < 2.2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.