annotate rDiff/src/variance/predict_variance.m @ 1:08d3a6143873

Deleted selected files
author vipints
date Tue, 08 Oct 2013 06:54:25 -0400
parents 0f80a5141704
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
1 function [VARIANCE]=predict_variance(MEANS,VARIANCE_FCT)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
2 %predict the variances for the means
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
3 if isstruct(VARIANCE_FCT)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
4 %use the estimated variance function
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
5 VARIANCE=exp(predict(VARIANCE_FCT,log(full(MEANS))));
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
6 else
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
7 %use parmeters a,b,c to compute the variance function
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
8 a=VARIANCE_FCT(1);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
9 b=VARIANCE_FCT(2);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
10 c=VARIANCE_FCT(3);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
11 VARIANCE=a+MEANS*b+(MEANS.^2)*c;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
12 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
13
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
14 %Make sure the variance is bigger than the poisson
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
15 %variance. Otherwise the NB cannot be definied
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
16
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
17 VARIANCE=max([VARIANCE,MEANS*(1e-8)],[],2);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
18
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
19 return