Summary statistics by group.
MEANS = nan_grpstats(X,GROUP) nan_grpstats(X,GROUP,ALPHA) displays a plot of the means versus index with 100(1 - ALPHA)% confidence intervals around each mean. [MEANS,SEM,COUNTS,GNAME] = nan_grpstats(X,GROUP) [A,B,...] = nan_grpstats(X,GROUP,WHICHSTATS) [...] = nan_grpstats(X,GROUP,WHICHSTATS,ALPHA)
matrix of observations
grouping variable defined as a vector, string array, or cell array of strings.
means of each column of X by GROUP
standard error of the mean
number of elements in each group
name of each group
specifies the confidence level as 100(1-ALPHA)% for the 'meanci' and 'predci' options.
a list of single function handles or names (strings)
statistics specified by WHICHSTATS, The number of outputs [A,B,...] must match the
grpstats computes groupwise summary statistics, for data in a matrix or dataset array.
GRPSTATS treats NaNs as missing values, and removes them.
Names in WHICHSTATS can be chosen from among the following:
'mean' mean 'sem' standard error of the mean 'numel' count, or number of elements 'gname' group name 'std' standard deviation 'var' variance 'min' minimum 'max' maximum 'range' maximum - minimum 'meanci' 95% confidence interval for the mean 'predci' 95% prediction interval for a new observation
Functions in WHICHTSTATS must accept a matrix and give out one values for each columns.
loadmatfile("demos/data/iris.mat"); [m,p,g] = nan_grpstats(meas,species,list('mean','predci','gname')) n = size(m,1) plot2d((1:n)',m) nan_errorbar(ones(1,4) .*. (1:n)',m,p(:,:,2)-m,p(:,:,2)-m) h=gca(); h.data_bounds(:,1)=[0.9;3.1]; title('95% prediction intervals for mean iris size by species') scf() nan_grpstats(meas,species,0.05)