Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sam.cor

Generate a Sample that Correlates with a Fixed Set of Observations


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

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)

See Also

Examples

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

multilevel

Multilevel Functions

v2.6
GPL (>= 2)
Authors
Paul Bliese
Initial release
2016-07-26

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.