sim.partially.matched {robustrank} | R Documentation |
Simulate Paired, Independent, or Partially Matched Two-Sample Data
Description
sim.partially.matched generates partially matched two-sample data. for Monte Carlo studies. r2sample is a wrapper for sim.partially.matched and generates indepenent two-sample data.
Usage
sim.partially.matched(m, n.x, n.y,
distr = c("normal","logistic","student","mixnormal","gamma","lognormal","beta",
"uniform","hybrid1","hybrid2","doublexp"), params, seed)
r2sample(m, n,
distr = c("normal", "logistic", "student", "mixnormal"), params, seed)
sim.paired.with.replicates(m, meanRatio, sdRatio, within.sd, type, hyp, distr, seed)
Arguments
m |
Number of pairs. |
n |
Number of Ys. |
n.x |
Number of extra Xs. |
n.y |
Number of extra Ys. |
distr |
Distributions. |
params |
Named vector. See details. |
seed |
Seed for random number generator. |
meanRatio |
meanRatio |
sdRatio |
sdRatio |
within.sd |
within.sd |
type |
type |
hyp |
hyp |
Details
If the distribution is in c("normal","student","logistic")
, params
should have three fields: loc.2, rho and scale.2; loc.1 is set to 0 and scale.1 is set to 1.
If the distribution is mixnormal, params
should have three fields: p.1, p.2 and sd.n.
If the distribution is gamma, params
should have fix fields: loc.2, shape.1, shape.2, rate.1, rate.2 and rho.
For details on bivariate logistic distribution, see rbilogistic
Value
sim.partially.matched return a list with the following components:
X |
m sample 1 that pair with Y |
Y |
m sample 2 that pair with X |
Xprime |
n.x sample 1 |
Yprime |
n.y sample 2 |
r2sample returns a list with the following components:
X |
m sample 1 that are independent of Y |
Y |
n sample 2 that are independent of X |
Examples
dat=sim.partially.matched(m=10,n.x=5,n.y=4,distr="normal",
params=c("loc.2"=0,"rho"=0,"scale.2"=1),seed=1)
X=dat$X; Y=dat$Y; Yprime=dat$Yprime
#dat=sim.partially.matched(m=10,n.x=5,n.y=4,distr="logistic",
# params=c("loc.2"=0,"rho"=0,"scale.2"=1),seed=1)
#X=dat$X; Y=dat$Y; Yprime=dat$Yprime