p_r.cat | R Documentation |
Generates correlated X-Y data and returns a p-value to assess the null of no correlation in the population. The X-Y data are generated assuming a multivariate normal distribution and subsequently discretized for one or both of the variables.
p_r.cat(
n,
r,
tauX,
rho = 0,
tauY = NULL,
ML = TRUE,
two.tailed = TRUE,
score = FALSE,
gen_fun = gen_r,
...
)
n |
sample size |
r |
correlation prior to the discretization (recovered via the polyserial/polychoric estimates) |
tauX |
intercept parameters used for discretizing the X variable |
rho |
population coefficient to test against |
tauY |
intercept parameters used for discretizing the Y variable. If missing a polyserial correlation will be estimated, otherwise a tetrachoric/polychoric correlation will be estimated |
ML |
logical; use maximum-likelihood estimation? |
two.tailed |
logical; should a two-tailed or one-tailed test be used? |
score |
logical; should the SE be based at the null hypothesis (score test) or the ML estimate (Wald test)? The former is the canonical form for a priori power analyses though requires twice as many computations as the Wald test approach |
gen_fun |
function used to generate the required
continuous bivariate data (prior to truncation).
Object returned must be a |
... |
additional arguments to be passed to |
a single p-value
Phil Chalmers rphilip.chalmers@gmail.com
gen_r
# 100 observations, .5 correlation, tetrachoric estimate
p_r.cat(100, r=.5, tauX=0, tauY=1)
# Wald test
p_r.cat(100, r=.5, tauX=0, tauY=1, score=FALSE)
# polyserial estimate (Y continuous)
p_r.cat(50, r=.5, tauX=0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.