sim.ci.median.ps | R Documentation |
Performs a computer simulation of confidence interval performance for a median difference in a paired-samples design. Sample data within each level of the within-subjects factor can be generated from bivariate population distributions with five different marginal distributions. All distributions are scaled to have standard deviations of 1.0 at level 1. Bivariate random data with specified marginal skewness and kurtosis are generated using the unonr function in the mnonr package.
sim.ci.median.ps(alpha, n, sd.ratio, cor, dist1, dist2, rep)
alpha |
alpha level for 1-alpha confidence |
n |
sample size |
sd.ratio |
ratio of population standard deviations |
cor |
population correlation of paired observations |
dist1 |
type of distribution at level 1 (1, 2, 3, 4, or 5) |
dist2 |
type of distribution at level 2 (1, 2, 3, 4, or 5)
|
rep |
number of Monte Carlo samples |
Returns a 1-row matrix. The columns are:
Coverage - probability of confidence interval including population median difference
Lower Error - probability of lower limit greater than population median difference
Upper Error - probability of upper limit less than population median difference
Ave CI Width - average confidence interval width
# Only 1000 reps because CRAN runs all examples and requires short execution time.
sim.ci.median.ps(.05, 30, 1.5, .7, 4, 3, 1000)
# Should return (within sampling error):
# Coverage Lower Error Upper Error Ave CI Width
# [1,] 0.961 0.026 0.013 0.9435462
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.