censCor | R Documentation |
Computes the maximum likelihood estimate of the correlation between two possibly left-censored vectors. It is equivalent the the Pearson product-moment correlation for uncensored data.
censCor(x, y, Full = TRUE, na.rm = TRUE)
x |
any data that can be converted to a left-censored data object. |
y |
any data that can be converted to a left-censored data object. |
Full |
how to compute the mean and standard deviation of |
na.rm |
logical, remove missing values before computing the correlation? |
Full
may be either logical or a numeric vector. If Full
is TRUE
,
then estimate the means and standard deviations for x
and y
.
If Full
is FALSE
, use the initial maximum likelihood estimate for those
statistics. Otherwise Full
can be a named vector containing mnx
, the mean
for x
; sdx
, the standard deviation for x
; mny
, the mean
for y
; sdy
, the standard deviation for y
. Full
can be set
to FALSE
if the optimization fails at large censoring levels or to improve
processing speed for large sample sizes.
A vector with these names:
cor |
the correlation between |
mnx |
the mean of |
sdx |
the standard deviation of |
mny |
the mean of |
sdy |
the standard deviation of |
cx |
the proportion of censored values of |
cy |
the proportion of censored values of |
cxy |
the proportion of censored values common to |
n |
the number of observations. |
ll0 |
the log likelihood for cor=0 |
llcor |
the log likelihood for cor=cor |
Lyles, R.H., Williams, J.K., and Chuachoowong R., 2001, Correlating two viral load assays with known detection limits: Biometrics, v. 57 no. 4, p. 1238–1244.
# Simple no censoring set.seed(450) tmp.X <- rnorm(25) tmp.Y <- tmp.X/2 + rnorm(25) cor(tmp.X, tmp.Y) censCor(tmp.X, tmp.Y) # Some censoring censCor(as.lcens(tmp.X, -1), as.lcens(tmp.Y, -1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.