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) 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) 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) calculateXI(peas$child,peas$parent) cleanEx() 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) xicor(peas$child,peas$parent) # Compute all the coefficients xicor(peas) ### *