Function to sample uncertainty of the Uptake

marginalEffect(
  params,
  method = "fitted",
  whichChains = 1,
  tCoef = NULL,
  range = seq.int(4000, 5000)
)

Arguments

params

An object of class RexParams containing the parameters of the Rex model

method

A character value indicating the method to use. Either "fitted" or "predict". Default is "fitted" which only include uncertainty in the model parameters and "predict" includes uncertainty in the model parameters and the error term (e.g. observation level error)

whichChains

An integer value indicating which chain to sample from

tCoef

A numeric vector of coefficients to use in the prediction

range

A numeric vector of the range of iterations to sample from

Value

Returns a list of samples

Examples

require(RexMS)
require(dplyr)
#> Loading required package: dplyr
#> 
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:S4Vectors’:
#> 
#>     first, intersect, rename, setdiff, setequal, union
#> The following objects are masked from ‘package:BiocGenerics’:
#> 
#>     combine, intersect, setdiff, union
#> The following objects are masked from ‘package:stats’:
#> 
#>     filter, lag
#> The following objects are masked from ‘package:base’:
#> 
#>     intersect, setdiff, setequal, union
data("BRD4_apo")
BRD4_apo <- BRD4_apo %>% filter(End < 40)

numTimepoints <- length(unique(BRD4_apo$Exposure))
Timepoints <- unique(BRD4_apo$Exposure)

rex_example <- rex(HdxData = DataFrame(BRD4_apo),
                numIter = 4, # typically much larger
                R = max(BRD4_apo$End),
                numtimepoints = numTimepoints,
                timepoints = Timepoints,
                seed = 1L,
                numChains = 1L,
                tCoef = c(0, rep(1, 5)),
                BPPARAM = SerialParam())
#> Fold 1 ... Fold 2 ... Fold 3 ... Fold 4 ... Fold 5 ... 
#> 
  |                                                                            
  |                                                                      |   0%
rex_example <- RexProcess(HdxData = DataFrame(BRD4_apo),
                          params = rex_example,
                          thin = 1,
                          range = 1:4,
                          whichChains = c(1))
samples <- marginalEffect(rex_example,
                          range= 1:4)