gvar

Variance of a grouped sample.
542.0 次下载
更新时间 2012/9/26

查看许可证

In some scientific works, once the data have been gathered from a population of interest, it is often difficult to get a sense of what the data indicate when they are presented in an unorganized fashion.

Assembling the raw data into a meaningful form, such as a frequency distribution, makes the data easier to understand and interpret. It is in the context of frequency distributions that the importance of conveying in a succinct way numerical information contained in the data is encountered.

So, grouped data is data that has been organized into groups known as classes. The raw dataset can be organized by constructing a table showing the frequency distribution of the variable (whose values are given in the raw dataset). Such a frequency table is often referred to as grouped data.

Here, we developed a m-code to calculate the variance of a grouped data. One can input the returns or modified vectors n and xout containing the frequency counts and the bin locations of the hist m-function, in a column form matrix.

Normalizes Y by (N-1), where N is the sample size. This is an unbiased estimator of the variance of the population from which X is drawn. Y = VAR(X,1) normalizes by N and produces the second moment of the sample about its mean. VAR(X,0) is the same as VAR(X).

Variance calculation uses the formula,

V = Sum(F*(MC - M)^2)/D

where:
F = class frequency
MC = mark class
M = grouped mean
D = N - 1 or N, whether normalizes by n-1 or by n
N = sample size [=sum(F)]

Syntax: function y = gvar(x)

Inputs:
x - data matrix (Size of matrix must be n-by-2; absolut frequency=column 1, class mark=column 2)
n - [normalized by n-1] = 0 (default), [normalized by n] = 1

Outputs:
y - variance of the values in x

引用格式

Antonio Trujillo-Ortiz (2024). gvar (https://www.mathworks.com/matlabcentral/fileexchange/38281-gvar), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2010a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Descriptive Statistics and Visualization 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.4.0.0

Text was improved.

1.2.0.0

It was added an appropriate format to cite this file.

1.1.0.0

It was added an appropriate format to cite this file.

1.0.0.0