Learn R Programming

multicon (version 1.0)

q.cor: Q Correlations

Description

Computes correlations, along with randomization tests (see rand.test), between a variable of interest (x) and a set of other variables (set), and repeats this for each sex.

Usage

q.cor(x, set, sex, fem = 1, male = 2, tails = 2, sims = 1000, seed = 2)

Arguments

x
A numeric vector of the same length as nrow(set) to be correlated with set.
set
A matrix or data.frame with nrow the same as length(x) to be correlated with x.
sex
A variable specifying the sex variable in the dataset from which x and set come.
fem
An element specifying the code for females in the sex variable.
male
An element specifying the code for males in the sex variable.
tails
An integer of either 1 or 2 specifying the tails for the p-values for the correlations.
sims
The number of randomizations passed to the rand.test() function.
seed
The seed passed to the rand.test function.

Value

  • A list containing...
  • NThe Ns (using complete cases) for the total sample as well as female and male subsamples.
  • corrsThe pattern of correlations between 'x' and 'set' for the combined sample, females, and males ordered by the items in set.
  • sortedThe pattern of correlations between 'x' and 'set' for the combined sample, females, and males ordered by the magnitude of the correlations in the combined sample.
  • vector.corThe correlation between the female and male patterns of correlations.

Details

A convenience function for quickly examining the pattern of correlations between a variable of interest "x" and a set of other variables "set".

See Also

q.cor.print rand.test

Examples

Run this code
data(RSPdata)
data(v2rbq)
names(v2rbq)
q.obj <- q.cor(RSPdata$sEXT, v2rbq, sex = RSPdata$ssex, fem = 1, male = 2, sims = 1000)
q.obj	
	#It is often useful to summarize this object with q.cor.print()
	#It might be necessary to adjust size of the width of your console to make this content fit.
data(rbqv3.items)
rbqv3.items #The item content for the rbq
q.cor.print(q.obj, rbqv3.items, initial = "RBQ", short = TRUE, EXPORT = FALSE) 
	# to export a .csv file change export to 'T'

Run the code above in your browser using DataLab