R version 4.2.1 (2022-06-23) -- "Funny-Looking Kid" Copyright (C) 2022 The R Foundation for Statistical Computing Platform: aarch64-apple-darwin20 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > pkgname <- "XICOR" > source(file.path(R.home("share"), "R", "examples-header.R")) > options(warn = 1) > library('XICOR') > > base::assign(".oldSearch", base::search(), pos = 'CheckExEnv') > base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv') > cleanEx() > nameEx("FRpredcor") > ### * FRpredcor > > flush(stderr()); flush(stdout()) > > ### Name: FRpredcor > ### Title: Compute the FR coefficient on two vectors based exactly on > ### Gamma2. > ### Aliases: FRpredcor Gamma2 > ### Keywords: ~methods > > ### ** Examples > > # Compute the coefficient and compare to the xi coefficient > simulCompare <- function(n = 20, B = 1000) + { + diffs<- rep(0,B) + xvec <- 1:n + for (i in 1:B) + { + yvec <- runif(n) + diffs[i] <- FRpredcor(xvec, yvec) - xicor(xvec, yvec) + } + return(diffs) + } > > simulcompare1K <- simulCompare() > summary(simulcompare1K) Min. 1st Qu. Median Mean 3rd Qu. Max. 408.0 420.1 420.1 420.0 420.1 420.1 > > > > > > cleanEx() > nameEx("FRpredcorhalf") > ### * FRpredcorhalf > > flush(stderr()); flush(stdout()) > > ### Name: FRpredcorhalf > ### Title: Compute the FR half coefficient on two vectors based on half > ### Gamma 2. > ### Aliases: FRpredcorhalf > ### Keywords: ~methods > > ### ** Examples > > # Compute the coefficient and compare to the xi coefficient > simulCompare <- function(n = 20, B = 1000) + { + diffsim <- rep(0,B) + xvec <- 1:n + for (i in 1:B) + { + yvec <- sample(n,n) + diffsim[i] <- FRpredcorhalf(xvec,yvec)-xicor(xvec,yvec) + } + return(diffsim) + } > > compare1K <- simulCompare() > summary(compare1K) Min. 1st Qu. Median Mean 3rd Qu. Max. -2.220e-16 -2.220e-16 -2.220e-16 -2.218e-16 -2.220e-16 0.000e+00 > > > > > > cleanEx() > nameEx("calculateXI") > ### * calculateXI > > flush(stderr()); flush(stdout()) > > ### Name: calculateXI > ### Title: Compute the cross rank coefficient xi on two vectors. > ### Aliases: calculateXI xicorcoefficient > ### Keywords: ~methods > > ### ** Examples > > # Compute one of the coefficients > library("psychTools") > data(peas) > calculateXI(peas$parent,peas$child) [1] 0.1008343 > calculateXI(peas$child,peas$parent) [1] 0.9225 > > > > cleanEx() detaching ‘package:psychTools’ > nameEx("xicor") > ### * xicor > > flush(stderr()); flush(stdout()) > > ### Name: xicor > ### Title: Compute the cross rank increment correlation coefficient xi. > ### Aliases: xicor xi > ### Keywords: ~htest ~methods > > ### ** 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 > xicor(peas$parent,peas$child,pvalue=TRUE) $xi [1] 0.1008343 $sd [1] 0.02408662 $pval [1] 1.417572e-05 > xicor(peas$child,peas$parent) [1] 0.9225 > # Compute all the coefficients > xicor(peas) parent child parent 0.99625 0.1008343 child 0.92250 0.9958986 > > > > > ### *