sam.cor: Generate a Sample that Correlates with a Fixed Set of...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/multilevel.R

Description

This function will generate a vector (y) with a known correlation to a given vector (x). The degree of correlation between x and y is determined by the parameter rho (the population correlation). Observed sample correlations between x and y will vary around rho, but this variation will decrease as the size of x increases.

Usage

1
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 paul.bliese@moore.sc.edu

See Also

simbias

Examples

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

multilevel documentation built on May 29, 2017, 5:38 p.m.

Search within the multilevel package
Search all R packages, documentation and source code