sam.cor: Generate a Sample that Correlates a Given Vector

View source: R/multilevel.R

sam.corR Documentation

Generate a Sample that Correlates a Given Vector

Description

Generate a sample vector (y) with a known population correlation to a given vector (x). The degree of correlation between x and y is determined by rho (the population correlation). Observed sample correlations between x and y will vary around rho, but this variation will decrease as the number of x observations increase.

Usage

sam.cor(x,rho)

Arguments

x

The given vector.

rho

Population correlation.

Value

The function prints the sample correlation for the specific set of numbers generated.

y

A vector of numbers correlated with x.

Author(s)

Paul Bliese pdbliese@gmail.com

See Also

sim.mlcor

Examples

   data(bh1996)
   NEWVAR<-sam.cor(x=bh1996$LEAD,rho=.30)
   cor(bh1996$LEAD,NEWVAR)

multilevel documentation built on March 18, 2022, 5:47 p.m.