FixedMean {clinDR} R Documentation

Fixed means (proportions) random data constructor for emaxsim for continuous or binary data

Description

Creates a list object that contains inputs and a function to create simulated data sets with a common mean (proportion) for use in emaxsim with normal or continuous data

Usage

FixedMean(n, doselev, meanlev, resSD, parm = NULL, binary=FALSE)


Arguments

 n Sample size for each dose group doselev Dose levels (including 0 for placebo) in the study corresponding to n. Must be in increasing order. meanlev Mean response at each doselev. For binary data, these are the proportion of responders (no logit transformation). resSD Standard deviation for residuals within each dose group (assumed common to all dose groups) parm Population parameters that are saved for later reference, but are not used when creating simulated data. parm can contain parameters for a 3- or 4- parameter Emax model that generated meanlev. They should be stored in the order given in emaxfun. Default is NULL. binary Normal data with homogeneous variance are generated unless binary is TRUE, and then means are interpreted as proportions and 0/1 data are generated.

Value

A list of length 2. The first element is itself a list named genP that contains named elments n, resSD, doselev, dose, parm, binary, and the element meanlev, which is specific to FixedMean. The second element is a function named genFun that takes genP as input and returns a list with named elements meanlev, parm, resSD, y.

Author(s)

Neal Thomas

emaxsim, RandEmax

Examples


## Not run:
##  example changes the random number seed

doselev<-c(0,5,25,50,100)
n<-c(78,81,81,81,77)

### population parameters for simulation
e0<-2.465375
ed50<-67.481113

dtarget<-100
diftarget<-9.032497
emax<-solveEmax(diftarget,dtarget,log(ed50),1,e0)

sdy<-7.967897
pop<-c(log(ed50),emax,e0)

meanlev<-emaxfun(doselev,pop)

###FixedMean is specialized constructor function for emaxsim
genp<-FixedMean(n,doselev,meanlev,sdy,pop)

### binary example
n<-rep(500,5)
doselev<-c(0,5,25,50,1000)
dose<-rep(doselev,n)

e0<- qlogis(0.2)
ed50<-20
diftarget<-qlogis(0.6)-qlogis(0.2)
lambda<-2
dtarget<-100
emax<-solveEmax(diftarget,dtarget,log(ed50),lambda,e0)

pop<-c(log(ed50),lambda,emax,e0)
meanlev<-plogis(emaxfun(doselev,pop))

genp<-FixedMean(n,doselev,meanlev,sdy,pop,binary=TRUE)

tapply(genp$genFun(genp$genP)\$y,dose,mean)
meanlev

## End(Not run)



[Package clinDR version 2.3.5 Index]