Description Usage Arguments Details Value Source Examples
r.1subgroup
generates data for a design with one subgroup within a full population. Each observation is normal distributed with mean 0 in the placebo group and a potential effect in the treatment group. Whether the effect is solely in the subgroup or additionally a certain amount outside of the subgroup can be specified as well as potentially different variances within the subgroup and outside of the subgroup.
1 | r.1subgroup(n, delta, sigma, tau, fix.tau = c("YES", "NO"), k)
|
n |
number of observations. If length(n) > 1, the length is taken to be the number required. |
delta |
vector of treatment effects in the treatment group, c(outside subgroup, within subgroup). |
sigma |
vector of standard deviations, c(outside subgroup, inside subgroup). |
tau |
subgroup prevalence. |
fix.tau |
subgroup prevalence fix or simulated according to tau, see 'Details'. |
k |
sample size allocation factor between groups: see 'Details'. |
For delta
=(Δ_F\S, Δ_S)' and sigma
=(σ_F\S, σ_S)'
this function r.1subgroup
generates data as follows:
Placebo group outside of subgroup ~N(0,σ^2_F\S), Placebo group within subgroup ~N(0,σ^2_S), Treatment group outside of subgroup ~N(Δ_F\S,σ^2_F\S), Treatment group within subgroup ~N(Δ_S,σ^2_S).
If fix.tau=YES
the subgroup size is generated according to the prevalence tau
, i.e. n_S=τ*n.
If fix.tau=YES
, then each new generated observations probability to belong to the subgroup is Ber(\code{tau})
distributed and therefore only E(n_s)=τ*n holds.
The argument k
is the
sample size allocation factor, i.e. let n_C and n_T denote the sample sizes of of the control and
treatment group, respectively, then k = n_T/n_C.
r.1subgroup
returns a data matrix of dimension n
x 3
. The first column TrPl
defines whether
the observation belongs to the treatment group (TrPl=0
) or to the placebo group (TrPl=1
). Second column
contains the grouping variable FS
. For FS=1
the observation stems from the subgroup, for FS=0
from
the full population without the subgroup. In the last column value
the observation can be found.
between time points.
r.1subgroup
uses code contributed by Marius Placzek.
1 2 3 | set.seed(142)
random<-r.1subgroup(n=50, delta=c(0,1), sigma=c(1,1), tau=0.4, fix.tau="YES", k=2)
random
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.