comparison rDiff/src/variance/predict_variance.m @ 0:0f80a5141704

version 0.3 uploaded
author vipints
date Thu, 14 Feb 2013 23:38:36 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:0f80a5141704
1 function [VARIANCE]=predict_variance(MEANS,VARIANCE_FCT)
2 %predict the variances for the means
3 if isstruct(VARIANCE_FCT)
4 %use the estimated variance function
5 VARIANCE=exp(predict(VARIANCE_FCT,log(full(MEANS))));
6 else
7 %use parmeters a,b,c to compute the variance function
8 a=VARIANCE_FCT(1);
9 b=VARIANCE_FCT(2);
10 c=VARIANCE_FCT(3);
11 VARIANCE=a+MEANS*b+(MEANS.^2)*c;
12 end
13
14 %Make sure the variance is bigger than the poisson
15 %variance. Otherwise the NB cannot be definied
16
17 VARIANCE=max([VARIANCE,MEANS*(1e-8)],[],2);
18
19 return