construct_gam_formula: Make a gam formula with the basis_vec number provided.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/construct_gam_formula.R

Description

Takes a number for the spline basis_vec value and pastes it together with character strings giving the parts of the formula before and after the basis_vec number, then returns the pasted string as a formula. This utility function circumvents some specific function scope issues that arise when fitting the gam model with a passed parameter number of basis_vecs.

Usage

1
2
3
4
5
construct_gam_formula(
  basis_vecs_value = -1,
  before_basis_vecs_value = "y ~ group +  s( x, bs = \"tp\", k =",
  after_basis_vecs_value = ", by = group )"
)

Arguments

basis_vecs_value

numeric integer value to be used for number basis_vecs.

before_basis_vecs_value

character string with the gam formula before the basis_vec number.

after_basis_vecs_value

character string with the gam formula after the basis_vec number.

Value

a formula object that can be passed to gamm4::gamm4(), which calls mgcv::gam().

Author(s)

Bill Forrest forrest@gene.com

See Also

character

Examples

1
2
3
4
5
  ## avoid a ':::'-related warning in package check by not running next lines:
  ## Not run: 
  test_gam_formula <- maeve:::construct_gam_formula( 6 )
  
## End(Not run)

wfforrest/maeve documentation built on Jan. 1, 2021, 12:47 p.m.