parCor: partial correlation In TripleR: Social Relation Model (SRM) Analyses for Single or Multiple Groups

Description

Performs partial correlations between x and y, controlled for z.

Usage

 1 parCor(x,y,z)

Arguments

 x First variable y Second variable z Control variable. This variable is coerced into a factor; in the TripleR context z usually is the group id.

Details

Performs partial correlations between x and y, controlled for z. The control variable is coerced into a factor; in the TripleR context z usually is the group id. Do not use this function with a continuous control variable - results will be wrong! Degrees of freedom for the t test are reduced by g - 1 (g is the number of groups).

Value

 par.cor partial correlation df degrees of freedom for the t test t.value t value p p value

Examples

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 data(multiGroup) data(multiNarc) # the function 'head' shows the first few lines of a data structure: head(multiNarc) # calculate SRA effects for extraversion ratings RR.style("p") RR1 <- RR(ex ~ perceiver.id * target.id | group.id, multiGroup, na.rm=TRUE) # merge variables to one data set dat <- merge(RR1\$effects, multiNarc, by="id") # We now have a combined data set with SRA effects and external self ratings: head(dat) # function parCor(x, y, z) computes partial correlation between x and y, # controlled for group membership z d1 <- parCor(dat\$ex.t, dat\$narc, dat\$group.id) d1 # disattenuate for target effect reliability parCor2 <- d1\$par.cor * (1/sqrt(attr(RR1\$effects\$ex.t, "reliability"))) parCor2

TripleR documentation built on May 2, 2019, 1:08 p.m.