w.cov {Weighted.Desc.Stat} | R Documentation |
weighted covariance
Description
Assume that is the observed value of a random sample from a fuzzy population.
In classical and usual random sample, the degree of belonging
into the random sample is equal to 1, for
.
But considering fuzzy population, we denote the degree of belonging
into the fuzzy population (or into the observed value of random sample) by
which is a real-valued number from [0,1].
Therefore in such situations, it is more appropriate that we show the observed value of the random sample by notation
which we called it real-valued fuzzy data.
The goal of w.cov function is computing covariance (or, the weighted covariance) between two vector-valued data sets
and
based on real-valued fuzzy data
and
by considering their vector-valued weights, i.e.
Usage
w.cov(x, y, mu)
Arguments
x , y |
Two vector-valued numeric data sets which you want to compute the weighted covariance between them. |
mu |
A vector of weights. The length of this vector must be equal to the length of data and each element of it is belongs to interval [0,1]. |
Value
The weighted covariance between two vectors x and y, by considering weights vector mu, is numeric or a vector of length one.
Warning
The length of x, y and mu must be equal. Also, each element of mu must be in interval [0,1].
Author(s)
Abbas Parchami
Examples
x <- c(1:10)
y <- c(10:1)
mu <- c(0.9, 0.7, 0.8, 0.7, 0.6, 0.4, 0.2, 0.3, 0.0, 0.1)
w.cov(x, y, mu)
## The function is currently defined as
function(x, y, mu) (sum(mu*x*y)/sum(mu)) - (w.mean(x,mu) * w.mean(y,mu))