MAsim.uneqvar: ~~function to do ... ~~

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

~~ A concise (1-5 lines) description of what the function does. ~~

Usage

1
MAsim.uneqvar(ng = 10000, n = 3, n1 = n, n2 = n, p0 = 0.9, d01 = 10, s2_01 = 1, v0m = 1, v0var = 1, p0var = 0.7)

Arguments

ng

~~Describe ng here~~

n

~~Describe n here~~

n1

~~Describe n1 here~~

n2

~~Describe n2 here~~

p0

~~Describe p0 here~~

d01

~~Describe d01 here~~

s2_01

~~Describe s2_01 here~~

v0m

~~Describe v0m here~~

v0var

~~Describe v0var here~~

p0var

~~Describe p0var here~~

Details

~~ If necessary, more details than the description above ~~

Value

~Describe the value returned If it is a LIST, use

comp1

Description of 'comp1'

comp2

Description of 'comp2'

...

Note

~~further notes~~

~Make other sections like Warning with .... ~

Author(s)

~~who you are~~

References

~put references to the literature/web site here ~

See Also

~~objects to See Also as help, ~~~

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (ng = 10000, n = 3, n1 = n, n2 = n, p0 = 0.9, 
                           d01 = 10, s2_01 = 1, v0m = 1, v0var=1, p0var=0.7) 
{
  nn = n1 + n2
  group = rep(c(0, 1), c(n1, n2))
  s2 = d01*s2_01/rchisq(ng, df = d01)
  s2_g1 = s2*exp(rnorm(ng,mean=0,sd= sqrt(v0var)))
  s2_g2 = s2*exp(rnorm(ng,mean=0,sd= sqrt(v0var)))
  
  eqvar = runif(ng)< p0var  # equal variance
  s2_g1[eqvar] = s2[eqvar]
  s2_g2[eqvar] = s2[eqvar]
  s2_g = (n1*s2_g1 + n2*s2_g2)/(n1+n2)   # average variance
  
  xdat1 = matrix(rnorm(ng*n1, sd = sqrt(s2_g1)), ncol = n1)
  
  ndx = runif(ng) > p0
  nde = sum(ndx)
  xmean2 = rep(0, ng)
  xmean2[ndx] = rnorm(nde, mean = 0, sd = sqrt(v0m * s2_g))
  xdat2 = matrix(rnorm(ng*n2, sd = sqrt(s2_g2)), ncol = n2) + xmean2
  
  xdat = cbind(xdat1, xdat2)
  colnames(xdat) = as.character(group)
  
  des = des.var = rep(FALSE, ng)   # DE status for mean and variance
  des[ndx] = TRUE
  des.var[!eqvar] = TRUE
  attr(xdat, "DE") = des
  attr(xdat, "DE.var") = des.var
  
  xdat
  }

Senbee/mwt documentation built on May 9, 2019, 1:21 p.m.