Skip to contents

Add or remove a single covariate term from an existing Emax regression model, returning a new fitted model object.

Usage

emax_add_term(mod, formula)

emax_remove_term(mod, formula)

Arguments

mod

An emaxnls object

formula

A formula such as E0 ~ AGE

Value

An object of class emaxnls

Details

These functions are not typically called directly; they underpin the stepwise covariate modeling procedures that are very commonly used when building Emax regressions.

See also

Examples

opts <- emax_nls_options(max_time = 10)
mod_0 <- emax_nls(rsp_1 ~ exp_1, list(E0 ~ 1, Emax ~ 1, logEC50 ~ 1), emax_df, opts = opts)
mod_1 <- emax_nls(rsp_1 ~ exp_1, list(E0 ~ cnt_a, Emax ~ 1, logEC50 ~ 1), emax_df, opts = opts)

if (emax_converged(mod_0)) emax_add_term(mod_0, E0 ~ cnt_a)
#> Structural model:
#> 
#>   Exposure:       exp_1 
#>   Response:       rsp_1 
#>   Emax type:      hyperbolic 
#>   Response type:  continuous
#> 
#> Covariate model:
#> 
#>   E0:       E0 ~ 1 + cnt_a 
#>   Emax:     Emax ~ 1 
#>   logEC50:  logEC50 ~ 1 
#> 
#> Model fit:
#> 
#>   Observations:         400 
#>   Residual df:          396 
#>   Residual std. error:  0.5108 
#>   AIC:                  603.6431 
#> 
#> Coefficients (95% CI):
#> 
#>   label             estimate std_error lower  upper
#> 1 E0_cnt_a             0.486    0.0116 0.463  0.509
#> 2 E0_Intercept         5.05     0.0759 4.91   5.20 
#> 3 Emax_Intercept       9.97     0.112  9.75  10.2  
#> 4 logEC50_Intercept    8.27     0.0394 8.19   8.35 
#> 
#> Use summary() for hypothesis tests.

if (emax_converged(mod_1)) emax_remove_term(mod_1, E0 ~ cnt_a)
#> Structural model:
#> 
#>   Exposure:       exp_1 
#>   Response:       rsp_1 
#>   Emax type:      hyperbolic 
#>   Response type:  continuous
#> 
#> Covariate model:
#> 
#>   E0:       E0 ~ 1 
#>   Emax:     Emax ~ 1 
#>   logEC50:  logEC50 ~ 1 
#> 
#> Model fit:
#> 
#>   Observations:         400 
#>   Residual df:          397 
#>   Residual std. error:  1.1927 
#>   AIC:                  1281.131 
#> 
#> Coefficients (95% CI):
#> 
#>   label             estimate std_error lower upper
#> 1 E0_Intercept          7.42    0.119   7.19  7.66
#> 2 Emax_Intercept        9.86    0.251   9.37 10.4 
#> 3 logEC50_Intercept     8.16    0.0931  7.97  8.35
#> 
#> Use summary() for hypothesis tests.