@@ -248,12 +248,30 @@ def compare_timeseries(parameters):
248248 df [s ]['Trend Err ({0}) Gt/yr' .format (com_lbl )] = fit ['error' ][1 ]
249249 df [s ]['Seasonal ({0}) Gt' .format (com_lbl )] = np .sqrt (fit ['beta' ][4 ]** 2 + fit ['beta' ][5 ]** 2 )
250250 df [s ]['Seasonal Err ({0}) Gt' .format (com_lbl )] = np .sqrt (fit ['error' ][4 ]** 2 + fit ['error' ][5 ]** 2 )
251+ df [s ]['R2 x1 ({0})' .format (com_lbl )] = fit ['R2' ]
252+ df [s ]['BIC x1 ({0})' .format (com_lbl )] = fit ['AIC' ]
253+ df [s ]['AIC x1 ({0})' .format (com_lbl )] = fit ['BIC' ]
254+ #-- compare with no trend case
255+ fit = tsregress (tdec [s ][ind [s ]],mass [s ][ind [s ]],ORDER = 0 ,CYCLES = [0.5 ,1 ])
256+ df [s ]['R2 x0 ({0})' .format (com_lbl )] = fit ['R2' ]
257+ df [s ]['BIC x0 ({0})' .format (com_lbl )] = fit ['AIC' ]
258+ df [s ]['AIC x0 ({0})' .format (com_lbl )] = fit ['BIC' ]
259+ #------------------------------------------------------
251260 #-- also get trend for 2015 onwards
261+ #------------------------------------------------------
252262 ind15 = np .squeeze (np .nonzero (tdec [s ]> 2015 ))
253263 fit = tsregress (tdec [s ][ind15 ],mass [s ][ind15 ],ORDER = 1 ,CYCLES = [0.5 ,1 ])
254- df [s ]['Trend (2015+) Gt/yr' .format (com_lbl )] = fit ['beta' ][1 ]
255- df [s ]['Trend Err (2015+) Gt/yr' .format (com_lbl )] = fit ['error' ][1 ]
256-
264+ df [s ]['Trend (2015+) Gt/yr' ] = fit ['beta' ][1 ]
265+ df [s ]['Trend Err (2015+) Gt/yr' ] = fit ['error' ][1 ]
266+ df [s ]['R2 x1 (2015+)' ] = fit ['R2' ]
267+ df [s ]['BIC x1 (2015+)' ] = fit ['AIC' ]
268+ df [s ]['AIC x1 (2015+)' ] = fit ['BIC' ]
269+ #-- compare with no trend case
270+ fit = tsregress (tdec [s ][ind [s ]],mass [s ][ind [s ]],ORDER = 0 ,CYCLES = [0.5 ,1 ])
271+ df [s ]['R2 x0 (2015+)' ] = fit ['R2' ]
272+ df [s ]['BIC x0 (2015+)' ] = fit ['AIC' ]
273+ df [s ]['AIC x0 (2015+)' ] = fit ['BIC' ]
274+
257275 #-- write regression results to file
258276 df = pd .DataFrame (df )
259277 df .to_csv (mscn_file .replace ('.txt' ,'_comparison_regession.csv' ))
0 commit comments