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

corr

Correlation Coefficient


Description

Calculates the weighted correlation given a data set and a set of weights.

Usage

corr(d, w = rep(1, nrow(d))/nrow(d))

Arguments

d

A matrix with two columns corresponding to the two variables whose correlation we wish to calculate.

w

A vector of weights to be applied to each pair of observations. The default is equal weights for each pair. Normalization takes place within the function so sum(w) need not equal 1.

Details

This function finds the correlation coefficient in weighted form. This is often useful in bootstrap methods since it allows for numerical differentiation to get the empirical influence values. It is also necessary to have the statistic in this form to find ABC intervals.

Value

The correlation coefficient between d[,1] and d[,2].

See Also


boot

Bootstrap Functions (Originally by Angelo Canty for S)

v1.3-28
Unlimited
Authors
Angelo Canty [aut], Brian Ripley [aut, trl, cre] (author of parallel support)
Initial release
2021-04-16

We don't support your browser anymore

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