Home > FMAToolbox > General > semedian.m

semedian

PURPOSE ^

semedian - Compute standard error of the median.

SYNOPSIS ^

function s = semedian(x,varargin)

DESCRIPTION ^

semedian - Compute standard error of the median.

  USAGE

    s = semedian(x)

    x              vector or matrix over which the error should be computed

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function s = semedian(x,varargin)
0002 
0003 %semedian - Compute standard error of the median.
0004 %
0005 %  USAGE
0006 %
0007 %    s = semedian(x)
0008 %
0009 %    x              vector or matrix over which the error should be computed
0010 
0011 % Copyright (C) 2013 by Michaƫl Zugaro
0012 %
0013 % This program is free software; you can redistribute it and/or modify
0014 % it under the terms of the GNU General Public License as published by
0015 % the Free Software Foundation; either version 3 of the License, or
0016 % (at your option) any later version.
0017 
0018 % Check parameters
0019 if nargin < 1,
0020   error('Incorrect number of parameters (type ''help <a href="matlab:help semedian">semedian</a>'' for details).');
0021 end
0022 if ~isdmatrix(x) & ~isdvector(x),
0023   error('Incorrect input - use vector or matrix (type ''help <a href="matlab:help semedian">semedian</a>'' for details).');
0024 end
0025 
0026 if any(size(x)==1), x = x(:); end
0027 
0028 n = size(x,1);
0029 m = repmat(nanmedian(x),n,1);
0030 s = sqrt( nansum((x-m).^2) / (n*(n-1)) );

Generated on Fri 16-Mar-2018 13:00:20 by m2html © 2005