Home > wafo > wstats > winvgstat.m

# winvgstat

## PURPOSE

Mean and variance for the Inverse Gaussian distribution.

## SYNOPSIS

[m,v]= winvgstat(m0,l0);

## DESCRIPTION

``` WINVGSTAT Mean and variance for the Inverse Gaussian distribution.

CALL:  [m,v] = winvgstat(m0,l0)

m, v = the mean and variance, respectively
m0, l0 = parameters of the Inverse Gaussian distribution (see winvgpdf)

Mean (m) and variance (v) for the Inverse Gaussian distribution is

m=m0  and  v=m0^3/l0;

Example:
[m,v] = winvgstat(10,100)```

## CROSS-REFERENCE INFORMATION

This function calls:
 comnsize Check if all input arguments are either scalar or of common size. error Display message and abort function. nan Not-a-Number.
This function is called by:
 winvginv Inverse of the Inverse Gaussian distribution function

## SOURCE CODE

```001 function [m,v]= winvgstat(m0,l0);
002 %WINVGSTAT Mean and variance for the Inverse Gaussian distribution.
003 %
004 % CALL:  [m,v] = winvgstat(m0,l0)
005 %
006 %   m, v = the mean and variance, respectively
007 % m0, l0 = parameters of the Inverse Gaussian distribution (see winvgpdf)
008 %
009 %  Mean (m) and variance (v) for the Inverse Gaussian distribution is
010 %
011 %  m=m0  and  v=m0^3/l0;
012 %
013 % Example:
014 %   [m,v] = winvgstat(10,100)
015
016 % Reference: Cohen & Whittle, (1988) "Parameter Estimation in Reliability
017 % and Life Span Models", p. 259 ff, Marcel Dekker.
018
019 % Tested on; Matlab 5.3
020 % History:
021 % revised pab 24.10.2000
022 %  - added comnsize, nargchk
024
025 error(nargchk(2,2,nargin))
026 %if nargin<1|isempty(m0),  m0=0;  end
027 %if nargin<2|isempty(l0),  l0=1;  end
028
029 [errorcode, m0, l0] = comnsize (m0, l0);
030 if (errorcode > 0)
031   error ('m and l must be of common size or scalar');
032 end
033
034 m = zeros(size(m0));
035 v = m;
036
037 ok =((m0>0)&(l0>0));
038 k = find(ok);
039 if any(k),
040   m(k) = m0(k);
041   v(k) = m0(k).^3./l0(k);
042 end
043
044 k1 = find (~ok);
045 if any (k1)
046   tmp=NaN;
047   m(k1) = tmp(ones(size(k1)));
048   v(k1)=m(k1);
049 end
050```

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group

Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003