Title: | Association Measurement Through Sliced Independence Test (SIT) |
Version: | 0.1.1 |
Description: | Computes the sit coefficient between two vectors x and y, possibly all paired coefficients for a matrix. The reference for the methods implemented here is Zhang, Yilin, Canyi Chen, and Liping Zhu. 2022. "Sliced Independence Test." Statistica Sinica. <doi:10.5705/ss.202021.0203>. This package incorporates the Galton peas example. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
LinkingTo: | Rcpp, RcppArmadillo |
Imports: | Rcpp, stats |
Date: | 2024-10-15 |
Suggests: | ggplot2, psychTools |
URL: | https://github.com/canyi-chen/SIT |
BugReports: | https://github.com/canyi-chen/SIT/issues |
NeedsCompilation: | yes |
Packaged: | 2024-10-16 01:52:31 UTC; chencanyi |
Author: | Canyi Chen |
Maintainer: | Canyi Chen <cychen.stats@outlook.com> |
Repository: | CRAN |
Date/Publication: | 2024-10-16 08:10:06 UTC |
Compute the block-wise sum of a vector.
Description
Compute the block-wise sum of a vector.
Usage
blocksum(r, c)
Arguments
r |
An integer vector |
c |
The number of observations in each block |
Value
The function returns the block sum of the vector.
Compute the cross rank coefficient sit on two vectors.
Description
This function computes the sit coefficient between two vectors x and y.
Usage
calculateSIT(x, y, c = 2)
Arguments
x |
Vector of numeric values in the first coordinate. |
y |
Vector of numeric values in the second coordinate. |
c |
The number of observations in each slice. |
Value
The function returns the value of the sit coefficient.
Note
Auxiliary function with no checks for NA, etc.
Author(s)
Yilin Zhang, Canyi Chen & Liping Zhu
References
Zhang Y., Chen C., & Zhu L. (2021). Sliced Independence Test. Statistica Sinica. https://doi.org/10.5705/ss.202021.0203.
See Also
sitcor
Examples
# Compute one of the coefficients
library("psychTools")
data(peas)
calculateSIT(peas$parent,peas$child)
calculateSIT(peas$child,peas$parent)
Conduct the sliced independence test.
Description
This function computes the sit coefficient between two vectors x and y, possibly all paired coefficients for a matrix.
Usage
sitcor(
x,
y = NULL,
c = 2,
pvalue = FALSE,
ties = FALSE,
method = "asymptotic",
nperm = 199,
factor = FALSE
)
Arguments
x |
Vector of numeric values in the first coordinate. |
y |
Vector of numeric values in the second coordinate. |
c |
The number of observations in each slice. |
pvalue |
Whether or not to return the p-value of rejecting independence, if TRUE the function also returns the standard deviation of sit. |
ties |
Do we need to handle ties? If ties=TRUE the algorithm assumes that the data has ties and employs the more elaborated theory for calculating s.d. and P-value. Otherwise, it uses the simpler theory. There is no harm in putting ties = TRUE even if there are no ties. |
method |
If method = "asymptotic" the function returns P-values computed by the asymptotic theory (not available in the presence of ties). If method = "permutation", a permutation test with nperm permutations is employed to estimate the P-value. Usually, there is no need for the permutation test. The asymptotic theory is good enough. |
nperm |
In the case of a permutation test, |
factor |
Whether to transform integers into factors, the default is to leave them alone. |
Value
In the case pvalue=FALSE, function returns the value of the sit coefficient, if the input is a matrix, a matrix of coefficients is returned. In the case pvalue=TRUE is chosen, the function returns a list:
- sitcor
The value of the sit coefficient.
- sd
The standard deviation.
- pval
The test p-value.
Author(s)
Yilin Zhang, Canyi Chen & Liping Zhu
References
Zhang Y., Chen C., & Zhu L. (2022). Sliced Independence Test. Statistica Sinica. https://doi.org/10.5705/ss.202021.0203.
Examples
##---- Should be DIRECTLY executable !! ----
library("psychTools")
data(peas)
# Visualize the peas data
library(ggplot2)
ggplot(peas,aes(parent,child)) +
geom_count() + scale_radius(range=c(0,5)) +
xlim(c(13.5,24))+ylim(c(13.5,24))+ coord_fixed() +
theme(legend.position="bottom")
# Compute one of the coefficients
sitcor(peas$parent,peas$child, c = 4, pvalue=TRUE)
sitcor(peas$child,peas$parent, c = 4)
# Compute all the coefficients
sitcor(peas, c = 4)