Learn R Programming

seqtest (version 0.1-0)

sim.seqtest.cor: Simulation of the sequential triangular test for Pearson's correlation coefficient

Description

This function performs a statistical simulation for the sequential triangular test for Pearson's correlation coefficient.

Usage

sim.seqtest.cor(rho.sim, k, rho, alternative = c("two.sided", "less", "greater"),
                delta, alpha = 0.05, beta = 0.1, runs = 1000,
                m.x = 0, sd.x = 1, m.y = 0, sd.y = 1,
                digits = 3, output = TRUE, plot = FALSE)

Arguments

rho.sim
simulated population correlation coefficient, $\rho$.
k
an integer or a numerical vector indicating the number of observations in each sub-sample.
rho
a number indicating the correlation coefficient under the null hypothesis, $\rho$.0.
alternative
a character string specifying the alternative hypothesis,
delta
minimum difference to be detected, $\delta$.
alpha
type-I-risk, $\alpha$.
beta
an integer or a numerical vector indicating the type-II-risk, $\beta$.
runs
numer of simulation runs.
m.x
population mean of simulated vector x.
sd.x
population standard deviation of simulated vector x.
m.y
population mean of simulated vector y.
sd.y
population standard deviation of simulated vector y.
digits
integer indicating the number of decimal places to be displayed.
output
logical: if TRUE, output is shown.
plot
logical: if TRUE, plot is shown.

Value

  • Returns an object of class sim.seqtest.cor with following entries: ll{ call function call spec specification of function arguments simres list with results (for each k or beta) for each run res data.frame with results, i.e., k, alpha.nom (nominal alpha), alpha.emp (estimated empirical alpha), beta.nom (nominal beta), beta.emp (empirica beta), p.H0 (proportion decision = H0), p.H1 (proportion decision = H1), AVN (average number of V), ASN (average number of sample pairs) }

Details

In order to determine the optimal k, simulation is conducted under the H0 condition, i.e., rho.sim = rho. Simulation is carried out for a sequence of k values to seek for the optimal k where the empirical alpha is as close as possible to the nominal alpha. In order to determine optimal beta (with fixed k), simulation is conudcted under the H1 condition, i.e., rho.sim = rho + delta or rho.sim = rho - delta. Simulation is carried out for a sequencen of beta values to seek for the optimal beta where the empirical beta is as close as possible to the nominal beta. In order to specify a one-sided test, argument alternative has to be used (i.e., two-sided tests are conducted by default). Specifying argument alternative = "less" conducts the simulation for the null hypothesis, H0: $\rho$ >= $\rho$.0 with the alternative hypothesis, H1: $\rho$ < $\rho$.0; specifying argument alternative = "greater" conducts the simluation for the null hypothesis, H0: $\rho$ <= $\rho$.0="" with="" the="" alternative="" hypothesis,="" h1:="" $\rho$=""> $\rho$.0.

References

Schneider, B., Rasch, D., Kubinger, K. D., & Yanagida, T. (2015). A Sequential triangular test of a correlation coefficient's null-hypothesis: 0 $< \rho \le \rho$0. Statistical Papers, 56, 689-699.

See Also

seqtest.cor, plot.sim.seqtest.cor, print.sim.seqtest.cor

Examples

Run this code
#---------------------------------------------
# Determine optimal k and nominal type-II-risk
# H0: rho <= 0.3, H1: rho > 0.3
# alpha = 0.01, beta = 0.05, delta = 0.25

# Step 1: Determine the optimal size of subsamples (k)

sim.seqtest.cor(rho.sim = 0.3, k = seq(4, 16, by = 1), rho = 0.3,
                alternative = "greater",
                delta = 0.25, alpha = 0.05, beta = 0.05,
                runs = 10000, plot = TRUE)

# Step 2: Determine the optimal nominal type-II-risk based on
#         the optimal size of subsamples (k) from step 1

sim.seqtest.cor(rho.sim = 0.55, k = 16, rho = 0.3,
                alternative = "greater",
                delta = 0.25, alpha = 0.05, beta = seq(0.05, 0.15, by = 0.01),
                runs = 10000, plot = TRUE)

Run the code above in your browser using DataLab