Spline time-course functions
tspline.Rd
Used to fit B-splines, natural cubic splines, and
piecewise linear splinesperperoglu2019MBNMAtime. Note that
B-splines with degree=1
and linear splines are equivalent in fit, but are
parameterised differently which can allow different informative prior specification.
Usage
tspline(
type = "bs",
knots = NULL,
nknots = 1,
degree = 1,
pool.1 = "rel",
method.1 = "common",
pool.2 = "rel",
method.2 = "common",
pool.3 = "rel",
method.3 = "common",
pool.4 = "rel",
method.4 = "common",
pool.5 = "rel",
method.5 = "common",
pool.6 = "rel",
method.6 = "common"
)
Arguments
- type
The type of spline. Can take
"bs"
(B-spline),"ns"
(natural cubic spline) or"ls"
(piecewise linear spline)- knots
A numeric vector indicating the location of spline internal knots (specified on the same scale as
time
in the dataset). Specifyingknots
overridesnknots
.- nknots
The number of spline internal knots. If
knots
is not specified then these will by default be evenly spaced between 0 and the maximum follow-up time in the dataset (max.time
).- degree
The degree of the piecewise B-spline polynomial - e.g.
degree=1
for linear,degree=2
for quadratic,degree=3
for cubic.- pool.1
Pooling for the 1st coefficient. Can take
"rel"
or"abs"
(see details).- method.1
Method for synthesis of the 1st coefficient. Can take
"common
,"random"
, or be assigned a numeric value (see details).- pool.2
Pooling for the 2nd coefficient. Can take
"rel"
or"abs"
(see details).- method.2
Method for synthesis of the 2nd coefficient. Can take
"common
,"random"
, or be assigned a numeric value (see details).- pool.3
Pooling for the 3rd coefficient. Can take
"rel"
or"abs"
(see details).- method.3
Method for synthesis of the 3rd coefficient. Can take
"common
,"random"
, or be assigned a numeric value (see details).- pool.4
Pooling for the 4th coefficient. Can take
"rel"
or"abs"
(see details).- method.4
Method for synthesis of the 4th coefficient. Can take
"common
,"random"
, or be assigned a numeric value (see details).- pool.5
Pooling for the 5th coefficient. Can take
"rel"
or"abs"
(see details).- method.5
Method for synthesis of the 5th coefficient. Can take
"common
,"random"
, or be assigned a numeric value (see details).- pool.6
Pooling for the 6th coefficient. Can take
"rel"
or"abs"
(see details).- method.6
Method for synthesis of the 6th coefficient. Can take
"common
,"random"
, or be assigned a numeric value (see details).
Time-course parameters
Time-course parameters in the model must be specified using a pool
and a method
prefix.
pool
is used to define the approach used for pooling of a given time-course parameter and
can take any of:
Argument | Model specification |
"rel" | Indicates that relative effects should be pooled for this time-course parameter. Relative effects preserve randomisation within included studies, are likely to vary less between studies (only due to effect modification), and allow for testing of consistency between direct and indirect evidence. Pooling follows the general approach for Network Meta-Analysis proposed by lu2004;textualMBNMAtime. |
"abs" | Indicates that study arms should be pooled across the whole network for this time-course parameter independently of assigned treatment to estimate an absolute effect. This implies estimating a single value across the network for this time-course parameter, and may therefore be making strong assumptions of similarity. |
method
is used to define the model used for meta-analysis for a given time-course parameter
and can take any of the following values:
Argument | Model specification |
"common" | Implies that all studies estimate the same true effect (often called a "fixed effect" meta-analysis) |
"random" | Implies that all studies estimate a separate true effect, but that each of these true effects vary randomly around a true mean effect. This approach allows for modelling of between-study heterogeneity. |
numeric() | Assigned a numeric value, indicating that this time-course parameter should not be estimated from the data but should be assigned the numeric value determined by the user. This can be useful for fixing specific time-course parameters (e.g. Hill parameters in Emax functions, power parameters in fractional polynomials) to a single value. |
When relative effects are modelled on more than one time-course parameter, correlation between them is automatically estimated using a vague inverse-Wishart prior.
Examples
# Second order B spline with 2 equally spaced knots and random effects on
#the 2nd coefficient
tspline(type="bs", nknots=2, degree=2,
pool.1="rel", method.1="common",
pool.2="rel", method.2="random")
#> $name
#> [1] "bs"
#>
#> $fun
#> ~beta.1 * spline.1 + beta.2 * spline.2 + beta.3 * spline.3 +
#> beta.4 * spline.4
#> <environment: 0x55964e94c950>
#>
#> $latex
#> [1] "\beta_1 * X[m,1] + \beta_2 * X[m,2] + \beta_3 * X[m,3] + \beta_4 * X[m,4]"
#>
#> $params
#> [1] "beta.1" "beta.2" "beta.3" "beta.4"
#>
#> $nparam
#> [1] 4
#>
#> $knots
#> NULL
#>
#> $nknots
#> [1] 2
#>
#> $degree
#> [1] 2
#>
#> $jags
#> [1] "beta.1[i,k] * spline[i,m,1] + beta.2[i,k] * spline[i,m,2] + beta.3[i,k] * spline[i,m,3] + beta.4[i,k] * spline[i,m,4]"
#>
#> $apool
#> beta.1 beta.2 beta.3 beta.4
#> "rel" "rel" "rel" "rel"
#>
#> $amethod
#> beta.1 beta.2 beta.3 beta.4
#> "common" "random" "common" "common"
#>
#> $bname
#> beta.1 beta.2 beta.3 beta.4
#> "beta.1" "beta.2" "beta.3" "beta.4"
#>
#> $bpool
#> beta.1 beta.2 beta.3 beta.4
#> "pool.1" "pool.2" "pool.3" "pool.4"
#>
#> $bmethod
#> beta.1 beta.2 beta.3 beta.4
#> "method.1" "method.2" "method.3" "method.4"
#>
#> attr(,"class")
#> [1] "timefun"
# Piecewise linear spline with knots at times of 5 and 10
# Single parameter independent of treatment estimated for 1st coefficient
#with random effects
tspline(type="ls", knots=c(5,10),
pool.1="abs", method.1="random",
pool.2="rel", method.2="common")
#> $name
#> [1] "ls"
#>
#> $fun
#> ~beta.1 * spline.1 + beta.2 * spline.2 + beta.3 * spline.3
#> <environment: 0x55964b1cb818>
#>
#> $latex
#> [1] "\beta_1 * X[m,1] + \beta_2 * X[m,2] + \beta_3 * X[m,3]"
#>
#> $params
#> [1] "beta.1" "beta.2" "beta.3"
#>
#> $nparam
#> [1] 3
#>
#> $knots
#> [1] 5 10
#>
#> $nknots
#> [1] 2
#>
#> $degree
#> [1] 1
#>
#> $jags
#> [1] "i.beta.1[i,k] * spline[i,m,1] + beta.2[i,k] * spline[i,m,2] + beta.3[i,k] * spline[i,m,3]"
#>
#> $apool
#> beta.1 beta.2 beta.3
#> "abs" "rel" "rel"
#>
#> $amethod
#> beta.1 beta.2 beta.3
#> "random" "common" "common"
#>
#> $bname
#> beta.1 beta.2 beta.3
#> "beta.1" "beta.2" "beta.3"
#>
#> $bpool
#> beta.1 beta.2 beta.3
#> "pool.1" "pool.2" "pool.3"
#>
#> $bmethod
#> beta.1 beta.2 beta.3
#> "method.1" "method.2" "method.3"
#>
#> attr(,"class")
#> [1] "timefun"