time_series.piecewise
Fits a synthetic signal to data over a time period by ordinary or weighted least-squares for breakpoint analysis
Calling Sequence
import gravity_toolkit.time_series
tsbeta = gravity_toolkit.time_series.piecewise(t_in, d_in, BREAKPOINT=len(t_in)//2, CYCLES=[0.5,1.0])
- gravity_toolkit.time_series.piecewise(t_in, d_in, BREAK_TIME=None, BREAKPOINT=None, CYCLES=[0.5, 1.0], TERMS=[], DATA_ERR=0, WEIGHT=False, STDEV=0, CONF=0, AICc=False)[source]
Fits a synthetic signal to data over a time period by ordinary or weighted least-squares for breakpoint analysis [68]
- Parameters:
- t_in: float
input time array
- d_in: float
input data array
- BREAK_TIME: float or NoneType, default None
breakpoint time for piecewise regression
- BREAKPOINT: int or NoneType, default None
breakpoint indice of piecewise regression
- CYCLES: list, default [0.5, 1.0]
list of cyclical terms in fractions of year
- TERMS: list, default []
list of extra fit terms
- DATA_ERR: float or list
data precision
single value if equal
array if unequal for weighted least squares
- WEIGHT: bool, default False
Use weighted least squares with measurement errors
- STDEV: float, default 0
Standard deviation of output error
- CONF: float, default 0
Confidence interval of output error
- AICc: bool, default False
Use second order AIC for small sample sizes [6]
- Returns:
- beta: float
regressed coefficients array
- error: float
regression fit error for each coefficient for an input deviation
STDEV: standard deviation of output errorCONF: confidence interval of output error
- std_err: float
standard error for each coefficient
- R2: float
coefficient of determination (r2)
- R2Adj: float
r2 adjusted for the number of terms in the model
- MSE: float
mean square error
- WSSE: float
Weighted sum of squares error
- NRMSE: float
normalized root mean square error
- AIC: float
Akaike information criterion
- BIC: float
Bayesian information criterion (Schwarz criterion)
- model: float
modeled timeseries
- simple: float
modeled timeseries without oscillating components
- residual: float
model residual
- DOF: int
degrees of freedom
- N: int
number of terms used in fit
- cov_mat: float
covariance matrix