time_series.regress
Fits a synthetic signal to data over a time period by ordinary or weighted least-squares
Calling Sequence
import gravity_toolkit.time_series
tsbeta = gravity_toolkit.time_series.regress(t_in, d_in, ORDER=1, CYCLES=[0.5,1.0], CONF=0.95)
- gravity_toolkit.time_series.regress(t_in, d_in, ORDER=1, CYCLES=[0.5, 1.0], TERMS=[], DATA_ERR=0, WEIGHT=False, RELATIVE=Ellipsis, STDEV=0, CONF=0, AICc=True)[source]
Fits a synthetic signal to data over a time period by ordinary or weighted least-squares
- Parameters:
- t_in: float
input time array
- d_in: float
input data array
- ORDER: int, default 1
maximum polynomial order in fit
0: constant1: linear2: quadratic
- CYCLES: list, default [0.5, 1.0]
list of cyclical terms
- 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
- RELATIVE: float or List, default Ellipsis
Epoch for calculating relative dates
float: use exact value as epoch
list: use mean from indices of available times
Ellipsis: use mean of all available times
- 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