EffFlexi-class | R Documentation |
This is a class where a flexible form is used to describe the realtionship between the efficacy responses and the dose levels. This flexible form aims to capture different shape for the dose-efficacy curve and the mean efficacy responses at each dose level are estimated using MCMC. In addition, the first (RW1) or second order (RW2) random walk model can be used for smoothing data. That is the random walk model is used to model the first or the second order differnece of the mean efficacy responses to its neighbouring dose levels of their mean efficacy responses. The flexible form is specified as
\mathbf{W}\vert\boldsymbol{\beta_w}, \sigma^2 \sim Normal (\mathbf{X}_w \boldsymbol{\beta_w}, \sigma^2 \mathbf{I})
where \mathbf{W}
represent the column vector of the efficacy responses, \boldsymbol{\beta_w}
is th column vector of the mean efficacy responses for all dose levels, \mathbf{X_w}
is the
design matrix with entries I_{i(j)}
which gives a value 1 if subject i is allocated to
dose j. The \sigma^2
(sigma2) is the variance of the efficacy responses which can be either fixed or from
an inverse gamma distribution.
The RW1 model is given as
\beta_{W,(j)} - \beta_{W,(j-1)} \sim Normal(0, \sigma^{2}_{\beta_{W}})
where \beta_{W,(j)}
is the mean efficacy responses at dose j
For the RW2 is given as
\beta_{W,(j-2)} - 2 \beta_{W,(j-1)} + \beta_{W,(j)} \sim Normal(0, \sigma^{2}_{\beta_{W}})
The variance parameter \sigma^{2}_{\beta_{W}}
. The variance \sigma^{2}_{\beta_{W}}
(sigma2betaW) will be the same at all dose levels and can
either be fixed or assigned an inverse gamma prior distribution.
The Eff
and Effdose
are the pseduo efficacy responses and dose levels at which these
pseudo efficacy responses are observed at. (see more details for Effloglog
class)
Eff
and Effdose
must be vector of at least length 2. The values or elements in vectors
Eff
or Effdose
must put in the same position with its corresponding value in the other
vector. The sigma2
is the prior variance of the flexible efficacy form. The variance is either specified
with a single scalar value (fixed) or postive scalar value have to be specified for the a
shape and
b
slope parameter for th inverse gamme distribtuion. Similarly, sigma2betaW
is the prior variance
of the random walk model which can be specified with a single scalar (fixed) value or specifying positive
scalar values for the shape a
and rate b
parameters for the inverse gamma distributions.
This model will output the updated value or the updated values of the paramters of the inverse gamma
distributions for sigma^2
(sigma2) and \sigma^2_{\beta_W}
(sigma2betaW)
Eff
the pseudo efficacy responses. A vector of at least length 2 with the elements here and its
corresponding value in Effdose
must be specified in the same position. (see dtails above)
Effdose
the dose levels at which the pseudo efficacy responses are observed. This is a vector of at
least length 2 and the elements here and its corrresponding value in Eff
must be specified in the
same postion. (see details from above)
sigma2
the prior variance of the flexible efficacy form. It can be specified with a single positive
scalar or specifying a
, the shape and b
, the rate parameter of the inverse gamma
distribution. (see details from above)
sigma2betaW
the prior variance of the random walk model for the mean efficact responses. A single
positve scalar can be specified or specifying a
, the shape and b
, the rate parameter of
the inverse gamma distribution (see details from above)
useFixed
a list of with logical value to each of the parameters sigma2
and sigma2betaw
indicating whether a fixed value is used or not; this slot is needed for internal purposes and not to
be touched by the user.
useRW1
for specifying the random walk model for the mean efficacy responses; if TRUE
,
first order random walk model is used, otherwise the second-order random walk model.
designW
is the design matrix for the efficacy responses. If only the pseudo efficacy responses are used, this will be the design matrix of the pseudo efficacy responses. If there are some observed efficacy responses available. It will be the design matrix based on both the pseudo and the observed efficacy responses.
RWmat
is the the difference matrix for the random walk model. This slot is needed for internal purposes and not to be touched by the user.
RWmatRank
is the rank of the difference matrix. This slot is needed for internal purposes and not to be touched by the user.
##Obtain prior estimates for the EffFlexi (efficacy model) given the pseudo data.
##First define an empty data set by only define the dose levels used in the study
## 12 dose levels are usesd from 25 to 300 mg with increments of 25.
emptydata<-DataDual(doseGrid=seq(25,300,25))
data<-emptydata
## define the pseudo data as first fixed 2 dose levels 25 and 300 mg and
## specified in (Effdose slot).
## Then the efficacy responses observed at these two dose levels are 1.223 and 2.513 and
## specified in (Eff slot).
## The prior variance of the pseudo efficay responses. This can be either a fixed value of
## specifying the shape (a) and the rate (b) parameters for the inverse gamma distribution
## in (sigma2 slot). The prior variance of the random walk model which can be a fixed value or
## two value for the shape (a) and rate (b) parameter of the inverse gamma distribution in
## (sigma2betaW slot). The data are specified in (data slot)
Effmodel<- EffFlexi(Eff=c(1.223, 2.513),Effdose=c(25,300),
sigma2=c(a=0.1,b=0.1),sigma2betaW=c(a=20,b=50),
smooth="RW2",data=data)
##Obtain estimates from the model given some observed responses
## first specified the data
data<-DataDual(x=c(25,50,50,75,100,100,225,300),y=c(0,0,0,0,1,1,1,1),
w=c(0.31,0.42,0.59,0.45,0.6,0.7,0.6,0.52),
doseGrid=seq(25,300,25))
Effmodel<- EffFlexi(Eff=c(1.223, 2.513),Effdose=c(25,300),
sigma2=c(a=0.1,b=0.1),sigma2betaW=c(a=20,b=50),
smooth="RW2",data=data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.