**************************** * * * Changes in segmented * * * **************************** =============== version 2.0-4 (2024-04-19) =============== * Some improvements in the fitter functions for segmented and stepmented fits to gain efficiency * A small change in the segmented.* methods: the possible estimated breakpoints at the boundary or too close each other are slightly outdistanced to avoid puzzly results (null or very large st.errs). See min.nj in seg.control() * Bug fix: confint.stepmented() did not work if the supplied fit had variable names including dots (thanks to Matti Lehtonen for reporting); segmented crashed when options(outDec=",") was set (thanks to Andras Kosztolanyi for reporting); selgmented() was ignoring return.fit=FALSE when 0 breakpoints were selected (thanks to Marc Laurencelle for reporting); vcov.stepmented() did not work correctly for glm fits. =============== version 2.0-3 (2024-02-16) =============== * Some improvements in selgmented() to select the number of breakpoints * Dataset globTempAnom included in the package * In plot.segmented() argument 'term' can be a vector to draw multiple fitted segmented relationships on the same plot * In points.segmented() argument 'term' can be numeric =============== version 2.0-2 (2024-01-23) =============== * In seg(), 'est' and 'psi' can be a list to set group specific constraints (when 'by' is specified) * Bug fix: - predict.segmented() did not work when the supplied dataset had 1 row (thanks to Felipe Mattioni for reporting), and when the object fit included a factor, possibly coming from interaction term such as seg(x, by=g) (thanks to Conor McAloon and Dave Armstrong for reporting) - segreg() did not work with contraints when 'by' was specified in seg() (thanks to Signe Marie Jensen for reporting) - segmented.numeric() and stepmented.numeric() were ignoring their 'weights' argument. =============== version 2.0-1 (2023-12-19) =============== * Change of values for argument 'break.type' in pscore.test(): now these are "break" or "jump" (were 1 or 2) * New arguments in plot.stepmented(), especially 'conf.level' to portray pointwise confidence intervals of the step regression function. * Bug fix: predict.segmented() did not work if the supplied dataframe included variables not in the model (thanks to A. Priulla and N. D'angelo for reporting); segreg() was not reporting the intercept name. =============== version 2.0-0 (2023-11-27) =============== * New class "stepmented" introduced, with some relevant methods. The functions stepmented.* allow to fit regression models (lm and glm) with step-function effects (and additional linear terms). * segreg() introduced for segmented modelling. This function allows to specify segmented (G)LM's via a proper formula including both linear and multiple segmented terms wherein some slopes can be constrained to be zero. * Some improvements in segmented.lme() wherein arguments 'nq' and 'adjust' have been removed. * Some changes in seg.control(): arguments 'gap', 'last', 'stop.if.error', and 'powers' removed; 'quant' now defaults to FALSE. -- 'alpha' accepts 2 values to fix (via the quantile probability values) the covariate range within which the breakpoint should stay (thanks to Clement Laroche for his input). -- h=0 is now allowed to keep fixed the breakpoints by also setting n.boot=0 (as an alternative to 'it.max=0') * new function model.matrix.segmented() * segmented.default() works with objects "svyglm" (thanks to Huifeng Jin for his input) * predict.segmented() has been rewritten and is stabler. * changed some default values in plot.segmented() (for lines and residuals). =============== version 1.6-4 (2023-04-14) =============== * A (relevant) enhancement in selgmented() which now can detect a large number of breakpoints not evenly distributed in the covariate range (see argument G). Also, selgmented() now works with Kmax=1 (thanks to Marc Laurencelle for his input) * plot.segmented.lme() now can draw all the segmented profiles on the same panel (see argument 'n.plot') * Bug fix: in slope() when managing "lme" fits; in pscore.test() when managing glm fits (thanks to Yuki Mori for reporting) =============== version 1.6-3 (2023-03-20) =============== * selgmented was not always returning information about the number of selected breakpoints (thanks to Alba Serrat for reporting) * slope() did not work on segmented.lme fits. (thanks to Luiz F. Silva Magnago for reporting; the error was introduced accidentally by version 1.6-2) =============== version 1.6-2 (2022-12-09) =============== * slope() now accepts also a list of two segmented fits to compare the corresponding slope estimates (thanks to Florencia Camus for the input) * Substantial improvement in selgmented() when selecting a large number (and locations) of breakpoints =============== version 1.6-1 (2022-11-08) =============== * New argument 'const' in points.segmented(). * A small correction in plot.segmented.lme() when xscale=-1 and/or yscale=-1 (i.e. for subject-specific x- or y-scales) * (Minor) bug fixed: in plot.segmented() 'const' was ignored when conf.level>0; in selgmented() type='davies' did not work and 'AIC' was always printed, even if type="bic" was set. =============== version 1.6-0 (2022-05-30) =============== * New function segmented.lme (and related methods) introduced to fit segmented mixed models, i.e. segmented model with random effects changepoints. * 'alpha' in seg.control() defaults to NULL, i.e. max(0.05, 1/n). =============== version 1.5-0 (2022-04-11) =============== * New method function segmented.numeric() to allow short call such as 'segmented(y)' (providing the same results of segmented(lm(y~x),~x). Such 'short' call also works for 'ts' objects. * Bug fix: functions segmented.* (with boot restarting) were ignoring the 'alpha' argument of seg.control(). =============== version 1.4-1 (2022-03-24) =============== * Improvement in the estimating algorithm for segmented.glm * Minor changes: option 'aic' introduced in selgmented(); 'alpha' in seg.control is set to 0.05 (it was 0.02); 'shift' in lines.segmented() now defaults to FALSE (was TRUE); a simple correction for plot.segmented(.., rev.sgn=TRUE); predict.segmented now also works for lme fits (thanks to Ting-Fang Lee for his input). =============== version 1.4-0 (2022-01-28) =============== * New function pwr.seg() for power analysis in segmented regression (thanks to Bastian Kückelhaus for his input) * An improvement in the estimating algorithm (only for lm models) to gain efficiency * Bugs fixed: pscore.test() returned an error with covariates taking large values (tens of thousands) leading to collinearity in the design matrix; (thanks to Michael Laviolette for reporting). A minor change in summary.segmented() which reports now "n.boot" information =============== version 1.3-4 (2021-04-22) =============== * selgmented() now returns information on the selection of the no.of breakpoints. It also gains argument 'msg'. * Bug fix in plot.segmented(): it did not work correctly with rev.sgn=TRUE and it did not handle correctly multiple colors for displaying the conf.intervals when shade=FALSE. =============== version 1.3-3 (2021-03-08) =============== * Two (internal) changes in the boot restarting algorithm: i) option 'break.boot' introduced in seg.control() to save computational time; ii) an improvement in the algorithm expected to better escape local solutions (thanks to Daniele Cuntrera for his input). * Fixed bugs: broken.line() didn't work (a silly bug, thanks to Kirstin Deuss for reporting); confint.segmented() and plot.segmented() did not handle correctly the Arima fits. * Some further code examples in ?segmented. =============== version 1.3-2 (2021-02-09) =============== * New arguments '.vcov' and '.coef' in the utility functions (slope(), plot.segmented(), confint.segmented(),..) in order to account for fit objects returned by segmented.default() (Thanks to Yi Hu for his input). * new argument 'smoos' in plot.segmented() to draw smoothed scatterplot when 'res=TRUE'. =============== version 1.3-1 (2020-12-10) =============== * segmented.default() now accepts "lme" objects (thanks to Hannah Watson for her input) * Bug fix: pscore.test() crashed in large datasets (thanks to John Grego for reporting); segmented.lm() did not work when the scale of x was defined on very large range, e.g. 1e8 to 2e8 (thanks to Elio Campitelli for reporting) =============== version 1.3-0 (2020-10-23) =============== * New function selgmented() to select the number of breakpoints (via BIC or hypothesis testing). * New argument 'fixed.psi' in segmented.* methods to fix some of breakpoints in the fitted model. * The 'seed' argument in seg.control() defaults to 12345 to guarantee reproducibility. =============== version 1.2-0 (2020-06-23) =============== * Changes in segmented.default to allow estimation of segmented censReg models (thanks to Georgina Kaltenecker for her input). * coef.segmented() introduced to extract regression coefficients and breakpoints. * A small improvement in segmented.* methods: if fix.npsi=TRUE, the returned number of breakpoints is always equal to the initial one. * npsi can be missing in the segmented.* methods, and one breakpoint is estimated for all variables specified in seg.Z. * New argument 'fc' in seg.control() to manage situations when the estimated breakpoints come to the boundary. * New argument in plot.segmented() to draw also the trends before the breakpoints. * Bug fix: plot.segmented() did not recycle arguments 'col', 'lwd' and 'lty'. =============== version 1.1-0 =============== * Changes in segmented.default to allow estimation of betareg models (thanks to Malcolm Baptie and Jochen Wilhelm for their input) =============== version 1.0-0 =============== * New implementation of the estimating algorithm. Now segmented is much stabler, and dependence on starting values (that occurred in some 'difficult' datasets) is greatly reduced and apparently cancelled. * New arguments: - 'npsi' in segmented.* methods to specify the number of breakpoints (and not the values) to be estimated. - 'is' in vcov.segmented() to compute covariance matrix based on the idea of induced smoothing. This leads to higher (and more trustworthy) standard errors for the breakpoint. - 'isV' in broken.line() and plot.segmented() to allow smooth "transition" in the standard errors values for the fitted values at the breakpoint. - 'conv.psi', 'alpha', 'fix.npsi', 'min.step' and 'tol' (the last one replacing 'toll') in seg.control() (where arguments 'last', 'stop.if.error', and 'gap' will be removed in the next releases) - 'n.break' in pscore.test(). - .vcov in broken.line() and plot.segmented() to pass directly the full covariance matrix of estimates. plot.segmented() accepts 'col.shade', see ?plot.segmented * Minor changes: better display of the iterative steps (if display=TRUE in seg.control()) and general improvement in draw.history(). =============== version 0.5-4.0 =============== * confint.segmented() now computes breakpoint confidence intervals via the (smoothed) Score or Gradient statistic, see new argument 'method' in confint.segmented(). * If segmented does not converge (since the estimated psi leaves only 1 datum on its left/right) the last psi estimate is printed as a message. * Argument keep.class added in segmented.default() * Argument 'rug' defaults to '!add' in plot.segmented() * confint.segmented() now returns a matrix (rather than a list) * Bug fixed: plot.segmented() did not handle appropriately arguments cex.lab and cex.axis. segmented methods did not terminate appropriately when automatic selection of number of breakpoints was performed (i.e. 'stop.if.error=FALSE'). davies.test() and segmented.glm() required 'seg.Z' even if there was just one covariate in the starting model and it could be missing (thanks to Lein E. Pardo for reporting that). Some minor bug fixes (related to argument 'data' and one-sided alternative) in pscore.test (thanks to Karista Hudelson for reporting). =============== version 0.5-3.0 =============== * aapc() introduced. The function computes the 'average annual percent change' to summarize piecewise linear trends (thanks to Yuchen Qin for his input). * plot.segmented() now accepts arguments 'cex.axis' and 'cex.lab' (thanks to Matthew Birk for his input). * Bug fixed: segmented.Arima didn't work for arima fits including a seasonal component (thanks to Claudio Agostinelli for reportig the bug). =============== version 0.5-2.2 =============== * When there is a single covariate in the starting (g)lm, seg.Z can be missing when calling the segmented methods. * Bug fixed: plot.segmented(.., link=FALSE) did not work correctly (sometimes it returned an error) for glm fits with multiple breakpoints. Weights were not handled appropriately by segmented.lm. =============== version 0.5-2.1 =============== * pscore.test() now works also for "glm" fits * plot.segmented() now plots the partial residuals as "component + working residuals" (rather than Pearson residuals, relevant only for glm fits). * segmented.default() now is expected to work for fits obtained by MASS::rlm(). =============== version 0.5-2.0 =============== * pscore.test() introduced. The function tests for a breakpoint using a (pseudo) score statistic which is more powerful than davies.test(), especially when the breakpoint is expected to be in the middle of the covariate range and the signal-to-noise ratio is high. * Argument 'digits' added in seg.control() to fix the number of digits of the breakpoint estimate during the iterative estimation algorithm. * Bug fixed: conf.level>0 in plot.segmented() did not work for objects returned by segmented.default(). =============== version 0.5-1.5 (not on CRAN) =============== * Arguments 'gap' and 'show.gap' removed in intercept() and in plot.segmented(). (they are meaningless, as segmented() always returns joined piecewise lines, i.e. with no gaps). * slope() and broken.line() (and then plot.segmented() which uses them) did not work for objects returned by segmented.default() (Thanks to Marcos Krull for reporting). =============== version 0.5-1.4 =============== * segmented.Arima() should be slightly faster, as starting values are passed in arima() (via 'init') throughout the iterative process. * plot.segmented() is expected to work for objects returned by segmented.Arima. * print.summary.segmented() does not print anymore the t-values for the gap coefficients (this information is meaningless as the gap coeffs are always set to zero in the returned model). * Bug fixed: intercept() ignored argument 'rev.sgn'; points.segmented() missed argument 'transf'. =============== version 0.5-1.3 (not on CRAN) =============== * plot.segmented() gains argument 'transf' to plot 'transf(values)' rather 'values' on the current plot. * print.summary.segmented() now uses round() rather than signif() when displaying the breakpoint estimate. * Bug fixed: psi=NA was not working in the segmented.* methods; this bug was incidentally introduced in the last version (thanks to Bertrand Sudre for first reporting that). =============== version 0.5-1.2 =============== * For 1 breakpoint models, 'psi' argument can be missing (default) when calling the segmented methods. * Bug fixed: lines.segmented() did not plot the dots when the fit object included multiple breakpoints and the argument 'shift' was set to FALSE (thanks to Jan Bull for reporting). There were some troubles with variable names including dots (thanks to Melanie Zoelck which first reported this bug). =============== version 0.5-1.1 =============== * segmented.default now accepts 'gee' fits (Thanks to John Boulanger for his input) * Minor change: argument 'col.dens' changed to 'dens.col' in plot.segmented() ('col.dens' made ineffective 'col') * Minor change: error/warning messages introduced in davies.test() if k<10; print.segmented slightly changed in displaying the estimated breakpoints. * Bug fixed: segmented did not terminate appropriately the algorithm with automatic selection of breakpoints concerning more than one variable (thanks to Ali Hashemi for reporting). =============== version 0.5-1.0 =============== * segmented.Arima() introduced. Now it is possible to estimate segmented relationships in "Arima" fits (although the summarizing and plotting methods do not work..) * plot.segmented() gains arguments 'dens.rug' and 'col.dens' to display in the plot (on the x axis) also the smoothed density of the segmented covariate. * Bug fixed: segmented.lm did not work if it.max=0 (but segmented.glm did), thanks to Eric Nussbaumer for reporting. segmented.lm and segmented.glm did work if the starting linear model included weights (this bug was introduced incidentally since version 0.4-0.1; thanks to Michael Rutter for reporting). segmented.lm and segmented.glm did not check appropriately inadmissible breakpoints (thanks to Erica Tennenhouse for reporting). segmented.lm and segmented.glm did not handle correctly variable names equal to function names. davies.test() did not work with 'segmented' objects (to test for and additional breakpoint). points.segmented() missed the argument 'rev.sgn'. =============== version 0.5-0.0 =============== * segmented.default() introduced. Now it is possible to estimate segmented relationships in arbitrary regression models (besides lm and glm) where specific methods do not exist (e.g. cox or quantile regression models). =============== version 0.4-0.1 (not on CRAN) =============== * segmented.lm() and segmented.glm() did not work if the starting model included additional "variables", such as 'threshold' in 'subset=age0. * The breakpoint starting values when automatic selection is performed are now specified as equally spaced values (optionally as quantiles). see argument 'quant' in seg.control() * added 'Authors@R' entry in the DESCRIPTION file =============== version 0.2-9.1 =============== * Some bugs fixed: segmented.lm() and segmented.glm() did not finish correctly when no breakpoint was found; now segmented.lm() and segmented.glm() take care of flat relationships; plot.segmented() did not compute correctly the partial residuals for segmented glm fits. =============== version 0.2-9.0 =============== * Bootstrap restarting implemented to deal with problems coming from flat segmented relationships. segmented now is less sensitive to starting values supplied for 'psi'. * At the convergence segmented now constrains the gap coefficients to be exactly zero. This is the default and it can be altered by the 'gap' argument in seg.control(). * plot.segmented() has been re-written. It gains argument `res' for plotting partial residuals along with the fitted piecewise lines, and now it produces nicer (and typically smaller) plots. * Some bugs fixed: davies.test() did not work correctly for deterministic data (thanks to Glenn Roberts for finding the error). davies.test() also returns the `process', i.e. the different values of the evaluation points and corresponding test statistic. =============== version 0.2-8.4 =============== * Some bugs fixed: segmented.glm() fitted a simple "lm" (and not "glm") (the error was introduced incidentally from 0.2-8.3, thanks to Veronique Storme for finding the error); broken.line() was not working for models without intercept and a null left slope; intercept() was not working correctly with multiple segmented variables. =============== version 0.2-8.3 =============== * Some minor bugs fixed: segmented.lm() and segmented.glm() did not find the offset variable in the dataframe where the initial (g)lm was called for; segmented.lm() and segmented.glm() sometimes returned an error when the automated algorithm was used (thanks to Paul Cohen for finding the error). =============== version 0.2-8.2 =============== * Some minor bugs fixed (segmented.lm() and segmented.glm() *alway* included the left slope in the estimation process, although the number of parameters was correct in the returned final fit. confint.segmented() did not order the estimated breakpoints for the variable having rev.sgn=TRUE; intercept() missed the (currently meaningless) argument var.diff (thanks to Eric Fuchs for pointing out that). ) =============== version 0.2-8.1 =============== * Some minor bugs fixed (segmented.lm() and segmented.glm() were not working correctly with dataframe subset or when the starting linear model included several intercepts (e.g., see the example about data("plant"); thanks to Nicola Ferrari for finding the error). davies.test() did not work when the variable name of its argument `seg.Z' included reserved words, e.g. `seg.Z~dist'; thanks to Thom White for finding the error). =============== version 0.2-8 =============== * intercept() added. It computes the intercepts of the regression lines for each segment of the fitted segmented relationship. * plot.segmented() now accepts a vector `col' argument to draw the fitted piecewise linear relationships with different colors. * Some minor bugs fixed (summary.segmented were not working correctly). =============== version 0.2-7.3 =============== * argument APC added to the slope() function to compute the `annual percent change'. * Some minor bugs fixed (confint and slope were not working correctly when the estimated breakpoints were returned in non-increasing order; offset was ignored in segmented.lm and segmented.glm; broken.line() was not working correctly (and its argument gap was unimplemented), thanks to M. Rennie for pointing out that; summary.segmented() was not working for models with no linear term, i.e. fitted via segmented(lm(y~0),..)). =============== version 0.2-7.2 =============== * segmented.lm and segmented.glm now accept objects with formulas y~., Thanks to G. Ferrara for finding the error. * Some bugs fixed (slope and confint were using the normal (rather than the t-distribution) to compute the CIs in gaussian models). =============== version 0.2-7.1 =============== * segmented.lm and segmented.glm now accept objects without 'explicit' formulas, namely returned by lm(my_fo,..) (and glm(my_fo,..)) where my_fo was defined earlier. Thanks to Y. Iwasaki for finding the error. =============== version 0.2-7 =============== * A sort of automatic procedure for breakpoint estimation is implemented. See argument stop.if.error in seg.control(). * davies.test() now accepts a one-sided formula (~x) rather than character ("x") to mean the segmented variable to be tested. davies.test also gains the arguments `beta0' and `dispersion'. * Some bugs fixed. =============== version 0.2-6 =============== * vcov.segmented() added. * option var.diff for robust covariance matrix has been added in summary.segmented(), print.summary.segmented(), slope(), and confint(). * Some bugs fixed.