Title: | Weighted Descriptive Statistics |
---|---|
Description: | Weighted descriptive statistics is the discipline of quantitatively describing the main features of real-valued fuzzy data which usually given from a fuzzy population. One can summarize this special kind of fuzzy data numerically or graphically using this package. To interpret some of the properties of one or several sets of real-valued fuzzy data, numerically summarize is possible by some weighted statistics which are designed in this package such as mean, variance, covariance and correlation coefficent. Also, graphically interpretation can be given by weighted histogram and weighted scatter plot using this package to describe properties of real-valued fuzzy data set. |
Authors: | Abbas Parchami (Department of Statistics, Faculty of Mathematics and Computer, Shahid Bahonar University of Kerman, Kerman, Iran) |
Maintainer: | Abbas Parchami <[email protected]> |
License: | LGPL (>= 3) |
Version: | 1.0 |
Built: | 2024-11-17 06:30:31 UTC |
Source: | CRAN |
Weighted Descriptive Statistics is an open source (LGPL 3) package for R which provides descriptive statistical methods to deal with weighted data. 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 or weighted data.
Weighted descriptive statistics is the discipline of quantitatively describing the main features of a real-valued fuzzy data which usually given from a fuzzy population.
The weighted descriptive statistics provide a concise summary a set of real data on the basis of the vector weight
. By Weighted.Desc.Stat package, one can easily summarize real-valued fuzzy data numerically or graphically using this package.
Calculating numerically summarize is possible by some weighted statistics in this package (such as mean, variance, covariance, correlation coefficent and etc) that summarize and interpret some of the properties of one or several sets of real-valued fuzzy data (real-valued fuzzy samples). Also, graphically interpretation can be drown by weighted histogram and weighted scatter plot using this package to describe properties of real-valued fuzzy data set.
Abbas Parchami
Maintainer: Abbas Parchami <[email protected]>
## Weighted statistics for one variable (property): x <- c(1:10) mu <- c(0.9, 0.7, 0.8, 0.7, 0.6, 0.4, 0.2, 0.3, 0.0, 0.1) w.mean(x, mu) w.sd(x, mu) w.var(x, mu) w.ad(x, mu) w.cv(x, mu) w.skewness(x, mu) w.kurtosis(x, mu) ## Weighted covariance, weighted correlation coefficent and weighted scatter ## plot for two variables (properties): n=50 x = rnorm(n,0,1) y = rnorm(n,0,1) mu = runif(n,0,1) w.cov(x, y, mu) w.r(x, y, mu) w.plot(x, y, 0.3, mu, lwd=2) ## Weighted histogram for one variable (property): n = 5000 x = rnorm(n,17,1) x[x<14 | x>20] = NA range(x) mu = runif(n,0,1) bre = seq(from=14,to=20,len=18) cu = seq(from=0,to=1,len=10) w.hist(x, mu, breaks=bre, cuts=cu, ylim=c(0,n/7), lwd = 2)
## Weighted statistics for one variable (property): x <- c(1:10) mu <- c(0.9, 0.7, 0.8, 0.7, 0.6, 0.4, 0.2, 0.3, 0.0, 0.1) w.mean(x, mu) w.sd(x, mu) w.var(x, mu) w.ad(x, mu) w.cv(x, mu) w.skewness(x, mu) w.kurtosis(x, mu) ## Weighted covariance, weighted correlation coefficent and weighted scatter ## plot for two variables (properties): n=50 x = rnorm(n,0,1) y = rnorm(n,0,1) mu = runif(n,0,1) w.cov(x, y, mu) w.r(x, y, mu) w.plot(x, y, 0.3, mu, lwd=2) ## Weighted histogram for one variable (property): n = 5000 x = rnorm(n,17,1) x[x<14 | x>20] = NA range(x) mu = runif(n,0,1) bre = seq(from=14,to=20,len=18) cu = seq(from=0,to=1,len=10) w.hist(x, mu, breaks=bre, cuts=cu, ylim=c(0,n/7), lwd = 2)
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.ad function is computing the absolute deviation (or, the weighted absolute deviation) value of
based on real-valued fuzzy data
by formula
w.ad(x, mu)
w.ad(x, mu)
x |
A vector-valued numeric data which you want to compute its weighted absolute deviation. |
mu |
A vector of weights. The length of this vector must be equal to the length of data and each element of it must be belong to interval [0,1]. |
The weighted absolute deviation of the vector x, by considering weights vector mu, is numeric or a vector of length one.
The length of x and mu must be equal. Also, each element of mu must be in interval [0,1].
Abbas Parchami
x <- c(1:10) mu <- c(0.9, 0.7, 0.8, 0.7, 0.6, 0.4, 0.2, 0.3, 0.0, 0.1) w.ad(x, mu) ## The function is currently defined as function(x, mu) sum( mu*abs(x- w.mean(x,mu) ) ) / sum(mu)
x <- c(1:10) mu <- c(0.9, 0.7, 0.8, 0.7, 0.6, 0.4, 0.2, 0.3, 0.0, 0.1) w.ad(x, mu) ## The function is currently defined as function(x, mu) sum( mu*abs(x- w.mean(x,mu) ) ) / sum(mu)
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.
w.cov(x, y, mu)
w.cov(x, y, mu)
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]. |
The weighted covariance between two vectors x and y, by considering weights vector mu, is numeric or a vector of length one.
The length of x, y and mu must be equal. Also, each element of mu must be in interval [0,1].
Abbas Parchami
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))
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))
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.cv function is computing the coefficient of variation (or, the weighted coefficient of variation) value of
based on real-valued fuzzy data
by considering its vector-valued weight. In other words, the weighted coefficient of variation is equal to the weighted standard deviation devided by the weighted mean.
w.cv(x, mu)
w.cv(x, mu)
x |
A vector-valued numeric data which you want to compute its weighted coefficient of variation. |
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]. |
The weighted coefficient of variation for vector x, by considering weights vector mu, is numeric or a vector of length one.
The length of x and mu must be equal. Also, each element of mu must be in interval [0,1].
Abbas Parchami
x <- c(1:10) mu <- c(0.9, 0.7, 0.8, 0.7, 0.6, 0.4, 0.2, 0.3, 0.0, 0.1) w.cv(x, mu) ## The function is currently defined as function(x, mu) w.sd(x,mu) / w.mean(x,mu)
x <- c(1:10) mu <- c(0.9, 0.7, 0.8, 0.7, 0.6, 0.4, 0.2, 0.3, 0.0, 0.1) w.cv(x, mu) ## The function is currently defined as function(x, mu) w.sd(x,mu) / w.mean(x,mu)
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.
This function drow the weighted histogram for a vector-valued data by considering a vector-valued weight. The weighted histogram containes several classical histograms which are depicted on one two-dimentional sorface. Each classical histogram drown only for the elements of real-value fuzzy data set which their weights are bigger than a cut point belongs to (0,1].
w.hist(x, mu, breaks, cuts, ylim = NULL, freq = NULL, lwd = NULL)
w.hist(x, mu, breaks, cuts, ylim = NULL, freq = NULL, lwd = NULL)
x |
A vector-valued numeric data for which the weighted histogram is desired by considering their weights. |
mu |
A vector of weights of the real-value fuzzy data. The length of this vector must be equal to the length of x and each element of it is belongs to interval [0,1]. |
breaks |
a vector giving the breakpoints between the weighted histogram cells. |
cuts |
a vector giving the cut-points between (to determine) the classical histograms in the desired weighted histogram. |
freq |
logical; if TRUE, the histogram graphic is a representation of frequencies, the counts component of the result; if FALSE, probability densities, component density, are plotted (so that the histogram has a total area of one). Defaults to TRUE if and only if breaks are equidistant (and probability is not specified). |
ylim |
numeric vector of length 2 giving the y limits for the plot. Unused if add = TRUE. |
lwd |
The line width, a positive number, defaulting to 1. The interpretation is device-specific, and some devices do not implement line widths less than one. |
The arguments of the weighted histogram can be extended similar to the arguments of usual histogram which is detailed in function "hist" from "graphics" package.
The length of x and mu must be equal. Also, each element of mu must be in interval [0,1].
Abbas Parchami
Department of Statistics, Faculty of Mathematics and Computer, Shahid Bahonar University of Kerman, Kerman, Iran
n = 5000 x = rnorm(n,17,1) x[x<14 | x>20] = NA range(x) mu = runif(n,0,1) bre = seq(from=14,to=20,len=18) cu = seq(from=0,to=1,len=10) w.hist(x, mu, breaks=bre, cuts=cu, ylim=c(0,n/7), lwd = 2) ## The function is currently defined as function(x, mu, breaks, cuts, ylim = NULL, freq = NULL, lwd = NULL) { Gray = paste("gray", round(seq(from=10, to=100, len=length(cuts)-1)), sep="") hist(x, col=Gray[1], xlim=range(breaks), ylim=ylim, breaks=breaks, freq=freq, lwd=lwd) i=2 while(i<=length(cuts)) { X=x X[(X*(mu>=cuts[i]))==0]=NA hist(X, col=Gray[i], xlim=range(breaks), ylim=ylim, breaks=breaks, freq=freq, lwd=lwd, add=TRUE) i=i+1 } }
n = 5000 x = rnorm(n,17,1) x[x<14 | x>20] = NA range(x) mu = runif(n,0,1) bre = seq(from=14,to=20,len=18) cu = seq(from=0,to=1,len=10) w.hist(x, mu, breaks=bre, cuts=cu, ylim=c(0,n/7), lwd = 2) ## The function is currently defined as function(x, mu, breaks, cuts, ylim = NULL, freq = NULL, lwd = NULL) { Gray = paste("gray", round(seq(from=10, to=100, len=length(cuts)-1)), sep="") hist(x, col=Gray[1], xlim=range(breaks), ylim=ylim, breaks=breaks, freq=freq, lwd=lwd) i=2 while(i<=length(cuts)) { X=x X[(X*(mu>=cuts[i]))==0]=NA hist(X, col=Gray[i], xlim=range(breaks), ylim=ylim, breaks=breaks, freq=freq, lwd=lwd, add=TRUE) i=i+1 } }
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.kurtosis function is computing the coefficient of kurtosis (or, the weighted coefficient of kurtosis) value of
based on real-valued fuzzy data
by formula
w.kurtosis(x, mu)
w.kurtosis(x, mu)
x |
A vector-valued numeric data which you want to compute its weighted coefficient of kurtosis. |
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]. |
The weighted coefficient of kurtosis for the vector x, by considering weights vector mu, is numeric or a vector of length one.
The length of x and mu must be equal. Also, each element of mu must be in interval [0,1].
Abbas Parchami
x <- c(1:10) mu <- c(0.9, 0.7, 0.8, 0.7, 0.6, 0.4, 0.2, 0.3, 0.0, 0.1) w.kurtosis(x, mu) ## The function is currently defined as function(x, mu) (( sum( mu*(x-w.mean(x,mu))^4 ) / sum(mu) ) / w.sd(x,mu)^4)-3
x <- c(1:10) mu <- c(0.9, 0.7, 0.8, 0.7, 0.6, 0.4, 0.2, 0.3, 0.0, 0.1) w.kurtosis(x, mu) ## The function is currently defined as function(x, mu) (( sum( mu*(x-w.mean(x,mu))^4 ) / sum(mu) ) / w.sd(x,mu)^4)-3
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.mean function is computing the mean (or, the weighted mean) value of
based on real-valued fuzzy data
by formula
w.mean(x, mu)
w.mean(x, mu)
x |
A vector-valued numeric data which you want to compute its weighted mean. |
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]. |
The weighted mean of the vector x, by considering weights vector mu, is numeric or a vector of length one.
The length of x and mu must be equal. Also, each element of mu must be in interval [0,1].
Abbas Parchami
x <- c(1:10) mu <- c(0.9, 0.7, 0.8, 0.7, 0.6, 0.4, 0.2, 0.3, 0.0, 0.1) w.mean(x, mu) ## The function is currently defined as function(x, mu) sum( mu*abs(x-w.mean(x,mu)) ) / sum(mu)
x <- c(1:10) mu <- c(0.9, 0.7, 0.8, 0.7, 0.6, 0.4, 0.2, 0.3, 0.0, 0.1) w.mean(x, mu) ## The function is currently defined as function(x, mu) sum( mu*abs(x-w.mean(x,mu)) ) / sum(mu)
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 weighted scatter plot, or weighted scatterplot, is a type of mathematical diagram to display values of two real-valued fuzzy data sets (from two variables of fuzzy populations) by considering a vector-valued weight. In weighted scatter plot, this kind of data is displayed as a collection of circles, the center point of each having the value of one variable determining the position on the horizontal axis and the value of the other variable determining the position on the vertical axis. Also the radius of each circle is considered equal to (or a ratio from) the weight of correcponding two-dimentional element (the center of circle).
w.plot(x, y, mu, coef.radii, xlim = NULL, ylim = NULL, lwd = NULL, add = NULL, ...)
w.plot(x, y, mu, coef.radii, xlim = NULL, ylim = NULL, lwd = NULL, add = NULL, ...)
x , y
|
Two vector-valued numeric data sets which you want to drow the weighted scatter plot for 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]. |
coef.radii |
a possitive number giving the coefficient of radiuses for the circles, i.e. radius[i] = mu[i] * coef.radii. |
xlim |
numeric vector of length 2 giving the x limits for the plot. Unused if add = TRUE. |
ylim |
numeric vector of length 2 giving the y limits for the plot. Unused if add = TRUE. |
lwd |
The line width, a positive number, defaulting to 1. The interpretation is device-specific, and some devices do not implement line widths less than one. |
add |
if add is TRUE, the new plot is added to an existing plot, otherwise a new plot is created. |
... |
Arguments to be passed to methods, such as graphical parameters. |
The length of x, y and mu must be equal. Also, each element of mu must be in interval [0,1].
Abbas Parchami
Department of Statistics, Faculty of Mathematics and Computer, Shahid Bahonar University of Kerman, Kerman, Iran
n=50 x = rnorm(n,0,1) y = rchisq(n,3) mu = runif(n,0,1) w.plot(x, y, 0.3, mu, lwd=3) ## The function is currently defined as function(x, y, mu, coef.radii, xlim = NULL, ylim = NULL, lwd = NULL, add = NULL, ...) { symbols(x, y, mu * coef.radii, inches = FALSE, xlim=xlim, ylim=ylim, lwd=lwd) }
n=50 x = rnorm(n,0,1) y = rchisq(n,3) mu = runif(n,0,1) w.plot(x, y, 0.3, mu, lwd=3) ## The function is currently defined as function(x, y, mu, coef.radii, xlim = NULL, ylim = NULL, lwd = NULL, add = NULL, ...) { symbols(x, y, mu * coef.radii, inches = FALSE, xlim=xlim, ylim=ylim, lwd=lwd) }
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.r function is computing the Pearson's correlation coefficent (or, the weighted Pearson's correlation coefficent) between two vector-valued data sets
and
based on real-valued fuzzy data
and
by formula
w.r(x, y, mu)
w.r(x, y, mu)
x , y
|
Two vector-valued numeric data sets which you want to compute the weighted Pearson's correlation coefficent between them. |
mu |
A vector of weights. The length of this vector must be equal to the length of data sets and each element of it is belongs to interval [0,1]. |
The weighted correlation coefficent between two vectors x and y, by considering weights vector mu, is numeric or a vector of length one.
The length of x, y and mu must be equal. Also, each element of mu must be in interval [0,1].
Abbas Parchami
x <- c(1:10) y <- c(2, 7, 0.8, -1, 3, 4, 8, 13, 0, 12) mu <- c(0.9, 0.7, 0.8, 0.7, 0.6, 0.4, 0.2, 0.3, 0.0, 0.1) w.r(x, y, mu) ## The function is currently defined as function(x, y, mu) w.cov(x,y,mu) / (w.sd(x,mu) * w.sd(y,mu))
x <- c(1:10) y <- c(2, 7, 0.8, -1, 3, 4, 8, 13, 0, 12) mu <- c(0.9, 0.7, 0.8, 0.7, 0.6, 0.4, 0.2, 0.3, 0.0, 0.1) w.r(x, y, mu) ## The function is currently defined as function(x, y, mu) w.cov(x,y,mu) / (w.sd(x,mu) * w.sd(y,mu))
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.sd function is computing the standard deviation (or, the weighted standard deviation) value of
based on real-valued fuzzy data
by formula
w.sd(x, mu)
w.sd(x, mu)
x |
A vector-valued numeric data which you want to compute its weighted standard deviation. |
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]. |
The weighted standard deviation of vector x, by considering weights vector mu, is numeric or a vector of length one.
The length of x and mu must be equal. Also, each element of mu must be in interval [0,1].
Abbas Parchami
x <- c(1:10) mu <- c(0.9, 0.7, 0.8, 0.7, 0.6, 0.4, 0.2, 0.3, 0.0, 0.1) w.sd(x, mu) ## The function is currently defined as function(x, mu) ( (sum(mu*x*x)/sum(mu)) - w.mean(x,mu)^2 )^.5
x <- c(1:10) mu <- c(0.9, 0.7, 0.8, 0.7, 0.6, 0.4, 0.2, 0.3, 0.0, 0.1) w.sd(x, mu) ## The function is currently defined as function(x, mu) ( (sum(mu*x*x)/sum(mu)) - w.mean(x,mu)^2 )^.5
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.skewness function is computing the coefficient of skewness (or, the weighted coefficient of skewness) value of
based on real-valued fuzzy data
by formula
w.skewness(x, mu)
w.skewness(x, mu)
x |
A vector-valued numeric data which you want to compute its weighted coefficient of skewness. |
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]. |
The weighted coefficient of skewness for the vector x, by considering weights vector mu, is numeric or a vector of length one.
The length of x and mu must be equal. Also, each element of mu must be in interval [0,1].
Abbas Parchami
x <- c(1:10) mu <- c(0.9, 0.7, 0.8, 0.7, 0.6, 0.4, 0.2, 0.3, 0.0, 0.1) w.skewness(x, mu) ## The function is currently defined as function(x, mu) ( sum( mu*(x-w.mean(x,mu))^3 ) / sum(mu) ) / w.sd(x,mu)^3
x <- c(1:10) mu <- c(0.9, 0.7, 0.8, 0.7, 0.6, 0.4, 0.2, 0.3, 0.0, 0.1) w.skewness(x, mu) ## The function is currently defined as function(x, mu) ( sum( mu*(x-w.mean(x,mu))^3 ) / sum(mu) ) / w.sd(x,mu)^3
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.var function is computing the variance (or, the weighted variance) value of
based on real-valued fuzzy data
by formula
w.var(x, mu)
w.var(x, mu)
x |
A vector-valued numeric data which you want to compute its weighted variance. |
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]. |
The weighted variance of vector x, by considering weights vector mu, is numeric or a vector of length one.
The length of x and mu must be equal. Also, each element of mu must be in interval [0,1].
Abbas Parchami
x <- c(1:10) mu <- c(0.9, 0.7, 0.8, 0.7, 0.6, 0.4, 0.2, 0.3, 0.0, 0.1) w.var(x, mu) ## The function is currently defined as function(x, mu) (sum(mu*x*x)/sum(mu)) - w.mean(x,mu)^2
x <- c(1:10) mu <- c(0.9, 0.7, 0.8, 0.7, 0.6, 0.4, 0.2, 0.3, 0.0, 0.1) w.var(x, mu) ## The function is currently defined as function(x, mu) (sum(mu*x*x)/sum(mu)) - w.mean(x,mu)^2