User Tools

Site Tools


howtos:calibration:projecting_into_history

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
howtos:calibration:projecting_into_history [2009/12/01 13:51]
shona.weldon created
howtos:calibration:projecting_into_history [2009/12/01 14:02] (current)
shona.weldon
Line 8: Line 8:
  
 <​code>​ <​code>​
-local ratioFamPerPer[cr,​th] = familiesTot[cr,​th] / CTotPop[cr,th+local ratioFamPerPer[cr,​t19782006] = familiesTot[cr,​t19782006] / CTotPop[cr,t19782006
-local ratioFamPerPerPH[cr,​t19101977] = lintrend (ratioFamPerPer[cr,​th]; time=1910) +local ratioFamPerPerPH[cr,​t19101977] = lintrend (ratioFamPerPer[cr,​t19782006]; time=1910) 
-familiesPH[cr,​t19101977] = extract (CEEFpop[cr,​t18511990];​ time:​1910..1977) * ratioFamPerPerPH[cr,​t19101977]+familiesPH[cr,​t19101977] = extract (CTotPopPH[cr,​t18511990];​ time:​1910..1977) * ratioFamPerPerPH[cr,​t19101977]
 </​code>​ </​code>​
  
 The main danger here is that your linear trend variable, ratioFamPerPerPH[cr,​t19101977],​ goes negative The main danger here is that your linear trend variable, ratioFamPerPerPH[cr,​t19101977],​ goes negative
- 
-===== log and exponential lintrend===== 
-Another way to use lintrend and avoid the negatives it to use logarithm and exponential 
- 
-<​code>​ 
-local ratioFamPerPer[cr,​th] = familiesTot[cr,​th] / CTotPop[cr,​th] 
-local ratioFamPerPerPH[cr,​t19101977] = exp (max (lintrend (loge (ratioFamPerPer[cr,​th]);​ time=1910), 0)) 
-familiesPH[cr,​t19101977] = extract (CEEFpop[cr,​t18511990];​ time:​1910..1977) * ratioFamPerPerPH[cr,​t19101977] 
-</​code>​ 
  
 ===== Ratio with linint ===== ===== Ratio with linint =====
-A safer way is to create an extra variable which is the ratio of the first year of pre-history to the first year of history and then linear interpret between these 2 points for the historic period.+A safer way is to create an extra variable which is the ratio of the first year of pre-history ​(ratioFamPerPer1910to1978) ​to the first year of history and then linear interpret between these 2 points for the historic period.
  
 <​code>​ <​code>​
-local ratioFamPerPer[cr,​th] = familiesTot[cr,​th] / CTotPop[cr,th+! Build an object to hold the time from beginning of pre history to end of history and put in the part we know 
-local ratioFamPerPerPHx[cr,​t19101977] = changeseq (copyshape (ratioFamPerPer[cr,​th]); dim=time, start=1910) +local ratioFamPerPer[cr,​t19782006] = familiesTot[cr,​t19782006] / CTotPop[cr,t19782006
-ratioFamPerPerPHx[cr,​t19101977] = insert (ratioFamPerPer[cr,​th]; time->​time:​1978) +local ratioFamPerPerPHx[cr,​t19101977] = changeseq (copyshape (ratioFamPerPer[cr,​t19782006]); dim=time, start=1910) 
-ratioFamPerPerPHx[cr,​t19101977] = insert (extract (ratioFamPerPer[cr,​th]; time:1978, shrink=on) * \+ratioFamPerPerPHx[cr,​t19101977] = insert (ratioFamPerPer[cr,​t19782006]; time->​time:​1978) 
 + 
 +! Multiply the ratioFamPerPer1910to1978 agains against the first year of history and insert that as the first year of pre history 
 +ratioFamPerPerPHx[cr,​t19101977] = insert (extract (ratioFamPerPer[cr,​t19782006]; time:1978, shrink=on) * \
  ratioFamPerPer1910to1978[cr];​ time:1910)  ratioFamPerPer1910to1978[cr];​ time:1910)
  
 +! Do Linear interpolation between these values
 local ratioFamPerPerPH[cr,​t19101977] ​ = extract (linint (ratioFamPerPerPHx[cr,​t19101977]);​ time:​+0..1977) local ratioFamPerPerPH[cr,​t19101977] ​ = extract (linint (ratioFamPerPerPHx[cr,​t19101977]);​ time:​+0..1977)
  
 +! Apply the ratio
 familiesPH[cr,​t19101977] = extract (CEEFpop[cr,​t18511990];​ time:​1910..1977) * ratioFamPerPerPH[cr,​t19101977] familiesPH[cr,​t19101977] = extract (CEEFpop[cr,​t18511990];​ time:​1910..1977) * ratioFamPerPerPH[cr,​t19101977]
 </​code>​ </​code>​
  
 The main problem with this approach is that it is very flat over pre-history time The main problem with this approach is that it is very flat over pre-history time
 +
 +===== log and exponential lintrend=====
 +Another way is to use lintrend with logarithm and exponential
 +
 +<​code>​
 +local ratioFamPerPer[cr,​t19782006] = familiesTot[cr,​t19782006] / CTotPop[cr,​t19782006]
 +local ratioFamPerPerPH[cr,​t19101977] = exp (max (lintrend (loge (ratioFamPerPer[cr,​t19782006]);​ time=1910), 0))
 +familiesPH[cr,​t19101977] = extract (CEEFpop[cr,​t18511990];​ time:​1910..1977) * ratioFamPerPerPH[cr,​t19101977]
 +</​code>​
 +
  
  
  
howtos/calibration/projecting_into_history.1259675477.txt.gz · Last modified: 2009/12/01 13:51 by shona.weldon