version 1.205, 2015/10/23 15:50:53
|
version 1.206, 2015/10/24 07:14:11
|
Line 1
|
Line 1
|
/* $Id$ |
/* $Id$ |
$State$ |
$State$ |
$Log$ |
$Log$ |
|
Revision 1.206 2015/10/24 07:14:11 brouard |
|
*** empty log message *** |
|
|
Revision 1.205 2015/10/23 15:50:53 brouard |
Revision 1.205 2015/10/23 15:50:53 brouard |
Summary: 0.98r3 some clarification for graphs on likelihood contributions |
Summary: 0.98r3 some clarification for graphs on likelihood contributions |
|
|
Line 1960 double **prevalim(double **prlim, int nl
|
Line 1963 double **prevalim(double **prlim, int nl
|
{ |
{ |
/* Computes the prevalence limit in each live state at age x by left multiplying the unit |
/* Computes the prevalence limit in each live state at age x by left multiplying the unit |
matrix by transitions matrix until convergence is reached with precision ftolpl */ |
matrix by transitions matrix until convergence is reached with precision ftolpl */ |
|
/* Wx= Wx-1 Px-1= Wx-2 Px-2 Px-1 = Wx-n Px-n ... Px-2 Px-1 I */ |
|
/* Wx is row vector: population in state 1, population in state 2, population dead */ |
|
/* or prevalence in state 1, prevalence in state 2, 0 */ |
|
/* newm is the matrix after multiplications, its rows are identical at a factor */ |
|
/* Initial matrix pimij */ |
|
/* {0.85204250825084937, 0.13044499163996345, 0.017512500109187184, */ |
|
/* 0.090851990222114765, 0.88271245433047185, 0.026435555447413338, */ |
|
/* 0, 0 , 1} */ |
|
/* |
|
* and after some iteration: */ |
|
/* {0.45504275246439968, 0.42731458730878791, 0.11764266022681241, */ |
|
/* 0.45201005341706885, 0.42865420071559901, 0.11933574586733192, */ |
|
/* 0, 0 , 1} */ |
|
/* And prevalence by suppressing the deaths are close to identical rows in prlim: */ |
|
/* {0.51571254859325999, 0.4842874514067399, */ |
|
/* 0.51326036147820708, 0.48673963852179264} */ |
|
/* If we start from prlim again, prlim tends to a constant matrix */ |
|
|
int i, ii,j,k; |
int i, ii,j,k; |
double min, max, maxmin, maxmax,sumnew=0.; |
double min, max, maxmin, maxmax,sumnew=0.; |
/* double **matprod2(); */ /* test */ |
/* double **matprod2(); */ /* test */ |
Line 2016 double **prevalim(double **prlim, int nl
|
Line 2036 double **prevalim(double **prlim, int nl
|
prlim[i][j]= newm[i][j]/(1-sumnew); |
prlim[i][j]= newm[i][j]/(1-sumnew); |
max=FMAX(max,prlim[i][j]); |
max=FMAX(max,prlim[i][j]); |
min=FMIN(min,prlim[i][j]); |
min=FMIN(min,prlim[i][j]); |
/* printf(" age= %d prevalim i=%d, j=%d, prmlim[%d][%d]=%f, agefin=%d max=%f min=%f\n", (int)age, i, j, i, j, prlim[i][j],(int)agefin, max, min); */ |
printf(" age= %d prevalim i=%d, j=%d, prmlim[%d][%d]=%f, agefin=%d max=%f min=%f\n", (int)age, i, j, i, j, prlim[i][j],(int)agefin, max, min); |
} |
} |
maxmin=(max-min)/(max+min)*2; |
maxmin=(max-min)/(max+min)*2; |
maxmax=FMAX(maxmax,maxmin); |
maxmax=FMAX(maxmax,maxmin); |
} /* j loop */ |
} /* j loop */ |
*ncvyear= (int)age- (int)agefin; |
*ncvyear= (int)age- (int)agefin; |
/* printf("maxmax=%lf maxmin=%lf ncvloop=%ld, age=%d, agefin=%d ncvyear=%d \n", maxmax, maxmin, ncvloop, (int)age, (int)agefin, *ncvyear); */ |
printf("maxmax=%lf maxmin=%lf ncvloop=%ld, age=%d, agefin=%d ncvyear=%d \n", maxmax, maxmin, ncvloop, (int)age, (int)agefin, *ncvyear); |
if(maxmax < ftolpl){ |
if(maxmax < ftolpl){ |
/* printf("maxmax=%lf maxmin=%lf ncvloop=%ld, age=%d, agefin=%d ncvyear=%d \n", maxmax, maxmin, ncvloop, (int)age, (int)agefin, *ncvyear); */ |
/* printf("maxmax=%lf maxmin=%lf ncvloop=%ld, age=%d, agefin=%d ncvyear=%d \n", maxmax, maxmin, ncvloop, (int)age, (int)agefin, *ncvyear); */ |
return prlim; |
return prlim; |