! zest es para contrastar b1=0
! estji, estchi son contrastes de bondad de ajuste que nos sirven para ver si
! realmente se puede suponer la hipótesis de Poisson

          


! This program calculates:

      
      MODULE ParGlob
       INTEGER, PARAMETER:: tim=39, reg=5, age=19, sol=2, 
     &    t1(reg)=(/24,24,24,24,24/), t2(reg)=(/39,39,39,39,39/)            
       INTEGER ifail2a, ifail2b, res                            
       DOUBLE PRECISION, PARAMETER:: a=1.d0     
       DOUBLE PRECISION n(reg,age,tim), d(reg,age,tim), t(reg,tim),
     &                resm(reg-1,reg), m1(reg,age,tim), estz0(reg),
     &                bb1(reg), bb0(reg), std(age), tvar(reg),
     &                tt(reg,age)   
      REAL mInd     
      END MODULE ParGlob
      
      PROGRAM Estimators      
      USE ParGlob
      IMPLICIT NONE
      INTEGER i, j, k                                  
      DOUBLE PRECISION apc(reg), CIapcInf(reg), CIapcSup(reg)
     
! USA Standard Population 2000     
       std=(/3794901.d0,15191619.d0,19919840.d0,20056779.d0,19819518.d0,
     &  18257225.d0,17722067.d0,19511370.d0,22179956.d0,22479229.d0,
     &  19805793.d0,17224359.d0,13307234.d0,10654272.d0,9409940.d0,
     &  8725574.d0,7414559.d0,4900234.d0,4259173.d0/)     
!     REGION 1: Weast Coast US (Population, 1969-2007)
       n(1,1,:)=(/436125.d0,436433.d0,446219.d0,407504.d0,
     & 385497.d0,378911.d0,390843.d0,394677.d0,424074.d0,
     & 441653.d0,464529.d0,494327.d0,512410.d0,528241.d0,
     & 540565.d0,537816.d0,563744.d0,574880.d0,584989.d0,
     & 605013.d0,636219.d0,684124.d0,718834.d0,703550.d0,
     & 681735.d0,664575.d0,646798.d0,629214.d0,616740.d0,
     & 609311.d0,606902.d0,615622.d0,653343.d0,646116.d0,
     & 659341.d0,663472.d0,670187.d0,678756.d0,692417.d0/)
       n(1,2,:)=(/1650825.d0,1652199.d0,1644095.d0,1652787.d0,
     & 1642729.d0,1608657.d0,1560236.d0,1537709.d0,
     & 1546495.d0,1602720.d0,1668444.d0,1742467.d0,1828367.d0,
     & 1906637.d0,1988801.d0,2054036.d0,2095370.d0,
     & 2138069.d0,2185336.d0,2237257.d0,2322593.d0,
     & 2444343.d0,2544029.d0,2653601.d0,2736159.d0,
     & 2776231.d0,2759743.d0,2707022.d0,2633821.d0,
     & 2570292.d0,2519567.d0,2494338.d0,2464722.d0,
     & 2488100.d0,2517290.d0,2563084.d0,2600004.d0,
     & 2610367.d0,2638278.d0/)
       n(1,3,:)=(/2507485.d0,2436547.d0,2365612.d0,
     & 2288686.d0,2222088.d0,2172018.d0,2159187.d0,
     & 2182292.d0,2180571.d0,2174843.d0,2146881.d0,
     & 2129853.d0,2091996.d0,2122933.d0,2173925.d0,
     & 2239488.d0,2320874.d0,2429405.d0,2530369.d0,
     & 2636706.d0,2716481.d0,2843614.d0,2896077.d0,
     & 2920743.d0,2960112.d0,3029442.d0,3121606.d0,
     & 3249380.d0,3338294.d0,3389963.d0,3410342.d0,
     & 3380211.d0,3340308.d0,3283642.d0,3228803.d0,
     & 3168777.d0,3108673.d0,3099023.d0,3099592.d0/)
       n(1,4,:)=(/2504940.d0,2533009.d0,2561078.d0,
     & 2555237.d0,2554199.d0,2553235.d0,2539404.d0,
     & 2479884.d0,2421144.d0,2370132.d0,2325451.d0,
     & 2325161.d0,2355755.d0,2353547.d0,2336156.d0,
     & 2290993.d0,2259265.d0,2225320.d0,2265324.d0,
     & 2324692.d0,2417883.d0,2575445.d0,2684400.d0,
     & 2774925.d0,2863958.d0,2924694.d0,2971927.d0,
     & 3031632.d0,3055908.d0,3095054.d0,3168593.d0,
     & 3264460.d0,3337911.d0,3401905.d0,3433001.d0,
     & 3432130.d0,3384176.d0,3324919.d0,3251451.d0/)
       n(1,5,:)=(/2318197.d0,2371745.d0,2425295.d0,
     & 2476536.d0,2530330.d0,2584266.d0,2633189.d0,
     & 2679418.d0,2697594.d0,2717952.d0,2724427.d0,
     & 2718948.d0,2653605.d0,2589236.d0,2530135.d0,
     & 2497350.d0,2515450.d0,2565641.d0,2589651.d0,
     & 2605995.d0,2601494.d0,2597550.d0,2530802.d0,
     & 2539384.d0,2561412.d0,2615104.d0,2689333.d0,
     & 2789036.d0,2890213.d0,2994439.d0,3072463.d0,
     & 3125603.d0,3169921.d0,3196369.d0,3222750.d0,
     & 3267620.d0,3330168.d0,3388051.d0,3433887.d0/)
       n(1,6,:)=(/2092494.d0,2228184.d0,2363874.d0,
     & 2364323.d0,2410053.d0,2481129.d0,2568473.d0,
     & 2657503.d0,2757212.d0,2853902.d0,2930646.d0,
     & 3002596.d0,3041692.d0,3047092.d0,3051284.d0,
     & 3057393.d0,3054271.d0,3027830.d0,3007732.d0,
     & 2997153.d0,3027213.d0,3058594.d0,3025943.d0,
     & 2981151.d0,2909332.d0,2812050.d0,2735863.d0,
     & 2681142.d0,2727295.d0,2800407.d0,2909272.d0,
     & 3029371.d0,3128852.d0,3206872.d0,3263838.d0,
     & 3298159.d0,3333826.d0,3361726.d0,3376632.d0/)
       n(1,7,:)=(/1807718.d0,1856655.d0,1905597.d0,
     & 2073822.d0,2159481.d0,2276242.d0,2403307.d0,
     & 2567923.d0,2594562.d0,2686597.d0,2783109.d0,
     & 2911162.d0,3026626.d0,3147803.d0,3232681.d0,
     & 3293067.d0,3345433.d0,3396783.d0,3417751.d0,
     & 3449523.d0,3478492.d0,3474556.d0,3457345.d0,
     & 3430876.d0,3364035.d0,3297218.d0,3261939.d0,
     & 3246301.d0,3241071.d0,3232316.d0,3199663.d0,
     & 3177414.d0,3144777.d0,3141742.d0,3159809.d0,
     & 3203196.d0,3254340.d0,3328199.d0,3392208.d0/)
       n(1,8,:)=(/1490279.d0,1542324.d0,1594371.d0,
     & 1662454.d0,1779415.d0,1870736.d0,1959063.d0,
     & 2027677.d0,2230957.d0,2344222.d0,2477068.d0,
     & 2626060.d0,2801299.d0,2828279.d0,2912510.d0,
     & 3006639.d0,3114595.d0,3218486.d0,3330542.d0,
     & 3415986.d0,3472576.d0,3515921.d0,3599508.d0,
     & 3665354.d0,3687477.d0,3678104.d0,3631853.d0,
     & 3557402.d0,3500680.d0,3438597.d0,3387687.d0,
     & 3371291.d0,3427069.d0,3444815.d0,3422310.d0,
     & 3373876.d0,3292598.d0,3231526.d0,3211518.d0/)
       n(1,9,:)=(/1435687.d0,1438737.d0,1441790.d0,
     & 1452502.d0,1479855.d0,1519200.d0,1563723.d0,
     & 1623149.d0,1701268.d0,1829223.d0,1923258.d0,
     & 2019849.d0,2092026.d0,2292719.d0,2395026.d0,
     & 2523135.d0,2656213.d0,2831901.d0,2863481.d0,
     & 2963158.d0,3074244.d0,3167528.d0,3264147.d0,
     & 3368948.d0,3429922.d0,3459048.d0,3484194.d0,
     & 3514714.d0,3550357.d0,3578253.d0,3581634.d0,
     & 3552535.d0,3516977.d0,3465256.d0,3422671.d0,
     & 3389456.d0,3402357.d0,3428744.d0,3430357.d0/)
       n(1,10,:)=(/1533458.d0,1519113.d0,1504771.d0,
     & 1485874.d0,1474562.d0,1465960.d0,1458857.d0,
     & 1469607.d0,1491026.d0,1529086.d0,1571666.d0,
     & 1621589.d0,1680057.d0,1748059.d0,1852641.d0,
     & 1937873.d0,2030916.d0,2109390.d0,2322633.d0,
     & 2450153.d0,2603631.d0,2746154.d0,2894864.d0,
     & 2912010.d0,2965837.d0,3023022.d0,3084625.d0,
     & 3154653.d0,3250190.d0,3334990.d0,3395534.d0,
     & 3448055.d0,3503025.d0,3530398.d0,3548638.d0,
     & 3568698.d0,3535245.d0,3480279.d0,3417082.d0/)
       n(1,11,:)=(/1587267.d0,1575868.d0,1564472.d0,
     & 1537710.d0,1524756.d0,1509557.d0,1503400.d0,
     & 1496261.d0,1488061.d0,1485522.d0,1478408.d0,
     & 1473159.d0,1473439.d0,1487335.d0,1524078.d0,
     & 1565578.d0,1609472.d0,1668923.d0,1746076.d0,
     & 1866466.d0,1970747.d0,2056720.d0,2115035.d0,
     & 2326096.d0,2414164.d0,2518984.d0,2626725.d0,
     & 2765213.d0,2794552.d0,2885102.d0,2983715.d0,
     & 3076936.d0,3157860.d0,3248143.d0,3318458.d0,
     & 3359805.d0,3410202.d0,3447419.d0,3463039.d0/)
       n(1,12,:)=(/1370709.d0,1400486.d0,1430265.d0,
     & 1465776.d0,1499192.d0,1526161.d0,1543458.d0,
     & 1541591.d0,1528602.d0,1526778.d0,1514778.d0,
     & 1518258.d0,1513174.d0,1495186.d0,1468456.d0,
     & 1451723.d0,1447600.d0,1450051.d0,1473149.d0,
     & 1525322.d0,1582700.d0,1624107.d0,1680281.d0,
     & 1753734.d0,1855018.d0,1924662.d0,1998628.d0,
     & 2054918.d0,2268634.d0,2386259.d0,2523803.d0,
     & 2655685.d0,2789755.d0,2806430.d0,2872138.d0,
     & 2944866.d0,3011028.d0,3079352.d0,3159184.d0/)
       n(1,13,:)=(/1196013.d0,1218680.d0,1241350.d0,
     & 1259078.d0,1281463.d0,1305606.d0,1333618.d0,
     & 1371574.d0,1411169.d0,1456285.d0,1497972.d0,1534418.d0,
     & 1523415.d0,1498741.d0,1484178.d0,1461529.d0,1450317.d0,
     & 1448506.d0,1441525.d0,1429193.d0,1428163.d0,1428661.d0,
     & 1429144.d0,1452627.d0,1484692.d0,1520215.d0,1544826.d0,
     & 1591271.d0,1661849.d0,1773327.d0,1858069.d0,1938705.d0,
     & 2015456.d0,2196545.d0,2307512.d0,2424156.d0,2553557.d0,
     & 2672287.d0,2680227.d0/)
       n(1,14,:)=(/986160.d0,1011181.d0,1036206.d0,
     & 1057190.d0,1082068.d0,1108392.d0,1137855.d0,
     & 1165464.d0,1194800.d0,1228760.d0,1260123.d0,
     & 1299679.d0,1342021.d0,1375895.d0,1390807.d0,
     & 1412922.d0,1430224.d0,1423819.d0,1412067.d0,
     & 1414145.d0,1410896.d0,1402899.d0,1402586.d0,
     & 1393803.d0,1369275.d0,1348072.d0,1342196.d0,
     & 1339027.d0,1364930.d0,1412928.d0,1463653.d0,
     & 1496560.d0,1542479.d0,1602415.d0,1689869.d0,
     & 1763804.d0,1830465.d0,1895356.d0,2065439.d0/)
       n(1,15,:)=(/780462.d0,807606.d0,834759.d0,
     & 861965.d0,889508.d0,917099.d0,945244.d0,978115.d0,
     & 1009697.d0,1037585.d0,1071718.d0,1101155.d0,1120922.d0,
     & 1141098.d0,1164872.d0,1187553.d0,1217221.d0,
     & 1258393.d0,1298236.d0,1318055.d0,1340120.d0,
     & 1358769.d0,1348819.d0,1332544.d0,1331263.d0,
     & 1319992.d0,1315984.d0,1317667.d0,1304621.d0,1290785.d0,
     & 1274008.d0,1272690.d0,1283666.d0,1302758.d0,1336023.d0,
     & 1370087.d0,1402096.d0,1444660.d0,1500222.d0/)
       n(1,16,:)=(/620186.d0,632039.d0,643895.d0,655764.d0,
     & 667906.d0,688902.d0,710277.d0,733059.d0,756879.d0,
     & 783503.d0,804547.d0,830088.d0,855949.d0,881899.d0,
     & 909029.d0,934755.d0,958488.d0,976787.d0,996621.d0,
     & 1017719.d0,1035530.d0,1057875.d0,1093874.d0,1130049.d0,
     & 1157013.d0,1175455.d0,1189551.d0,1180586.d0,
     & 1169931.d0,1168468.d0,1170667.d0,1172044.d0,
     & 1168608.d0,1162108.d0,1157549.d0,1154902.d0,
     & 1159189.d0,1170545.d0,1190653.d0/)
       n(1,17,:)=(/441053.d0,451511.d0,461975.d0,472403.d0,
     & 483032.d0,494706.d0,506583.d0,516202.d0,530905.d0,
     & 548379.d0,569722.d0,585383.d0,600707.d0,619900.d0,
     & 639831.d0,660438.d0,682444.d0,705614.d0,730475.d0,
     & 752452.d0,774204.d0,796447.d0,817877.d0,833519.d0,
     & 849882.d0,866658.d0,889325.d0,923913.d0,960632.d0,
     & 982506.d0,1003464.d0,1021104.d0,1021443.d0,1017888.d0,
     & 1014437.d0,1002941.d0,1003254.d0,1002343.d0,1000587.d0/)
       n(1,18,:)=(/270255.d0,280344.d0,290440.d0,300508.d0,
     & 310689.d0,320925.d0,331198.d0,336574.d0,344304.d0,
     & 351110.d0,354464.d0,364241.d0,375106.d0,385437.d0,
     & 396130.d0,409197.d0,420983.d0,435203.d0,450964.d0,
     & 466481.d0,482188.d0,498534.d0,514595.d0,532186.d0,
     & 551978.d0,570700.d0,591811.d0,610231.d0,624733.d0,
     & 636905.d0,654991.d0,673868.d0,703221.d0,732513.d0,
     & 752764.d0,774425.d0,785866.d0,789604.d0,792223.d0/)
       n(1,19,:)=(/165876.d0,176270.d0,186672.d0,197010.d0,
     & 207364.d0,219949.d0,232470.d0,238770.d0,252910.d0,
     & 266694.d0,279243.d0,291773.d0,301064.d0,311451.d0,
     & 322285.d0,333163.d0,340985.d0,353503.d0,363111.d0,
     & 369988.d0,379682.d0,391092.d0,406707.d0,422071.d0,
     & 440873.d0,456634.d0,475051.d0,492376.d0,510616.d0,
     & 529784.d0,551682.d0,574207.d0,595534.d0,616075.d0,
     & 642276.d0,662119.d0,694702.d0,729637.d0,767598.d0/)



!     REGION 2: South Weastern US (Population, 1969-2007)
       n(2,1,:)=(/384094.d0,386216.d0,397189.d0,365555.d0,
     & 347941.d0,343354.d0,354819.d0,357318.d0,382793.d0,
     & 397554.d0,417603.d0,443767.d0,461164.d0,478989.d0,
     & 494121.d0,495280.d0,522976.d0,536861.d0,549928.d0,
     & 571036.d0,602671.d0,647595.d0,687126.d0,672157.d0,
     & 653936.d0,638983.d0,624684.d0,609323.d0,595551.d0,
     & 591103.d0,591990.d0,600875.d0,644038.d0,641134.d0,
     & 657115.d0,663919.d0,675760.d0,684933.d0,700682.d0/)
       n(2,2,:)=(/1454581.d0,1462621.d0,1461810.d0,
     & 1479121.d0,1478637.d0,1453832.d0,1413169.d0,1388385.d0,
     & 1392020.d0,1437820.d0,1493724.d0,1556986.d0,1637459.d0,
     & 1718876.d0,1805908.d0,1878096.d0,1929313.d0,1980859.d0,
     & 2036805.d0,2092199.d0,2177442.d0,2293105.d0,2396115.d0,
     & 2507663.d0,2600961.d0,2648558.d0,2645915.d0,2603768.d0,
     & 2534844.d0,2479932.d0,2438329.d0,2422928.d0,2401947.d0,
     & 2438134.d0,2484427.d0,2548737.d0,2605825.d0,
     & 2631119.d0,2666925.d0/)
       n(2,3,:)=(/2209483.d0,2152038.d0,2094594.d0,
     & 2035175.d0,1982159.d0,1940263.d0,1927985.d0,
     & 1950656.d0,1951170.d0,1947666.d0,1926197.d0,
     & 1910830.d0,1875505.d0,1906687.d0,1955124.d0,
     & 2017397.d0,2097195.d0,2207502.d0,2314839.d0,
     & 2424646.d0,2505906.d0,2627777.d0,2681282.d0,
     & 2705241.d0,2755217.d0,2829203.d0,2934559.d0,
     & 3074699.d0,3167859.d0,3234990.d0,3273401.d0,
     & 3262644.d0,3239816.d0,3198819.d0,3156366.d0,
     & 3110568.d0,3066554.d0,3073342.d0,3091121.d0/)
       n(2,4,:)=(/2183248.d0,2217186.d0,2251125.d0,2259679.d0,
     & 2269818.d0,2275565.d0,2265915.d0,2214745.d0,
     & 2163612.d0,2118720.d0,2081698.d0,2080608.d0,2107301.d0,
     & 2113751.d0,2110019.d0,2081148.d0,2064273.d0,
     & 2042834.d0,2086919.d0,2140407.d0,2224952.d0,2366293.d0,
     & 2467132.d0,2547549.d0,2639236.d0,2699080.d0,
     & 2756067.d0,2825504.d0,2852858.d0,2905637.d0,
     & 2994750.d0,3107471.d0,3194541.d0,3271602.d0,3317238.d0,
     & 3335946.d0,3309995.d0,3269649.d0,3210669.d0/)
       n(2,5,:)=(/1990882.d0,2050712.d0,2110542.d0,2172512.d0,
     & 2234665.d0,2291932.d0,2340512.d0,2387873.d0,2411208.d0,
     & 2435298.d0,2448740.d0,2447997.d0,2395851.d0,
     & 2349691.d0,2306837.d0,2281624.d0,2303826.d0,
     & 2359216.d0,2393550.d0,2417769.d0,2422372.d0,
     & 2417075.d0,2347267.d0,2346456.d0,2363276.d0,
     & 2415316.d0,2488903.d0,2588569.d0,2690223.d0,
     & 2799028.d0,2885528.d0,2948960.d0,3002864.d0,
     & 3039710.d0,3078101.d0,3136576.d0,3214410.d0,
     & 3286358.d0,3344205.d0/)
       n(2,6,:)=(/1822466.d0,1954865.d0,2087267.d0,
     & 2103437.d0,2157950.d0,2227645.d0,2308888.d0,
     & 2389843.d0,2481886.d0,2569904.d0,2641452.d0,
     & 2708376.d0,2760187.d0,2785089.d0,2806497.d0,
     & 2826994.d0,2841543.d0,2836023.d0,2832911.d0,
     & 2829074.d0,2862278.d0,2885372.d0,2853391.d0,
     & 2810810.d0,2741102.d0,2659411.d0,2591698.d0,
     & 2541097.d0,2590699.d0,2665139.d0,2777125.d0,
     & 2902591.d0,2996768.d0,3070457.d0,3130793.d0,
     & 3180029.d0,3222280.d0,3259878.d0,3284675.d0/)
       n(2,7,:)=(/1583443.d0,1631919.d0,1680399.d0,
     & 1836477.d0,1919167.d0,2025483.d0,2137893.d0,
     & 2281539.d0,2303021.d0,2381746.d0,2465725.d0,
     & 2580677.d0,2704763.d0,2843778.d0,2951507.d0,
     & 3031413.d0,3103704.d0,3173286.d0,3209044.d0,
     & 3246093.d0,3283507.d0,3282171.d0,3277527.d0,
     & 3262428.d0,3201654.d0,3149756.d0,3119089.d0,
     & 3106324.d0,3109214.d0,3105338.d0,3079420.d0,
     & 3066721.d0,3042437.d0,3044312.d0,3066371.d0,
     & 3117706.d0,3179613.d0,3255151.d0,3320203.d0/)
       n(2,8,:)=(/1319790.d0,1366760.d0,1413731.d0,
     & 1477172.d0,1582181.d0,1661824.d0,1736162.d0,
     & 1795185.d0,1972127.d0,2070229.d0,2187052.d0,
     & 2318059.d0,2480109.d0,2517373.d0,2606441.d0,
     & 2702790.d0,2817496.d0,2932391.d0,3056054.d0,
     & 3149942.d0,3216422.d0,3260949.d0,3350527.d0,
     & 3425022.d0,3454973.d0,3468707.d0,3441178.d0,
     & 3382491.d0,3342663.d0,3287933.d0,3240385.d0,
     & 3225922.d0,3286961.d0,3314883.d0,3307026.d0,
     & 3280070.d0,3219615.d0,3170563.d0,3155615.d0/)
       n(2,9,:)=(/1274011.d0,1278764.d0,1283518.d0,
     & 1297171.d0,1324024.d0,1359174.d0,1396673.d0,
     & 1447991.d0,1515545.d0,1626667.d0,1709175.d0,
     & 1793076.d0,1858518.d0,2040060.d0,2137280.d0,
     & 2256782.d0,2383493.d0,2550796.d0,2588191.d0,
     & 2681580.d0,2787906.d0,2872333.d0,2962962.d0,
     & 3066943.d0,3130832.d0,3180637.d0,3222429.d0,
     & 3268241.d0,3323542.d0,3367045.d0,3387469.d0,
     & 3375264.d0,3357956.d0,3321071.d0,3293588.d0,
     & 3271129.d0,3291923.d0,3328008.d0,3338357.d0/)
       n(2,10,:)=(/1347419.d0,1339406.d0,1331394.d0,
     & 1321632.d0,1317210.d0,1312697.d0,1307142.d0,
     & 1317830.d0,1337767.d0,1372145.d0,1411826.d0,
     & 1456270.d0,1508139.d0,1571942.d0,1668037.d0,
     & 1744584.d0,1831263.d0,1906567.d0,2100961.d0,
     & 2215675.d0,2355655.d0,2478873.d0,2608538.d0,
     & 2622306.d0,2665635.d0,2725384.d0,2790045.d0,
     & 2865388.d0,2973215.d0,3071822.d0,3151307.d0,
     & 3220483.d0,3288445.d0,3333782.d0,3366252.d0,
     & 3406660.d0,3395619.d0,3360826.d0,3309956.d0/)
       n(2,11,:)=(/1384284.d0,1379726.d0,1375171.d0,
     & 1359376.d0,1354128.d0,1344584.d0,1341040.d0,
     & 1337952.d0,1333547.d0,1334174.d0,1331799.d0,
     & 1329138.d0,1331652.d0,1347958.d0,1384873.d0,
     & 1425062.d0,1468919.d0,1526392.d0,1599687.d0,
     & 1707278.d0,1799346.d0,1870669.d0,1917500.d0,
     & 2103061.d0,2175813.d0,2275001.d0,2374493.d0,
     & 2503444.d0,2538532.d0,2626458.d0,2725890.d0,
     & 2824119.d0,2910174.d0,3007240.d0,3091583.d0,
     & 3149686.d0,3218442.d0,3271017.d0,3302485.d0/)
       n(2,12,:)=(/1178460.d0,1211536.d0,1244612.d0,
     & 1284920.d0,1322258.d0,1351353.d0,1369526.d0,
     & 1371899.d0,1363810.d0,1365472.d0,1359361.d0,
     & 1365386.d0,1364101.d0,1354097.d0,1336918.d0,
     & 1325545.d0,1326568.d0,1334702.d0,1359552.d0,
     & 1407367.d0,1459761.d0,1494857.d0,1544352.d0,
     & 1609831.d0,1697905.d0,1763768.d0,1832236.d0,
     & 1883884.d0,2082291.d0,2192270.d0,2324576.d0,
     & 2452993.d0,2577999.d0,2597234.d0,2656757.d0,
     & 2729191.d0,2799707.d0,2872876.d0,2957276.d0/)
       n(2,13,:)=(/1019325.d0,1045040.d0,1070755.d0,
     & 1094134.d0,1120327.d0,1145995.d0,1173082.d0,
     & 1212199.d0,1252123.d0,1296938.d0,1339935.d0,
     & 1375834.d0,1368696.d0,1352366.d0,1344865.d0,
     & 1328786.d0,1325620.d0,1331834.d0,1331904.d0,
     & 1323954.d0,1324168.d0,1323112.d0,1324174.d0,
     & 1347741.d0,1376859.d0,1415358.d0,1441789.d0,1488014.d0,
     & 1558435.d0,1664168.d0,1745300.d0,1824847.d0,1898188.d0,
     & 2063500.d0,2168254.d0,2279706.d0,2401500.d0,
     & 2511574.d0,2519517.d0/)
       n(2,14,:)=(/842948.d0,869092.d0,895237.d0,
     & 919691.d0,946485.d0,972762.d0,999899.d0,
     & 1028506.d0,1058047.d0,1091735.d0,1124342.d0,
     & 1162088.d0,1201199.d0,1237056.d0,1257873.d0,
     & 1283842.d0,1306477.d0,1308104.d0,1303257.d0,
     & 1307152.d0,1305669.d0,1299749.d0,1302825.d0,
     & 1299175.d0,1279740.d0,1268763.d0,1269070.d0,
     & 1271445.d0,1303780.d0,1353729.d0,1407314.d0,
     & 1443922.d0,1486709.d0,1543299.d0,1625654.d0,
     & 1694568.d0,1756669.d0,1816604.d0,1968349.d0/)
       n(2,15,:)=(/673364.d0,700128.d0,726894.d0,
     & 753683.d0,780735.d0,808010.d0,835751.d0,
     & 867274.d0,897876.d0,926182.d0,959181.d0,987541.d0,
     & 1007944.d0,1028888.d0,1054216.d0,1077983.d0,
     & 1109294.d0,1151617.d0,1192325.d0,1214825.d0,
     & 1239150.d0,1261141.d0,1259016.d0,1250429.d0,
     & 1258584.d0,1255645.d0,1259268.d0,1269095.d0,
     & 1263290.d0,1258337.d0,1244060.d0,1245738.d0,
     & 1256513.d0,1274323.d0,1305226.d0,1338283.d0,
     & 1368358.d0,1408663.d0,1462097.d0/)
       n(2,16,:)=(/528800.d0,541978.d0,555159.d0,568370.d0,
     & 581753.d0,603159.d0,624851.d0,647544.d0,671128.d0,
     & 698329.d0,719115.d0,743489.d0,767737.d0,792667.d0,
     & 818005.d0,843567.d0,867420.d0,887268.d0,908756.d0,
     & 929407.d0,948588.d0,972293.d0,1011092.d0,1050859.d0,
     & 1083596.d0,1110083.d0,1130135.d0,1128681.d0,1126203.d0,
     & 1131740.d0,1136385.d0,1140924.d0,1140752.d0,1137329.d0,
     & 1134911.d0,1134078.d0,1138148.d0,1150648.d0,1170467.d0/)
       n(2,17,:)=(/367554.d0,379089.d0,390625.d0,402119.d0,
     & 413774.d0,426106.d0,438578.d0,449369.d0,464213.d0,
     & 482042.d0,503203.d0,518754.d0,533793.d0,552449.d0,
     & 571906.d0,591360.d0,613045.d0,635604.d0,658479.d0,
     & 679984.d0,701121.d0,723006.d0,745906.d0,764072.d0,
     & 783267.d0,802128.d0,827326.d0,864514.d0,902318.d0,
     & 927408.d0,952059.d0,973282.d0,980054.d0,980904.d0,
     & 983156.d0,976020.d0,981447.d0,983817.d0,985409.d0/)
       n(2,18,:)=(/220222.d0,230067.d0,239916.d0,249745.d0,
     & 259640.d0,269768.d0,279946.d0,285896.d0,293963.d0,
     & 301327.d0,305284.d0,315094.d0,326061.d0,336555.d0,
     & 347211.d0,360587.d0,371994.d0,385893.d0,400927.d0,
     & 415629.d0,430626.d0,446394.d0,461973.d0,478271.d0,
     & 498881.d0,517753.d0,539171.d0,558583.d0,575007.d0,
     & 588101.d0,606659.d0,626165.d0,657922.d0,689915.d0,
     & 713250.d0,738523.d0,754599.d0,763178.d0,769587.d0/)
       n(2,19,:)=(/134453.d0,143190.d0,151930.d0,160606.d0,
     & 169293.d0,180281.d0,191199.d0,197440.d0,209926.d0,
     & 222332.d0,233532.d0,244942.d0,253473.d0,263180.d0,
     & 273289.d0,283582.d0,291257.d0,303396.d0,313486.d0,
     & 320446.d0,330194.d0,341543.d0,356778.d0,371752.d0,
     & 390116.d0,405288.d0,422604.d0,439030.d0,456580.d0,
     & 474030.d0,495798.d0,517972.d0,540551.d0,
     & 562560.d0,590672.d0,612621.d0,647861.d0,
     & 685539.d0,727704.d0/)
     
!     REGION 3: Weastern US (Population, 1969-2007)                 es region 1
       n(3,1,:)=(/260580.d0,267490.d0,280149.d0,263608.d0,
     & 256583.d0,258044.d0,272447.d0,273676.d0,291758.d0,
     & 300115.d0,315236.d0,334010.d0,344642.d0,358216.d0,
     & 365249.d0,362554.d0,377130.d0,381320.d0,378516.d0,
     & 377157.d0,379476.d0,389850.d0,404888.d0,408481.d0,
     & 408401.d0,408182.d0,411926.d0,417307.d0,421501.d0,
     & 429813.d0,436392.d0,442737.d0,476094.d0,480252.d0,
     & 491506.d0,500047.d0,509553.d0,524650.d0,539558.d0/)
       n(3,2,:)=(/971215.d0,996781.d0,1016605.d0,1053965.d0,
     & 1078856.d0,1083920.d0,1077762.d0,1058840.d0,1057546.d0,
     & 1085712.d0,1131313.d0,1181291.d0,1244715.d0,1314802.d0,
     & 1374446.d0,1421981.d0,1446064.d0,1470405.d0,1473332.d0,
     & 1461991.d0,1458073.d0,1478111.d0,1500774.d0,1539001.d0,
     & 1582930.d0,1615213.d0,1633385.d0,1647035.d0,1652260.d0,
     & 1669666.d0,1688391.d0,1702206.d0,1729853.d0,1792889.d0,
     & 1853677.d0,1920455.d0,1983844.d0,2040762.d0,2091601.d0/)
       n(3,3,:)=(/1477008.d0,1451628.d0,1426252.d0,1403420.d0,
     & 1384331.d0,1371016.d0,1381270.d0,1424484.d0,1446798.d0,
     & 1461926.d0,1476577.d0,1488764.d0,1470350.d0,1496474.d0,
     & 1513301.d0,1548059.d0,1595469.d0,1664379.d0,1713677.d0,
     & 1768668.d0,1779312.d0,1819192.d0,1835026.d0,1848738.d0,
     & 1870425.d0,1902688.d0,1943783.d0,2003788.d0,2057391.d0,
     & 2119131.d0,2163562.d0,2184103.d0,2188697.d0,2192398.d0,
     & 2197419.d0,2210694.d0,2245309.d0,2330585.d0,2406376.d0/)
       n(3,4,:)=(/1478503.d0,1507631.d0,1536762.d0,1553517.d0,
     & 1570242.d0,1581997.d0,1585621.d0,1564432.d0,1537565.d0,
     & 1510961.d0,1503862.d0,1523856.d0,1573583.d0,1619711.d0,
     & 1634684.d0,1632969.d0,1626644.d0,1609436.d0,1609584.d0,
     & 1611914.d0,1630336.d0,1698529.d0,1761013.d0,1824844.d0,
     & 1895817.d0,1939923.d0,1976353.d0,2018676.d0,2041894.d0,
     & 2077523.d0,2122370.d0,2171967.d0,2203814.d0,2237169.d0,
     & 2263058.d0,2279396.d0,2282039.d0,2309297.d0,2318025.d0/)
       n(3,5,:)=(/1336464.d0,1384552.d0,1432649.d0,1487234.d0,
     & 1540721.d0,1582829.d0,1620714.d0,1664560.d0,1683012.d0,
     & 1700800.d0,1725449.d0,1735248.d0,1702912.d0,1694088.d0,
     & 1673435.d0,1655969.d0,1666438.d0,1710670.d0,1721385.d0,
     & 1717456.d0,1701921.d0,1690418.d0,1672729.d0,1691815.d0,
     & 1732168.d0,1790499.d0,1861770.d0,1937837.d0,2008304.d0,
     & 2080410.d0,2125471.d0,2153827.d0,2159642.d0,2165039.d0,
     & 2175729.d0,2200096.d0,2236400.d0,2282202.d0,2322393.d0/)
       n(3,6,:)=(/1104419.d0,1207474.d0,1310538.d0,1348540.d0,
     & 1409086.d0,1468865.d0,1535710.d0,1599692.d0,1657751.d0,
     & 1714195.d0,1768219.d0,1819523.d0,1860701.d0,1898332.d0,
     & 1919627.d0,1915901.d0,1899278.d0,1858982.d0,1801291.d0,
     & 1747691.d0,1728643.d0,1726663.d0,1747296.d0,1769735.d0,
     & 1794122.d0,1819198.d0,1838410.d0,1835361.d0,1869129.d0,
     & 1911375.d0,1969997.d0,2041580.d0,2131308.d0,2215434.d0,
     & 2264129.d0,2294798.d0,2307286.d0,2321825.d0,2317961.d0/)
       n(3,7,:)=(/917842.d0,958186.d0,998541.d0,1105158.d0,
     & 1168773.d0,1244686.d0,1323965.d0,1431769.d0,1456824.d0,
     & 1513717.d0,1588306.d0,1678214.d0,1762467.d0,1873320.d0,
     & 1950626.d0,1988799.d0,2021367.d0,2053189.d0,2033384.d0,
     & 2007541.d0,1996632.d0,1966627.d0,1947726.d0,1921322.d0,
     & 1896258.d0,1890754.d0,1913178.d0,1956399.d0,1998184.d0,
     & 2032074.d0,2060406.d0,2080110.d0,2074250.d0,2091869.d0,
     & 2115505.d0,2172944.d0,2250663.d0,2351235.d0,2440124.d0/)
       n(3,8,:)=(/781388.d0,812202.d0,843034.d0,885820.d0,
     & 953937.d0,1005444.d0,1053796.d0,1100142.d0,1215067.d0,
     & 1277257.d0,1363183.d0,1456075.d0,1568004.d0,1623198.d0,
     & 1699698.d0,1763505.d0,1835805.d0,1902331.d0,1947771.d0,
     & 1968850.d0,1988336.d0,2004513.d0,2063128.d0,2107318.d0,
     & 2149208.d0,2187353.d0,2194089.d0,2164913.d0,2127183.d0,
     & 2082154.d0,2054798.d0,2065848.d0,2117200.d0,2166763.d0,
     & 2193814.d0,2207025.d0,2210523.d0,2220328.d0,2242965.d0/)
       n(3,9,:)=(/779676.d0,783003.d0,786341.d0,797297.d0,
     & 816116.d0,839201.d0,863749.d0,901296.d0,945889.d0,
     & 1015104.d0,1076131.d0,1134515.d0,1176143.d0,1309109.d0,
     & 1384430.d0,1456978.d0,1531772.d0,1635375.d0,1638282.d0,
     & 1672064.d0,1724801.d0,1774408.d0,1844468.d0,1919788.d0,
     & 1993459.d0,2062289.d0,2128540.d0,2175686.d0,2207157.d0,
     & 2226174.d0,2233920.d0,2223708.d0,2200103.d0,2168318.d0,
     & 2140306.d0,2130854.d0,2161975.d0,2230814.d0,2291052.d0/)
       n(3,10,:)=(/807112.d0,807591.d0,808076.d0,809835.d0,
     & 813975.d0,817770.d0,821605.d0,832386.d0,846082.d0,
     & 866623.d0,899084.d0,933213.d0,972210.d0,1031736.d0,
     & 1102639.d0,1156209.d0,1208300.d0,1246086.d0,1346038.d0,
     & 1393613.d0,1463141.d0,1531210.d0,1624496.d0,1645029.d0,
     & 1704633.d0,1780124.d0,1855734.d0,1924109.d0,1998275.d0,
     & 2061844.d0,2112353.d0,2164492.d0,2210941.d0,2238736.d0,
     & 2258805.d0,2280544.d0,2278076.d0,2273054.d0,2250003.d0/)
       n(3,11,:)=(/780310.d0,789711.d0,799119.d0,804154.d0,
     & 814249.d0,821720.d0,833642.d0,840922.d0,844682.d0,
     & 848892.d0,859723.d0,869556.d0,883043.d0,910401.d0,
     & 941429.d0,963249.d0,982880.d0,1014598.d0,1043043.d0,
     & 1087650.d0,1134139.d0,1169956.d0,1205305.d0,1325624.d0,
     & 1394278.d0,1481313.d0,1572196.d0,1671753.d0,1697478.d0,
     & 1756678.d0,1825484.d0,1894417.d0,1954391.d0,2025621.d0,
     & 2084090.d0,2133126.d0,2188937.d0,2250287.d0,2284153.d0/)
       n(3,12,:)=(/673353.d0,696224.d0,719103.d0,748607.d0,
     & 775044.d0,796471.d0,812270.d0,826412.d0,831800.d0,
     & 840489.d0,852567.d0,871122.d0,884533.d0,903651.d0,
     & 908537.d0,905721.d0,908725.d0,914636.d0,913567.d0,
     & 923159.d0,938943.d0,946489.d0,979494.d0,1023292.d0,
     & 1091904.d0,1154916.d0,1217957.d0,1257585.d0,1385979.d0,
     & 1455633.d0,1538848.d0,1625661.d0,1716561.d0,1734779.d0,
     & 1783917.d0,1841322.d0,1905492.d0,1977611.d0,2052710.d0/)
       n(3,13,:)=(/624531.d0,635975.d0,647422.d0,659815.d0,
     & 672150.d0,683808.d0,697089.d0,723967.d0,749433.d0,
     & 775232.d0,807765.d0,838046.d0,850741.d0,867856.d0,
     & 883918.d0,887149.d0,891308.d0,898882.d0,890630.d0,
     & 874579.d0,867005.d0,863265.d0,869816.d0,884754.d0,
     & 912348.d0,946128.d0,972075.d0,1006239.d0,1052577.d0,
     & 1119541.d0,1176849.d0,1232359.d0,1275679.d0,1386231.d0,
     & 1460624.d0,1538549.d0,1629361.d0,1731189.d0,1753707.d0/)
       n(3,14,:)=(/543816.d0,557640.d0,571475.d0,586428.d0,
     & 601056.d0,614708.d0,629722.d0,643421.d0,656210.d0,
     & 669258.d0,688497.d0,711940.d0,741262.d0,781913.d0,
     & 806443.d0,827964.d0,845625.d0,853492.d0,845048.d0,
     & 841714.d0,841037.d0,838122.d0,847607.d0,851012.d0,
     & 853123.d0,861554.d0,878001.d0,886118.d0,904473.d0,
     & 932908.d0,962567.d0,983019.d0,1011540.d0,1052071.d0,
     & 1108187.d0,1163981.d0,1218827.d0,1269983.d0,1381836.d0/)
       n(3,15,:)=(/433011.d0,453964.d0,474926.d0,495871.d0,
     & 516936.d0,533649.d0,550207.d0,569977.d0,588139.d0,
     & 603655.d0,623555.d0,635632.d0,641203.d0,647016.d0,
     & 657757.d0,666856.d0,682001.d0,706264.d0,730606.d0,
     & 747628.d0,768064.d0,787412.d0,795502.d0,802684.d0,
     & 817772.d0,829191.d0,839808.d0,854086.d0,859401.d0,
     & 856495.d0,855370.d0,863476.d0,869920.d0,878505.d0,
     & 896714.d0,919166.d0,940666.d0,974965.d0,1018566.d0/)
       n(3,16,:)=(/319748.d0,333012.d0,346289.d0,359497.d0,
     & 372835.d0,390653.d0,408271.d0,424346.d0,442582.d0,
     & 462514.d0,478331.d0,494003.d0,508758.d0,522183.d0,
     & 535626.d0,546104.d0,554844.d0,559685.d0,568217.d0,
     & 577996.d0,588684.d0,602226.d0,630448.d0,660493.d0,
     & 684665.d0,707621.d0,724017.d0,730519.d0,735938.d0,
     & 750600.d0,757444.d0,763377.d0,766711.d0,769595.d0,
     & 771985.d0,775863.d0,785615.d0,799014.d0,812184.d0/)
       n(3,17,:)=(/216858.d0,226413.d0,235985.d0,245474.d0,
     & 255087.d0,264244.d0,273127.d0,281699.d0,295218.d0,
     & 309697.d0,326462.d0,340909.d0,353171.d0,366116.d0,
     & 380080.d0,392335.d0,404456.d0,418160.d0,429511.d0,
     & 441046.d0,452263.d0,463068.d0,474890.d0,485855.d0,
     & 495709.d0,505756.d0,520626.d0,543304.d0,567427.d0,
     & 584796.d0,601095.d0,615453.d0,623703.d0,629400.d0,
     & 637052.d0,641796.d0,654567.d0,664129.d0,671055.d0/)
       n(3,18,:)=(/125359.d0,132016.d0,138683.d0,145259.d0,
     & 151904.d0,159310.d0,166398.d0,170968.d0,177072.d0,
     & 183157.d0,187306.d0,194028.d0,202188.d0,211660.d0,
     & 220744.d0,230269.d0,241144.d0,251080.d0,261686.d0,
     & 272568.d0,283793.d0,294552.d0,306635.d0,317394.d0,
     & 329682.d0,340868.d0,350702.d0,358713.d0,366982.d0,
     & 375328.d0,382304.d0,391064.d0,409400.d0,429257.d0,
     & 444547.d0,464671.d0,479218.d0,492138.d0,501118.d0/)
       n(3,19,:)=(/77572.d0,82549.d0,87537.d0,92455.d0,
     & 97370.d0,103905.d0,110037.d0,113581.d0,121192.d0,
     & 128347.d0,135150.d0,142758.d0,148592.d0,155328.d0,
     & 162302.d0,168488.d0,175448.d0,183214.d0,191990.d0,
     & 199417.d0,208348.d0,217815.d0,230645.d0,243741.d0,
     & 256603.d0,267979.d0,279094.d0,290180.d0,300613.d0,
     & 312214.d0,322504.d0,334159.d0,346083.d0,357252.d0,
     & 374476.d0,389298.d0,413688.d0,439633.d0,465868.d0/)


!     REGION 4: California (Population, 1969-2007)  
       n(4,1,:)=(/343239.d0,343197.d0,350836.d0,320535.d0,
     & 302999.d0,297066.d0,305826.d0,308465.d0,330744.d0,
     & 343554.d0,360204.d0,382814.d0,398199.d0,413880.d0,
     & 427476.d0,428524.d0,452303.d0,464415.d0,475213.d0,
     & 493430.d0,520789.d0,561534.d0,598068.d0,583437.d0,
     & 564236.d0,547307.d0,528892.d0,511446.d0,496336.d0,
     & 487974.d0,485647.d0,492099.d0,526997.d0,522035.d0,
     & 533946.d0,536182.d0,542387.d0,545494.d0,555074.d0/)
       n(4,2,:)=(/1300232.d0,1300202.d0,1292491.d0,1298933.d0,
     & 1289822.d0,1260303.d0,1220480.d0,1200977.d0,1204893.d0,
     & 1244826.d0,1290733.d0,1345020.d0,1414245.d0,1484958.d0,
     & 1561517.d0,1623129.d0,1665683.d0,1709386.d0,1754382.d0,
     & 1800781.d0,1873744.d0,1973993.d0,2069054.d0,2169354.d0,
     & 2249101.d0,2289253.d0,2276263.d0,2225242.d0,2150251.d0,
     & 2081672.d0,2026500.d0,1999734.d0,1969206.d0,1988261.d0,
     & 2017105.d0,2060070.d0,2092413.d0,2096698.d0,2114003.d0/)
       n(4,3,:)=(/1970995.d0,1914392.d0,1857789.d0,1797391.d0,
     & 1743375.d0,1700150.d0,1686851.d0,1703273.d0,1699024.d0,
     & 1690576.d0,1663012.d0,1645267.d0,1614875.d0,1643522.d0,
     & 1688195.d0,1740600.d0,1806585.d0,1901568.d0,1990361.d0,
     & 2083090.d0,2150208.d0,2251433.d0,2299399.d0,2316373.d0,
     & 2352770.d0,2412460.d0,2494120.d0,2612345.d0,2689391.d0,
     & 2731250.d0,2748888.d0,2721883.d0,2691152.d0,2642092.d0,
     & 2593347.d0,2535340.d0,2475532.d0,2458471.d0,2455331.d0/)
       n(4,4,:)=(/1947352.d0,1971155.d0,1994958.d0,1993759.d0,
     & 1994628.d0,1992811.d0,1982383.d0,1935887.d0,
     & 1887834.d0,1844436.d0,1804059.d0,1798509.d0,1819397.d0,
     & 1823286.d0,1819370.d0,1790613.d0,1772352.d0,1754070.d0,
     & 1789303.d0,1834232.d0,1903747.d0,2020720.d0,2109191.d0,
     & 2175193.d0,2247018.d0,2295042.d0,2332936.d0,2384952.d0,
     & 2402190.d0,2434160.d0,2497890.d0,2584696.d0,2653385.d0,
     & 2712304.d0,2742995.d0,2747538.d0,2710021.d0,2656851.d0,
     & 2590062.d0/)
       n(4,5,:)=(/1788757.d0,1834922.d0,1881087.d0,1926838.d0,
     & 1973133.d0,2016763.d0,2057550.d0,2096451.d0,
     & 2112596.d0,2128775.d0,2131538.d0,2125860.d0,
     & 2078007.d0,2035394.d0,1997621.d0,1974275.d0,1991952.d0,
     & 2037819.d0,2063706.d0,2082521.d0,2084973.d0,2078773.d0,
     & 2012605.d0,2005481.d0,2009216.d0,2041574.d0,2091693.d0,
     & 2168087.d0,2247439.d0,2333653.d0,2403117.d0,2451337.d0,
     & 2502713.d0,2531603.d0,2558504.d0,2600112.d0,2655955.d0,
     & 2706833.d0,2746844.d0/)
       n(4,6,:)=(/1654474.d0,1764327.d0,1874180.d0,1877276.d0,
     & 1915231.d0,1968729.d0,2036628.d0,2105651.d0,2183031.d0,
     & 2256143.d0,2311031.d0,2365036.d0,2407806.d0,2429065.d0,
     & 2448368.d0,2465632.d0,2477373.d0,2469871.d0,2464527.d0,
     & 2461389.d0,2494177.d0,2517089.d0,2476628.d0,2428532.d0,
     & 2353487.d0,2259300.d0,2182162.d0,2126179.d0,2156819.d0,
     & 2213601.d0,2303169.d0,2403589.d0,2470011.d0,2525424.d0,
     & 2575912.d0,2617607.d0,2656034.d0,2686392.d0,2704533.d0/)
       n(4,7,:)=(/1437251.d0,1474235.d0,1511223.d0,1642984.d0,
     & 1709333.d0,1797775.d0,1895473.d0,2020465.d0,2035965.d0,
     & 2101124.d0,2167040.d0,2263477.d0,2369355.d0,2488033.d0,
     & 2579807.d0,2645474.d0,2704435.d0,2760064.d0,2787999.d0,
     & 2820258.d0,2854149.d0,2855194.d0,2842053.d0,2823459.d0,
     & 2760774.d0,2696372.d0,2652237.d0,2624074.d0,2610926.d0,
     & 2597843.d0,2563984.d0,2543017.d0,2516154.d0,2507102.d0,
     & 2512456.d0,2535045.d0,2560316.d0,2598879.d0,2641562.d0/)
       n(4,8,:)=(/1191469.d0,1229768.d0,1268067.d0,
     & 1319703.d0,1408597.d0,1475551.d0,1541010.d0,1591298.d0,
     & 1744833.d0,1828179.d0,1924741.d0,2036451.d0,2175141.d0,
     & 2205196.d0,2282517.d0,2363705.d0,2460717.d0,2556664.d0,
     & 2659382.d0,2737690.d0,2794400.d0,2832808.d0,2898334.d0,
     & 2953313.d0,2965089.d0,2953691.d0,2911149.d0,2848941.d0,
     & 2806799.d0,2758463.d0,2714559.d0,2695866.d0,2737383.d0,
     & 2747810.d0,2730274.d0,2692268.d0,2622438.d0,2564205.d0,
     & 2537470.d0/)
       n(4,9,:)=(/1148938.d0,1149477.d0,1150016.d0,1157247.d0,
     & 1176583.d0,1203828.d0,1235818.d0,1279652.d0,1337083.d0,
     & 1432129.d0,1499313.d0,1570529.d0,1627329.d0,
     & 1785628.d0,1870420.d0,1972246.d0,2079134.d0,2219822.d0,
     & 2247581.d0,2326415.d0,2417759.d0,2490548.d0,2560368.d0,
     & 2644149.d0,2687123.d0,2709154.d0,2726245.d0,2751032.d0,
     & 2785972.d0,2818048.d0,2830371.d0,2814829.d0,2795691.d0,
     & 2760192.d0,2731870.d0,2703443.d0,2706573.d0,
     & 2715847.d0,2708156.d0/)
       n(4,10,:)=(/1219900.d0,1208472.d0,1197044.d0,
     & 1182630.d0,1173513.d0,1164878.d0,1157733.d0,
     & 1165033.d0,1179741.d0,1206612.d0,1235711.d0,
     & 1271096.d0,1314192.d0,1367257.d0,1450031.d0,
     & 1514222.d0,1588232.d0,1652086.d0,1818432.d0,
     & 1916143.d0,2036144.d0,2141267.d0,2244567.d0,
     & 2251135.d0,2279717.d0,2314134.d0,2354676.d0,
     & 2408067.d0,2490348.d0,2569273.d0,2631815.d0,
     & 2683536.d0,2733364.d0,2762417.d0,2784842.d0,
     & 2808749.d0,2785037.d0,2743576.d0,2694348.d0/)
       n(4,11,:)=(/1255775.d0,1247538.d0,1239304.d0,
     & 1219433.d0,1209468.d0,1196364.d0,1191172.d0,
     & 1185944.d0,1178714.d0,1175546.d0,1167390.d0,
     & 1160659.d0,1159400.d0,1170748.d0,1201242.d0,
     & 1233132.d0,1268402.d0,1315263.d0,1374846.d0,
     & 1465647.d0,1544374.d0,1606834.d0,1642439.d0,
     & 1798058.d0,1852949.d0,1923745.d0,1994856.d0,
     & 2093422.d0,2115783.d0,2188241.d0,2269009.d0,
     & 2346572.d0,2414215.d0,2489656.d0,2553605.d0,
     & 2593087.d0,2638428.d0,2668309.d0,2683213.d0/)
       n(4,12,:)=(/1064899.d0,1091664.d0,1118429.d0,
     & 1150195.d0,1179691.d0,1202368.d0,1217900.d0,
     & 1217754.d0,1207479.d0,1205307.d0,1194032.d0,
     & 1195102.d0,1190190.d0,1177919.d0,1160725.d0,
     & 1147503.d0,1145225.d0,1148184.d0,1165916.d0,
     & 1204611.d0,1248279.d0,1277378.d0,1314200.d0,
     & 1365743.d0,1433503.d0,1477846.d0,1526495.d0,
     & 1563888.d0,1723333.d0,1812986.d0,1920301.d0,
     & 2021528.d0,2119281.d0,2131659.d0,2178858.d0,
     & 2231754.d0,2280606.d0,2332584.d0,2395588.d0/)
       n(4,13,:)=(/920161.d0,939830.d0,959499.d0,
     & 975753.d0,994906.d0,1014175.d0,1036975.d0,
     & 1069855.d0,1102839.d0,1139686.d0,1172535.d0,
     & 1200905.d0,1192877.d0,1176245.d0,1167669.d0,
     & 1149887.d0,1143132.d0,1143399.d0,1138623.d0,
     & 1128302.d0,1126399.d0,1123739.d0,1119497.d0,
     & 1135539.d0,1153837.d0,1175734.d0,1188366.d0,
     & 1219267.d0,1270170.d0,1352965.d0,1415902.d0,
     & 1477069.d0,1534736.d0,1666383.d0,1748372.d0,
     & 1833119.d0,1924851.d0,2004202.d0,2006092.d0/)
       n(4,14,:)=(/757357.d0,777012.d0,796668.d0,
     & 813635.d0,832968.d0,852433.d0,874743.d0,
     & 897692.d0,920986.d0,947515.d0,970936.d0,1000654.d0,
     & 1033949.d0,1063274.d0,1080403.d0,1100096.d0,1116393.d0,
     & 1114485.d0,1106731.d0,1106535.d0,1102690.d0,
     & 1094589.d0,1091907.d0,1084770.d0,1062234.d0,
     & 1043116.d0,1034747.d0,1030223.d0,1050271.d0,
     & 1087517.d0,1127145.d0,1152283.d0,1183783.d0,
     & 1225022.d0,1286115.d0,1334365.d0,1377271.d0,
     & 1420410.d0,1540509.d0/)
       n(4,15,:)=(/603989.d0,624149.d0,644310.d0,
     & 664496.d0,684909.d0,706375.d0,728279.d0,
     & 753165.d0,775940.d0,796481.d0,821619.d0,
     & 843217.d0,857876.d0,873394.d0,892059.d0,909852.d0,
     & 934757.d0,968627.d0,1001759.d0,1018709.d0,
     & 1035594.d0,1050191.d0,1042666.d0,1029179.d0,
     & 1028478.d0,1018348.d0,1015629.d0,1017159.d0,
     & 1007365.d0,999101.d0,985605.d0,984419.d0,
     & 992388.d0,1005189.d0,1028361.d0,1050885.d0,
     & 1070703.d0,1098398.d0,1135637.d0/)
       n(4,16,:)=(/477338.d0,486825.d0,496313.d0,
     & 505827.d0,515490.d0,531999.d0,548812.d0,565916.d0,
     & 583299.d0,603431.d0,618240.d0,636754.d0,
     & 655518.d0,674557.d0,694197.d0,713753.d0,
     & 731702.d0,746367.d0,761484.d0,775960.d0,
     & 788673.d0,805070.d0,833827.d0,862106.d0,
     & 885046.d0,901003.d0,912898.d0,907576.d0,
     & 900687.d0,899650.d0,902399.d0,904559.d0,
     & 902080.d0,896757.d0,892876.d0,889735.d0,
     & 891019.d0,898626.d0,912365.d0/)
       n(4,17,:)=(/335228.d0,344141.d0,353055.d0,
     & 361936.d0,370953.d0,380772.d0,390738.d0,
     & 399114.d0,410341.d0,423731.d0,440138.d0,
     & 451320.d0,461866.d0,475986.d0,490494.d0,
     & 505053.d0,521701.d0,538857.d0,556571.d0,
     & 572566.d0,588267.d0,604449.d0,619831.d0,
     & 630247.d0,642273.d0,653687.d0,671649.d0,
     & 699341.d0,729116.d0,747373.d0,766688.d0,
     & 782784.d0,784904.d0,782618.d0,780125.d0,
     & 769910.d0,770158.d0,768905.d0,767455.d0/)
       n(4,18,:)=(/203713.d0,211843.d0,219976.d0,
     & 228083.d0,236260.d0,244645.d0,253090.d0,
     & 257571.d0,263745.d0,269069.d0,271581.d0,
     & 279279.d0,287939.d0,295919.d0,303849.d0,
     & 314206.d0,322729.d0,333017.d0,344509.d0,
     & 355310.d0,366116.d0,377748.d0,388696.d0,
     & 400459.d0,415526.d0,429176.d0,444855.d0,
     & 458772.d0,470166.d0,478394.d0,492951.d0,
     & 507942.d0,531998.d0,556027.d0,573493.d0,
     & 591044.d0,600259.d0,603821.d0,606033.d0/)
       n(4,19,:)=(/124838.d0,132657.d0,140479.d0,
     & 148264.d0,156035.d0,165699.d0,175350.d0,
     & 180441.d0,191245.d0,201918.d0,211325.d0,
     & 220891.d0,227737.d0,235764.d0,244068.d0,
     & 252478.d0,258293.d0,268277.d0,275796.d0,
     & 280641.d0,287681.d0,296158.d0,307406.d0,
     & 318132.d0,332551.d0,343493.d0,356714.d0,
     & 368821.d0,382648.d0,395511.d0,413264.d0,
     & 431025.d0,447589.d0,463944.d0,484342.d0,
     & 499413.d0,525414.d0,552795.d0,583259.d0/)

!     REGION 5: Arizona (Population, 1969-2007)  
       n(5,1,:)=(/32148.d0,34059.d0,36849.d0,35975.d0,
     & 36148.d0,37321.d0,39492.d0,39214.d0,41603.d0,
     & 42932.d0,45440.d0,47923.d0,49003.d0,50347.d0,51527.d0,
     & 51831.d0,55048.d0,56490.d0,58195.d0,60027.d0,62870.d0,
     & 65051.d0,67267.d0,67196.d0,67644.d0,68207.d0,71121.d0,
     & 72421.d0,72695.d0,75335.d0,77506.d0,79059.d0,85383.d0,
     & 86429.d0,89572.d0,92379.d0,96654.d0,100131.d0,105135.d0/)
       n(5,2,:)=(/120135.d0,127220.d0,133426.d0,142977.d0,
     & 151132.d0,155540.d0,155204.d0,150554.d0,150034.d0,
     & 154039.d0,161577.d0,167629.d0,174759.d0,181843.d0,
     & 189703.d0,198802.d0,206264.d0,212658.d0,221060.d0,
     & 226484.d0,234211.d0,240776.d0,246420.d0,254291.d0,
     & 264082.d0,267934.d0,275597.d0,280512.d0,281669.d0,
     & 289969.d0,298582.d0,305783.d0,312030.d0,324934.d0,
     & 337482.d0,352303.d0,370536.d0,385334.d0,397894.d0/)
       n(5,3,:)=(/187244.d0,186839.d0,186434.d0,187704.d0,
     & 189411.d0,190602.d0,191169.d0,196220.d0,200141.d0,
     & 203727.d0,208533.d0,209692.d0,204481.d0,205309.d0,
     & 208066.d0,216141.d0,226906.d0,238801.d0,253137.d0,
     & 264371.d0,275480.d0,285875.d0,289302.d0,293291.d0,
     & 302040.d0,309525.d0,326697.d0,341171.d0,349860.d0,
     & 366709.d0,380471.d0,390711.d0,394377.d0,399199.d0,
     & 403085.d0,410788.d0,422933.d0,441616.d0,456665.d0/)
       n(5,4,:)=(/188014.d0,195872.d0,203730.d0,211546.d0,
     & 219467.d0,225171.d0,225024.d0,220774.d0,217806.d0,
     & 215587.d0,217514.d0,219860.d0,223429.d0,224734.d0,
     & 225449.d0,227100.d0,229792.d0,228112.d0,235486.d0,
     & 241026.d0,251556.d0,264303.d0,273683.d0,283752.d0,
     & 297610.d0,303678.d0,317707.d0,328724.d0,332669.d0,
     & 346639.d0,364017.d0,381872.d0,393206.d0,404200.d0,
     & 413327.d0,421052.d0,429060.d0,437760.d0,443140.d0/)
       n(5,5,:)=(/164191.d0,174752.d0,185313.d0,198133.d0,
     & 211118.d0,221602.d0,226937.d0,232549.d0,237374.d0,
     & 241959.d0,249131.d0,251492.d0,246367.d0,242685.d0,
     & 239661.d0,239571.d0,244295.d0,252998.d0,260104.d0,
     & 263828.d0,264544.d0,261958.d0,257170.d0,261502.d0,
     & 271675.d0,285466.d0,302875.d0,319195.d0,333439.d0,
     & 348574.d0,359836.d0,369476.d0,371977.d0,377028.d0,
     & 384309.d0,395240.d0,410050.d0,424125.d0,435739.d0/)
       n(5,6,:)=(/132441.d0,150539.d0,168637.d0,179419.d0,
     & 193376.d0,206289.d0,216527.d0,224404.d0,234742.d0,
     & 244802.d0,256495.d0,265663.d0,273734.d0,277686.d0,
     & 279725.d0,282086.d0,283843.d0,284856.d0,285273.d0,
     & 283975.d0,281882.d0,280256.d0,286523.d0,292381.d0,
     & 297158.d0,306206.d0,311990.d0,313661.d0,325382.d0,
     & 336548.d0,350911.d0,367206.d0,386440.d0,401234.d0,
     & 409007.d0,414326.d0,417906.d0,423006.d0,426615.d0/)
       n(5,7,:)=(/110169.d0,119508.d0,128847.d0,148239.d0,
     & 161939.d0,176125.d0,187460.d0,200899.d0,204669.d0,
     & 213848.d0,226799.d0,239607.d0,252000.d0,266288.d0,
     & 279025.d0,291308.d0,303628.d0,316666.d0,323419.d0,
     & 325180.d0,323266.d0,316412.d0,317748.d0,318848.d0,
     & 320176.d0,329570.d0,340404.d0,352728.d0,364068.d0,
     & 368263.d0,371429.d0,374507.d0,376357.d0,
     & 385048.d0,395537.d0,414130.d0,438361.d0,
     & 464088.d0,480307.d0/)
       n(5,8,:)=(/95582.d0,102399.d0,109216.d0,118602.d0,
     & 131594.d0,141394.d0,147955.d0,154232.d0,171681.d0,
     & 182229.d0,197196.d0,210968.d0,227609.d0,232588.d0,
     & 241326.d0,252196.d0,265715.d0,280470.d0,295900.d0,
     & 307326.d0,313848.d0,316253.d0,329017.d0,341522.d0,
     & 353174.d0,368809.d0,376834.d0,376824.d0,375691.d0,
     & 369515.d0,367109.d0,370808.d0,383847.d0,396323.d0,
     & 403669.d0,411016.d0,419067.d0,426579.d0,435216.d0/)
       n(5,9,:)=(/94580.d0,97635.d0,100690.d0,105629.d0,
     & 111656.d0,117441.d0,121123.d0,126283.d0,133422.d0,
     & 144845.d0,155865.d0,164662.d0,170888.d0,188222.d0,
     & 198442.d0,212580.d0,228622.d0,249808.d0,257477.d0,
     & 267452.d0,275942.d0,281195.d0,292793.d0,306669.d0,
     & 321993.d0,341564.d0,358550.d0,372040.d0,384361.d0,
     & 389847.d0,393281.d0,393677.d0,392984.d0,390412.d0,
     & 389875.d0,392274.d0,405066.d0,424288.d0,437283.d0/)
       n(5,10,:)=(/97113.d0,99565.d0,102017.d0,105590.d0,
     & 109483.d0,112418.d0,113150.d0,115069.d0,118387.d0,
     & 123160.d0,130421.d0,136393.d0,142615.d0,150432.d0,
     & 160746.d0,170253.d0,180443.d0,189746.d0,210660.d0,
     & 222626.d0,235692.d0,246468.d0,263586.d0,269531.d0,
     & 280750.d0,298733.d0,315180.d0,329205.d0,345124.d0,
     & 357371.d0,368155.d0,379224.d0,391203.d0,402388.d0,
     & 408363.d0,418214.d0,426450.d0,430556.d0,428239.d0/)
       n(5,11,:)=(/98440.d0,101044.d0,103648.d0,106740.d0,
     & 110587.d0,113054.d0,113766.d0,115013.d0,116768.d0,
     & 118984.d0,122920.d0,125325.d0,127537.d0,130778.d0,
     & 135620.d0,141833.d0,148441.d0,156868.d0,166832.d0,
     & 178383.d0,186399.d0,190489.d0,196626.d0,218074.d0,
     & 231415.d0,251776.d0,271868.d0,292963.d0,301215.d0,
     & 310797.d0,322567.d0,335483.d0,347857.d0,362422.d0,
     & 376382.d0,388784.d0,406124.d0,422490.d0,434254.d0/)
       n(5,12,:)=(/86622.d0,91482.d0,96342.d0,103065.d0,
     & 109514.d0,114400.d0,116092.d0,117574.d0,118762.d0,
     & 120916.d0,124305.d0,127381.d0,129777.d0,131242.d0,
     & 131416.d0,132848.d0,135553.d0,139475.d0,144214.d0,
     & 149834.d0,154461.d0,156240.d0,163333.d0,173285.d0,
     & 187885.d0,203010.d0,216705.d0,225947.d0,252190.d0,
     & 265464.d0,282200.d0,300334.d0,318783.d0,324297.d0,
     & 333093.d0,345992.d0,361553.d0,377014.d0,392136.d0/)
       n(5,13,:)=(/76568.d0,81141.d0,85714.d0,91236.d0,
     & 96936.d0,101730.d0,104621.d0,109205.d0,114297.d0,
     & 119869.d0,127349.d0,132536.d0,132467.d0,132418.d0,
     & 133339.d0,134477.d0,137347.d0,142151.d0,145446.d0,
     & 146235.d0,146138.d0,145113.d0,146941.d0,151777.d0,
     & 159316.d0,170663.d0,179592.d0,189386.d0,202223.d0,
     & 217277.d0,229310.d0,241283.d0,251477.d0,273648.d0,
     & 289228.d0,307304.d0,329585.d0,352054.d0,357850.d0/)
       n(5,14,:)=(/68848.d0,73788.d0,78728.d0,84575.d0,
     & 90581.d0,95743.d0,99081.d0,103241.d0,107824.d0,
     & 112832.d0,119657.d0,125318.d0,129012.d0,133470.d0,
     & 136207.d0,140982.d0,146031.d0,148849.d0,150743.d0,
     & 152865.d0,152735.d0,152224.d0,154839.d0,157159.d0,
     & 159255.d0,164732.d0,170281.d0,174110.d0,181541.d0,
     & 189418.d0,198437.d0,205501.d0,212036.d0,221684.d0,
     & 235611.d0,249317.d0,263494.d0,276365.d0,298007.d0/)
       n(5,15,:)=(/57623.d0,63006.d0,68389.d0,73790.d0,
     & 79212.d0,83783.d0,88394.d0,93574.d0,99505.d0,
     & 105250.d0,111161.d0,115893.d0,119891.d0,123565.d0,
     & 128315.d0,132571.d0,136936.d0,143039.d0,148360.d0,
     & 151568.d0,155988.d0,160230.d0,163263.d0,166078.d0,
     & 171960.d0,176567.d0,180447.d0,185885.d0,188262.d0,
     & 189751.d0,188248.d0,189339.d0,190076.d0,192572.d0,
     & 196918.d0,203630.d0,211402.d0,220764.d0,232638.d0/)
       n(5,16,:)=(/43758.d0,46765.d0,49772.d0,52801.d0,
     & 55841.d0,59841.d0,63864.d0,68436.d0,73530.d0,
     & 79232.d0,83903.d0,88384.d0,92580.d0,97018.d0,
     & 101144.d0,105513.d0,109796.d0,113348.d0,117952.d0,
     & 122303.d0,126354.d0,131075.d0,137932.d0,145904.d0,
     & 152661.d0,159735.d0,165283.d0,167172.d0,169696.d0,
     & 173810.d0,174466.d0,175410.d0,176175.d0,176723.d0,
     & 176861.d0,177979.d0,180269.d0,184146.d0,188903.d0/)
       n(5,17,:)=(/27511.d0,29714.d0,31917.d0,34136.d0,
     & 36367.d0,38389.d0,40427.d0,42353.d0,45313.d0,49005.d0,
     & 52867.d0,56456.d0,60161.d0,63910.d0,68040.d0,71856.d0,
     & 75754.d0,80016.d0,83851.d0,87847.d0,91632.d0,95597.d0,
     & 100854.d0,106450.d0,111451.d0,116643.d0,121769.d0,
     & 128549.d0,134053.d0,138427.d0,141816.d0,145102.d0,
     & 147440.d0,148998.d0,151805.d0,153568.d0,157903.d0,
     & 160818.d0,163497.d0/)
       n(5,18,:)=(/13899.d0,15373.d0,16847.d0,18333.d0,19814.d0,
     & 21278.d0,22743.d0,24084.d0,25705.d0,27416.d0,28663.d0,
     & 30349.d0,32167.d0,34262.d0,36558.d0,38961.d0,41434.d0,
     & 44419.d0,47325.d0,50503.d0,53622.d0,56715.d0,60291.d0,
     & 63661.d0,67601.d0,71440.d0,75647.d0,79342.d0,83051.d0,
     & 86530.d0,89282.d0,92434.d0,97949.d0,103464.d0,107243.d0,
     & 112691.d0,118096.d0,122074.d0,125469.d0/)
       n(5,19,:)=(/8059.d0,8830.d0,9601.d0,10362.d0,11129.d0,
     & 12235.d0,13313.d0,14292.d0,15733.d0,17219.d0,18776.d0,
     & 20309.d0,21633.d0,23080.d0,24603.d0,26216.d0,27688.d0,
     & 29499.d0,31663.d0,33367.d0,35560.d0,37867.d0,40988.d0,
     & 44369.d0,47594.d0,50831.d0,53952.d0,57105.d0,59801.d0,
     & 63098.d0,66200.d0,69601.d0,74035.d0,78192.d0,
     & 84145.d0,89488.d0,96730.d0,105043.d0,114434.d0/)


!     REGION 1: Weast Coast US (Thyroid Cancer Mortality, 1969-2007)
       d(1,1,:)=(/0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,
     & 0.d0,0.d0,0.d0,0.d0,1.d0,0.d0,0.d0,0.d0,0.d0,0.d0,
     & 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,
     & 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0/)
       d(1,2,:)=(/0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,
     & 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,
     & 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,
     & 0.d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12,:)=(/4.d0,5.d0,13.d0,6.d0,6.d0,4.d0,6.d0,5.d0,
     & 8.d0,9.d0,5.d0,13.d0,10.d0,7.d0,5.d0,7.d0,7.d0,6.d0,
     & 7.d0,12.d0,5.d0,4.d0,4.d0,8.d0,7.d0,3.d0,7.d0,7.d0,
     & 10.d0,3.d0,11.d0,12.d0,8.d0,13.d0,13.d0,11.d0,
     & 15.d0,10.d0,14.d0/)
       d(1,13,:)=(/15.d0,9.d0,9.d0,7.d0,15.d0,11.d0,11.d0,
     & 14.d0,7.d0,12.d0,13.d0,8.d0,13.d0,13.d0,10.d0,10.d0,
     & 9.d0,11.d0,3.d0,7.d0,11.d0,9.d0,17.d0,10.d0,13.d0,
     & 9.d0,13.d0,16.d0,10.d0,10.d0,18.d0,19.d0,17.d0,18.d0,
     & 17.d0,21.d0,20.d0,19.d0,19.d0/)
       d(1,14,:)=(/7.d0,17.d0,14.d0,14.d0,13.d0,10.d0,17.d0,
     & 17.d0,10.d0,15.d0,12.d0,12.d0,9.d0,10.d0,10.d0,12.d0,
     & 18.d0,12.d0,18.d0,16.d0,16.d0,10.d0,18.d0,11.d0,
     & 14.d0,12.d0,13.d0,13.d0,14.d0,18.d0,18.d0,17.d0,13.d0,20.d0,
     & 16.d0,16.d0,16.d0,26.d0,29.d0/)
       d(1,15,:)=(/18.d0,13.d0,14.d0,17.d0,13.d0,11.d0,
     & 14.d0,15.d0,20.d0,14.d0,13.d0,18.d0,17.d0,7.d0,13.d0,
     & 19.d0,24.d0,16.d0,23.d0,25.d0,17.d0,23.d0,24.d0,
     & 23.d0,22.d0,20.d0,26.d0,21.d0,26.d0,25.d0,24.d0,
     & 27.d0,19.d0,26.d0,17.d0,26.d0,29.d0,17.d0,30.d0/)
       d(1,16,:)=(/17.d0,28.d0,18.d0,19.d0,19.d0,19.d0,
     & 13.d0,28.d0,20.d0,14.d0,12.d0,21.d0,21.d0,26.d0,
     & 13.d0,15.d0,20.d0,28.d0,24.d0,19.d0,19.d0,17.d0,23.d0,
     & 20.d0,22.d0,19.d0,22.d0,20.d0,28.d0,27.d0,16.d0,
     & 23.d0,32.d0,31.d0,23.d0,24.d0,28.d0,35.d0,41.d0/)
       d(1,17,:)=(/15.d0,20.d0,18.d0,16.d0,14.d0,20.d0,
     & 22.d0,14.d0,20.d0,11.d0,14.d0,19.d0,18.d0,17.d0,
     & 17.d0,17.d0,24.d0,23.d0,23.d0,21.d0,27.d0,23.d0,
     & 29.d0,21.d0,17.d0,18.d0,37.d0,27.d0,25.d0,26.d0,
     & 28.d0,28.d0,34.d0,25.d0,31.d0,22.d0,35.d0,26.d0,56.d0/)
       d(1,18,:)=(/16.d0,17.d0,11.d0,20.d0,23.d0,13.d0,
     & 13.d0,16.d0,17.d0,21.d0,17.d0,13.d0,18.d0,18.d0,
     & 16.d0,21.d0,17.d0,20.d0,20.d0,23.d0,14.d0,12.d0,
     & 19.d0,24.d0,29.d0,19.d0,22.d0,25.d0,28.d0,29.d0,
     & 25.d0,23.d0,33.d0,37.d0,27.d0,30.d0,29.d0,51.d0,38.d0/)
       d(1,19,:)=(/6.d0,6.d0,14.d0,16.d0,14.d0,15.d0,14.d0,
     & 12.d0,12.d0,15.d0,13.d0,15.d0,17.d0,19.d0,16.d0,
     & 17.d0,17.d0,23.d0,18.d0,11.d0,17.d0,12.d0,11.d0,
     & 23.d0,26.d0,21.d0,19.d0,31.d0,24.d0,16.d0,25.d0,
     & 21.d0,33.d0,17.d0,26.d0,33.d0,30.d0,35.d0,41.d0/)


!     REGION 2: South Weastern US (Thyroid Cancer Mortality, 1969-2007)
       d(2,1,:)=(/0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,
     & 0.d0,0.d0,0.d0,0.d0,0.d0,1.d0,0.d0,0.d0,0.d0,0.d0,0.d0,
     & 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,
     & 0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.d0,0.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,4.d0,
     & 3.d0,5.d0,2.d0,2.d0,2.d0,4.d0,4.d0,3.d0,1.d0,1.d0,
     & 4.d0,5.d0,7.d0,3.d0,9.d0,5.d0,4.d0,4.d0,4.d0,4.d0,
     & 6.d0,7.d0,7.d0,3.d0,4.d0,13.d0,7.d0,12.d0,5.d0,10.d0,5.d0/)
       d(2,12,:)=(/4.d0,5.d0,9.d0,6.d0,3.d0,3.d0,4.d0,6.d0,
     & 7.d0,7.d0,7.d0,9.d0,8.d0,7.d0,6.d0,6.d0,7.d0,5.d0,
     & 7.d0,10.d0,5.d0,4.d0,4.d0,10.d0,4.d0,3.d0,7.d0,
     & 9.d0,12.d0,4.d0,10.d0,13.d0,10.d0,12.d0,13.d0,11.d0,
     & 12.d0,7.d0,14.d0/)
       d(2,13,:)=(/13.d0,5.d0,8.d0,6.d0,13.d0,12.d0,6.d0,
     & 14.d0,6.d0,13.d0,10.d0,5.d0,9.d0,9.d0,9.d0,9.d0,
     & 12.d0,8.d0,5.d0,5.d0,8.d0,7.d0,17.d0,14.d0,14.d0,
     & 11.d0,13.d0,10.d0,12.d0,9.d0,15.d0,19.d0,13.d0,
     & 15.d0,20.d0,18.d0,19.d0,19.d0,18.d0/)
       d(2,14,:)=(/6.d0,16.d0,11.d0,11.d0,13.d0,12.d0,
     & 16.d0,13.d0,9.d0,15.d0,10.d0,10.d0,7.d0,10.d0,
     & 9.d0,9.d0,15.d0,12.d0,16.d0,15.d0,16.d0,7.d0,16.d0,
     & 12.d0,12.d0,13.d0,14.d0,11.d0,12.d0,17.d0,19.d0,
     & 15.d0,18.d0,16.d0,16.d0,18.d0,21.d0,20.d0,27.d0/)
       d(2,15,:)=(/10.d0,12.d0,11.d0,14.d0,12.d0,12.d0,
     & 11.d0,14.d0,18.d0,12.d0,14.d0,19.d0,15.d0,7.d0,
     & 9.d0,19.d0,25.d0,17.d0,19.d0,21.d0,19.d0,20.d0,
     & 22.d0,22.d0,21.d0,21.d0,22.d0,24.d0,25.d0,25.d0,
     & 23.d0,25.d0,14.d0,26.d0,20.d0,21.d0,32.d0,19.d0,27.d0/)
       d(2,16,:)=(/13.d0,28.d0,18.d0,16.d0,17.d0,18.d0,10.d0,
     & 21.d0,21.d0,10.d0,11.d0,16.d0,21.d0,21.d0,13.d0,
     & 11.d0,21.d0,23.d0,17.d0,10.d0,19.d0,16.d0,16.d0,
     & 20.d0,21.d0,23.d0,20.d0,15.d0,25.d0,22.d0,13.d0,
     & 18.d0,28.d0,31.d0,24.d0,26.d0,32.d0,34.d0,36.d0/)
       d(2,17,:)=(/13.d0,13.d0,13.d0,9.d0,12.d0,16.d0,22.d0,
     & 12.d0,14.d0,13.d0,16.d0,17.d0,16.d0,14.d0,20.d0,18.d0,
     & 21.d0,17.d0,22.d0,22.d0,25.d0,21.d0,23.d0,20.d0,
     & 18.d0,18.d0,31.d0,25.d0,23.d0,27.d0,23.d0,29.d0,
     & 29.d0,31.d0,29.d0,26.d0,31.d0,28.d0,53.d0/)
       d(2,18,:)=(/14.d0,16.d0,9.d0,17.d0,23.d0,13.d0,11.d0,
     & 15.d0,11.d0,23.d0,17.d0,11.d0,15.d0,17.d0,16.d0,
     & 20.d0,14.d0,16.d0,15.d0,17.d0,11.d0,16.d0,15.d0,
     & 20.d0,23.d0,17.d0,20.d0,22.d0,30.d0,26.d0,25.d0,
     & 24.d0,30.d0,29.d0,23.d0,28.d0,30.d0,55.d0,36.d0/)
       d(2,19,:)=(/5.d0,3.d0,10.d0,13.d0,9.d0,11.d0,12.d0,
     & 11.d0,10.d0,14.d0,15.d0,11.d0,14.d0,13.d0,14.d0,
     & 16.d0,16.d0,23.d0,14.d0,9.d0,13.d0,10.d0,11.d0,
     & 21.d0,22.d0,18.d0,13.d0,30.d0,22.d0,18.d0,23.d0,
     & 20.d0,25.d0,17.d0,21.d0,24.d0,35.d0,36.d0,33.d0/)

!     REGION 3: Weastern US (Thyroid Cancer Mortality, 1969-2007)
       d(3,1,:)=(/0.d0,0.d0,0.d0,0.d0,0.d0,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1.d0,1.d0,0.d0,
     & 0.d0,1.d0,1.d0,0.d0,2.d0,2.d0,1.d0,2.d0,1.d0,3.d0,4.d0,
     & 3.d0,5.d0,6.d0,6.d0,4.d0,4.d0,3.d0,0.d0,1.d0/)
       d(3,11,:)=(/2.d0,2.d0,5.d0,2.d0,2.d0,2.d0,2.d0,2.d0,
     & 4.d0,2.d0,1.d0,3.d0,2.d0,2.d0,0.d0,1.d0,0.d0,2.d0,2.d0,
     & 4.d0,3.d0,5.d0,4.d0,7.d0,4.d0,3.d0,4.d0,3.d0,6.d0,3.d0,
     & 3.d0,1.d0,4.d0,9.d0,9.d0,3.d0,10.d0,7.d0,3.d0/)
       d(3,12,:)=(/5.d0,4.d0,1.d0,5.d0,5.d0,3.d0,2.d0,3.d0,
     & 4.d0,3.d0,5.d0,5.d0,6.d0,5.d0,5.d0,6.d0,1.d0,5.d0,
     & 3.d0,2.d0,2.d0,2.d0,3.d0,10.d0,4.d0,2.d0,9.d0,8.d0,
     & 5.d0,3.d0,3.d0,5.d0,9.d0,6.d0,7.d0,6.d0,6.d0,7.d0,6.d0/)
       d(3,13,:)=(/6.d0,7.d0,8.d0,5.d0,5.d0,7.d0,4.d0,5.d0,
     & 10.d0,8.d0,7.d0,5.d0,6.d0,6.d0,2.d0,3.d0,7.d0,5.d0,
     & 5.d0,6.d0,9.d0,2.d0,5.d0,7.d0,3.d0,6.d0,4.d0,8.d0,5.d0,
     & 6.d0,10.d0,11.d0,8.d0,10.d0,12.d0,5.d0,13.d0,11.d0,12.d0/)
       d(3,14,:)=(/10.d0,4.d0,11.d0,6.d0,10.d0,13.d0,7.d0,
     & 3.d0,3.d0,5.d0,4.d0,3.d0,4.d0,11.d0,8.d0,8.d0,8.d0,6.d0,
     & 6.d0,7.d0,4.d0,8.d0,7.d0,7.d0,7.d0,9.d0,6.d0,9.d0,7.d0,
     & 7.d0,10.d0,12.d0,15.d0,15.d0,13.d0,13.d0,24.d0,8.d0,18.d0/)
       d(3,15,:)=(/7.d0,10.d0,13.d0,16.d0,11.d0,9.d0,4.d0,
     & 8.d0,8.d0,9.d0,8.d0,6.d0,12.d0,10.d0,7.d0,12.d0,4.d0,
     & 12.d0,9.d0,9.d0,10.d0,13.d0,12.d0,12.d0,6.d0,15.d0,
     & 16.d0,18.d0,14.d0,13.d0,15.d0,11.d0,15.d0,18.d0,
     & 17.d0,16.d0,17.d0,20.d0,20.d0/)
       d(3,16,:)=(/11.d0,10.d0,10.d0,7.d0,9.d0,14.d0,9.d0,8.d0,
     & 13.d0,15.d0,5.d0,6.d0,18.d0,12.d0,9.d0,12.d0,14.d0,
     & 5.d0,11.d0,10.d0,9.d0,12.d0,11.d0,13.d0,13.d0,14.d0,
     & 17.d0,12.d0,16.d0,10.d0,10.d0,13.d0,15.d0,22.d0,
     & 14.d0,25.d0,24.d0,17.d0,17.d0/)
       d(3,17,:)=(/9.d0,7.d0,10.d0,8.d0,10.d0,9.d0,14.d0,
     & 7.d0,11.d0,15.d0,8.d0,6.d0,10.d0,9.d0,13.d0,11.d0,
     & 11.d0,9.d0,14.d0,10.d0,12.d0,9.d0,11.d0,15.d0,
     & 13.d0,15.d0,16.d0,11.d0,17.d0,15.d0,16.d0,20.d0,
     & 16.d0,20.d0,13.d0,23.d0,20.d0,14.d0,29.d0/)
       d(3,18,:)=(/5.d0,8.d0,3.d0,7.d0,11.d0,5.d0,6.d0,
     & 6.d0,6.d0,8.d0,8.d0,2.d0,7.d0,7.d0,7.d0,9.d0,8.d0,
     & 4.d0,2.d0,7.d0,4.d0,7.d0,11.d0,15.d0,11.d0,12.d0,
     & 16.d0,18.d0,14.d0,13.d0,14.d0,9.d0,15.d0,17.d0,
     & 10.d0,16.d0,23.d0,20.d0,19.d0/)
       d(3,19,:)=(/5.d0,5.d0,5.d0,1.d0,6.d0,5.d0,8.d0,
     & 10.d0,4.d0,7.d0,14.d0,11.d0,5.d0,5.d0,7.d0,6.d0,
     & 6.d0,7.d0,4.d0,11.d0,9.d0,7.d0,12.d0,12.d0,
     & 17.d0,14.d0,16.d0,16.d0,16.d0,17.d0,10.d0,17.d0,
     & 11.d0,17.d0,23.d0,19.d0,26.d0,25.d0,19.d0/)

!     REGION 4: California (Thyroid Cancer Mortality, 1969-2007)
      d(4,:,:)=1.d0!d(2,:,:)*n(4,:,:)/n(2,:,:)

!     REGION 5: Arizona (Thyroid Cancer Mortality, 1969-2007)
      d(5,:,:)=1.d0!d(2,:,:)*n(5,:,:)/n(2,:,:)
                                                                                                
      DO k=1,reg                
       DO i=t1(k),t2(k)
        t(k,i)=((i-t1(1)+1)*1.d0)
       ENDDO       
      ENDDO        
      !Warning!!! Its the same constraint repeated twice                        
!      resm(1,:)=(/1.d0,-1.d0/2.d0,-1.d0/2.d0/)          
!      resm(2,:)=(/2.d0,-1.d0,-1.d0/)      
!!      DO h=1,nr
       DO k=1,reg
        DO j=1,age
         IF (SUM(d(k,j,t1(k):t2(k))).LT.1.d-9) THEN
          d(k,j,t1(k):t2(k))=1.d-9 
         ENDIF
        ENDDO
       ENDDO
       !------------------------------------------------------------------    
       CALL estimate0()                 
       IF (ifail2a.EQ.0) THEN
        CALL var(m1)                                
       !-----------------------------------------------------------------      
          
!!      ENDDO
      !-----------------------------------------------------------------
        PRINT*, 'PARAMETER LAMBDA=',a
        PRINT*, '-------------------------------------------'
        PRINT*, 'b1 ESTIMATOR'
        PRINT*, '------------'
        PRINT*, bb1
!        PRINT*, 'dif=', bb1(2)-bb1(1)      
        PRINT*, 'b1 ESTIMATOR VARIANCE'
        PRINT*, '---------------------'
        PRINT*, tvar
!        PRINT*, 'dif=', tvar(1)-tvar(2)                   
        PRINT*, 'b0 ESTIMATOR (with rates per 100,000 and t1=1)'
        PRINT*, '----------------------------------------------'
        PRINT*, bb0-LOG(1.d-5)
        PRINT*                        
        PRINT*, 'APC ESTIMATOR AND 95% CONFIDENCE INTERVAL'
        PRINT*, '----------------------------------------'
        DO k=1,reg-sol
         apc(k)=100.d0*(EXP(bb1(k))-1.d0)
         CIapcInf(k)=100.d0*(EXP(bb1(k)-1.959963985d0*SQRT(tvar(k)))
     &               -1.d0)
         CIapcSup(k)=100.d0*(EXP(bb1(k)+1.959963985d0*SQRT(tvar(k)))
     &               -1.d0)        
         PRINT*, '* APC Region',k,'=',apc(k)
         PRINT*, '(',CIapcInf(k),',',CIapcSup(k),')'
         PRINT*, 'Width=',CIapcSup(k)-CIapcInf(k)
        ENDDO      
        PRINT*              
        PRINT*, 'Z TEST STATISTIC:'
        PRINT*, '-----------------'             
        PRINT*, (bb1(1)-bb1(2))/sqrt(tvar(1)+tvar(2)-
     &            2.d0*tvar(1)*tvar(2)*tvar(4)) 
        PRINT*, (bb1(1)-bb1(2))/sqrt(tvar(1)+tvar(2))     
        PRINT*, (bb1(2)-bb1(3))/sqrt(tvar(2)+tvar(3)-
     &            2.d0*tvar(2)*tvar(3)*tvar(5))
        PRINT*, (bb1(2)-bb1(3))/sqrt(tvar(2)+tvar(3))            
        PRINT*   
        PRINT*, 'MEAN PER CELL (AGE GROUPS x POINTS OF TIME)'
        PRINT*, '-------------------------------------------'
        DO k=1,reg
         PRINT*, SUM(d(k,:,t1(k):t2(k)))/(1.d0*age*(t2(k)-t1(k)+1))
         PRINT*, 'totals', SUM(d(k,:,t1(k):t2(k)))
        ENDDO
        PRINT*
        PRINT*, 'SAMPLE RATES (per 100,000)'
        PRINT*, '--------------------------' 
        DO k=1,reg
         PRINT*, 'pobl=',k
         DO i=t1(k),t2(k)
          PRINT*, 1.d5*SUM(std*d(k,:,i)/n(K,:,i))/SUM(std)
!          PRINT*, LOG(1.d5*SUM(std*d(k,:,i)/n(K,:,i))/SUM(std))          
         ENDDO
        ENDDO                    
      ENDIF
      END PROGRAM Estimators
      
      SUBROUTINE estimate0()
      USE ParGlob
      IMPLICIT NONE        
      INTEGER, PARAMETER:: no=reg, ldfJac=no, lwa=(no*(no+13))/2
      INTEGER k, j, i, ifail
      DOUBLE PRECISION  b1(no),b1gs(no), erel, X02AJF, wa(lwa),
     &  f(no), fJac(ldfJac,no), aux(tim), p(reg,age,tim),
     &  phi(reg,age,tim), expb0(reg,age)      
      EXTERNAL X02AJF, C05PBF, fcn
       ifail=1
       res=0
       erel=SQRT(X02AJF())                     
       b1gs=0.d0
       b1=b1gs            
       CALL C05PBF(fcn,no,b1,f,fJac,ldfJac,erel,wa,lwa,ifail)
       IF (ifail.NE.0) THEN
        b1gs=1.d0/20.d0
        b1=b1gs            
        CALL C05PBF(fcn,no,b1,f,fJac,ldfJac,erel,wa,lwa,ifail)
        IF (ifail.NE.0) THEN
         b1gs=-1.d0/20.d0
         b1=b1gs            
         CALL C05PBF(fcn,no,b1,f,fJac,ldfJac,erel,wa,lwa,ifail)
        ENDIF               
       ENDIF
       bb0=0.d0        
       IF (ifail.EQ.0) THEN
       DO k=1,reg-sol
        DO j=1,age
         DO i=t1(k),t2(k)
          aux(i)=n(k,j,i)*exp(b1(k)*t(k,i))         
          phi(k,j,i)=d(k,j,i)/aux(i)
         ENDDO
         DO i=t1(k),t2(k)
          p(k,j,i)=aux(i)/SUM(aux(t1(k):t2(k)))
         ENDDO        
         expb0(k,j)=(SUM(p(k,j,t1(k):t2(k))*
     &              (phi(k,j,t1(k):t2(k))**(a+1.d0))))**(1.d0/(a+1.d0))
         DO i=t1(k),t2(k)
          m1(k,j,i)=expb0(k,j)*aux(i)
         ENDDO
         bb0(k)=bb0(k)+std(j)*expb0(k,j)                      
        ENDDO
       ENDDO
       !la region 4 es el solapamiento entre 1 y 2, y 1>2
       b1(4)=b1(1)
       bb0(4)=bb0(1)
       m1(4,:,:)=n(4,:,:)*m1(1,:,:)/n(1,:,:)
!       print*,  n(1,:,t1(1):t2(1))-n(4,:,t1(4):t2(4))
       !la region 5 es el solapamiento entre 2 y 3, y 2>3
       b1(5)=b1(2)
       bb0(5)=bb0(2)
       m1(5,:,:)=n(5,:,:)*m1(2,:,:)/n(2,:,:)      
                                                         
       bb0=LOG(bb0/SUM(std))
       ENDIF      
       ifail2a=ifail
       bb1=b1(1:reg)              
      END SUBROUTINE estimate0
      

      
      SUBROUTINE fcn(no,x,f,fJac,ldfJac,iflag)
      USE ParGlob
      IMPLICIT NONE      
      INTEGER k, j, i, no, iflag, ldfJac
      DOUBLE PRECISION x(no), f(no), fJac(ldfJac,no), psi(reg,tim),
     &   aux(tim), p(reg,age,tim), phi(reg,age,tim), expb0(reg,age),
     &   xi(reg,age,tim), zeta(reg,age), kappa(reg,tim), theta(reg,tim)              

!      print*, ldfJac, no
      DO k=1,reg
       DO j=1,age
        DO i=t1(k),t2(k)
         aux(i)=n(k,j,i)*exp(x(k)*t(k,i))         
         phi(k,j,i)=d(k,j,i)/aux(i)
        ENDDO
        DO i=t1(k),t2(k)
          p(k,j,i)=aux(i)/SUM(aux(t1(k):t2(k)))
        ENDDO        
        expb0(k,j)=(SUM(p(k,j,t1(k):t2(k))
     &            *(phi(k,j,t1(k):t2(k))**(a+1.d0))))**(1.d0/(a+1.d0))
        zeta(k,j)=SUM((SUM(t(k,t1(k):t2(k))*p(k,j,t1(k):t2(k)))
     &            +a*t(k,t1(k):t2(k)))*p(k,j,t1(k):t2(k))*
     &            (phi(k,j,t1(k):t2(k))**(a+1.d0)))/(expb0(k,j)**a)
        DO i=t1(k),t2(k)
         xi(k,j,i)=n(k,j,i)*((a*(phi(k,j,i)**(a+1.d0)))/(expb0(k,j)**
     &             (a+1.d0))+1.d0)
        ENDDO
       ENDDO
       DO i=t1(k),t2(k)
        psi(k,i)=SUM(n(k,:,i)*((phi(k,:,i)**(a+1.d0))/(expb0(k,:)**a)-
     &           expb0(k,:)))
        kappa(k,i)=SUM(xi(k,:,i)*zeta(k,:))
        theta(k,i)=SUM(n(k,:,i)*expb0(k,:))
       ENDDO 
      ENDDO
      IF (iflag.NE.2) THEN
       DO k=1,reg
        f(k)=SUM(t(k,t1(k):t2(k))*exp(x(k)*t(k,t1(k):t2(k)))*
     &   psi(k,t1(k):t2(k)))
       ENDDO
       DO i=1,res
        f(reg+i)=SUM(resm(i,:)*x(1:reg))
        DO k=1,reg
         f(k)=f(k)+x(reg+i)*resm(i,k)
        ENDDO
       ENDDO       
      ELSE    
       fJac=0.d0            
       DO k=1,reg
        fJac(k,k)=SUM(t(k,t1(k):t2(k))*exp(x(k)*t(k,t1(k):t2(k)))
     &  *kappa(k,t1(k):t2(k)))/(a+1.d0)-SUM(t(k,t1(k):t2(k))
     &  *t(k,t1(k):t2(k))*exp(x(k)*t(k,t1(k):t2(k)))*
     &  (a*psi(k,t1(k):t2(k))+(a+1.d0)*theta(k,t1(k):t2(k))))
!     When there are no constraints, the next loop never is executed because 1>0=res       
        DO j=1,res
         fJac(k,reg+j)=resm(j,k)
        ENDDO      
       ENDDO
      ENDIF       
      END SUBROUTINE fcn
      
      
      SUBROUTINE  tTil(mm)
      USE ParGlob     !Warning: even the argument m, the variance is for bb1
      IMPLICIT NONE      
      INTEGER k,j
      DOUBLE PRECISION v(reg,age,tim),mm(reg,age,tim)
      v=0.d0      
      DO k=1,reg
       v(k,:,t1(k):t2(k))=mm(k,:,t1(k):t2(k))       
       DO j=1,age
        tt(k,j)=SUM(v(k,j,:)*t(k,:))/SUM(v(k,j,:))
       ENDDO
      ENDDO            
      END tTil
      
      SUBROUTINE var(mm) !with m=d0 we can calculate the true "asymptotic" variance and with m=m1 its estimation
      USE ParGlob     !Warning: even the argument m, the variance is for bb1
      IMPLICIT NONE      
      INTEGER k, j, i
      DOUBLE PRECISION v(reg,age,tim),mm(reg,age,tim)
      v=0.d0
      tvar=0.d0
      CALL tTil(mm)
      DO k=1,reg-sol
       v(k,:,t1(k):t2(k))=mm(k,:,t1(k):t2(k))
       DO i=t1(k),t2(k)
        tvar(k)=tvar(k)+SUM(v(k,:,i)*t(k,i)*t(k,i))
       ENDDO
       DO j=1,age       
         tvar(k)=tvar(k)-SUM(v(k,j,t1(k):t2(k)))*tt(k,j)*tt(k,j)
       ENDDO               
      ENDDO
      tvar(1:reg-sol)=1.d0/tvar(1:reg-sol)
      !la region 4 es el solapamiento entre 1 y 2, y 1>2
      v(4,:,t1(4):t2(4))=mm(4,:,t1(4):t2(4))
      DO i=t1(4),t2(4)
       DO j=1,age     
        tvar(4)=tvar(4)+v(4,j,i)*(t(4,i)-tt(1,j))*(t(4,i)-tt(2,j))
       ENDDO
      ENDDO        
      !la region 5 es el solapamiento entre 2 y 3, y 2>3
      v(5,:,t1(5):t2(5))=mm(5,:,t1(5):t2(5))
      DO i=t1(5),t2(5)
       DO j=1,age     
        tvar(5)=tvar(5)+v(5,j,i)*(t(5,i)-tt(2,j))*(t(5,i)-tt(3,j))
       ENDDO
      ENDDO              
                
      END SUBROUTINE var      
      
