getS.StatInMed(iseed = "random", rev = 4, dist = "b", mod = 0, probs = seq(0, 0.99, 0.01), ts = seq(0.001, 0.99, 0.001), trueCPI = FALSE, full = FALSE, Scenario = "SPMS")
mod
= 0.
Integers to specify a seed. If iseed="random", seed is not specified.
mod
= 0.
At which DSMB reviews, data is generated.
mod
= 0.
dist
must be either "b"
"b2"
or "YZ"
.
If dist="b"
then random effect $G[i]$ is from a single beta, if dist="b2"
then it is from a mixture of two betas and
if dist="YZ"
then it is transformed to range $[0,Inf)$ and from a mixture of normal and gamma.
See details
for more details.
mod
= 0 then getS.StatInMed
generates a simulation sample. If mod
= 1 then getS.StatInMed
returns true quantiles of $G[i]$ at given probs
.
If mod
= 2 then getS.StatInMed
returns true densities of $G[i]$ at grids of points specified at ts
.
If mod
= 3 then getS.StatInMed
returns parameters of the simulation model.
mod
= 1. probs
can be a vector of probabilities.
mod
= 3. ts
can be a grid of points in (0,1).
mod
= 0.
If trueCPI=TRUE
, getS.StatInMed
returns the true conditional probability indices of $N$ patient,
computed using separate mean functions for the control and treated groups.
mod
= 0.
If full=TRUE
, rev
is ignored and getS.StatInMed
returns complete dataset that contains 180 patients and all of them have 10 repeated measures.
mod
= 0.
If Scenario
specifies the prior for $\boldsymbol{\beta}$, and it must be either "full"
or "SPMS"
.
See details
.
mod=0
, the it returns a dataframe that contains:Y
: the generated response countsIntercept
: all 1timeInt1
: 1 if the row corresponds to the count taken at the 1st 4-month followup interval, else 0.timeInt2
: 1 if the row corresponds to the count taken at the 2nd 4-month followup interval, else 0.ID
: the patient ID.gs
: generated random effect $G_i$.scan
: $-1,0,1,2,\cdots$.
-1 indicates the screening scan, 0 indicates the baseline and 1,2,.. indicates 1,2-th followup scans.days
: scan
+ 2hs
: indicates which component the random effect is generated.
If dist="b"
, hs
is all 1.
If dist="b2"
or dist="YZ"
then hs
is either 1 or 2.trtAss
: indicates treatment assignments.labelnp
: 1 if scans correspond to new scans else 0.betPlcb
: The only first three elements are relevant.
They are the generated intercept and time effects of placebo patients for mean counts.
i.e., $\alpha_0,\beta_{0,1},\beta_{0,2}$.betFull
: The only first five elements are relevant. They are the generated intercept and time effects for mean counts.
i.e., $\alpha_0,\beta_{0,1},\beta_{1,1},\beta_{0,2},\beta_{1,2}$.probIndex
: The only first $N$ elements are relevant. They are the true conditional probability indices of $N$ patient, computed using true mean functions of the control patients (for both control and treated patients).probIndexTRUE
: This appear only if trueCPI=TRUE
.
The only first $N$ elements are relevant. They are the true conditional probability indices of $N$ patient, computed using separate mean functions for the control and treated groups.
Simulation settings are as follows.
Given the covariate vectors $\boldsymbol{X}_{ij}$ for mean counts, response counts $Y_{ij}$ of the $j$th repeated measure of $i$th patient are assumed to be from the mixed-effect negative binomial model:
$ Y[ij] | G[i]=g[i], beta i.i.d.~ NB(Y[ij]; size=exp(X[ij]*beta),prob=g[i]) $.
This formulation results in $\log E(Y_{i,j}) = \log(\mu_{\frac{1}{G}} - 1 ) + \boldsymbol{X}_{ij}^T\boldsymbol{\beta}$. The mean count is modeled on the log scale as a constant over every four-month follow-up period, where the constants are allowed to dependent on the treatment assignment $A_i$ ($A_i$ = 1 for treatment, else 0).
$ \log E(Y_{i,j}|A_i = a_i) = \log(\mu_{\frac{1}{G}} - 1 ) + \alpha_0 + \sum_{a=0}^{1} \sum_{t=1}^2 \beta_{a,t} I(j \in \boldsymbol{T}_t, a_i = a) $,
where $\mu_{\frac{1}{G}} = E(\frac{1}{G_i})$ and $\boldsymbol{T}_1$ and $\boldsymbol{T}_2$ respectively contains indices corresponding to scans taken within the 1st and 2nd four-month interval during the follow-up.
The regression coefficients $\boldsymbol{\beta}=(\alpha_0,\beta_{0,1},\beta_{1,1},\beta_{0,2},\beta_{1,2})$
are assumed to differ among studies and are generated from a multivariate normal distribution with
$mu$ and $Sigma$ replaced by the estimates from the full informative prior (Scenario A) or the SPMC informative prior (Scenario B) developed in Section 5.3 of the referred paper. To see their values set mod=3
. (See example below). The proportion of treated patients is assumed to be 0.67.
getS.StatInMed
allows three random effect model:
Setting 1: $G[i] ~ Beta(3,0.8)$ which returns $(E(Y_{ij},SD(Y_{ij})))=(1.48,3.45)$ and $(1.40,3.29)$ at baseline under full and SPMC Scenarios respectively.
Setting 2: $G_i\sim 0.3 Beta(10,10) + 0.7 Beta(20,1)$ which returns $(E(Y_{ij},SD(Y_{ij})))=(4.12,3.73)$ and $(0.20,0.51)$ at baseline for the patients whose REs are generated from the first and the second component of the mixture under full Scenario, and $(2.90,3.59)$ and $(0.18,0.49)$ under SPMS Scenario.
Setting 3: $G_i=\frac{1}{G_i^*+1}$ where $G_i^*\sim 0.85 Gamma (0.176,2.226) + 0.15N(1.820,0.303)$ where $Gamma(a,b)$ represents the gamma CDF with variance $ab^2$. This mixture returns $(E(Y_{ij},SD(Y_{ij})))=(1.46,4.16)$ and $(6.75,4.56)$ at baseline for the patients whose REs are drawn from the first and second component of the mixture under full Scenario, and $(1.38,3.97)$ and $(6.39,4.41)$ under SPMS Scenario.
The choices of the random effect settings can be controlled by the input dist
.
getS.StatInMed
assumes MRI scans are taken monthly with a total of 10 MRI scans for each patients, a screening a baseline and eight follow-up scans. We assume that 15 patients are recruited every month so that 180 patients are recruited in 12 months, leading to a study duration of 21 month. DSMB reviews are assumed to occur every 4 months.
This means that by the DSMB review 1, 150 scans are available from 60 patients
(15 patients have 4 scans each,
next 15 patients have 3 scans each,
next 15 patients have 2 scans each and the last 15 patient have 1 scan each.)
By the DSMB review 2, 540 scans are available from 120 patients
(15 patients have 8 scans each, the next 15 patients have 7 scans each,....the last 15 patients have only 1 scan each.)
The DSMB reviews can be specified by the input rev
.
lmeNBBayes
getS.StatInMed
getDIC
dqmix
index.batch.Bayes
## Not run:
#
# ## See the full informative prior for beta
# temp <- getS.StatInMed(mod=3,Scenario="full")
# temp$mu_beta
# temp$Sigma_beta
#
# ## See the SPMS informative prior for beta
# temp <- getS.StatInMed(mod=3,Scenario="SPMS")
# temp$mu_beta
# temp$Sigma_beta
#
# ## See also the examples in lmeNBBayes
# ## End(Not run)
Run the code above in your browser using DataLab