<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.2 20190208//EN"
                  "JATS-archivearticle1.dtd">
<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.2" article-type="other">
<front>
<journal-meta>
<journal-id journal-id-type="publisher-id">jrepstat</journal-id>
<journal-title-group>
<journal-title>Journal of Reproducible Statistics</journal-title>
</journal-title-group>
<issn publication-format="electronic">3043-2790</issn>
<publisher>
<publisher-name>FAIR Press</publisher-name>
</publisher>
</journal-meta>
<article-meta>
<title-group>
<article-title>Fitting segmented mixed models with random changepoints in R</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<contrib-id contrib-id-type="orcid">https://orcid.org/0000-0002-3386-4054</contrib-id>
<name>
<surname>Muggeo</surname>
<given-names>Vito M.R.</given-names>
</name>
<aff>Dip. Scienze Economiche, Aziendali &amp; Statistiche - Universita' di Palermo, Italy</aff>
</contrib>
</contrib-group>
<pub-date date-type="pub" publication-format="electronic">
<year>2026</year>
</pub-date>
<volume>1</volume>
<elocation-id>12</elocation-id>
<history>
<date date-type="received" iso-8601-date="2026-10-01"><day>01</day><month>10</month><year>2026</year></date>
<date date-type="accepted" iso-8601-date="2026-11-18"><day>18</day><month>11</month><year>2026</year></date>
</history>
<permissions>
<license license-type="open-access" xlink:href="https://creativecommons.org/licenses/by/4.0/">
<license-p>This is an open access article distributed under the terms of the Creative Commons Attribution 4.0 International License (CC-BY 4.0), which permits unrestricted use, distribution and reproduction in any medium provided the original work is properly cited.</license-p>
</license>
</permissions>
<self-uri content-type="html" xlink:href="https://jrepstat.fairpressjournals.com/articles/fitting-segmented-mixed-models-with-random-changepoints-in-r/"/>
<abstract>
<p>We illustrate and discuss R code to fit segmented mixed models with random changepoints in a likelihood based framework. Some examples are presented to show capability of the methodology and of the relevant functions in the R package segmented.</p>
</abstract>
<kwd-group kwd-group-type="author">
<kwd>segmented regression</kwd>
<kwd>mixed models</kwd>
<kwd>random changepoints</kwd>
<kwd>R package</kwd>
<kwd>piecewise-linear models</kwd>
<kwd>longitudinal data</kwd>
</kwd-group>
<custom-meta-group>
<custom-meta>
<meta-name>data-availability-route</meta-name>
<meta-value>no_data</meta-value>
</custom-meta>
<custom-meta>
<meta-name>founding-article</meta-name>
<meta-value>true</meta-value>
</custom-meta>
</custom-meta-group>
</article-meta>
</front>
<body>
<sec id="introduction">
  <title>Introduction</title>
  <p>In segmented regression, the effect of a numeric covariate is
  expressed via a piecewise linear relationship, namely two straight
  lines with different slopes connected at some unknown value within the
  covariate range, the so-called breakpoint (Hardy, 2001; Muggeo, 2003).
  <italic>Segmented mixed models</italic> extend simple segmented
  regression to the mixed model framework by putting random effects in
  each model parameter, including the breakpoint (Cudeck &amp; Klebe,
  2002; Morrell et al., 1995; Muggeo et al., 2014). Random effects are
  popular to model longitudinal or clustered data when repeated
  measurements for each unit have been collected, see Fitzmaurice et al.
  (2004) for instance.</p>
  <p>Assuming numeric data <inline-formula><alternatives>
  <tex-math><![CDATA[y_{ij}]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>y</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mi>j</mml:mi></mml:mrow></mml:msub></mml:math></alternatives></inline-formula>,
  with observational times <inline-formula><alternatives>
  <tex-math><![CDATA[t_{ij}]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>t</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mi>j</mml:mi></mml:mrow></mml:msub></mml:math></alternatives></inline-formula>
  (<inline-formula><alternatives>
  <tex-math><![CDATA[j=1,\ldots,n_i]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mi>j</mml:mi><mml:mo>=</mml:mo><mml:mn>1</mml:mn><mml:mo>,</mml:mo><mml:mi>…</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>n</mml:mi><mml:mi>i</mml:mi></mml:msub></mml:mrow></mml:math></alternatives></inline-formula>
  and <inline-formula><alternatives>
  <tex-math><![CDATA[i=1,\ldots,N]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mi>i</mml:mi><mml:mo>=</mml:mo><mml:mn>1</mml:mn><mml:mo>,</mml:mo><mml:mi>…</mml:mi><mml:mo>,</mml:mo><mml:mi>N</mml:mi></mml:mrow></mml:math></alternatives></inline-formula>),
  the model reads as
  <styled-content id="eqU003Asegmented"><disp-formula><alternatives>
  <tex-math><![CDATA[\begin{equation}
  \label{eq:segmented}
  y_{ij}=\beta_{0i}+\beta_{1i}t_{ij}+\delta_{i}(t_{ij}-\psi_i)_++\epsilon_{ij},
  \end{equation} \qquad(1)]]></tex-math>
  <mml:math display="block" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mrow><mml:msub><mml:mi>y</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mi>j</mml:mi></mml:mrow></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>β</mml:mi><mml:mrow><mml:mn>0</mml:mn><mml:mi>i</mml:mi></mml:mrow></mml:msub><mml:mo>+</mml:mo><mml:msub><mml:mi>β</mml:mi><mml:mrow><mml:mn>1</mml:mn><mml:mi>i</mml:mi></mml:mrow></mml:msub><mml:msub><mml:mi>t</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mi>j</mml:mi></mml:mrow></mml:msub><mml:mo>+</mml:mo><mml:msub><mml:mi>δ</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mi>j</mml:mi></mml:mrow></mml:msub><mml:mo>−</mml:mo><mml:msub><mml:mi>ψ</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:msub><mml:mo stretchy="false" form="postfix">)</mml:mo><mml:mo>+</mml:mo></mml:msub><mml:mo>+</mml:mo><mml:msub><mml:mi>ϵ</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mi>j</mml:mi></mml:mrow></mml:msub><mml:mo>,</mml:mo></mml:mrow><mml:mspace width="2.0em"></mml:mspace><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mn>1</mml:mn><mml:mo stretchy="false" form="postfix">)</mml:mo></mml:mrow></mml:math></alternatives></disp-formula></styled-content>
  where the <inline-formula><alternatives>
  <tex-math><![CDATA[\epsilon_{ij}]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>ϵ</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mi>j</mml:mi></mml:mrow></mml:msub></mml:math></alternatives></inline-formula>
  are the usual zero-mean stochastic component. Note that, according to
  parametrization above, the left and right slopes are
  <inline-formula><alternatives>
  <tex-math><![CDATA[\beta_{1i}]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>β</mml:mi><mml:mrow><mml:mn>1</mml:mn><mml:mi>i</mml:mi></mml:mrow></mml:msub></mml:math></alternatives></inline-formula>
  and <inline-formula><alternatives>
  <tex-math><![CDATA[\beta_{1i}+\delta_i]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:msub><mml:mi>β</mml:mi><mml:mrow><mml:mn>1</mml:mn><mml:mi>i</mml:mi></mml:mrow></mml:msub><mml:mo>+</mml:mo><mml:msub><mml:mi>δ</mml:mi><mml:mi>i</mml:mi></mml:msub></mml:mrow></mml:math></alternatives></inline-formula>
  respectively. Each parameter of model
  (<xref alt="(1)" rid="eqU003Asegmented">(1)</xref>) is given by the
  sum of fixed effects, possibly depending on covariates, and the random
  component. Thus for the intercept and the left slope it is possible to
  write
  <styled-content id="eqU003AdiffSlope"><disp-formula><alternatives>
  <tex-math><![CDATA[\begin{equation}
  \label{eq:diffSlope}
  \beta_{0i}=\beta_{00}+x_{0i}^T\beta_0+b_{0i} \qquad\qquad
  \beta_{1i}=\beta_{10}+x_{1i}^T\beta_1+b_{1i},
  \end{equation} \qquad(2)]]></tex-math>
  <mml:math display="block" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mrow><mml:msub><mml:mi>β</mml:mi><mml:mrow><mml:mn>0</mml:mn><mml:mi>i</mml:mi></mml:mrow></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>β</mml:mi><mml:mn>00</mml:mn></mml:msub><mml:mo>+</mml:mo><mml:msubsup><mml:mi>x</mml:mi><mml:mrow><mml:mn>0</mml:mn><mml:mi>i</mml:mi></mml:mrow><mml:mi>T</mml:mi></mml:msubsup><mml:msub><mml:mi>β</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>+</mml:mo><mml:msub><mml:mi>b</mml:mi><mml:mrow><mml:mn>0</mml:mn><mml:mi>i</mml:mi></mml:mrow></mml:msub><mml:mspace width="2.0em"></mml:mspace><mml:mspace width="2.0em"></mml:mspace><mml:msub><mml:mi>β</mml:mi><mml:mrow><mml:mn>1</mml:mn><mml:mi>i</mml:mi></mml:mrow></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>β</mml:mi><mml:mn>10</mml:mn></mml:msub><mml:mo>+</mml:mo><mml:msubsup><mml:mi>x</mml:mi><mml:mrow><mml:mn>1</mml:mn><mml:mi>i</mml:mi></mml:mrow><mml:mi>T</mml:mi></mml:msubsup><mml:msub><mml:mi>β</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo>+</mml:mo><mml:msub><mml:mi>b</mml:mi><mml:mrow><mml:mn>1</mml:mn><mml:mi>i</mml:mi></mml:mrow></mml:msub><mml:mo>,</mml:mo></mml:mrow><mml:mspace width="2.0em"></mml:mspace><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mn>2</mml:mn><mml:mo stretchy="false" form="postfix">)</mml:mo></mml:mrow></mml:math></alternatives></disp-formula></styled-content>
  while for the slope-difference and the changepoint parameters we have
  <styled-content id="eqU003Achangepoint"><disp-formula><alternatives>
  <tex-math><![CDATA[\begin{equation}
  \label{eq:changepoint}
  \delta_i=\delta_0+x_{di}^T\delta+d_i \qquad\qquad
  \psi_i=\kappa_0+z^T_i\kappa+k_i.
  \end{equation} \qquad(3)]]></tex-math>
  <mml:math display="block" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mrow><mml:msub><mml:mi>δ</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>δ</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>+</mml:mo><mml:msubsup><mml:mi>x</mml:mi><mml:mrow><mml:mi>d</mml:mi><mml:mi>i</mml:mi></mml:mrow><mml:mi>T</mml:mi></mml:msubsup><mml:mi>δ</mml:mi><mml:mo>+</mml:mo><mml:msub><mml:mi>d</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mspace width="2.0em"></mml:mspace><mml:mspace width="2.0em"></mml:mspace><mml:msub><mml:mi>ψ</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>κ</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>+</mml:mo><mml:msubsup><mml:mi>z</mml:mi><mml:mi>i</mml:mi><mml:mi>T</mml:mi></mml:msubsup><mml:mi>κ</mml:mi><mml:mo>+</mml:mo><mml:msub><mml:mi>k</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mi>.</mml:mi></mml:mrow><mml:mspace width="2.0em"></mml:mspace><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mn>3</mml:mn><mml:mo stretchy="false" form="postfix">)</mml:mo></mml:mrow></mml:math></alternatives></disp-formula></styled-content>
  The <inline-formula><alternatives>
  <tex-math><![CDATA[x_0,x_1, x_d]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mi>d</mml:mi></mml:msub></mml:mrow></mml:math></alternatives></inline-formula>
  and <inline-formula><alternatives>
  <tex-math><![CDATA[z]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>z</mml:mi></mml:math></alternatives></inline-formula>
  are, possibly overlapped, covariate vectors describing the subject
  features or experimental conditions, i.e. with values fixed within the
  same subject. Note that for the changepoint parameter, an alternative
  parameterization is <inline-formula><alternatives>
  <tex-math><![CDATA[\psi_i=\frac{a_1+a_2\exp\{\kappa_0+z^T_i\kappa+k_i\}}{1+\exp\{\kappa_0+z^T_i\kappa+k_i\} }]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:msub><mml:mi>ψ</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:mfrac><mml:mrow><mml:msub><mml:mi>a</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo>+</mml:mo><mml:msub><mml:mi>a</mml:mi><mml:mn>2</mml:mn></mml:msub><mml:mrow><mml:mi mathvariant="normal">exp</mml:mi><mml:mo>&#8289;</mml:mo></mml:mrow><mml:mo stretchy="false" form="prefix">{</mml:mo><mml:msub><mml:mi>κ</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>+</mml:mo><mml:msubsup><mml:mi>z</mml:mi><mml:mi>i</mml:mi><mml:mi>T</mml:mi></mml:msubsup><mml:mi>κ</mml:mi><mml:mo>+</mml:mo><mml:msub><mml:mi>k</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo stretchy="false" form="postfix">}</mml:mo></mml:mrow><mml:mrow><mml:mn>1</mml:mn><mml:mo>+</mml:mo><mml:mrow><mml:mi mathvariant="normal">exp</mml:mi><mml:mo>&#8289;</mml:mo></mml:mrow><mml:mo stretchy="false" form="prefix">{</mml:mo><mml:msub><mml:mi>κ</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>+</mml:mo><mml:msubsup><mml:mi>z</mml:mi><mml:mi>i</mml:mi><mml:mi>T</mml:mi></mml:msubsup><mml:mi>κ</mml:mi><mml:mo>+</mml:mo><mml:msub><mml:mi>k</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo stretchy="false" form="postfix">}</mml:mo></mml:mrow></mml:mfrac></mml:mrow></mml:math></alternatives></inline-formula>,
  where <inline-formula><alternatives>
  <tex-math><![CDATA[a_1=min\{t_{ij}\}]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:msub><mml:mi>a</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo>=</mml:mo><mml:mi>m</mml:mi><mml:mi>i</mml:mi><mml:mi>n</mml:mi><mml:mo stretchy="false" form="prefix">{</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mi>j</mml:mi></mml:mrow></mml:msub><mml:mo stretchy="false" form="postfix">}</mml:mo></mml:mrow></mml:math></alternatives></inline-formula>
  and <inline-formula><alternatives>
  <tex-math><![CDATA[a_2=max\{t_{ij}\}]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:msub><mml:mi>a</mml:mi><mml:mn>2</mml:mn></mml:msub><mml:mo>=</mml:mo><mml:mi>m</mml:mi><mml:mi>a</mml:mi><mml:mi>x</mml:mi><mml:mo stretchy="false" form="prefix">{</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mi>j</mml:mi></mml:mrow></mml:msub><mml:mo stretchy="false" form="postfix">}</mml:mo></mml:mrow></mml:math></alternatives></inline-formula>.
  This logistic parameterization guarantees values of
  <inline-formula><alternatives>
  <tex-math><![CDATA[\psi_i]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>ψ</mml:mi><mml:mi>i</mml:mi></mml:msub></mml:math></alternatives></inline-formula>
  always in the admissible range <inline-formula><alternatives>
  <tex-math><![CDATA[(a_1,a_2)]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:msub><mml:mi>a</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>a</mml:mi><mml:mn>2</mml:mn></mml:msub><mml:mo stretchy="false" form="postfix">)</mml:mo></mml:mrow></mml:math></alternatives></inline-formula>.</p>
  <p>As usual, a multinormal distribution with zero mean and specified
  covariance matrix, is assumed for the random effects, i.e.</p>
  <p><styled-content id="eqU003Anormal.re"><disp-formula><alternatives>
  <tex-math><![CDATA[\begin{equation}
  \label{eq:normal.re}
  \left[
  \begin{array}{l}
      b_{0i}\\
      b_{1i}\\
      d_i\\
      k_i\\
  \end{array}%
  \right]
  %(b_{0i},b_{1i},d_i,k_i)^T
  \sim \mathcal{N}_4 \left(\left[%
  \begin{array}{l}
      \:0\\
      \:0\\
      \:0\\
      \:0\\
  \end{array}%
  \right],\left[
  \begin{array}{llll}
      \:\sigma^2_{b_0}&.&.&.\\
      \:\sigma_{b_0b_1}&\sigma^2_{b_1}&.&.\\
      \:\sigma_{b_0d}&\sigma_{b_1d}&\sigma^2_{d}&.\\
      \:\sigma_{b_0k}&\sigma_{b_1k}&\sigma_{dk}&\sigma^2_{k}\\
  \end{array}%
  \right]\right).
  \end{equation} \qquad(4)]]></tex-math>
  <mml:math display="block" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mrow><mml:mrow><mml:mo stretchy="true" form="prefix">[</mml:mo><mml:mtable><mml:mtr><mml:mtd columnalign="left" style="text-align: left"><mml:msub><mml:mi>b</mml:mi><mml:mrow><mml:mn>0</mml:mn><mml:mi>i</mml:mi></mml:mrow></mml:msub></mml:mtd></mml:mtr><mml:mtr><mml:mtd columnalign="left" style="text-align: left"><mml:msub><mml:mi>b</mml:mi><mml:mrow><mml:mn>1</mml:mn><mml:mi>i</mml:mi></mml:mrow></mml:msub></mml:mtd></mml:mtr><mml:mtr><mml:mtd columnalign="left" style="text-align: left"><mml:msub><mml:mi>d</mml:mi><mml:mi>i</mml:mi></mml:msub></mml:mtd></mml:mtr><mml:mtr><mml:mtd columnalign="left" style="text-align: left"><mml:msub><mml:mi>k</mml:mi><mml:mi>i</mml:mi></mml:msub></mml:mtd></mml:mtr><mml:mtr><mml:mtd columnalign="left" style="text-align: left"></mml:mtd></mml:mtr></mml:mtable><mml:mo stretchy="true" form="postfix">]</mml:mo></mml:mrow><mml:mo>∼</mml:mo><mml:msub><mml:mi mathvariant="script">𝒩</mml:mi><mml:mn>4</mml:mn></mml:msub><mml:mrow><mml:mo stretchy="true" form="prefix">(</mml:mo><mml:mrow><mml:mo stretchy="true" form="prefix">[</mml:mo><mml:mtable><mml:mtr><mml:mtd columnalign="left" style="text-align: left"><mml:mspace width="0.222em"></mml:mspace><mml:mn>0</mml:mn></mml:mtd></mml:mtr><mml:mtr><mml:mtd columnalign="left" style="text-align: left"><mml:mspace width="0.222em"></mml:mspace><mml:mn>0</mml:mn></mml:mtd></mml:mtr><mml:mtr><mml:mtd columnalign="left" style="text-align: left"><mml:mspace width="0.222em"></mml:mspace><mml:mn>0</mml:mn></mml:mtd></mml:mtr><mml:mtr><mml:mtd columnalign="left" style="text-align: left"><mml:mspace width="0.222em"></mml:mspace><mml:mn>0</mml:mn></mml:mtd></mml:mtr><mml:mtr><mml:mtd columnalign="left" style="text-align: left"></mml:mtd></mml:mtr></mml:mtable><mml:mo stretchy="true" form="postfix">]</mml:mo></mml:mrow><mml:mo>,</mml:mo><mml:mrow><mml:mo stretchy="true" form="prefix">[</mml:mo><mml:mtable><mml:mtr><mml:mtd columnalign="left" style="text-align: left"><mml:mspace width="0.222em"></mml:mspace><mml:msubsup><mml:mi>σ</mml:mi><mml:msub><mml:mi>b</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mn>2</mml:mn></mml:msubsup></mml:mtd><mml:mtd columnalign="left" style="text-align: left"><mml:mi>.</mml:mi></mml:mtd><mml:mtd columnalign="left" style="text-align: left"><mml:mi>.</mml:mi></mml:mtd><mml:mtd columnalign="left" style="text-align: left"><mml:mi>.</mml:mi></mml:mtd></mml:mtr><mml:mtr><mml:mtd columnalign="left" style="text-align: left"><mml:mspace width="0.222em"></mml:mspace><mml:msub><mml:mi>σ</mml:mi><mml:mrow><mml:msub><mml:mi>b</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:msub><mml:mi>b</mml:mi><mml:mn>1</mml:mn></mml:msub></mml:mrow></mml:msub></mml:mtd><mml:mtd columnalign="left" style="text-align: left"><mml:msubsup><mml:mi>σ</mml:mi><mml:msub><mml:mi>b</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mn>2</mml:mn></mml:msubsup></mml:mtd><mml:mtd columnalign="left" style="text-align: left"><mml:mi>.</mml:mi></mml:mtd><mml:mtd columnalign="left" style="text-align: left"><mml:mi>.</mml:mi></mml:mtd></mml:mtr><mml:mtr><mml:mtd columnalign="left" style="text-align: left"><mml:mspace width="0.222em"></mml:mspace><mml:msub><mml:mi>σ</mml:mi><mml:mrow><mml:msub><mml:mi>b</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mi>d</mml:mi></mml:mrow></mml:msub></mml:mtd><mml:mtd columnalign="left" style="text-align: left"><mml:msub><mml:mi>σ</mml:mi><mml:mrow><mml:msub><mml:mi>b</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mi>d</mml:mi></mml:mrow></mml:msub></mml:mtd><mml:mtd columnalign="left" style="text-align: left"><mml:msubsup><mml:mi>σ</mml:mi><mml:mi>d</mml:mi><mml:mn>2</mml:mn></mml:msubsup></mml:mtd><mml:mtd columnalign="left" style="text-align: left"><mml:mi>.</mml:mi></mml:mtd></mml:mtr><mml:mtr><mml:mtd columnalign="left" style="text-align: left"><mml:mspace width="0.222em"></mml:mspace><mml:msub><mml:mi>σ</mml:mi><mml:mrow><mml:msub><mml:mi>b</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mi>k</mml:mi></mml:mrow></mml:msub></mml:mtd><mml:mtd columnalign="left" style="text-align: left"><mml:msub><mml:mi>σ</mml:mi><mml:mrow><mml:msub><mml:mi>b</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mi>k</mml:mi></mml:mrow></mml:msub></mml:mtd><mml:mtd columnalign="left" style="text-align: left"><mml:msub><mml:mi>σ</mml:mi><mml:mrow><mml:mi>d</mml:mi><mml:mi>k</mml:mi></mml:mrow></mml:msub></mml:mtd><mml:mtd columnalign="left" style="text-align: left"><mml:msubsup><mml:mi>σ</mml:mi><mml:mi>k</mml:mi><mml:mn>2</mml:mn></mml:msubsup></mml:mtd></mml:mtr><mml:mtr><mml:mtd columnalign="left" style="text-align: left"></mml:mtd></mml:mtr></mml:mtable><mml:mo stretchy="true" form="postfix">]</mml:mo></mml:mrow><mml:mo stretchy="true" form="postfix">)</mml:mo></mml:mrow><mml:mi>.</mml:mi></mml:mrow><mml:mspace width="2.0em"></mml:mspace><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mn>4</mml:mn><mml:mo stretchy="false" form="postfix">)</mml:mo></mml:mrow></mml:math></alternatives></disp-formula></styled-content></p>
  <p>The model has been discussed by several authors, and estimation has
  been illustrated mostly in a Bayesian paradigm, see Lange et al.
  (1992); <named-content content-type="nocase">Kiuchi et
  al.</named-content> (1995); Jacqmin-Gadda et al. (2006). Muggeo et al.
  (2014) proposed estimation in a likelihood framework, i.e. without
  need to specify any prior for parameters.</p>
  <p>We illustrate how to fit the model and to display the relevant
  results via specific functions of the R package
  <named-content content-type="sans-serif">segmented</named-content>
  (Muggeo, 2008), version 2.3-0. Full information on the operating
  system, the R version, and on additional packages used, is reported at
  the end of section 3.</p>
  <p>The rest of the paper is organized as follows: section 2 introduces
  the functions by describing their main arguments, and section 3
  reports some analyses on real-data as well as on a simulated dataset.
  Finally, section 4 is devoted to conclusions and discussion.</p>
</sec>
<sec id="structure-of-the-functions">
  <title>Structure of the functions</title>
  <p>The main function is <monospace>segmented.lme</monospace> shipped
  within package
  <named-content content-type="sans-serif">segmented</named-content> for
  <named-content content-type="sans-serif">R</named-content> (R Core
  Team, 2026), with main arguments</p>
  <preformat>segmented.lme(obj, seg.Z, z.psi =~1, x.diff =~1, random,
              psi.link = c(&quot;identity&quot;, &quot;logit&quot;))</preformat>
  <p><monospace>obj</monospace> is a classical
  <monospace>‘lme’</monospace> object returned by
  <monospace>lme()</monospace> from the
  <named-content content-type="sans-serif">nlme</named-content> package
  (Pinheiro &amp; Bates, 2000) that is automatically loaded along with
  <named-content content-type="sans-serif">segmented</named-content>;
  <monospace>seg.Z</monospace> is one-sided formula to specify the
  ‘segmented’ covariate having the piecewise linear relationship with
  the response, namely the <inline-formula><alternatives>
  <tex-math><![CDATA[t_{ij}]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>t</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mi>j</mml:mi></mml:mrow></mml:msub></mml:math></alternatives></inline-formula>
  values in equation
  (<xref alt="(1)" rid="eqU003Asegmented">(1)</xref>).
  <monospace>x.diff</monospace> and <monospace>z.psi</monospace> are
  one-sided formulas to indicate the possible covariates for the slope
  difference <inline-formula><alternatives>
  <tex-math><![CDATA[\delta_i]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>δ</mml:mi><mml:mi>i</mml:mi></mml:msub></mml:math></alternatives></inline-formula>
  and for the breakpoint <inline-formula><alternatives>
  <tex-math><![CDATA[\psi_i]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>ψ</mml:mi><mml:mi>i</mml:mi></mml:msub></mml:math></alternatives></inline-formula>,
  i.e. respectively the <inline-formula><alternatives>
  <tex-math><![CDATA[x_d]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>x</mml:mi><mml:mi>d</mml:mi></mml:msub></mml:math></alternatives></inline-formula>’s
  and the <inline-formula><alternatives>
  <tex-math><![CDATA[z]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>z</mml:mi></mml:math></alternatives></inline-formula>’s
  in equations (<xref alt="(3)" rid="eqU003Achangepoint">(3)</xref>).
  Both of them default to <monospace>~1</monospace>, meaning no
  covariate, namely <inline-formula><alternatives>
  <tex-math><![CDATA[\delta=0]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mi>δ</mml:mi><mml:mo>=</mml:mo><mml:mn>0</mml:mn></mml:mrow></mml:math></alternatives></inline-formula>
  and <inline-formula><alternatives>
  <tex-math><![CDATA[\kappa=0]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mi>κ</mml:mi><mml:mo>=</mml:mo><mml:mn>0</mml:mn></mml:mrow></mml:math></alternatives></inline-formula>.
  Dependence on covariates of the linear parameters
  <inline-formula><alternatives>
  <tex-math><![CDATA[\beta_{0i}]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>β</mml:mi><mml:mrow><mml:mn>0</mml:mn><mml:mi>i</mml:mi></mml:mrow></mml:msub></mml:math></alternatives></inline-formula>
  and <inline-formula><alternatives>
  <tex-math><![CDATA[\beta_{1i}]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>β</mml:mi><mml:mrow><mml:mn>1</mml:mn><mml:mi>i</mml:mi></mml:mrow></mml:msub></mml:math></alternatives></inline-formula>
  can be modelled via appropriate main effects or interaction terms to
  be included in the starting <monospace>obj</monospace>.
  <monospace>psi.link</monospace> specifies which sub-regression model
  should be employed for the breakpoint, linear or logistic, as
  discussed in the previous section.</p>
  <p><monospace>random</monospace> allows to set the random structure of
  the model, namely the covariance matrix in equation
  (<xref alt="(4)" rid="eqU003Anormal.re">(4)</xref>). It should be a
  list with a formula for the clustering variable, typically the subject
  identifier. The formula can include any linear variable in the model
  and, more importantly, the specific terms <monospace>U</monospace> and
  <monospace>G0</monospace> to set random effects, respectively for the
  difference-in-slope (the <inline-formula><alternatives>
  <tex-math><![CDATA[d_i]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>d</mml:mi><mml:mi>i</mml:mi></mml:msub></mml:math></alternatives></inline-formula>’s),
  and for breakpoint (the <inline-formula><alternatives>
  <tex-math><![CDATA[k_i]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>k</mml:mi><mml:mi>i</mml:mi></mml:msub></mml:math></alternatives></inline-formula>’s).
  Some possible specifications of the random effects covariance in
  (<xref alt="(4)" rid="eqU003Anormal.re">(4)</xref>) using the
  constructors of positive-definite matrix classes in the package
  <named-content content-type="sans-serif">nlme</named-content>, are
  reported below. We refer to model
  (<xref alt="(1)" rid="eqU003Asegmented">(1)</xref>), with the
  <inline-formula><alternatives>
  <tex-math><![CDATA[t_{ij}]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>t</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mi>j</mml:mi></mml:mrow></mml:msub></mml:math></alternatives></inline-formula>
  values represented by the variable <monospace>time</monospace>, and
  clustering variable <monospace>id</monospace>.</p>
  <def-list>
    <def-item>
      <term>i</term>
      <def>
        <p><monospace>random=list(id=pdDiag(~1+time+U+G0))</monospace>:
        independent random effects in each model parameter, namely the
        covariance matrix is diagonal;</p>
      </def>
    </def-item>
    <def-item>
      <term>ii</term>
      <def>
        <p><monospace>random=list(id=pdBlocked(list(pdDiag(~1+time), pdSymm(~U+G0-1))))</monospace>:
        a block diagonal covariance matrix, where the second block
        assumes correlated random effects, namely all covariances set to
        zero but <inline-formula><alternatives>
        <tex-math><![CDATA[\sigma_{dk}]]></tex-math>
        <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>σ</mml:mi><mml:mrow><mml:mi>d</mml:mi><mml:mi>k</mml:mi></mml:mrow></mml:msub></mml:math></alternatives></inline-formula>;</p>
      </def>
    </def-item>
    <def-item>
      <term>iii</term>
      <def>
        <p><monospace>random=list(id=pdBlocked(list(pdSymm(~1+time), pdSymm(~U+G0-1))))</monospace>:
        a block diagonal covariance matrix, where both the blocks assume
        correlated random effects, namely all covariances set to zero
        but <inline-formula><alternatives>
        <tex-math><![CDATA[\sigma_{dk}]]></tex-math>
        <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>σ</mml:mi><mml:mrow><mml:mi>d</mml:mi><mml:mi>k</mml:mi></mml:mrow></mml:msub></mml:math></alternatives></inline-formula>
        and <inline-formula><alternatives>
        <tex-math><![CDATA[\sigma_{b_0b_1}]]></tex-math>
        <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>σ</mml:mi><mml:mrow><mml:msub><mml:mi>b</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:msub><mml:mi>b</mml:mi><mml:mn>1</mml:mn></mml:msub></mml:mrow></mml:msub></mml:math></alternatives></inline-formula>;</p>
      </def>
    </def-item>
    <def-item>
      <term>iv</term>
      <def>
        <p><monospace>random=list(id=pdSymm(~1+time+U+G0))</monospace>:
        non-independent random effects, i.e. the full covariance matrix
        is estimated.</p>
      </def>
    </def-item>
  </def-list>
  <p>The four specifications above are listed according their
  complexity: the first one is the simplest and, probably, it could
  represent the first option when one is interested in assessing if
  heterogeneity is supported by data. For this very reason,
  <monospace>segmented.lme()</monospace> simplifies that by also
  accepting in <monospace>random</monospace> a simple formula; in other
  words, <monospace>random=id~time+U+G0</monospace> will set independent
  random effects without specifying <monospace>pdDiag</monospace>. In
  item iv, we want to estimate an unstructured covariance matrix with 4
  variances and 6 covariances. Of course, the more complex the model,
  the better the fit and corresponding predictions, but also the heavier
  the corresponding computational burden which could make model
  estimation more demanding: namely overfitting with unsuccessful fits.
  Roughly speaking, if the model being fitted is not supported by data
  (for instance unnecessary covariances or even variances), troubles can
  arise in reaching convergence. This is true also in linear mixed
  models, but it is enhanced in nonlinear mixed models and in the
  segmented, in particular, see Example 2 in sec 3.2.</p>
  <p>The object resulting from <monospace>segmented.lme()</monospace> is
  a list of class ‘segmented.lme’, with some related methods, such as
  <monospace>print.segmented.lme</monospace>,
  <monospace>summary.segmented.lme</monospace>,
  <monospace>vcov.segmented.lme</monospace>, and the plot method
  <monospace>plot.segmented.lme</monospace>. In particular, the ‘plot’
  method can be used to produce graphics of the resulting model, namely
  the fitted segmented lines along with observations. The function with
  its main arguments is</p>
  <preformat>plot.segmented.lme(x, level=1, id = NULL, res = TRUE, pop = FALSE,
           yscale = 1, xscale=1,  n.plot, by=NULL, ...)</preformat>
  <p><monospace>x</monospace> is the fit object returned by
  <monospace>segmented.lme()</monospace>, and
  <monospace>level</monospace> refers to the level of grouping, with
  level zero corresponding to the population fitted values;
  <monospace>id</monospace> specifies which profiles should be drawn
  (default to <monospace>NULL</monospace> meaning all profiles);
  <monospace>res=TRUE</monospace> indicates if the plot should also
  include the observations; finally <monospace>pop=TRUE</monospace> adds
  the population (i.e. based on fixed effects only) estimates. The
  remaining arguments affect the appearance.
  <monospace>yscale</monospace> and <monospace>xscale</monospace>
  regulate the <inline-formula><alternatives>
  <tex-math><![CDATA[y]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>y</mml:mi></mml:math></alternatives></inline-formula>
  and the <inline-formula><alternatives>
  <tex-math><![CDATA[x]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>x</mml:mi></mml:math></alternatives></inline-formula>-scale
  of the figures: if negative values are supplied, ‘individual’, i.e.
  subject-specific limits are used, otherwise the common limits are
  obtained by considering the ranges of all subjects. Finally
  <monospace>n.plot</monospace> is a vector to be passed to
  <monospace>mfrow</monospace> when multiple plots have to be
  produced.</p>
  <p>If the fixed-effect (i.e. <monospace>level=0</monospace>)
  relationship depends on some covariates (included via interactions in
  the starting lme fit or via the arguments
  <monospace>x.diff</monospace> and/or <monospace>z.psi</monospace> of
  <monospace>segmented.lme</monospace>), the argument
  <monospace>by</monospace> allows to specify for which covariate
  pattern the relationships has to be drawn, see examples in the next
  section.</p>
</sec>
<sec id="fitting-the-model-in-practice">
  <title>Fitting the model in practice</title>
  <p>Broadly speaking, maximization of log marginal likelihood is quite
  a difficult task in nonlinear mixed models, even under the standard
  Gaussian assumptions for the <inline-formula><alternatives>
  <tex-math><![CDATA[\epsilon]]></tex-math>
  <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>ϵ</mml:mi></mml:math></alternatives></inline-formula>’s
  in (<xref alt="(1)" rid="eqU003Asegmented">(1)</xref>) and for the
  random effects in (<xref alt="(4)" rid="eqU003Anormal.re">(4)</xref>).
  The load is enhanced in segmented mixed models as the breakpoints make
  the model non regular. The approach implemented in
  <monospace>segmented.lme</monospace>, based on the aforementioned
  Gaussian assumptions, is discussed in detail in Muggeo et al. (2014)
  and relies on iterative fitting of simple linear mixed models via the
  <monospace>lme()</monospace> function of the
  <named-content content-type="sans-serif">nlme</named-content> package.
  The algorithm is quite efficient but, due to possible local optima,
  bootstrap restarting (Wood, 2001) is also implemented to escape the
  local solutions where the algorithm can get stuck.</p>
  <sec id="example-1-real-data">
    <title>Example 1: real data</title>
    <p>The dataframe <monospace>glucoseData</monospace> shipped with the
    package includes data on <inline-formula><alternatives>
    <tex-math><![CDATA[n=33]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mi>n</mml:mi><mml:mo>=</mml:mo><mml:mn>33</mml:mn></mml:mrow></mml:math></alternatives></inline-formula>
    patients (in two groups, Control and Obese) who took a standard
    glucose tolerance test. The goal was to assess the pattern of
    phosphate elimination (<monospace>phos</monospace>) with respect to
    time after introduction: therefore the response measurements are
    plasma inorganic phosphate (inversely related to glucose level)
    taken at the beginning and 0.5, 1, 1.5, 2, 3, 4, and 5 hours after
    introduction. Data come from Zerbe (1979) and have been analysed
    also in Cudeck &amp; Klebe (2002).</p>
    <p>A first look to data can be provided by scatterplots for each
    subject,</p>
    <preformat>&gt; plot(groupedData(phos~time|subj,data=glucoseData)) #plot not shown</preformat>
    <p>The Phosphate level decreases immediately after administration
    and recovers subsequently, which suggests that a segmented mixed
    models could be a reasonable tool for the analysis. To fit the
    model, we first fit the starting linear mixed model via
    <monospace>lme()</monospace>, and then add the piecewise-linear
    relationship via <monospace>segmented.lme()</monospace>, which does
    not need to be called explicitly as it is a <italic>method</italic>
    function in the
    <named-content content-type="sans-serif">R</named-content>
    philosophy. Hence</p>
    <preformat>&gt; o &lt;-lme(phos~time, random=~1|subj, data=glucoseData)
&gt; os &lt;-segmented(o, ~time, random=subj~1+time+U+G0)</preformat>
    <p>With respect to the starting lme object,
    <monospace>segmented.lme()</monospace> updates the fixed part
    formula by adding the slope-difference term along with the
    breakpoint, and replaces the <monospace>random</monospace> statement
    by the new one; as discussed in the previous section, here we use a
    simple formula to set independent random effects. When implementing
    the bootstrap restarting, the bootstrap samples are randomly drawn,
    leading to select different starting values at each run; however,
    the global optimum is evaluated on the original dataset, and
    therefore the final solution is expected to be independent of the
    bootstrap runs, at least when data are not excessively noisy.
    However, to make fully replicable the analysis on the same data,
    including the ‘path’ driving to the final solution,
    <monospace>segmented.lme()</monospace> uses a seed coming from the
    response values; as an alternative, it is also possible to set it
    explicitly in the call via <monospace>seg.control()</monospace>,
    namely
    <monospace>segmented(.., control=seg.control(seed=..))</monospace>.</p>
    <p>The print method returns some basic information, just like the
    print method for lme objects, namely point estimates for the fixed
    effects and the variance components</p>
    <preformat>&gt; os
Segmented linear mixed-effects model fit by REML
  Data: glucoseData 
  Log-restricted-likelihood (approx): -155.9955
  Bootstrap restarting on 6 samples; 1 different solution(s)

Fixed: phos ~ time + U + G0 
(Intercept)        time           U          G0 
  4.3050486  -0.8483528   1.2048822   1.6624618 
  psi.link = identity

Random effects:
 Formula: ~time + U + G0 | subj
 Structure: Diagonal
        (Intercept)       time           U        G0 Residual
StdDev:    0.675425 0.00189322 0.003314052 0.4340041 0.365604

Number of Observations: 264
Number of Groups: 33 </preformat>
    <p>The fixed effects correspond to estimates of the intercept, left
    slope and slope-difference (coefficient of
    <monospace>U</monospace>), while the coefficient of
    <monospace>G0</monospace> is the changepoint estimate (i.e.
    <inline-formula><alternatives>
    <tex-math><![CDATA[\hat\psi=1.662]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mover><mml:mi>ψ</mml:mi><mml:mo accent="true">̂</mml:mo></mml:mover><mml:mo>=</mml:mo><mml:mn>1.662</mml:mn></mml:mrow></mml:math></alternatives></inline-formula>).
    The high standard deviations for the intercepts and
    <monospace>G0</monospace> underline the high heterogeneity of the
    subjects with respect to their intercepts and changepoints.</p>
    <p>The first output of the print method (and also of summary, see
    later) is the log (marginal) likelihood value which comes from an
    approximation, as illustrated in Muggeo et al. (2014). Model fitting
    via maximization of the actual likelihood requires heavy
    computations and numerical integration that could lead to a
    considerable computational burden. Simulation studies presented in
    Muggeo et al. (2014) and in the end of section 3, show that such
    approximation works reasonable well in practice, while maintaining
    an acceptable execution times.</p>
    <p>According to results of model <monospace>os</monospace>, all
    subjects share the same V-shaped pattern (quite low
    <inline-formula><alternatives>
    <tex-math><![CDATA[\hat\sigma_{b_1}]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mover><mml:mi>σ</mml:mi><mml:mo accent="true">̂</mml:mo></mml:mover><mml:msub><mml:mi>b</mml:mi><mml:mn>1</mml:mn></mml:msub></mml:msub></mml:math></alternatives></inline-formula>
    and <inline-formula><alternatives>
    <tex-math><![CDATA[\hat\sigma_d]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mover><mml:mi>σ</mml:mi><mml:mo accent="true">̂</mml:mo></mml:mover><mml:mi>d</mml:mi></mml:msub></mml:math></alternatives></inline-formula>),
    although their changepoints are different. However, data refer to
    Control and Obese patients, therefore it could be interesting to
    assess whether the two V-shaped relationships are the same or not in
    the two groups. Therefore, we include the term
    <monospace>group</monospace> as main effect and interaction term in
    the starting lme fit, and also in the arguments
    <monospace>x.diff</monospace> and <monospace>z.psi</monospace>,</p>
    <preformat>&gt; o1&lt;-lme(phos~time*group, random=~1|subj, data=glucoseData)
&gt; os1&lt;-segmented(o1, ~time, z.psi=~group, x.diff=~group, 
+                random=subj~1+time+U+G0)</preformat>
    <p>When there are interaction terms, the
    <monospace>summary.lme()</monospace> returns results by assembling
    the estimates of each parameter of the regression equation
    (<xref alt="(1)" rid="eqU003Asegmented">(1)</xref>),</p>
    <preformat>&gt; summary(os1)
Segmented mixed-effects model fit by REML
       AIC      BIC    logLik
  327.5191 373.7076 -150.7596
 Bootstrap restarting on 6 samples;  1 different solution(s)

Random effects:
 Formula: ~time + U + G0 | subj
 Structure: Diagonal
        (Intercept)       time           U        G0  Residual
StdDev:   0.5619773 0.05488536 0.003517548 0.2958991 0.3511334

Fixed effects:
                  Value Std.Error  DF t-value p-value
(Intercept)      4.0349    0.1788 225  22.567 0.00000
groupObese       0.5113    0.2271  31   2.252 0.03155
-- leftS:                                            
time            -1.2796    0.1415 225  -9.045 0.00000
time:groupObese  0.5460    0.1521 225   3.589 0.00041
-- diffS:                                            
U                1.6481    0.1446 225  11.397        
U.groupObese    -0.5350    0.1611 225  -3.322 0.00104
-- break:                                            
G0               1.1086    0.1170 225                
G.groupObese     1.0465    0.1714 225   6.104 0.00000
 psi.link = identity 

Standardized Within-Group Residuals:
        Min          Q1         Med          Q3         Max 
-2.73565679 -0.55307557  0.01409987  0.63157506  3.20513447 

Number of Observations: 264
Number of Groups: 33 </preformat>
    <p>As in the summary of usual lme fits, the last columns return
    <inline-formula><alternatives>
    <tex-math><![CDATA[t]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>t</mml:mi></mml:math></alternatives></inline-formula>-values
    relevant to the null hypothesis of zero coefficient, and
    <inline-formula><alternatives>
    <tex-math><![CDATA[p]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>p</mml:mi></mml:math></alternatives></inline-formula>-values
    relying on a Gaussian distribution of the estimator <italic>under
    the null hypothesis</italic>. It is well known that such
    approximation is not reliable for <inline-formula><alternatives>
    <tex-math><![CDATA[\hat\delta_0]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mover><mml:mi>δ</mml:mi><mml:mo accent="true">̂</mml:mo></mml:mover><mml:mn>0</mml:mn></mml:msub></mml:math></alternatives></inline-formula>
    (Muggeo, 2016, 2025), and therefore the term
    <monospace>U</monospace> misses the <inline-formula><alternatives>
    <tex-math><![CDATA[p]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>p</mml:mi></mml:math></alternatives></inline-formula>-value;
    the corresponding <inline-formula><alternatives>
    <tex-math><![CDATA[t]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>t</mml:mi></mml:math></alternatives></inline-formula>-value
    is displayed, as it can be used to quantify the strength of the
    slope change estimate regardless of the reference null distribution.
    For the changepoint, testing for a zero value is meaningless, and
    therefore both the <inline-formula><alternatives>
    <tex-math><![CDATA[t]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>t</mml:mi></mml:math></alternatives></inline-formula>-
    and the <inline-formula><alternatives>
    <tex-math><![CDATA[p]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>p</mml:mi></mml:math></alternatives></inline-formula>-value
    have been dropped. However, for the remaining regression
    coefficients including those in equations
    (<xref alt="(3)" rid="eqU003Achangepoint">(3)</xref>), the Normal
    approximation for the sampling distributions is generally understood
    to be valid, making the <inline-formula><alternatives>
    <tex-math><![CDATA[p]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>p</mml:mi></mml:math></alternatives></inline-formula>-values
    acceptable from a statistical viewpoint, at least in large
    samples.</p>
    <p>The <monospace>confint</monospace> method returns the interval
    estimates for the model parameters, using again the Wald statistic
    relying on a limiting Gaussian distribution and asymptotic
    model-based standard errors (that are returned internally by the
    <monospace>vcov</monospace> method)</p>
    <preformat>&gt; t(confint(os1))
                       2.5%      97.5%
(Intercept)      3.68444601  4.3853227
time            -1.55692116 -1.0023407
groupObese       0.06626251  0.9563422
U                1.36470061  1.9315360
G0               0.87932679  1.3378761
G.groupObese     0.71045946  1.3825110
U.groupObese    -0.85069494 -0.2193703
time:groupObese  0.24784367  0.8440827</preformat>
    <p>By looking at the results, the curve for the Obese patients can
    be considered different from the Control group. More specifically,
    the Obese group has a higher intercept
    (<inline-formula><alternatives>
    <tex-math><![CDATA[4.0349+0.5113]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mn>4.0349</mml:mn><mml:mo>+</mml:mo><mml:mn>0.5113</mml:mn></mml:mrow></mml:math></alternatives></inline-formula>),
    a less steep left slope (<inline-formula><alternatives>
    <tex-math><![CDATA[-1.2796+0.5460]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mi>−</mml:mi><mml:mn>1.2796</mml:mn><mml:mo>+</mml:mo><mml:mn>0.5460</mml:mn></mml:mrow></mml:math></alternatives></inline-formula>),
    and a larger changepoint (<inline-formula><alternatives>
    <tex-math><![CDATA[1.1086+1.0465]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mn>1.1086</mml:mn><mml:mo>+</mml:mo><mml:mn>1.0465</mml:mn></mml:mrow></mml:math></alternatives></inline-formula>).
    To have estimates of the slopes and breakpoints in both groups, we
    use the functions <monospace>slope()</monospace> and
    <monospace>breakpoint()</monospace>,</p>
    <preformat>&gt; slope(os1) #in the baseline group
                 Est.     St.Err t value   0.95.low    0.95.up
leftSlope  -1.2796309 0.14147721  -9.045 -1.5569212 -1.0023407
rightSlope  0.3684874 0.03629992  10.151  0.2973409  0.4396339
&gt;
&gt; slope(os1, by=list(group=&quot;Obese&quot;))
                 Est.     St.Err t value   0.95.low    0.95.up
leftSlope  -0.7336678 0.05585699 -13.135 -0.8431455 -0.6241901
rightSlope  0.3794180 0.04677694   8.111  0.2877368  0.4710991
    </preformat>
    <p>The former call returns the slopes corresponding to the baseline
    values of the interaction term, i.e.
    <monospace>group='Control'</monospace>, while in the latter, we
    specify the covariate and its corresponding label of interest via
    argument <monospace>by</monospace> to obtain the slopes in the Obese
    group. Likewise, for the estimated breakpoint we type</p>
    <preformat>&gt; breakpoint(os1) #in the baseline group
        Est.    St.Err  0.95.low  0.95.up
psi 1.108601 0.1296831 0.8793268 1.337876
&gt;
&gt; breakpoint(os1, by=list(group=&quot;Obese&quot;))
        Est.    St.Err  0.95.low  0.95.up
psi 2.155087 0.2701112  1.909431 2.400742</preformat>
    <p>As in <monospace>confint</monospace>, the confidence intervals
    returned by <monospace>slope()</monospace> and
    <monospace>breakpoint()</monospace> are computed using the
    approximate Gaussian distribution of the Wald statistic. We remark
    such approximation is generally reliable if the sample is large, the
    breakpoint is understood to exist, and the segmented relationship is
    rather clear-cut. We present results from a small simulation study
    in the next section to bear this out.</p>
    <p>Some graphical outputs could complete the analysis. For instance,
    to visualize the fitted segmented profiles, the method
    <monospace>plot</monospace> described in the previous section can be
    used. Thus typing</p>
    <preformat>&gt; plot(os1, n.plot=c(5,7), res=TRUE, 
+      l.col=rep(c(4,2), c(13,20)), l.lty=rep(c(1,2), c(13,20)),
+      ylab=&quot;Phosphate level (mg/dl)&quot;, xlab=&quot;Hours after challenge&quot;)</preformat>
    <p>produces the output of Figure
    <xref alt="1" rid="figU003Aex1">1</xref>. Dots are the observed data
    (via <monospace>res=TRUE</monospace>), and the lines portray the
    individual profiles (given by the sum of fixed effects and random
    predictions), while symbols on the bottom locate the individual
    changepoints. In this example there <inline-formula><alternatives>
    <tex-math><![CDATA[n=33]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mi>n</mml:mi><mml:mo>=</mml:mo><mml:mn>33</mml:mn></mml:mrow></mml:math></alternatives></inline-formula>
    subjects, so we decide to put the individual panels into 5 rows and
    7 columns (<monospace>n.plot=c(5,7)</monospace>), and to use the
    blue and continuous line to display the first 13 subjects (of the
    Control group), and the red and dashed line for the 20 individuals
    of the Obese group. We specify such color and line type vectors in
    the argument <monospace>l.col</monospace> and
    <monospace>l.lty</monospace>.</p>
    <fig id="figU003Aex1">
      <caption><p> Output of
      <monospace>plot.segmented.lme(..)</monospace> to display the
      individual profiles. The continuous blue and the dashed red lines
      refer to the Control and Obese groups respectively. </p></caption>
      <graphic mimetype="application" mime-subtype="pdf" xlink:href="plot1N.pdf" />
    </fig>
    <p>Finally, for illustrative purposes, we also report additional
    plots in Figure <xref alt="2" rid="figU003Aex2">2</xref> by running
    the following code</p>
    <preformat>&gt; par(mfrow=c(1,2))
&gt; #left panel (population estimates)
&gt; plot(os1, level=0, vline=TRUE, ylim=c(1,6), p.lwd=4, p.col=4,
+      pos.leg=&quot;topleft&quot;, text.leg = &quot;Control&quot; )
&gt; plot(os1, level=0, by=list(group=&quot;Obese&quot;), add=TRUE, p.col=2, p.lty=2,
+      pos.leg=&quot;top&quot;, text.leg = &quot;Obese&quot; ,vline=TRUE, p.lwd=5)
&gt; #right panel
&gt; plot(os1, n.plot=1, l.col=2:6, ylim=c(1,6), dens.col=grey(.5), res=FALSE)</preformat>
    <p>In the left panel we first plot the baseline population segmented
    relationship in the baseline (Control) group, then we add the Obese
    group estimate via arguments <monospace>add</monospace> and
    <monospace>by</monospace>; <monospace>p.col</monospace> and
    <monospace>p.lwd</monospace> are used to set width and color of the
    segmented lines. On the right panel, we display the subject-specific
    profiles along with a kernel density of the individual breakpoints
    on the bottom. Unlike the previous plot in Figure
    <xref alt="1" rid="figU003Aex1">1</xref>, we do not specify the axes
    labels, but we let the function to take the variable names, as
    happen in the other plot functions in
    <named-content content-type="sans-serif">R</named-content>.</p>
    <fig id="figU003Aex2">
      <caption><p> Additional output of
      <monospace>plot.segmented.lme(..)</monospace>. Marginal profiles
      in the left panel, and subject-specific predictions in the right.
      On the bottom, the nonparametric density estimate of the
      individual breakpoints is optionally reported (via the
      <monospace>dens.col</monospace>): the bimodality comes from having
      different fixed-effect breakpoint estimates in two groups.
      <monospace>time</monospace> in the <inline-formula><alternatives>
      <tex-math><![CDATA[x]]></tex-math>
      <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>x</mml:mi></mml:math></alternatives></inline-formula>-axis
      refers hours after challenge and <monospace>phos</monospace> on
      the <inline-formula><alternatives>
      <tex-math><![CDATA[y]]></tex-math>
      <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>y</mml:mi></mml:math></alternatives></inline-formula>-axis
      to phosphate level (mg/dl).</p></caption>
      <graphic mimetype="application" mime-subtype="pdf" xlink:href="plot2N.pdf" />
    </fig>
    <p>By looking at the variance estimates of model
    <monospace>os1</monospace>, we note that the heterogeneity in the
    slope difference is quite low, <inline-formula><alternatives>
    <tex-math><![CDATA[\hat\sigma_d=0.0035]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:msub><mml:mover><mml:mi>σ</mml:mi><mml:mo accent="true">̂</mml:mo></mml:mover><mml:mi>d</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:mn>0.0035</mml:mn></mml:mrow></mml:math></alternatives></inline-formula>.
    While the estimation process did not return any error or warning
    message, we could assess whether the fit could be simplified by
    removing it in the interest of the parsimony principle. However, in
    the same perspective as model selection, we should also assess if
    data support a more complex model, for instance by also estimating
    <inline-formula><alternatives>
    <tex-math><![CDATA[\sigma_{b_0b_1}]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>σ</mml:mi><mml:mrow><mml:msub><mml:mi>b</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:msub><mml:mi>b</mml:mi><mml:mn>1</mml:mn></mml:msub></mml:mrow></mml:msub></mml:math></alternatives></inline-formula>
    and <inline-formula><alternatives>
    <tex-math><![CDATA[\sigma_{dk}]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>σ</mml:mi><mml:mrow><mml:mi>d</mml:mi><mml:mi>k</mml:mi></mml:mrow></mml:msub></mml:math></alternatives></inline-formula>,
    for instance. To this end, we exploit the usual
    <monospace>update()</monospace> function in
    <named-content content-type="sans-serif">R</named-content>, to
    change just a single argument value with respect to
    <monospace>os1</monospace>,</p>
    <preformat>&gt; os2&lt;-update(os1, random=subj~time+G0)
&gt; os3&lt;-update(os1, random=list(subj=
+             pdBlocked(list(pdSymm(~1+time), pdSymm(~U+G0-1)))))
&gt; AIC(os1,os2,os3)
    df      AIC
os1 13 327.5191
os2 12 325.5192
os3 15 327.1868</preformat>
    <p>While the AIC values (and the BIC as well) suggest that
    <monospace>os2</monospace> could be preferred, it should be remarked
    that model selection is a hot and open research topic in mixed
    models. We do not pursue the topic further, as it is beyond the
    scope of this paper.</p>
  </sec>
  <sec id="example-2-simulated-data">
    <title>Example 2: simulated data</title>
    <p>As a further example we use simulated data. The aim is twofold:
    to illustrate the code for somewhat more complicated modelling, and
    to ‘assess’ the results reliability by comparing them with the true
    values. We discuss results for a single dataset and then across
    several datasets in a small simulation study at the end of
    section.</p>
    <p>We simulate data by means of the function
    <monospace>sim.seg()</monospace> that, with its
    <italic>main</italic> arguments, reads as</p>
    <preformat>&gt; args(sim.seg)
  function (N, ni, fixEff = c(2, -0.2, 0.3, 0.4), 
  S = diag(c(0.05, 0.05, 0.05, 0.07)^2), seg.Z = NULL, z.psi, x.diff, 
  sd.eps = 0.01, seed) </preformat>
    <p><monospace>N</monospace> and <monospace>ni</monospace> are the
    number of subjects and the number of measurements per subject,
    <monospace>fixEff</monospace> indicates the 4 fixed parameters
    <inline-formula><alternatives>
    <tex-math><![CDATA[(\beta_0,\beta_1,\delta_0,\kappa_0)]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:msub><mml:mi>β</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>β</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>δ</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>κ</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo stretchy="false" form="postfix">)</mml:mo></mml:mrow></mml:math></alternatives></inline-formula>,
    <monospace>S</monospace> the covariance matrix in
    (<xref alt="(4)" rid="eqU003Anormal.re">(4)</xref>),
    <monospace>seg.Z</monospace> the segmented covariate, and
    <monospace>x.diff</monospace> and <monospace>z.psi</monospace> the
    covariates and corresponding coefficients for the sub-regression
    models for <inline-formula><alternatives>
    <tex-math><![CDATA[\delta_i]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>δ</mml:mi><mml:mi>i</mml:mi></mml:msub></mml:math></alternatives></inline-formula>
    and <inline-formula><alternatives>
    <tex-math><![CDATA[\psi_i]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>ψ</mml:mi><mml:mi>i</mml:mi></mml:msub></mml:math></alternatives></inline-formula>
    using a linear link. Both arguments are specified via a list with
    coefficient(s) and covariate values, see the example below. It is
    assumed that such variables are subject-specific, so
    <inline-formula><alternatives>
    <tex-math><![CDATA[N]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>N</mml:mi></mml:math></alternatives></inline-formula>
    values have to be provided for each variable: a
    <inline-formula><alternatives>
    <tex-math><![CDATA[N]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>N</mml:mi></mml:math></alternatives></inline-formula>-dimensional
    vector for a single covariate (which needs a single coefficient),
    and a <inline-formula><alternatives>
    <tex-math><![CDATA[N\times p]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mi>N</mml:mi><mml:mo>×</mml:mo><mml:mi>p</mml:mi></mml:mrow></mml:math></alternatives></inline-formula>
    matrix for <inline-formula><alternatives>
    <tex-math><![CDATA[p]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>p</mml:mi></mml:math></alternatives></inline-formula>
    covariates (and <inline-formula><alternatives>
    <tex-math><![CDATA[p]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>p</mml:mi></mml:math></alternatives></inline-formula>
    coefficients have to be specified). We set the seeds just to
    reproduce the results</p>
    <preformat>&gt; N=30
&gt; set.seed(123)
&gt; Xd=runif(N, 0,2) #1 covariate for delta (N-vector)
&gt; Z=cbind(1:N/N, rnorm(N)) #2 covariates for psi (N x 2 matrix)
&gt; dd=sim.seg(N, ni=12, S=diag(c(.12,.05,.3,.1)^2),
+          x.diff=list(.5,Xd), z.psi=list(c(.3,-.2),Z), sd.eps=.003, seed=15)
&gt; 
&gt; d=dd$data
&gt;
&gt; head(d,3)
  id        y          x     Xdif      Zpsi1    Zpsi2
1  1 1.931448 0.06693461 0.575155 0.03333333 1.786913
2  1 1.932327 0.09619888 0.575155 0.03333333 1.786913
3  1 1.934428 0.10839553 0.575155 0.03333333 1.786913</preformat>
    <p>In the simulated dataset, <monospace>Xdif</monospace> is the
    covariate for the slope change parameter, and
    <monospace>Zpsi1</monospace> and <monospace>Zpsi2</monospace> affect
    the changepoint.</p>
    <p>To fit the segmented model, we can avoid to fit a lme object
    beforehand and specify the fixed effect formula directly in
    <monospace>segmented.lme()</monospace> which has to be called
    explicitly; we also need to indicate the dataframe where the
    variables are stored</p>
    <preformat>&gt; oseg1 &lt;- segmented.lme(y~x, ~x, x.diff=~Xdif, z.psi=~Zpsi1+Zpsi2, 
+                        random=id~1+x+U+G0, data=d)</preformat>
    <p>Out of curiosity, we can compare the true fixed effect versus the
    corresponding estimates extracted by
    <monospace>fixef()</monospace>,</p>
    <preformat>&gt; cbind(true=c(2,-0.2,0.3,0.4,0.3,-0.2,0.5), est=fixef(oseg1))
            true        est
(Intercept)  2.0  2.0457565
x           -0.2 -0.1990579
U            0.3  0.2526996
G0           0.4  0.3547105
G.Zpsi1      0.3  0.3545174
G.Zpsi2     -0.2 -0.1827813
U.Xdif       0.5  0.5980579</preformat>
    <p>while for the random effects, we take the main diagonal of the
    covariance matrix extracted by
    <monospace>getVarCov()</monospace></p>
    <preformat>&gt; cbind(true=c(0.12,0.05,0.30,0.10), est=sqrt(diag(getVarCov(oseg1))))
            true        est
(Intercept) 0.12 0.11410761
x           0.05 0.05667073
U           0.30 0.25146646
G0          0.10 0.10089096</preformat>
    <p>As in the previous example, to compute correctly the slopes and
    breakpoints accounting for the interaction variables, we need to
    specify the covariate pattern in the argument
    <monospace>by</monospace>. For instance, for the breakpoint
    depending on <monospace>Zpsi1</monospace> and
    <monospace>Zpsi2</monospace>, and assuming
    <inline-formula><alternatives>
    <tex-math><![CDATA[0.5]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mn>0.5</mml:mn></mml:math></alternatives></inline-formula>
    and <inline-formula><alternatives>
    <tex-math><![CDATA[-1.2]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mi>−</mml:mi><mml:mn>1.2</mml:mn></mml:mrow></mml:math></alternatives></inline-formula>
    are two values of interest, we type</p>
    <preformat>&gt; breakpoint(oseg1, by=list(Zpsi1=.5,Zpsi2=-1.2))
         Est.     St.Err  0.95.low   0.95.up
psi 0.7513068 0.02449226 0.6874128 0.8152007</preformat>
    <p><monospace>oseg1$psi.i</monospace> includes the predicted
    <inline-formula><alternatives>
    <tex-math><![CDATA[N]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>N</mml:mi></mml:math></alternatives></inline-formula>
    changepoints with two attributes:
    <monospace>&quot;ni&quot;</monospace> the number of measurements per
    subject, and <monospace>&quot;is.break&quot;</monospace> a logical
    vector indicating whether the individual changepoint is within the
    covariate range or not. Possible <monospace>FALSE</monospace> values
    identify subjects wherein the changepoint has been predicted on the
    boundary, and whose corresponding profiles are estimated to be
    linear. Thus</p>
    <preformat>&gt; which(!attr(oseg1$psi.i, &quot;is.break&quot;))
 4 28 
 4 28 </preformat>
    <p>Hence, the model identifies two subjects with a fitted linear
    profile, and it is worth checking if such ‘predictions’ are correct.
    In order to do that, note the object returned by
    <monospace>sim.seg()</monospace> also includes the actual
    breakpoints (<monospace>dd$psi.i</monospace>), and its percentile
    (<monospace>dd$perc.psi</monospace>) with respect to corresponding
    covariate ranges. Clearly, if the percentile is 0 or 1, the
    breakpoint is on boundary, leading to data simulated according to
    underlying linear profiles. We have</p>
    <preformat>&gt; which(dd$perc.psi%in%c(0,1))
[1]  4 28</preformat>
    <p>Thus, we can claim predictions are correct to detect subjects
    with no change. We display their predicted linear profiles along
    with some additional segmented profiles (the 6th, the 5th and the
    10th, say) using their specific <inline-formula><alternatives>
    <tex-math><![CDATA[x]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>x</mml:mi></mml:math></alternatives></inline-formula>-
    and <inline-formula><alternatives>
    <tex-math><![CDATA[y]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>y</mml:mi></mml:math></alternatives></inline-formula>-scales,</p>
    <preformat>&gt; plot(oseg1, id=c(4,28,6,5,10),n.plot=c(1,5), yscale=-1,xscale=-1)</preformat>
    <fig id="figU003Aex3">
      <caption><p> Output for 5 subjects on their individual
      <inline-formula><alternatives>
      <tex-math><![CDATA[x]]></tex-math>
      <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>x</mml:mi></mml:math></alternatives></inline-formula>
      and <inline-formula><alternatives>
      <tex-math><![CDATA[y]]></tex-math>
      <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>y</mml:mi></mml:math></alternatives></inline-formula>
      scales (via <monospace>xscale=-1</monospace> and
      <monospace>yscale=-1</monospace>). </p></caption>
      <graphic mimetype="application" mime-subtype="pdf" xlink:href="plot3N.pdf" />
    </fig>
    <p>In addition to the aforementioned linear profiles for subjects 4
    and 28, it is worth stressing the fitted line for subj# 6:
    interestingly, even if data follow an almost linear pattern, the
    model succeeds in predicting correctly the corresponding
    breakpoint.</p>
    <p>We now try to fit the same model, but with a non-null covariance
    between the breakpoint and the slope difference random effects, i.e.
    <inline-formula><alternatives>
    <tex-math><![CDATA[\sigma_{dk}\neq0]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:msub><mml:mi>σ</mml:mi><mml:mrow><mml:mi>d</mml:mi><mml:mi>k</mml:mi></mml:mrow></mml:msub><mml:mo>≠</mml:mo><mml:mn>0</mml:mn></mml:mrow></mml:math></alternatives></inline-formula>
    in (<xref alt="(4)" rid="eqU003Anormal.re">(4)</xref>).</p>
    <preformat>&gt; oseg2&lt;-update(oseg1, 
+              random=list(id=pdBlocked(list(pdDiag(~1+x), pdSymm(~U+G0-1)))))
 There were 14 warnings (use warnings() to see them)</preformat>
    <p>While the procedure succeeds in fitting the model, several
    warning messages are returned.</p>
    <preformat>&gt; warnings()
Warning messages:
1: In logLik.reStruct(object, conLin) :
  Singular precision matrix in level -1, block 28
..............
14: In logLik.reStruct(object, conLin) :
  Singular precision matrix in level -1, block 28</preformat>
    <p>The reason is that we are trying to fit a over-parametrized model
    having an additional covariance parameter which is actually zero. In
    general, when we try to estimate more parameters than the data
    support, it is not rare to run into such warnings or even error
    messages with no final fit. Starting the analysis with a simple
    structure, e.g. a diagonal matrix, for the random effects covariance
    matrix is, generally, recommended.</p>
    <p>We conclude this section by running a small simulation experiment
    using the following code. Results are displayed in Table
    <xref alt="1" rid="tabU003Asimul">1</xref> based on
    <monospace>B=300</monospace> runs rather than
    <monospace>B=3</monospace>.</p>
    <preformat>&gt; #a small simulation study
&gt; N=50
&gt; set.seed(123)
&gt; Xd=runif(N, 0, 2) #1 covariate for delta (N-vector)
&gt; Z=cbind(1:N/N, rnorm(N))
&gt; 
&gt; B=3
&gt; V=matrix(,B,4)
&gt; SE&lt;-E&lt;-matrix(,B,7)
&gt; 
&gt; for(i in 1:B){
+   dd=sim.seg(N,ni=10,S=diag(c(.12,.05,.3,.1)^2), seed=i,
+            x.diff=list(0.5,Xd), z.psi=list(c(.3,-.1),Z), sd.eps=.01)
+   d=dd$data
+   suppressWarnings(oseg1 &lt;-segmented.lme(y~x, ~x, 
+             x.diff=~Xdif, z.psi=~Zpsi1+Zpsi2, 
+             random=id~1+x+U+G0, data=d))
+   
+   V[i,]&lt;-sqrt(diag(getVarCov(oseg1)))#sd
+   E[i,]&lt;-fixef(oseg1)
+   SE[i,]&lt;-sqrt(diag(vcov(oseg1)))
+ }</preformat>
    <table-wrap>
      <caption>
        <p>Results of the simulation experiment: mean, median and
        standard deviations of the sampling distributions, and mean of
        the standard errors. The last column refers to the coverage
        levels of the 95% confidence intervals based on the Normal
        distribution of the Wald statistic. Results based on 300
        replicates.</p>
      </caption>
      <table id="tabU003Asimul">
        <thead>
          <tr>
            <th align="center"> </th>
            <th align="right"> </th>
            <th align="right"> </th>
            <th align="center" colspan="4"><italic>sampling distribution
            summary</italic></th>
            <th align="center"></th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td align="center">4-7parameter</td>
            <td align="right"></td>
            <td align="right">true</td>
            <td align="right">mean</td>
            <td align="right">med</td>
            <td align="center">sd</td>
            <td align="center"><inline-formula><alternatives>
            <tex-math><![CDATA[\bar{\mathrm{se}}]]></tex-math>
            <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mover><mml:mrow><mml:mi mathvariant="normal">s</mml:mi><mml:mi mathvariant="normal">e</mml:mi></mml:mrow><mml:mo accent="true">‾</mml:mo></mml:mover></mml:math></alternatives></inline-formula></td>
            <td align="center">CL</td>
          </tr>
          <tr>
            <td align="center"><inline-formula><alternatives>
            <tex-math><![CDATA[\beta_0]]></tex-math>
            <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>β</mml:mi><mml:mn>0</mml:mn></mml:msub></mml:math></alternatives></inline-formula></td>
            <td align="right"> </td>
            <td align="right">2.0</td>
            <td align="right">2.001</td>
            <td align="right">2.002</td>
            <td align="center">0.016</td>
            <td align="center">0.017</td>
            <td align="center">0.970</td>
          </tr>
          <tr>
            <td align="center"><inline-formula><alternatives>
            <tex-math><![CDATA[\beta_1]]></tex-math>
            <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>β</mml:mi><mml:mn>1</mml:mn></mml:msub></mml:math></alternatives></inline-formula></td>
            <td align="right"> </td>
            <td align="right"><inline-formula><alternatives>
            <tex-math><![CDATA[-0.2]]></tex-math>
            <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mi>−</mml:mi><mml:mn>0.2</mml:mn></mml:mrow></mml:math></alternatives></inline-formula></td>
            <td align="right"><inline-formula><alternatives>
            <tex-math><![CDATA[-0.199]]></tex-math>
            <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mi>−</mml:mi><mml:mn>0.199</mml:mn></mml:mrow></mml:math></alternatives></inline-formula></td>
            <td align="right"><inline-formula><alternatives>
            <tex-math><![CDATA[-0.199]]></tex-math>
            <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mi>−</mml:mi><mml:mn>0.199</mml:mn></mml:mrow></mml:math></alternatives></inline-formula></td>
            <td align="center">0.011</td>
            <td align="center">0.009</td>
            <td align="center">0.923</td>
          </tr>
          <tr>
            <td align="center"><inline-formula><alternatives>
            <tex-math><![CDATA[\delta_0]]></tex-math>
            <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>δ</mml:mi><mml:mn>0</mml:mn></mml:msub></mml:math></alternatives></inline-formula></td>
            <td align="right"> </td>
            <td align="right">0.3</td>
            <td align="right">0.279</td>
            <td align="right">0.271</td>
            <td align="center">0.092</td>
            <td align="center">0.095</td>
            <td align="center">0.937</td>
          </tr>
          <tr>
            <td align="center"><inline-formula><alternatives>
            <tex-math><![CDATA[\delta_1]]></tex-math>
            <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>δ</mml:mi><mml:mn>1</mml:mn></mml:msub></mml:math></alternatives></inline-formula></td>
            <td align="right"> </td>
            <td align="right">0.5</td>
            <td align="right">0.504</td>
            <td align="right">0.501</td>
            <td align="center">0.078</td>
            <td align="center">0.079</td>
            <td align="center">0.950</td>
          </tr>
          <tr>
            <td align="center"><inline-formula><alternatives>
            <tex-math><![CDATA[\kappa_0]]></tex-math>
            <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>κ</mml:mi><mml:mn>0</mml:mn></mml:msub></mml:math></alternatives></inline-formula></td>
            <td align="right"> </td>
            <td align="right">0.4</td>
            <td align="right">0.402</td>
            <td align="right">0.403</td>
            <td align="center">0.030</td>
            <td align="center">0.028</td>
            <td align="center">0.910</td>
          </tr>
          <tr>
            <td align="center"><inline-formula><alternatives>
            <tex-math><![CDATA[\kappa_1]]></tex-math>
            <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>κ</mml:mi><mml:mn>1</mml:mn></mml:msub></mml:math></alternatives></inline-formula></td>
            <td align="right"> </td>
            <td align="right">0.3</td>
            <td align="right">0.280</td>
            <td align="right">0.280</td>
            <td align="center">0.055</td>
            <td align="center">0.049</td>
            <td align="center">0.877</td>
          </tr>
          <tr>
            <td align="center"><inline-formula><alternatives>
            <tex-math><![CDATA[\kappa_2]]></tex-math>
            <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>κ</mml:mi><mml:mn>2</mml:mn></mml:msub></mml:math></alternatives></inline-formula></td>
            <td align="right"> </td>
            <td align="right"><inline-formula><alternatives>
            <tex-math><![CDATA[-0.1]]></tex-math>
            <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mi>−</mml:mi><mml:mn>0.1</mml:mn></mml:mrow></mml:math></alternatives></inline-formula></td>
            <td align="right"><inline-formula><alternatives>
            <tex-math><![CDATA[-0.094]]></tex-math>
            <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mi>−</mml:mi><mml:mn>0.094</mml:mn></mml:mrow></mml:math></alternatives></inline-formula></td>
            <td align="right"><inline-formula><alternatives>
            <tex-math><![CDATA[-0.094]]></tex-math>
            <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mi>−</mml:mi><mml:mn>0.094</mml:mn></mml:mrow></mml:math></alternatives></inline-formula></td>
            <td align="center">0.017</td>
            <td align="center">0.015</td>
            <td align="center">0.897</td>
          </tr>
          <tr>
            <td align="center">*[.2cm] <inline-formula><alternatives>
            <tex-math><![CDATA[\sigma_{b0}]]></tex-math>
            <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>σ</mml:mi><mml:mrow><mml:mi>b</mml:mi><mml:mn>0</mml:mn></mml:mrow></mml:msub></mml:math></alternatives></inline-formula></td>
            <td align="right"> </td>
            <td align="right">0.12</td>
            <td align="right">0.119</td>
            <td align="right">0.119</td>
            <td align="center">0.012</td>
            <td align="center">-</td>
            <td align="center">-</td>
          </tr>
          <tr>
            <td align="center"><inline-formula><alternatives>
            <tex-math><![CDATA[\sigma_{b1}]]></tex-math>
            <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>σ</mml:mi><mml:mrow><mml:mi>b</mml:mi><mml:mn>1</mml:mn></mml:mrow></mml:msub></mml:math></alternatives></inline-formula></td>
            <td align="right"> </td>
            <td align="right">0.05</td>
            <td align="right">0.052</td>
            <td align="right">0.051</td>
            <td align="center">0.014</td>
            <td align="center">-</td>
            <td align="center">-</td>
          </tr>
          <tr>
            <td align="center"><inline-formula><alternatives>
            <tex-math><![CDATA[\sigma_{d}]]></tex-math>
            <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>σ</mml:mi><mml:mi>d</mml:mi></mml:msub></mml:math></alternatives></inline-formula></td>
            <td align="right"> </td>
            <td align="right">0.30</td>
            <td align="right">0.308</td>
            <td align="right">0.307</td>
            <td align="center">0.037</td>
            <td align="center">-</td>
            <td align="center">-</td>
          </tr>
          <tr>
            <td align="center"><inline-formula><alternatives>
            <tex-math><![CDATA[\sigma_{k}]]></tex-math>
            <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>σ</mml:mi><mml:mi>k</mml:mi></mml:msub></mml:math></alternatives></inline-formula></td>
            <td align="right"> </td>
            <td align="right">0.10</td>
            <td align="right">0.090</td>
            <td align="right">0.090</td>
            <td align="center">0.011</td>
            <td align="center">-</td>
            <td align="center">-</td>
          </tr>
        </tbody>
      </table>
    </table-wrap>
    <p>The means and medians are rather overlapped, suggesting that the
    underlying distributions are fairly symmetric; the estimators appear
    substantially unbiased, with <inline-formula><alternatives>
    <tex-math><![CDATA[\hat\kappa_0]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mover><mml:mi>κ</mml:mi><mml:mo accent="true">̂</mml:mo></mml:mover><mml:mn>0</mml:mn></mml:msub></mml:math></alternatives></inline-formula>,
    <inline-formula><alternatives>
    <tex-math><![CDATA[\hat\kappa_1]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mover><mml:mi>κ</mml:mi><mml:mo accent="true">̂</mml:mo></mml:mover><mml:mn>1</mml:mn></mml:msub></mml:math></alternatives></inline-formula>,
    and <inline-formula><alternatives>
    <tex-math><![CDATA[\hat\kappa_2]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mover><mml:mi>κ</mml:mi><mml:mo accent="true">̂</mml:mo></mml:mover><mml:mn>2</mml:mn></mml:msub></mml:math></alternatives></inline-formula>
    sharing slight differences between the means and the corresponding
    true parameter values. The model-based standard errors appears to
    quantify appropriately the corresponding standard deviations for all
    estimators but <inline-formula><alternatives>
    <tex-math><![CDATA[\hat\kappa_0]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mover><mml:mi>κ</mml:mi><mml:mo accent="true">̂</mml:mo></mml:mover><mml:mn>0</mml:mn></mml:msub></mml:math></alternatives></inline-formula>,
    <inline-formula><alternatives>
    <tex-math><![CDATA[\hat\kappa_1]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mover><mml:mi>κ</mml:mi><mml:mo accent="true">̂</mml:mo></mml:mover><mml:mn>1</mml:mn></mml:msub></mml:math></alternatives></inline-formula>,
    and <inline-formula><alternatives>
    <tex-math><![CDATA[\hat\kappa_2]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mover><mml:mi>κ</mml:mi><mml:mo accent="true">̂</mml:mo></mml:mover><mml:mn>2</mml:mn></mml:msub></mml:math></alternatives></inline-formula>.
    Their corresponding coverage levels in the last column exhibit
    values lower than the nominal 95%, unlike the other interval
    estimators having values quite close to 0.95. Overall, the
    breakpoint parameters appear, unsurprisingly, to be those having an
    unsatisfactory performance of the Wald statistic. Better
    performances, however, are expected with larger samples or in
    scenarios with higher signal-to-noise ratio. Broader simulation
    settings, and further investigation are beyond the goal of this
    paper; some additional results are discussed in Muggeo et al.
    (2014). Regardless the sample size or the signal-to-noise ratio, we
    remark that the Wald statistic <inline-formula><alternatives>
    <tex-math><![CDATA[\hat\delta_0/\mathrm{SE}(\hat\delta_0)]]></tex-math>
    <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:msub><mml:mover><mml:mi>δ</mml:mi><mml:mo accent="true">̂</mml:mo></mml:mover><mml:mn>0</mml:mn></mml:msub><mml:mi>/</mml:mi><mml:mrow><mml:mi mathvariant="normal">S</mml:mi><mml:mi mathvariant="normal">E</mml:mi></mml:mrow><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:msub><mml:mover><mml:mi>δ</mml:mi><mml:mo accent="true">̂</mml:mo></mml:mover><mml:mn>0</mml:mn></mml:msub><mml:mo stretchy="false" form="postfix">)</mml:mo></mml:mrow></mml:math></alternatives></inline-formula>
    is useless, and the existence of the breakpoint, with or without
    heterogeneity, cannot currently be tested via the functions in the
    package.</p>
    <p>At the end we report technical information on the machine used to
    run the code</p>
    <preformat>
&gt; sessionInfo()
R version 4.6.2 (2026-10-29 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26200)

Matrix products: default
  LAPACK version 3.12.1

locale:
[1] LC_COLLATE=Italian_Italy.utf8  LC_CTYPE=Italian_Italy.utf8    LC_MONETARY=Italian_Italy.utf8
[4] LC_NUMERIC=C                   LC_TIME=Italian_Italy.utf8    

time zone: Europe/Rome
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] segmented_2.3-0 nlme_3.1-171    MASS_7.3-66    

loaded via a namespace (and not attached):
[1] compiler_4.6.2 tools_4.6.2    splines_4.6.2  grid_4.6.2     stats4_4.6.2   lattice_0.23-1</preformat>
  </sec>
</sec>
<sec id="conclusions">
  <title>Conclusions</title>
  <p>We have discussed how to fit segmented mixed models within the
  <named-content content-type="sans-serif">R</named-content>
  environmentvia the
  <named-content content-type="sans-serif">segmented</named-content>
  package. At time of writing, to the best of author’s knowledge, there
  is no package on CRAN to fit such class of models in a likelihood
  (non-Bayesian) framework. While the Bayesian approach can lead to
  in-depth results via the parameter posterior distributions, a simple
  effective framework could foster a somewhat more widespread adoption
  and usage of the model in practical applications
  (<named-content content-type="nocase">Krefman et al.</named-content>,
  2021).</p>
  <p>The method (and functions) are not limited to analysis of data
  equal number of measurements per subject, by working reasonably well
  and relatively fast. In our experience, some troubles can arise when
  the structure of the random effects covariance matrix is uselessly
  complicated, namely too many variances and covariances. Especially
  with noisy data, we suggest to start from a simple model, such as a
  diagonal covariance matrix, and then to try progressively more complex
  structures as illustrated in sec 3.2. However the AIC based on the log
  marginal likelihood, as that returned by <monospace>AIC()</monospace>
  function, is known not to be appropriate when the focus is on the
  clusters, and a <italic>conditional</italic> AIC should be used (Vaida
  &amp; Blanchard, 2005). Implementing that, along with an hypothesis
  testing procedures for the existence of breakpoint and corresponding
  heterogeneity (Muggeo, 2025; Segalas et al., 2019; Spuck et al.,
  2026), and model fitting with more than 1 breakpoint, represent
  notable extensions for the
  <named-content content-type="sans-serif">segmented</named-content>
  package.</p>
  <sec id="data-and-code-availability" sec-type="data-availability">
    <title>Data and Code Availability</title>
    <p>The analyses and relevant results reported in this paper, have
    been obtained via the R package
    <named-content content-type="sans-serif">segmented</named-content>,
    version 0.2-3. The
    <named-content content-type="sans-serif">glucoseData</named-content>
    dataset of section 3.1 (example 1) is shipped with the package, and
    the simulated dataset of section 3.2 is obtained via the code
    reported in the text. The file <monospace>Rcode.R</monospace>
    contains the R code to replicate the analyses, including the
    simulation experiment and corresponding results of Table 1. The file
    <monospace>Rcode.R</monospace> along with
    <named-content content-type="sans-serif">segmented
    2.3-0</named-content> are available as Supplentary Material of this
    paper at
    <monospace>https://jrepstat.fairpressjournals.com/articles/</monospace>;
    The R package
    <named-content content-type="sans-serif">segmented</named-content>
    is also downloadable from CRAN at
    <monospace>https://cran.r-project.org/web/packages/segmented/index.html</monospace>.</p>
    <p>The author is the creator, developer and the maintainer of
    <named-content content-type="sans-serif">segmented</named-content>
    package.</p>
  </sec>
  <sec id="acknowledgements">
    <title>Acknowledgements</title>
    <p>The author thanks the Editor and the three referees for the
    insightful comments that led to a substantial improvement of the
    paper. The author also thanks dr. V. Genova for reading the draft
    version of the manuscript.</p>
  </sec>
</sec>
</body>
<back><ref-list><ref id="ref1"><element-citation publication-type="journal"><person-group person-group-type="author"><name><surname>Cudeck</surname><given-names>Robert</given-names></name><name><surname>Klebe</surname><given-names>Kelli J.</given-names></name></person-group><article-title>Multiphase mixed-effects models for repeated measures data.</article-title><source>Psychological Methods</source><year>2002</year><volume>7</volume><issue>1</issue><fpage>41</fpage><lpage>63</lpage><publisher-name>American Psychological Association (APA)</publisher-name><pub-id pub-id-type="doi">10.1037/1082-989x.7.1.41</pub-id></element-citation></ref><ref id="ref2"><mixed-citation>Fitzmaurice, G. M., Laird, N. M., &amp; Ware, J. H. (2004). Applied longitudinal analysis. Wiley.</mixed-citation></ref><ref id="ref3"><element-citation publication-type="journal"><person-group person-group-type="author"><name><surname>Hardy</surname><given-names>Rebecca</given-names></name></person-group><article-title>Commentary: Are piecewise mixed effects models useful in epidemiology?</article-title><source>International Journal of Epidemiology</source><year>2001</year><volume>30</volume><issue>6</issue><fpage>1341</fpage><lpage>1342</lpage><publisher-name>Oxford University Press (OUP)</publisher-name><pub-id pub-id-type="doi">10.1093/ije/30.6.1341</pub-id></element-citation></ref><ref id="ref4"><mixed-citation>Jacqmin-Gadda, H., Commenges, D., &amp; Dartigues, J.-F. (2006). Random changepoint model for joint modeling of cognitive decline and dementia. Biometrics, 62, 254–260.</mixed-citation></ref><ref id="ref5"><element-citation publication-type="journal"><person-group person-group-type="author"><name><surname>Kiuchi</surname><given-names>Amy S.</given-names></name><name><surname>Hartigan</surname><given-names>J. A.</given-names></name><name><surname>Holford</surname><given-names>Theodore R.</given-names></name><name><surname>Rubinstein</surname><given-names>Pablo</given-names></name><name><surname>Stevens</surname><given-names>Cladd E.</given-names></name></person-group><article-title>Change Points in the Series of T4 Counts Prior to AIDS</article-title><source>Biometrics</source><year>1995</year><volume>51</volume><issue>1</issue><fpage>236</fpage><publisher-name>JSTOR</publisher-name><pub-id pub-id-type="doi">10.2307/2533329</pub-id></element-citation></ref><ref id="ref6"><element-citation publication-type="journal"><person-group person-group-type="author"><name><surname>Krefman</surname><given-names>Amy E</given-names></name><name><surname>Labarthe</surname><given-names>Darwin</given-names></name><name><surname>Greenland</surname><given-names>Philip</given-names></name><name><surname>Pool</surname><given-names>Lindsay</given-names></name><name><surname>Aguayo</surname><given-names>Liliana</given-names></name><name><surname>Juonala</surname><given-names>Markus</given-names></name><name><surname>Kähönen</surname><given-names>Mika</given-names></name><name><surname>Lehtimäki</surname><given-names>Terho</given-names></name><name><surname>Day</surname><given-names>R Sue</given-names></name><name><surname>Bazzano</surname><given-names>Lydia</given-names></name><name><surname>Muggeo</surname><given-names>Vito M R</given-names></name><name><surname>Van Horn</surname><given-names>Linda</given-names></name><name><surname>Liu</surname><given-names>Lei</given-names></name><name><surname>Webber</surname><given-names>Larry S</given-names></name><name><surname>Pahkala</surname><given-names>Katja</given-names></name><name><surname>Laitinen</surname><given-names>Tomi T</given-names></name><name><surname>Raitakari</surname><given-names>Olli</given-names></name><name><surname>Lloyd-Jones</surname><given-names>Donald M</given-names></name><name><surname>Allen</surname><given-names>Norrina B</given-names></name></person-group><article-title>Influential Periods in Longitudinal Clinical Cardiovascular Health Scores</article-title><source>American Journal of Epidemiology</source><year>2021</year><volume>190</volume><issue>11</issue><fpage>2384</fpage><lpage>2394</lpage><publisher-name>Oxford University Press (OUP)</publisher-name><pub-id pub-id-type="doi">10.1093/aje/kwab149</pub-id></element-citation></ref><ref id="ref7"><element-citation publication-type="journal"><person-group person-group-type="author"><name><surname>Lange</surname><given-names>Nicholas</given-names></name><name><surname>Carlin</surname><given-names>Bradley P.</given-names></name><name><surname>Gelfand</surname><given-names>Alan E.</given-names></name></person-group><article-title>Hierarchical Bayes Models for the Progression of HIV Infection Using Longitudinal CD4 T-Cell Numbers</article-title><source>Journal of the American Statistical Association</source><year>1992</year><volume>87</volume><issue>419</issue><fpage>615</fpage><lpage>626</lpage><publisher-name>Informa UK Limited</publisher-name><pub-id pub-id-type="doi">10.1080/01621459.1992.10475258</pub-id></element-citation></ref><ref id="ref8"><element-citation publication-type="journal"><person-group person-group-type="author"><name><surname>Morrell</surname><given-names>Christopher H.</given-names></name><name><surname>Pearson</surname><given-names>Jay D.</given-names></name><name><surname>Carter</surname><given-names>H. Ballentine</given-names></name><name><surname>Brant</surname><given-names>Larry J.</given-names></name></person-group><article-title>Estimating Unknown Transition Times Using a Piecewise Nonlinear Mixed-Effects Model in Men with Prostate Cancer</article-title><source>Journal of the American Statistical Association</source><year>1995</year><volume>90</volume><issue>429</issue><fpage>45</fpage><lpage>53</lpage><publisher-name>Informa UK Limited</publisher-name><pub-id pub-id-type="doi">10.1080/01621459.1995.10476487</pub-id></element-citation></ref><ref id="ref9"><element-citation publication-type="journal"><person-group person-group-type="author"><name><surname>Muggeo</surname><given-names>Vito MR</given-names></name><name><surname>Atkins</surname><given-names>David C</given-names></name><name><surname>Gallop</surname><given-names>Robert J</given-names></name><name><surname>Dimidjian</surname><given-names>Sona</given-names></name></person-group><article-title>Segmented mixed models with random changepoints: a maximum likelihood approach with application to treatment for depression study</article-title><source>Statistical Modelling</source><year>2014</year><volume>14</volume><issue>4</issue><fpage>293</fpage><lpage>313</lpage><publisher-name>SAGE Publications</publisher-name><pub-id pub-id-type="doi">10.1177/1471082x13504721</pub-id></element-citation></ref><ref id="ref10"><element-citation publication-type="journal"><person-group person-group-type="author"><name><surname>Muggeo</surname><given-names>Vito M. R.</given-names></name></person-group><article-title>Estimating regression models with unknown break‐points</article-title><source>Statistics in Medicine</source><year>2003</year><volume>22</volume><issue>19</issue><fpage>3055</fpage><lpage>3071</lpage><publisher-name>Wiley</publisher-name><pub-id pub-id-type="doi">10.1002/sim.1545</pub-id></element-citation></ref><ref id="ref11"><mixed-citation>Muggeo, V. M. R. (2008). Segmented: An R package to fit regression models with broken-line relationships. R News, 8(1), 20–25.</mixed-citation></ref><ref id="ref12"><element-citation publication-type="journal"><person-group person-group-type="author"><name><surname>Muggeo</surname><given-names>Vito M. R.</given-names></name></person-group><article-title>Testing with a nuisance parameter present only under the alternative: a score-based approach with application to segmented modelling</article-title><source>Journal of Statistical Computation and Simulation</source><year>2016</year><volume>86</volume><issue>15</issue><fpage>3059</fpage><lpage>3067</lpage><publisher-name>Informa UK Limited</publisher-name><pub-id pub-id-type="doi">10.1080/00949655.2016.1149855</pub-id></element-citation></ref><ref id="ref13"><element-citation publication-type="journal"><person-group person-group-type="author"><name><surname>Muggeo</surname><given-names>Vito M R</given-names></name></person-group><article-title>Letter to the Editors: Comments on “Statistical inference on change points in generalized semiparametric segmented models” by Yang et al. (2025)</article-title><source>Biometrics</source><year>2025</year><volume>81</volume><issue>4</issue><publisher-name>Oxford University Press (OUP)</publisher-name><pub-id pub-id-type="doi">10.1093/biomtc/ujaf147</pub-id></element-citation></ref><ref id="ref14"><mixed-citation>Pinheiro, J. C., &amp; Bates, D. M. (2000). Mixed-effects models in s and s-PLUS,. Springer.</mixed-citation></ref><ref id="ref15"><element-citation publication-type="journal"><person-group person-group-type="author"><string-name>R Core Team</string-name></person-group><article-title>R: A Language and Environment for Statistical Computing</article-title><year>2026</year><publisher-name>R Foundation for Statistical Computing</publisher-name><pub-id pub-id-type="doi">10.32614/R.manuals</pub-id></element-citation></ref><ref id="ref16"><element-citation publication-type="journal"><person-group person-group-type="author"><name><surname>Segalas</surname><given-names>Corentin</given-names></name><name><surname>Amieva</surname><given-names>Hélène</given-names></name><name><surname>Jacqmin‐Gadda</surname><given-names>Hélène</given-names></name></person-group><article-title>A hypothesis testing procedure for random changepoint mixed models</article-title><source>Statistics in Medicine</source><year>2019</year><volume>38</volume><issue>20</issue><fpage>3791</fpage><lpage>3803</lpage><publisher-name>Wiley</publisher-name><pub-id pub-id-type="doi">10.1002/sim.8195</pub-id></element-citation></ref><ref id="ref17"><mixed-citation>Spuck, N., Schmid, M., &amp; Berger, M. (2026). Detection of nonlinearity, discontinuity and interactions in generalized regression models. Statistical Modelling, 26, 248–276.</mixed-citation></ref><ref id="ref18"><element-citation publication-type="journal"><person-group person-group-type="author"><name><surname>Vaida</surname><given-names>Florin</given-names></name><name><surname>Blanchard</surname><given-names>Suzette</given-names></name></person-group><article-title>Conditional Akaike information for mixed-effects models</article-title><source>Biometrika</source><year>2005</year><volume>92</volume><issue>2</issue><fpage>351</fpage><lpage>370</lpage><publisher-name>Oxford University Press (OUP)</publisher-name><pub-id pub-id-type="doi">10.1093/biomet/92.2.351</pub-id></element-citation></ref><ref id="ref19"><element-citation publication-type="journal"><person-group person-group-type="author"><name><surname>Wood</surname><given-names>Simon N.</given-names></name></person-group><article-title>Minimizing Model Fitting Objectives That Contain Spurious Local Minima by Bootstrap Restarting</article-title><source>Biometrics</source><year>2001</year><volume>57</volume><issue>1</issue><fpage>240</fpage><lpage>244</lpage><publisher-name>Oxford University Press (OUP)</publisher-name><pub-id pub-id-type="doi">10.1111/j.0006-341x.2001.00240.x</pub-id></element-citation></ref><ref id="ref20"><element-citation publication-type="journal"><person-group person-group-type="author"><name><surname>Zerbe</surname><given-names>Gary O.</given-names></name></person-group><article-title>Randomization Analysis of the Completely Randomized Design Extended to Growth and Response Curves</article-title><source>Journal of the American Statistical Association</source><year>1979</year><volume>74</volume><issue>365</issue><fpage>215</fpage><lpage>221</lpage><publisher-name>Informa UK Limited</publisher-name><pub-id pub-id-type="doi">10.1080/01621459.1979.10481640</pub-id></element-citation></ref></ref-list>
<ref-list>
  <title>References</title>
  <ref id="ref-cudeck02">
    <mixed-citation>Cudeck, R., &amp; Klebe, K. J. (2002). Multiphase
    mixed-effects models for repeated measures data.
    <italic>Psychological Methods</italic>, 41–63.</mixed-citation>
  </ref>
  <ref id="ref-fitmaurice04">
    <mixed-citation>Fitzmaurice, G. M., Laird, N. M., &amp; Ware, J. H.
    (2004). <italic>Applied longitudinal analysis</italic>.
    Wiley.</mixed-citation>
  </ref>
  <ref id="ref-hardy01">
    <mixed-citation>Hardy, R. (2001). Commentary: Are piecewise mixed
    effects models useful in epidemiology? <italic>International Journal
    of Epidemiology</italic>, <italic>30</italic>,
    1341–1342.</mixed-citation>
  </ref>
  <ref id="ref-Jacqmin-Gadda06">
    <mixed-citation>Jacqmin-Gadda, H., Commenges, D., &amp; Dartigues,
    J.-F. (2006). Random changepoint model for joint modeling of
    cognitive decline and dementia. <italic>Biometrics</italic>,
    <italic>62</italic>, 254–260.</mixed-citation>
  </ref>
  <ref id="ref-kiuchi95">
    <mixed-citation><named-content content-type="nocase">Kiuchi, A. S.,
    Hartigan, J. A., Holford, T. R., et al.</named-content> (1995).
    Change points in the series of T4 counts prior to AIDS.
    <italic>Biometrics</italic>, <italic>51</italic>,
    236–248.</mixed-citation>
  </ref>
  <ref id="ref-krefman21">
    <mixed-citation><named-content content-type="nocase">Krefman, A.,
    Labarthe, D., Greenland, P., Pool, L., et al.</named-content>
    (2021). Influential periods in longitudinal clinical cardiovascular
    health scores. <italic>American Journal of Epidemiology</italic>,
    <italic>190</italic>, 2384–2394.</mixed-citation>
  </ref>
  <ref id="ref-lange92">
    <mixed-citation>Lange, N., Carlin, B. P., &amp; Gelfand, A. E.
    (1992). Hierarchical Bayes models for the progression of HIV
    infection using longitudinalCD4 T-cell numbers (with discussion).
    <italic>Journal of American Statistical Association</italic>,
    <italic>87</italic>, 615–632.</mixed-citation>
  </ref>
  <ref id="ref-morrell95">
    <mixed-citation>Morrell, C., Pearson, J., Carter, H., &amp; Brant,
    L. (1995). Estimating unknown transition times using a piecewise non
    linear mixed- effects model in men with prostate cancer.
    <italic>Journal of the American Statistical Association</italic>,
    <italic>90</italic>, 45–53.</mixed-citation>
  </ref>
  <ref id="ref-muggeo14">
    <mixed-citation>Muggeo, V. M. R., Atkins, D. C., Gallop, R. J.,
    &amp; Dimidjian, S. (2014). Segmented mixed models with random
    changepoints: A maximum likelihood approach with application to
    treatment for depression study. <italic>Statistical
    Modelling</italic>, <italic>14</italic>, 293–313.</mixed-citation>
  </ref>
  <ref id="ref-muggeo03">
    <mixed-citation>Muggeo, V. M. R. (2003). Estimating regression
    models with unknown break-points. <italic>Statistics in
    Medicine</italic>, <italic>22</italic>, 3055–3071.</mixed-citation>
  </ref>
  <ref id="ref-muggeo08">
    <mixed-citation>Muggeo, V. M. R. (2008). Segmented: An R package to
    fit regression models with broken-line relationships. <italic>R
    News</italic>, <italic>8</italic>(1), 20–25.</mixed-citation>
  </ref>
  <ref id="ref-muggeo16">
    <mixed-citation>Muggeo, V. M. R. (2016). Testing with a nuisance
    parameter present only under the alternative: A score-based approach
    with application to segmented modelling. <italic>Journal of
    Statistical Computation and Simulation</italic>,
    <italic>86</italic>, 3059–3067.</mixed-citation>
  </ref>
  <ref id="ref-muggeo25">
    <mixed-citation>Muggeo, V. M. R. (2025). Comments on “statistical
    inference on change points in generalized semiparametric segmented
    models” by Yang et al. (2025). <italic>Biometrics</italic>,
    <italic>81</italic>, ujaf147.
    https://doi.org/<ext-link ext-link-type="uri" xlink:href="https://doi.org/10.1093/biomtc/ujaf147">https://doi.org/10.1093/biomtc/ujaf147</ext-link></mixed-citation>
  </ref>
  <ref id="ref-lmeBook">
    <mixed-citation>Pinheiro, J. C., &amp; Bates, D. M. (2000).
    <italic>Mixed-effects models in s and s-PLUS,</italic>.
    Springer.</mixed-citation>
  </ref>
  <ref id="ref-R">
    <mixed-citation>R Core Team. (2026). <italic>R: A language and
    environment for statistical computing</italic>. R Foundation for
    Statistical Computing.
    <ext-link ext-link-type="uri" xlink:href="https://doi.org/10.32614/R.manuals">https://doi.org/10.32614/R.manuals</ext-link></mixed-citation>
  </ref>
  <ref id="ref-segalas">
    <mixed-citation>Segalas, C., Amieva, H., &amp; Jacqmin-Gadda, H.
    (2019). A hypothesis testing procedure for random changepoint mixed
    models. <italic>Statistics in Medicine</italic>,
    <italic>38</italic>, 3791–3803.</mixed-citation>
  </ref>
  <ref id="ref-StatMod26">
    <mixed-citation>Spuck, N., Schmid, M., &amp; Berger, M. (2026).
    Detection of nonlinearity, discontinuity and interactions in
    generalized regression models. <italic>Statistical
    Modelling</italic>, <italic>26</italic>, 248–276.</mixed-citation>
  </ref>
  <ref id="ref-cAic">
    <mixed-citation>Vaida, F., &amp; Blanchard, S. (2005). Conditional
    akaike information for mixed-effects models.
    <italic>Biometrika</italic>, <italic>92</italic>,
    351–370.</mixed-citation>
  </ref>
  <ref id="ref-wood01">
    <mixed-citation>Wood, S. N. (2001). Minimizing model fitting
    objectives that contain spurious local minima by bootstrap
    restarting. <italic>Biometrics</italic>, <italic>57</italic>,
    240–244.</mixed-citation>
  </ref>
  <ref id="ref-zerbe79">
    <mixed-citation>Zerbe, G. O. (1979). Randomization analysis of the
    completely randomized design extended to growth and response curves.
    <italic>Journal of the American Statistical Association</italic>,
    <italic>74</italic>, 215–221.</mixed-citation>
  </ref>
</ref-list>
<fn-group>
  <fn id="fn1">
    <label>1</label><p>Email:
    <monospace>vito.muggeo@unipa.it, orcid id: 0000-0002-3386-4054</monospace></p>
  </fn>
</fn-group>
</back>
<sub-article id="pr-r1-letter" article-type="editor-report">
<front-stub>
<article-id pub-id-type="doi">10.68365/jrepstat.2026.12.r1.letter</article-id>
<title-group>
<article-title>Decision letter, round 1</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<contrib-id contrib-id-type="orcid">https://orcid.org/0000-0002-8638-5276</contrib-id>
<string-name>Matthias Templ</string-name>
<role specific-use="editor">Editor</role>
</contrib>
</contrib-group>
<pub-history>
<event event-type="editor-decision-sent">
<event-desc>Editor decision sent</event-desc>
<date iso-8601-date="2026-10-04"><day>04</day><month>10</month><year>2026</year></date>
</event>
</pub-history>
<related-object document-id="10.68365/jrepstat.2026.12" document-id-type="doi" document-type="peer-reviewed-article"/>
<custom-meta-group>
<custom-meta><meta-name>peer-review-stage</meta-name><meta-value>pre-publication</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-revision-round</meta-name><meta-value>0</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-recommendation</meta-name><meta-value>minor-revision</meta-value></custom-meta>
</custom-meta-group>
</front-stub>
<body>
<p><bold>Minor revision.</bold> Confirmed and signed by Matthias Templ on 2026-10-04.</p>
<p>Thank you for your submission to JRepStat. We are inviting a minor revision. The reviewers’ points follow, grouped by weight.</p>
<p>This paper shows, with one real and one simulated dataset, how to fit and visualise segmented mixed models with random changepoints using segmented.lme in the R package segmented. It matters to applied analysts of longitudinal and clustered data who need subject-specific breakpoints estimated in a likelihood framework. We would be glad to see the revised version.</p>
<p>How to read this letter. The decision rests on the items marked required. If a required item seems wrong to you, or cannot be done within this paper, say so in your response letter and give the reason. A reasoned decline is a legitimate answer, and the editor weighs it. Reviewers can be mistaken. Items marked recommended or optional are advice from the reviewers. Adopt them, decline them with a sentence, or leave them for later work. None of that counts against the paper. The reviewer reports below carry the same marks. The editor who signs this decision may weigh an item differently in the accompanying message, and that message prevails.</p>
<p><sc>required</sc> (the decision rests on these):</p>
<list list-type="bullet">
  <list-item>
    <p>[Reviewer 1] Example 2 states its aim is to validate the functions against the true simulation parameters, then reports “results not shown here”. Show the summary(oseg1) comparison to the true values, or drop the validation framing and present the example as illustration only.</p>
  </list-item>
  <list-item>
    <p>[Reviewer 3] Example 1 is not reproducible as written because bootstrap restarting is stochastic and no seed is set, while Example 2 does set seeds. Set a seed (or the relevant seg.control option) so the printed estimates reproduce, or state in the text that bootstrap-restarting results can vary across runs.</p>
  </list-item>
</list>
<p><sc>recommended</sc>:</p>
<list list-type="bullet">
  <list-item>
    <p>[methods-soundness] The text states the breakpoints make the model non-regular, yet the summary and slope outputs report Wald t-values and p-values for the changepoint (G0) and slope-difference (U) parameters, and the narrative reads significance directly from them (“significantly different”, “a larger changepoint”). Near-boundary and changepoint parameters are exactly where Wald inference is least reliable under non-regularity. Please add one or two sentences stating which quantities have trustworthy standard errors and advising caution for the changepoint-related terms, so readers do not transfer the displayed p-values uncritically.</p>
  </list-item>
  <list-item>
    <p>[software-quality] I am assessing from the manuscript and the described public interface. The package source, its help pages, and any <monospace>tests/</monospace> directory were not supplied, so I cannot confirm that the documented behaviour of <monospace>segmented.lme</monospace>, <monospace>plot.segmented.lme</monospace>, <monospace>sim.seg</monospace>, and <monospace>slope</monospace> is covered by automated tests. State in the paper whether the demonstrated functions are exercised by the package test suite, and point readers to where those tests live.</p>
  </list-item>
  <list-item>
    <p>[software-quality] The examples set seeds (<monospace>set.seed(123)</monospace>, <monospace>seed=15</monospace>, <monospace>seed</monospace> argument of <monospace>sim.seg</monospace>) and use shipped data with no hard-coded paths, so the runs are portable. The paper does not record the R version or a captured session state. Add one line giving the R version and <monospace>sessionInfo()</monospace> (or the exact <monospace>segmented</monospace>/<monospace>nlme</monospace> versions) used for the printed output, so the numeric results can be reproduced.</p>
  </list-item>
  <list-item>
    <p>[software-quality] The code appears across the text as interleaved snippets rather than one runnable file. Provide the two examples as a single script or a package vignette that runs end to end, so a new user can reproduce Figures 1 to 3 and the printed estimates without reassembling fragments.</p>
  </list-item>
  <list-item>
    <p>[statistical-rigor] The analysis of glucoseData describes the Obese curve as “significantly different” from Control on the basis of several contrasts read off one summary table (intercept, left slope, slope difference, changepoint) with no correction across them. Please restate these conclusions in terms of the estimated differences and their intervals, which the example already produces, and drop the threshold wording so the example does not model uncorrected multiple testing for readers who copy it.</p>
  </list-item>
  <list-item>
    <p>[statistical-rigor] The multinormal random-effects distribution in equation (4) and the zero-mean residual assumption are stated but never examined in either example. One sentence pointing to a residual or random-effects diagnostic, alongside the standardized-residual summary already printed, would show readers how to check the fit rather than assert it.</p>
  </list-item>
  <list-item>
    <p>[statistical-rigor] The simulated example validates recovery on a single draw (seed 15) at one noise level. Since the Conclusions state the method “work[s] reasonably well when the signal-to-noise ratio is modest to high”, a short note on the range of conditions behind that statement, using runs you have already done, would let readers judge where the recovery claim holds.</p>
  </list-item>
  <list-item>
    <p>[visualisation] Figure 1 packs 33 subjects into a 3 by 11 grid. At that size the per-panel axis annotation and the “time”/“phos” labels are hard to read, and only a handful of panels carry tick values. Consider a 5 by 7 or 6 by 6 layout, or a single faceted plot with shared axes and one axis label per edge, so the reader can compare profiles without squinting.</p>
  </list-item>
  <list-item>
    <p>[visualisation] The red/blue coding in Figures 1 and 2 reads for the common red-green colourblindness because the two hues differ in blue content, so the palette is broadly safe. Figure 2 reinforces colour with line type (lty=3 for Obese), which is good practice. Carrying that same line-type distinction into Figure 1, and stating the red/blue meaning once in the main text as well as the caption, would make the group contrast legible in greyscale print too.</p>
  </list-item>
  <list-item>
    <p>[visualisation] Axis labels give variable names (“time”, “phos”) without units. One phrase in each caption, naming the time unit and that phos is plasma inorganic phosphate, would let the figures stand on their own.</p>
  </list-item>
  <list-item>
    <p>[writing-quality] Section 1 ends the sentence “the R package segmented (version 2.3-0 or higher)” without a full stop, and the paragraph in Section 2 ending “in the segmented, in particular” and “demanding … more demanding” trails off without a closing period in two places. A pass to close these sentences would help the reader.</p>
  </list-item>
  <list-item>
    <p>[writing-quality] The <monospace>summary(os1)</monospace> output shows no t-value or p-value for the <monospace>U</monospace> and <monospace>G0</monospace> rows while neighbouring rows report both. One sentence saying why these entries are blank (for example that the changepoint and reference slope-difference are reported without the associated test) would prevent readers from reading it as a defect in the output.</p>
  </list-item>
  <list-item>
    <p>[ethics-and-integrity] The empirical example uses <monospace>glucoseData</monospace>, a de-identified dataset of 33 patients (Control and Obese) shipped inside the <monospace>segmented</monospace> package, analysed as a secondary illustration. No individuals are identifiable and no new data were collected, so the absence of an ethics-approval or consent statement does not meet the threshold for a violation. Add one sentence naming the original source of <monospace>glucoseData</monospace> and its public availability, so the provenance of the human measurements is on record.</p>
  </list-item>
  <list-item>
    <p>[ethics-and-integrity] The paper is a tutorial for the author’s own <monospace>segmented</monospace> package, a relationship visible from the author line and the citations. A short competing-interests line stating that the author maintains the software would make the interest explicit. Add a competing-interests statement.</p>
  </list-item>
  <list-item>
    <p>[Reviewer 1] Provide a single self-contained script that runs both examples end to end, with the output of sessionInfo() and the segmented/nlme versions used.</p>
  </list-item>
  <list-item>
    <p>[Reviewer 1] Comment on the near-zero random-effect standard deviations in Example 1 (time and U, around 0.002) and link them to the overparameterization guidance already given in the Conclusions.</p>
  </list-item>
  <list-item>
    <p>[Reviewer 1] In summary(os1) the U and G0 rows carry no p-value (and G0 no t-value). State what these entries mean, or confirm they are intentionally omitted.</p>
  </list-item>
  <list-item>
    <p>[Reviewer 2] The summary of os1 omits t and p columns for G0 and the p column for U. Add one sentence explaining the omission and the non-regular nature of inference on the changepoint.</p>
  </list-item>
  <list-item>
    <p>[Reviewer 2] Add a small repeated-simulation check (bias and interval coverage over replicates) to support the validation claim, since one dataset recovers one draw.</p>
  </list-item>
  <list-item>
    <p>[Reviewer 2] Give a short account of the approximate restricted log-likelihood (the “approx” in the print output) and what the approximation affects.</p>
  </list-item>
  <list-item>
    <p>[Reviewer 2] Expand the guidance for choosing among the four covariance specifications into a short worked rule, since convergence difficulty is the practical obstacle you identify.</p>
  </list-item>
  <list-item>
    <p>[Reviewer 3] Report R version, operating system, and the exact versions of segmented and nlme used, and pin an exact segmented version instead of “2.3-0 or higher” for the numeric outputs.</p>
  </list-item>
</list>
<p><sc>optional</sc>:</p>
<list list-type="bullet">
  <list-item>
    <p>[methods-soundness] The statement “the more complex the model, the better the fit and corresponding predictions” is loose, since richer random-effect structures risk overfitting and the convergence problems the same paragraph describes. A brief note tying model choice to an information criterion, which the AIC/BIC output already provides, would make the guidance concrete. This is beyond the illustrative scope of the current examples.</p>
  </list-item>
  <list-item>
    <p>[Reviewer 1] (conditional) One or two sentences on the clinical reading of the Control-versus-Obese changepoint difference would help an applied reader connect the fit to the glucose tolerance test.</p>
  </list-item>
</list>
<p>We will correct these in production, and you confirm them in the proof:</p>
<list list-type="bullet">
  <list-item>
    <p>[consistency-check] In Example 2 the text names the additional segmented profiles as “the 3rd, the 4th and the 10th”, but the code call <monospace>plot(oseg1, id=c(4,28,3,5,10), ...)</monospace> and Figure 3 show subjects 3, 5 and 10 (subject 4 is one of the two linear profiles). The “4th” should read “5th” to match the code and figure.</p>
  </list-item>
  <list-item>
    <p>[writing-quality] In Section 2, “In particular, the the ‘plot’ method can be used” repeats “the”. This is a duplicated word, not an extraction artefact.</p>
  </list-item>
  <list-item>
    <p>[writing-quality] In Section 3.1 the summary discussion reads “the Obese group has an higher intercept”; this should read “a higher”.</p>
  </list-item>
</list>
</body>
</sub-article>
<sub-article id="pr-r1-report1" article-type="reviewer-report">
<front-stub>
<article-id pub-id-type="doi">10.68365/jrepstat.2026.12.r1.report1</article-id>
<title-group>
<article-title>Report Reviewer 1, round 1</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<collab>JRepStat review engine</collab>
<role specific-use="reviewer" content-type="reviewer-1">Reviewer 1</role>
</contrib>
</contrib-group>
<pub-history>
<event event-type="reviewer-report-received">
<event-desc>Reviewer report received</event-desc>
<date iso-8601-date="2026-10-01"><day>01</day><month>10</month><year>2026</year></date>
</event>
</pub-history>
<related-object document-id="10.68365/jrepstat.2026.12" document-id-type="doi" document-type="peer-reviewed-article"/>
<custom-meta-group>
<custom-meta><meta-name>peer-review-stage</meta-name><meta-value>pre-publication</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-revision-round</meta-name><meta-value>0</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-recommendation</meta-name><meta-value>minor-revision</meta-value></custom-meta>
</custom-meta-group>
</front-stub>
<body>
<p><italic>Written by the journal&#x27;s review engine in the role of the application reviewer, and read by the editor before the decision. How the engine works is on the <ext-link ext-link-type="uri" xlink:href="https://jrepstat.fairpressjournals.com/about/peer-review/">peer review page</ext-link>.</italic></p>
<p>Recommendation: minor.</p>
<p>This is a clear, practically useful software illustration from the package author, showing how segmented.lme fits piecewise-linear mixed models with subject-specific breakpoints. The underlying method is already published (Muggeo et al., 2014), so the contribution here is the code, the argument reference, and two worked examples. For an applied reader who has longitudinal data with a plausible turning point per subject, the paper gives a usable path from an lme fit to a segmented fit, to group comparisons, to plots. The structure of the functions section is a good quick reference, and the glucose example reads well.</p>
<p>My main concern is in Example 2, which the text sets up explicitly as a validation exercise, comparing estimates to the true simulation parameters, and then reports the key comparison as “results not shown here”. For a software paper the recovery of known parameters is close to the point of the example, and an applied reader cannot judge whether the functions behave as claimed without seeing it. The boundary-detection part (identifying subjects 4 and 28 as linear, matching dd$perc.psi) is shown and is convincing. The parameter-recovery part is asserted. Please either print the summary(oseg1) comparison against the true values, or present the example as an illustration of the workflow and remove the validation language.</p>
<p>Two things in Example 1 would help a practitioner more than they currently do. The diagonal fit reports random-effect standard deviations for time and U of roughly 0.002, which are effectively zero and suggest those random components are not supported by these data. Your Conclusions already warn about exactly this situation, so one sentence connecting the warning to the visible output would teach the reader how to read it. Separately, the summary(os1) table shows no p-value for U and no t-value or p-value for G0. If that omission is deliberate, because testing a zero slope-difference or a zero-valued changepoint is not a standard test here, say so in a line, because an applied reader will otherwise read the blank as missing output.</p>
<p>On reproducibility, the code is embedded in the text and uses set.seed and seed arguments, which is good practice. The submission record lists reproducibility artifacts that I was not given, so I cannot confirm whether a single runnable script exists. If one does not, a self-contained script plus the output of sessionInfo() and the segmented and nlme version numbers would let a reader reproduce both examples without reassembling snippets from the prose. The package version floor (2.3-0 or higher) is already stated, which is helpful.</p>
<p>The interpretive language around the group comparison (“significantly different”, “it turns out the curve for the Obese patients is significantly different”) leans on significance rather than on the estimated differences and their uncertainty, which you already report. Stating the intercept, slope and changepoint differences with their intervals, as you do for the slopes, would make the applied reading cleaner. This is a presentation point and not a barrier.</p>
<p>Numbered suggestions to the authors:</p>
<list list-type="order">
  <list-item>
    <p><sc>required</sc> In Example 2, show the summary(oseg1) estimates against the true simulation parameters that the example says it validates, or remove the “validate” framing and present the example as a workflow illustration.</p>
  </list-item>
  <list-item>
    <p><sc>recommended</sc> Supply one self-contained script that runs both examples, together with sessionInfo() output and the segmented and nlme versions used.</p>
  </list-item>
  <list-item>
    <p><sc>recommended</sc> Add a sentence in Example 1 noting the near-zero random-effect standard deviations for time and U, and connect it to the overparameterization guidance in the Conclusions.</p>
  </list-item>
  <list-item>
    <p><sc>recommended</sc> Explain the blank entries for U and G0 in the summary(os1) table, or confirm they are omitted by design.</p>
  </list-item>
  <list-item>
    <p><sc>optional</sc> (conditional) Add one or two sentences on what the Control-versus-Obese changepoint difference means for the glucose tolerance test, to anchor the fit for applied readers.</p>
  </list-item>
</list>
</body>
</sub-article>
<sub-article id="pr-r1-report2" article-type="reviewer-report">
<front-stub>
<article-id pub-id-type="doi">10.68365/jrepstat.2026.12.r1.report2</article-id>
<title-group>
<article-title>Report Reviewer 2, round 1</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<collab>JRepStat review engine</collab>
<role specific-use="reviewer" content-type="reviewer-2">Reviewer 2</role>
</contrib>
</contrib-group>
<pub-history>
<event event-type="reviewer-report-received">
<event-desc>Reviewer report received</event-desc>
<date iso-8601-date="2026-10-01"><day>01</day><month>10</month><year>2026</year></date>
</event>
</pub-history>
<related-object document-id="10.68365/jrepstat.2026.12" document-id-type="doi" document-type="peer-reviewed-article"/>
<custom-meta-group>
<custom-meta><meta-name>peer-review-stage</meta-name><meta-value>pre-publication</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-revision-round</meta-name><meta-value>0</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-recommendation</meta-name><meta-value>minor-revision</meta-value></custom-meta>
</custom-meta-group>
</front-stub>
<body>
<p><italic>Written by the journal&#x27;s review engine in the role of the methodology reviewer, and read by the editor before the decision. How the engine works is on the <ext-link ext-link-type="uri" xlink:href="https://jrepstat.fairpressjournals.com/about/peer-review/">peer review page</ext-link>.</italic></p>
<p>Recommendation: minor.</p>
<p>This is a clear software illustration of a method that is already established in Muggeo et al. (2014). As a methodology read, my job is to check that the illustration represents the estimator and its caveats correctly, and that the claims the examples make are supported by what the examples show. On the first count the paper is in good shape. The model in equation (1), the decomposition into fixed and random parts in (2), the two changepoint parametrisations in (3) with the logistic form keeping psi inside (a1, a2), and the covariance structure in (4) are all stated correctly, and the four random-effect specifications are ordered sensibly by complexity. I checked the internal arithmetic of the os1 example and it holds together: the Obese left slope (-1.2797 + 0.5461 = -0.7336) and right slope (-0.7336 + 1.6482 - 0.5351 = 0.3795) match the slope() output to the digits shown, and the intercept and changepoint sums match the text. The numbers are coherent.</p>
<p>My main concern is the validation claim in Example 2. The paper states the aim is “to ‘validate’ the functions by comparing the results with the true parameter values,” and then reports “Estimates of the fixed effects and of the variance components can be compared to the true values … (results not shown here).” The one comparison that is the stated purpose of the example is the one withheld. For a software paper this is the evidence a methodology reader looks for first. The fix is cheap because you already have the object: print the fixed effects and variance components against the fixEff and S arguments used in sim.seg. If instead you prefer to keep the example compact, qualify the word “validate” to a single recovery illustration, because one simulated dataset recovers one draw of the random effects and does not on its own establish that the estimator is unbiased or that its intervals cover. A short repeated-simulation summary over replicates, reporting bias and the coverage of the Wald intervals, would carry the stronger word and is worth adding.</p>
<p>A second, lighter methodological point concerns inference on the changepoint. The summary of os1 shows no t or p value for G0 and no p value for U, while G.groupObese and the slope terms carry full columns. A reader will notice the gap. This is the right place to say in one sentence why Wald inference on the breakpoint location is treated differently, given the non-regularity you already flag at the start of Section 3, and what the confint.segmented.lme method reports instead. The print output also labels the log-restricted-likelihood as “approx”, which a methodology reader will want explained: a sentence on what is approximated in the likelihood used for REML, and what that affects in the reported standard errors, would close the loop.</p>
<p>The practical guidance in the Conclusions is sound and matches my experience with these models, that convergence is the binding constraint and a diagonal start is wise. It would help to turn that advice into a short rule tied to the four specifications in Section 2, so a reader who hits non-convergence knows which covariance to drop first. None of these points unsettles the method or the examples. They are about showing the evidence the paper says it has and stating the inferential caveats that a changepoint model carries.</p>
<p>Numbered suggestions to the authors:</p>
<list list-type="order">
  <list-item>
    <p><sc>required</sc> Display the Example 2 comparison of the estimated fixed effects and variance components against the sim.seg truth (fixEff and S), or change “validate” to a single illustrative recovery so the claim matches what is shown.</p>
  </list-item>
  <list-item>
    <p>[editor_fix] Remove the duplicated word in “the the ‘plot’ method” (Section 2).</p>
  </list-item>
  <list-item>
    <p><sc>recommended</sc> Add one sentence in Section 3.1 explaining why the summary omits t and p for G0 and p for U, linking it to the non-regular inference on the changepoint and to what confint.segmented.lme reports.</p>
  </list-item>
  <list-item>
    <p><sc>recommended</sc> Add a small repeated-simulation summary over replicates reporting bias and Wald-interval coverage for the fixed effects and changepoint, to support the validation claim.</p>
  </list-item>
  <list-item>
    <p><sc>recommended</sc> Add a sentence describing the approximate restricted log-likelihood (the “approx” in the print output) and what the approximation affects in the reported standard errors.</p>
  </list-item>
  <list-item>
    <p><sc>recommended</sc> Turn the Conclusions advice into a short rule tied to the four covariance specifications, naming which variance or covariance to drop first on non-convergence.</p>
  </list-item>
</list>
</body>
</sub-article>
<sub-article id="pr-r1-report3" article-type="reviewer-report">
<front-stub>
<article-id pub-id-type="doi">10.68365/jrepstat.2026.12.r1.report3</article-id>
<title-group>
<article-title>Report Reviewer 3, round 1</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<collab>JRepStat review engine</collab>
<role specific-use="reviewer" content-type="reviewer-3">Reviewer 3</role>
</contrib>
</contrib-group>
<pub-history>
<event event-type="reviewer-report-received">
<event-desc>Reviewer report received</event-desc>
<date iso-8601-date="2026-10-01"><day>01</day><month>10</month><year>2026</year></date>
</event>
</pub-history>
<related-object document-id="10.68365/jrepstat.2026.12" document-id-type="doi" document-type="peer-reviewed-article"/>
<custom-meta-group>
<custom-meta><meta-name>peer-review-stage</meta-name><meta-value>pre-publication</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-revision-round</meta-name><meta-value>0</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-recommendation</meta-name><meta-value>minor-revision</meta-value></custom-meta>
</custom-meta-group>
</front-stub>
<body>
<p><italic>Written by the journal&#x27;s review engine in the role of the software reviewer, and read by the editor before the decision. How the engine works is on the <ext-link ext-link-type="uri" xlink:href="https://jrepstat.fairpressjournals.com/about/peer-review/">peer review page</ext-link>.</italic></p>
<p>Recommendation: minor.</p>
<p>This is a clear, compact software illustration of segmented.lme and its companion methods. Read as code, the manuscript hangs together well. The internal arithmetic across the printed outputs is consistent: in Example 1 the changepoint estimate (1.724) matches the G0 coefficient, and the right slope (0.3507) equals the left slope plus the U coefficient. In Example 1 with the group interaction, the Obese left slope (-0.7337) and both right slopes recovered from slope(os1) reconstruct exactly from the summary table. In Example 2 the boundary-detection check is a genuine small validation, because which(!attr(oseg1<inline-formula><tex-math><![CDATA[psi.i, "is.break")) and which(dd]]></tex-math></inline-formula>perc.psi %in% c(0,1)) both return subjects 4 and 28. That agreement is the strongest part of the paper from a software standpoint.</p>
<p>The reproducibility gap sits in Example 1. The print output reports “Bootstrap restarting on 6 samples; 1 different solution(s)”, which tells the reader the fit involves a random component, yet no seed is set before the segmented() call. Example 2, by contrast, sets set.seed(123) and passes seed=15 to sim.seg, and the text even says “We set the seeds just to reproduce the results”. The two examples should be held to the same standard. A reader who runs the Example 1 block today may see different fixed effects and variance components from those in the paper. Setting a seed (or the appropriate seg.control option that governs the restart draws), or a one-line statement that the restarting results can vary, closes this.</p>
<p>The second gap is the one claim I cannot see supported. The paper states the simulated example serves “to validate the functions by comparing the results with the true parameter values”, then reports summary(oseg1) as “results not shown here”. The only quantities shown against truth are the left slope (-0.1995 against -0.2) and the boundary detection. For a paper that names validation as an explicit aim, the summary output and a short estimate-versus-truth comparison belong in the text. If that is more than intended, the simpler route is to describe the simulated example as an illustration plus the boundary check, and drop “validate”.</p>
<p>On environment: the manuscript pins “version 2.3-0 or higher” and names nlme, but gives no R version, operating system, or exact package versions. For a software article whose value is the exact printed numbers, a session-info block removes ambiguity about what produced them. I note that the artifacts declared at submission were not provided to me, so I have assessed the inline code and its internal consistency and have not run anything. A reader reproducing Example 2 also depends on sim.seg naming its output columns Xdif, Zpsi1, and Zpsi2, which the fit formula assumes. A single head(d) or a note on the column names would make that explicit.</p>
<p>Numbered suggestions to the authors:</p>
<list list-type="order">
  <list-item>
    <p><sc>required</sc> Make Example 1 reproducible: set a seed (or the seg.control option controlling the bootstrap restarts) before the segmented() call so the printed estimates reproduce, or add one sentence that bootstrap-restarting results can vary across runs.</p>
  </list-item>
  <list-item>
    <p><sc>required</sc> Support the validation aim by including the summary(oseg1) output with an explicit comparison of the estimated fixed effects and variance components to the true simulation values, or narrow “validate” to the boundary-detection check you already show.</p>
  </list-item>
  <list-item>
    <p><sc>recommended</sc> Add a session-info block giving the R version, operating system, and exact versions of segmented and nlme, and pin an exact segmented version for the numeric outputs.</p>
  </list-item>
  <list-item>
    <p><sc>recommended</sc> In Example 2, note or show that sim.seg returns the columns Xdif, Zpsi1, and Zpsi2 that the fit formula references, for instance with head(d), so the block runs without the reader guessing the column names.</p>
  </list-item>
  <list-item>
    <p>[editor_fix] Remove the duplicated word in Section 2, “the the ‘plot’ method”.</p>
  </list-item>
</list>
</body>
</sub-article>
<sub-article id="pr-r1-response" article-type="author-comment">
<front-stub>
<article-id pub-id-type="doi">10.68365/jrepstat.2026.12.r1.response</article-id>
<title-group>
<article-title>Authors&#x27; response, round 1</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<string-name>Vito M.R. Muggeo</string-name>
<role specific-use="author">Author</role>
</contrib>
</contrib-group>
<pub-history>
<event event-type="author-comment-received">
<event-desc>Author comment received</event-desc>
<date iso-8601-date="2026-10-30"><day>30</day><month>10</month><year>2026</year></date>
</event>
</pub-history>
<related-object document-id="10.68365/jrepstat.2026.12.r1.letter" document-id-type="doi" document-type="editor-report"/>
<related-object document-id="10.68365/jrepstat.2026.12.r1.report1" document-id-type="doi" document-type="reviewer-report"/>
<related-object document-id="10.68365/jrepstat.2026.12.r1.report2" document-id-type="doi" document-type="reviewer-report"/>
<related-object document-id="10.68365/jrepstat.2026.12.r1.report3" document-id-type="doi" document-type="reviewer-report"/>
<custom-meta-group>
<custom-meta><meta-name>peer-review-stage</meta-name><meta-value>pre-publication</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-revision-round</meta-name><meta-value>0</meta-value></custom-meta>
</custom-meta-group>
</front-stub>
<body>
<p>Authors confirm each required point as done or give their reason for declining it. Further answers are voluntary, because the review compares every revision with the previous version and the next round&#x27;s reports say what remains open.</p>
<p>With respect to the first version, I have modified the text to follow the referees’ suggestions, I have modified (slightly)the title, and I have added treatment of a couple of new functions (mainly breakpoint()). Also, the results in the 1st example are slightly improved (in terms of Likelihood) as I have modified the fitter functions to avoid early stopping of the algorithm.</p>
<list list-type="simple">
<list-item>
<p><sc>required</sc> Example 2 states its aim is to validate the functions against the true simulation parameters, then reports &quot;results not shown here&quot;. Show the summary(oseg1) comparison to the true values, or drop the validation framing and present the example as illustration only.</p>
<p><bold>Done.</bold></p>
</list-item>
<list-item>
<p><sc>required</sc> Example 1 is not reproducible as written because bootstrap restarting is stochastic and no seed is set, while Example 2 does set seeds. Set a seed (or the relevant seg.control option) so the printed estimates reproduce, or state in the text that bootstrap-restarting results can vary across runs.</p>
<p><bold>Done.</bold></p>
</list-item>
<list-item>
<p><sc>recommended</sc> The multinormal random-effects distribution in equation (4) and the zero-mean residual assumption are stated but never examined in either example. One sentence pointing to a residual or random-effects diagnostic, alongside the standardized-residual summary already printed, would show readers how to check the fit rather than assert it.</p>
<p><bold>Declined.</bold> it would require a not-so short treatment and I think it is out of aims of the paper</p>
</list-item>
<list-item>
<p><sc>recommended</sc> The paper is a tutorial for the author&#x27;s own `segmented` package, a relationship visible from the author line and the citations. A short competing-interests line stating that the author maintains the software would make the interest explicit. Add a competing-interests statement.</p>
<p><bold>Declined.</bold> I do not understand what you mean. Sorry.</p>
</list-item>
<list-item>
<p><sc>optional</sc> (conditional) One or two sentences on the clinical reading of the Control-versus-Obese changepoint difference would help an applied reader connect the fit to the glucose tolerance test.</p>
<p><bold>Declined.</bold> I don’t have added any “medical comment’ on the results in the first example: I don&#x27;t have the skills to do it</p>
</list-item>
</list>
<supplementary-material id="pr-r1-letter-file" xlink:href="fitting-segmented-mixed-models-with-random-changepoints-in-r-response-round1.pdf" mimetype="application" mime-subtype="pdf">
<caption>
<p>The authors' full response letter to round 1, as uploaded.</p>
</caption>
</supplementary-material>
</body>
</sub-article>
<sub-article id="pr-r2-letter" article-type="editor-report">
<front-stub>
<article-id pub-id-type="doi">10.68365/jrepstat.2026.12.r2.letter</article-id>
<title-group>
<article-title>Decision letter, round 2</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<contrib-id contrib-id-type="orcid">https://orcid.org/0000-0002-8638-5276</contrib-id>
<string-name>Matthias Templ</string-name>
<role specific-use="editor">Editor</role>
</contrib>
</contrib-group>
<pub-history>
<event event-type="editor-decision-sent">
<event-desc>Editor decision sent</event-desc>
<date iso-8601-date="2026-10-31"><day>31</day><month>10</month><year>2026</year></date>
</event>
</pub-history>
<related-object document-id="10.68365/jrepstat.2026.12" document-id-type="doi" document-type="peer-reviewed-article"/>
<custom-meta-group>
<custom-meta><meta-name>peer-review-stage</meta-name><meta-value>pre-publication</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-revision-round</meta-name><meta-value>1</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-recommendation</meta-name><meta-value>minor-revision</meta-value></custom-meta>
</custom-meta-group>
</front-stub>
<body>
<p><bold>Minor revision.</bold> Confirmed and signed by Matthias Templ on 2026-10-31.</p>
<p>The reviewers of the first round read the revision. Both required points of that round are met, one reviewer now recommends acceptance and two ask for a further minor revision. The remaining work is in the code that reproduces the paper. The uploaded script fits the group model from the wrong starting object, two printed functions give different intervals for the same slope, and the package build that produced the printed output is not on file.</p>
<p>Thank you for the revised version of your manuscript. This is round 2, and we are inviting a further minor revision. This round was read against the list you answered, and the editor has read your response against it in full. What follows is only what remains. An item carried over from the previous round says so.</p>
<p>This paper shows, with one real and one simulated dataset, how to fit and visualise segmented mixed models with random changepoints using segmented.lme in the R package segmented. It matters to applied analysts of longitudinal and clustered data who need subject-specific breakpoints estimated in a likelihood framework. We would be glad to see the revised version.</p>
<p>How to read this letter. The decision rests on the items marked required. If a required item seems wrong to you, or cannot be done within this paper, decline it on the revision page and give the reason. A reasoned decline is a legitimate answer, and the editor weighs it. Reviewers can be mistaken. Items marked recommended or optional are advice from the reviewers. Adopt them, decline them with a sentence, or leave them for later work. None of that counts against the paper. The reviewer reports below carry the same marks. The editor who signs this decision may weigh an item differently in the accompanying message, and that message prevails.</p>
<p>Reproducibility items marked required are the journal’s minimum for a paper that ships code with its results: code and a command that runs it, and by acceptance a captured computational environment (dependencies/lockfile/container) and a signed determinism attestation for the entry-point command. They document what you already have. They do not ask for new analysis.</p>
<p><sc>required</sc> (the decision rests on these):</p>
<list list-type="bullet">
  <list-item>
    <p>[consistency-check] The confint(os1) interval for the baseline left slope (“time” row, [-1.6293, -1.0747]) is not centred on the point estimate -1.2796 shown in summary(os1), and it disagrees with slope(os1), which reports [-1.5569, -1.0023] for the same baseline left slope. The breakpoint rows (G0, G.groupObese) in confint do match their point estimates, so the mismatch is specific to the non-breakpoint parameters. Please reconcile the confint output with summary and slope, or add one sentence stating why confint and slope produce different intervals for the same quantity.</p>
  </list-item>
  <list-item>
    <p>[methods-soundness] The new simulation block that produces Table 1 cannot run as printed. The storage matrices are sized to B with <monospace>B=3</monospace> (<monospace>V=matrix(,B,4)</monospace>, <monospace>SE&lt;-E&lt;-matrix(,B,7)</monospace>), while the loop is hard-coded <monospace>for(i in 1:300)</monospace>, so assignment to <monospace>V[i,]</monospace> fails once <monospace>i</monospace> exceeds 3 with a subscript-out-of-bounds error. The text states the table rests on 300 runs. Set <monospace>B=300</monospace> and index the loop as <monospace>for(i in 1:B)</monospace> so the printed snippet reproduces the table, or state that the manuscript snippet is a reduced illustration and the full run sits in the uploaded script. I did not open Rcode.R, so the script may already carry the corrected form.</p>
  </list-item>
  <list-item>
    <p>[software-quality] The self-contained script <monospace>Rcode.R</monospace> fits the group model with the wrong starting object. The line <monospace>os1&lt;-segmented(o,  time, z.psi= group, x.diff= group, random=subj 1+time+U+G0)</monospace> passes <monospace>o</monospace> (from <monospace>lme(phos time, ...)</monospace>), but the manuscript builds <monospace>os1</monospace> from <monospace>o1 &lt;- lme(phos time*group, ...)</monospace>. Starting from <monospace>o</monospace> drops the <monospace>groupObese</monospace> and <monospace>time:groupObese</monospace> fixed effects, so the script cannot produce the <monospace>summary(os1)</monospace>, <monospace>confint(os1)</monospace>, Figure 1 or Figure 2 shown in Section 3.1. Change <monospace>o</monospace> to <monospace>o1</monospace> on that line.</p>
  </list-item>
  <list-item>
    <p>[software-quality] Two divergent copies of <monospace>Rcode.R</monospace> are shipped (one inside <monospace>package+Rscript.zip</monospace>, one standalone) and neither reproduces the paper end to end. The zip copy calls <monospace>sim.seg(N, nj=12, ...)</monospace>, but the argument is <monospace>ni</monospace> (per <monospace>args(sim.seg)</monospace> in the paper), so that call errors; it also uses the old <monospace>n.plot=c(3,11)</monospace> layout. The standalone copy carries the <monospace>os1</monospace> bug above. Please ship one authoritative script that matches the printed output, or state which file is the reproduction artifact.</p>
  </list-item>
</list>
<p><sc>recommended</sc>:</p>
<list list-type="bullet">
  <list-item>
    <p>[software-quality] The package source extracted for this review contained only <monospace>Rcode.R</monospace>, not the <monospace>segmented</monospace> help pages or any <monospace>tests/</monospace> directory, so I cannot confirm that <monospace>segmented.lme</monospace>, <monospace>plot.segmented.lme</monospace>, <monospace>sim.seg</monospace>, <monospace>fixef</monospace>, <monospace>getVarCov</monospace>, <monospace>slope</monospace>, and <monospace>breakpoint</monospace> are exercised by automated tests. The earlier request (75ae2e1b) asked the paper to state whether these functions are covered by the package test suite and where those tests live; the revised text still does not say. One sentence pointing readers to the tests would close this.</p>
  </list-item>
  <list-item>
    <p>[software-quality] The reproducibility of the printed estimates rests on <monospace>segmented.lme()</monospace> deriving a seed from the response values, as the text now states. The script does not set <monospace>seg.control(seed=...)</monospace> explicitly anywhere, so reproduction depends entirely on that implicit behaviour and on the exact <monospace>segmented</monospace> version. The <monospace>sessionInfo()</monospace> now pins <monospace>segmented_2.3-0</monospace>, which helps; consider setting the seed explicitly in the script so the path is fixed independently of the internal default.</p>
  </list-item>
  <list-item>
    <p>[statistical-rigor] The new Table 1 supports the recovery claim with bias and a comparison of the mean model-based standard error to the empirical sampling sd over 300 replicates. It does not report the empirical coverage of the Wald intervals, which is the quantity that would directly back the sentence “we can trust the Wald statistic to build confidence intervals.” Add the coverage from the replicates already run.</p>
  </list-item>
  <list-item>
    <p>[statistical-rigor] For κ2 the mean standard error (0.020) is below the empirical sampling sd (0.025), and the mean estimate (-0.186) sits off the true -0.2. The summary “model-based standard errors quantifying rather appropriately the distribution standard deviations” overstates agreement for that term. Name the terms where the model-based SE understates spread.</p>
  </list-item>
  <list-item>
    <p>[ethics-and-integrity] The competing-interests point from the prior round [b6d11824] was declined because the request was unclear, so no statement was added. To be plain about what is meant: you wrote and maintain the segmented package that this paper is a tutorial for, and that is a competing interest a reader should see stated in the paper, separate from the maintainer field on CRAN. Add one line, for example “The author develops and maintains the segmented R package”, to the Acknowledgements or a Competing Interests section.</p>
  </list-item>
  <list-item>
    <p>[revision-response-verifier] Carry the unit phrasing into the Figure 2 caption and either pin an exact segmented version in Section 1 or note that “2.3-0 or higher” is intentional for the printed outputs.</p>
  </list-item>
  <list-item>
    <p>[visualisation] Axis labels give variable names (“time”, “phos”) without units. One phrase in each caption, naming the time unit and that phos is plasma inorganic phosphate, would let the figures stand on their own. This was asked in the previous round and is still open.</p>
  </list-item>
</list>
<p><sc>optional</sc>:</p>
<list list-type="bullet">
  <list-item>
    <p>[visualisation] One small residual, newly visible now that the grid is denser: each of the 33 panels in Figure 1 still repeats the base-plot “time”/“phos” labels inside the panel, while the units sit only on the outer edges. The panels would read more cleanly with the per-panel “time”/“phos” text suppressed so only the edge labels with units remain. The figure stands as drawn.</p>
  </list-item>
</list>
<p>We will correct these in production, and you confirm them in the proof:</p>
<list list-type="bullet">
  <list-item>
    <p>[consistency-check] In Section 3.1 the text reads “a less steep left slope (−1.2796 + 0.5461)”, but the summary(os1) table gives time:groupObese = 0.5460. The text value should read 0.5460.</p>
  </list-item>
  <list-item>
    <p>[consistency-check] The Section 1 roadmap states “section 3 reports some analyses on the simulated dataset”, but Section 3 contains both Example 1 (real data, glucoseData) and Example 2 (simulated data). The sentence should name both.</p>
  </list-item>
  <list-item>
    <p>[consistency-check] In Section 3.2 the additional profiles are named “the 6rd, the 5th and the 10th”. The subject numbers match the code <monospace>plot(oseg1, id=c(4,28,6,5,10), ...)</monospace> and Figure 3, so only the ordinal is wrong: “6rd” should read “6th”.</p>
  </list-item>
  <list-item>
    <p>[writing-quality] In Section 3 the sentence “even under the the standard Gaussian assumptions for the ϵ’s” repeats “the”. This is a duplicated word that survives into the revision, distinct from the Section 2 instance that was fixed.</p>
  </list-item>
  <list-item>
    <p>[writing-quality] In the Acknowledgements, “Teh author also thanks dr. V. Genoa” should read “The author”. A transposition, not an extraction artefact.</p>
  </list-item>
  <list-item>
    <p>[writing-quality] In Example 2, “Starting the analysis with a simple structure, e.e a diagonal matrix” should read “e.g.”.</p>
  </list-item>
  <list-item>
    <p>[revision-response-verifier] (production) The consistency fix for Example 2 introduced “the 6rd”, which should read “6th”.</p>
  </list-item>
</list>
</body>
</sub-article>
<sub-article id="pr-r2-report1" article-type="reviewer-report">
<front-stub>
<article-id pub-id-type="doi">10.68365/jrepstat.2026.12.r2.report1</article-id>
<title-group>
<article-title>Report Reviewer 1, round 2</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<collab>JRepStat review engine</collab>
<role specific-use="reviewer" content-type="reviewer-1">Reviewer 1</role>
</contrib>
</contrib-group>
<pub-history>
<event event-type="reviewer-report-received">
<event-desc>Reviewer report received</event-desc>
<date iso-8601-date="2026-10-30"><day>30</day><month>10</month><year>2026</year></date>
</event>
</pub-history>
<related-object document-id="10.68365/jrepstat.2026.12" document-id-type="doi" document-type="peer-reviewed-article"/>
<custom-meta-group>
<custom-meta><meta-name>peer-review-stage</meta-name><meta-value>pre-publication</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-revision-round</meta-name><meta-value>1</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-recommendation</meta-name><meta-value>minor-revision</meta-value></custom-meta>
</custom-meta-group>
</front-stub>
<body>
<p><italic>Written by the journal&#x27;s review engine in the role of the application reviewer, and read by the editor before the decision. How the engine works is on the <ext-link ext-link-type="uri" xlink:href="https://jrepstat.fairpressjournals.com/about/peer-review/">peer review page</ext-link>.</italic></p>
<p>Recommendation: minor.</p>
<p>Of the one required point and the recommended and optional points I raised, all are met or declined with a reason I accept. Example 2 no longer carries the validation framing and now shows the parameter recovery directly, through fixef() and getVarCov() tables that place the true values beside the estimates. That is a cleaner answer than the one I asked for and it settles the point. The near-zero random-effect standard deviations are now discussed and tied to the parsimony and model-selection reasoning, the blank U and G0 entries in the summary are explained in the text after the first summary() call, and sessionInfo() is printed. The decline on a clinical reading of the changepoint difference is reasonable: the author is a statistician and the paper does not need a medical interpretation to stand.</p>
<p>One issue is new in this version and I flag it as new. The small simulation study added at the end of Section 3.2 is a genuine improvement and the coverage-style summary in Table 1 is exactly the kind of evidence the recovery claim needed. The printed code for it will not run, though. The matrices V, E and SE are created with B rows where B is set to 3, and the loop then runs for(i in 1:300). In R a matrix does not grow on assignment, so V[i,] fails once i exceeds 3. A reader who copies the block to reproduce Table 1 gets a subscript error. The fix is small: set B=300 and index the loop and the matrices by B. The uploaded source file may already be correct, but the manuscript code is what a reader of a tutorial copies, so the printed snippet should be the one that runs.</p>
<p>Three small textual errors are new and can be settled in proof: “6rd” for “6th” in the Section 3.2 profile list, “Teh author” in the Acknowledgements, and “e.e” for “e.g.” in Section 3.2.</p>
<p>Numbered suggestions to the authors:</p>
<list list-type="order">
  <list-item>
    <p><sc>required</sc> Repair the Section 3.2 simulation snippet so it runs: set B=300 and size V, E and SE and the loop by B (for(i in 1:B)), so the code reproduces Table 1 rather than erroring at the fourth iteration.</p>
  </list-item>
  <list-item>
    <p>[editor_fix] Correct “the 6rd” to “the 6th” in Section 3.2 to match the plot call and Figure 3.</p>
  </list-item>
  <list-item>
    <p>[editor_fix] Correct “Teh author” to “The author” in the Acknowledgements and “e.e a diagonal matrix” to “e.g. a diagonal matrix” in Section 3.2.</p>
  </list-item>
</list>
</body>
</sub-article>
<sub-article id="pr-r2-report2" article-type="reviewer-report">
<front-stub>
<article-id pub-id-type="doi">10.68365/jrepstat.2026.12.r2.report2</article-id>
<title-group>
<article-title>Report Reviewer 2, round 2</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<collab>JRepStat review engine</collab>
<role specific-use="reviewer" content-type="reviewer-2">Reviewer 2</role>
</contrib>
</contrib-group>
<pub-history>
<event event-type="reviewer-report-received">
<event-desc>Reviewer report received</event-desc>
<date iso-8601-date="2026-10-30"><day>30</day><month>10</month><year>2026</year></date>
</event>
</pub-history>
<related-object document-id="10.68365/jrepstat.2026.12" document-id-type="doi" document-type="peer-reviewed-article"/>
<custom-meta-group>
<custom-meta><meta-name>peer-review-stage</meta-name><meta-value>pre-publication</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-revision-round</meta-name><meta-value>1</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-recommendation</meta-name><meta-value>accept</meta-value></custom-meta>
</custom-meta-group>
</front-stub>
<body>
<p><italic>Written by the journal&#x27;s review engine in the role of the methodology reviewer, and read by the editor before the decision. How the engine works is on the <ext-link ext-link-type="uri" xlink:href="https://jrepstat.fairpressjournals.com/about/peer-review/">peer review page</ext-link>.</italic></p>
<p>Recommendation: accept.</p>
<p>Of the one required point and five lighter ones I raised, all are met. The validation framing in Example 2 is now “assess”, and the example displays the fixed effects against the sim.seg truth via fixef() and the random-effect standard deviations via getVarCov(), which is exactly the evidence the stated purpose needed. The summary output now carries a clear paragraph on why U drops its p-value and why both the t- and p-value are dropped for the changepoint, tied to the non-regular inference. The “approx” log-likelihood is explained with a pointer to Muggeo et al. (2014). The Conclusions give a usable rule for the four covariance specifications, start simple and build up. The new repeated-simulation study (Table 1, 300 replicates) reports means, medians and sampling standard deviations against the model-based standard errors, which answers the bias-and-coverage request in substance even though coverage is not tabulated as a percentage. The decline on residual and random-effects diagnostics is reasoned and reasonable for a tutorial of this length, and I am content to leave it out of scope.</p>
<p>What remains is a single code inconsistency in the new material, which I could not have raised before because the simulation did not exist in the prior version. The loop dimensions V, SE and E with B rows after setting B=3, then iterates over 1:300. As printed it will fail at the fourth iteration with a subscript error, so the code does not reproduce Table 1. The fix is to set B to 300 before the matrices are created, and to confirm the uploaded script carries the same value.</p>
<p>The remaining items are small demonstrable mismatches between the text and the outputs it quotes, which production handles and you confirm in the proof.</p>
<p>Numbered suggestions to the authors:</p>
<list list-type="order">
  <list-item>
    <p>[editor_fix] In the simulation code, set B to 300 before dimensioning V, SE and E, so the loop over 1:300 runs and produces Table 1, and align the uploaded script.</p>
  </list-item>
  <list-item>
    <p>[editor_fix] Remove the duplicated word in “even under the the standard Gaussian assumptions” (Section 3).</p>
  </list-item>
  <list-item>
    <p>[editor_fix] Change “the 6rd” to “the 6th” (Section 3.2) to match id=c(4,28,6,5,10) and Figure 3.</p>
  </list-item>
  <list-item>
    <p>[editor_fix] Reconcile “-1.2796 + 0.5461” in Section 3.1 with the summary coefficient 0.5460.</p>
  </list-item>
  <list-item>
    <p>[editor_fix] Change “Teh author” to “The author” in the acknowledgements.</p>
  </list-item>
</list>
</body>
</sub-article>
<sub-article id="pr-r2-report3" article-type="reviewer-report">
<front-stub>
<article-id pub-id-type="doi">10.68365/jrepstat.2026.12.r2.report3</article-id>
<title-group>
<article-title>Report Reviewer 3, round 2</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<collab>JRepStat review engine</collab>
<role specific-use="reviewer" content-type="reviewer-3">Reviewer 3</role>
</contrib>
</contrib-group>
<pub-history>
<event event-type="reviewer-report-received">
<event-desc>Reviewer report received</event-desc>
<date iso-8601-date="2026-10-30"><day>30</day><month>10</month><year>2026</year></date>
</event>
</pub-history>
<related-object document-id="10.68365/jrepstat.2026.12" document-id-type="doi" document-type="peer-reviewed-article"/>
<custom-meta-group>
<custom-meta><meta-name>peer-review-stage</meta-name><meta-value>pre-publication</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-revision-round</meta-name><meta-value>1</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-recommendation</meta-name><meta-value>minor-revision</meta-value></custom-meta>
</custom-meta-group>
</front-stub>
<body>
<p><italic>Written by the journal&#x27;s review engine in the role of the software reviewer, and read by the editor before the decision. How the engine works is on the <ext-link ext-link-type="uri" xlink:href="https://jrepstat.fairpressjournals.com/about/peer-review/">peer review page</ext-link>.</italic></p>
<p>Recommendation: minor.</p>
<p>All five points from my prior report are met. The Example 1 reproducibility gap is resolved cleanly: the text now explains that segmented.lme() derives its seed from the response values, so the bootstrap-restart path is deterministic, and it points to seg.control(seed=) for an explicit alternative. The validation framing is softened to “assess” and backed by a direct true-versus-estimate table for both fixed effects (via fixef) and the random-effect standard deviations (via getVarCov), which is exactly the comparison I asked for. The sessionInfo() block pins R 4.6.1, the OS, and segmented_2.3-0 and nlme_3.1-169. Example 2 now shows head(d,3) with the Xdif, Zpsi1, and Zpsi2 columns named in the text. The duplicated “the the ‘plot’ method” is gone.</p>
<p>One new item is material and newly visible in this version. The simulation study added at the end of Section 3.2 is a genuine improvement and the Table 1 recovery looks sound, but the displayed code will not run. V, E, and SE are allocated with matrix(,B,4) and matrix(,B,7) while B is set to 3, yet the loop iterates for(i in 1:300). Assigning V[i,] for i greater than 3 raises “subscript out of bounds” in R, so the block errors at the fourth iteration and never fills the matrices Table 1 reports. The caption and surrounding text both say the results are based on 300 runs, so the intent is clear. Set B=300 and index both the allocations and the loop by B (or 1:B), so the code that produces Table 1 is the code the paper prints. For a software article whose value rests on the printed numbers being the code’s output, this one should be correct.</p>
<p>The three small text errors I list as editor_fix all sit in newly added or newly edited sentences and the paper itself fixes their values.</p>
<p>Numbered suggestions to the authors:</p>
<list list-type="order">
  <list-item>
    <p><sc>required</sc> Make the simulation block run as printed: set B=300 (or allocate V, E, SE with nrow=300) and iterate the loop by 1:B, so the code matches Table 1’s stated 300 replicates.</p>
  </list-item>
  <list-item>
    <p>[editor_fix] Correct three text errors in the new material: “under the the standard Gaussian assumptions” (duplicated “the”), “Teh author” in the Acknowledgements, and “the 6rd” in Section 3.2 (should read “6th”).</p>
  </list-item>
</list>
</body>
</sub-article>
<sub-article id="pr-r2-response" article-type="author-comment">
<front-stub>
<article-id pub-id-type="doi">10.68365/jrepstat.2026.12.r2.response</article-id>
<title-group>
<article-title>Authors&#x27; response, round 2</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<string-name>Vito M.R. Muggeo</string-name>
<role specific-use="author">Author</role>
</contrib>
</contrib-group>
<pub-history>
<event event-type="author-comment-received">
<event-desc>Author comment received</event-desc>
<date iso-8601-date="2026-11-03"><day>03</day><month>11</month><year>2026</year></date>
</event>
</pub-history>
<related-object document-id="10.68365/jrepstat.2026.12.r2.letter" document-id-type="doi" document-type="editor-report"/>
<related-object document-id="10.68365/jrepstat.2026.12.r2.report1" document-id-type="doi" document-type="reviewer-report"/>
<related-object document-id="10.68365/jrepstat.2026.12.r2.report2" document-id-type="doi" document-type="reviewer-report"/>
<related-object document-id="10.68365/jrepstat.2026.12.r2.report3" document-id-type="doi" document-type="reviewer-report"/>
<custom-meta-group>
<custom-meta><meta-name>peer-review-stage</meta-name><meta-value>pre-publication</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-revision-round</meta-name><meta-value>1</meta-value></custom-meta>
</custom-meta-group>
</front-stub>
<body>
<p>Authors confirm each required point as done or give their reason for declining it. Further answers are voluntary, because the review compares every revision with the previous version and the next round&#x27;s reports say what remains open.</p>
<list list-type="simple">
<list-item>
<p><sc>required</sc> The confint(os1) interval for the baseline left slope (&quot;time&quot; row, [-1.6293, -1.0747]) is not centred on the point estimate -1.2796 shown in summary(os1), and it disagrees with slope(os1), which reports [-1.5569, -1.0023] for the same baseline left slope. The breakpoint rows (G0, G.groupObese) in confint do match their point estimates, so the mismatch is specific to the non-breakpoint parameters. Please reconcile the confint output with summary and slope, or add one sentence stating why confint and slope produce different intervals for the same quantity.</p>
<p><bold>Done.</bold> Thanks for noting that. I have corrected the function</p>
</list-item>
<list-item>
<p><sc>required</sc> The new simulation block that produces Table 1 cannot run as printed. The storage matrices are sized to B with `B=3` (`V=matrix(,B,4)`, `SE&lt;-E&lt;-matrix(,B,7)`), while the loop is hard-coded `for(i in 1:300)`, so assignment to `V[i,]` fails once `i` exceeds 3 with a subscript-out-of-bounds error. The text states the table rests on 300 runs. Set `B=300` and index the loop as `for(i in 1:B)` so the printed snippet reproduces the table, or state that the manuscript snippet is a reduced illustration and the full run sits in the uploaded script. I did not open Rcode.R, so the script may already carry the corrected form.</p>
<p><bold>Done.</bold> corrected, thanks.</p>
</list-item>
<list-item>
<p><sc>required</sc> The self-contained script `Rcode.R` fits the group model with the wrong starting object. The line `os1&lt;-segmented(o,  time, z.psi= group, x.diff= group, random=subj 1+time+U+G0)` passes `o` (from `lme(phos time, ...)`), but the manuscript builds `os1` from `o1 &lt;- lme(phos time*group, ...)`. Starting from `o` drops the `groupObese` and `time:groupObese` fixed effects, so the script cannot produce the `summary(os1)`, `confint(os1)`, Figure 1 or Figure 2 shown in Section 3.1. Change `o` to `o1` on that line.</p>
<p><bold>Done.</bold> Yes, of course. Thanks for noting that. I have corrected that</p>
</list-item>
<list-item>
<p><sc>required</sc> Two divergent copies of `Rcode.R` are shipped (one inside `package+Rscript.zip`, one standalone) and neither reproduces the paper end to end. The zip copy calls `sim.seg(N, nj=12, ...)`, but the argument is `ni` (per `args(sim.seg)` in the paper), so that call errors; it also uses the old `n.plot=c(3,11)` layout. The standalone copy carries the `os1` bug above. Please ship one authoritative script that matches the printed output, or state which file is the reproduction artifact.</p>
<p><bold>Done.</bold> I&#x27;m sorry for the inconvenience. I got confused. I am uploading the file Rcode+package.zip including  i)the new version of the package segmented_2.3-0.tar.gz, and ii)the Rcode.R to replicate the analyses in the paper</p>
</list-item>
<list-item>
<p><sc>recommended</sc> The package source extracted for this review contained only `Rcode.R`, not the `segmented` help pages or any `tests/` directory, so I cannot confirm that `segmented.lme`, `plot.segmented.lme`, `sim.seg`, `fixef`, `getVarCov`, `slope`, and `breakpoint` are exercised by automated tests. The earlier request (75ae2e1b) asked the paper to state whether these functions are covered by the package test suite and where those tests live; the revised text still does not say. One sentence pointing readers to the tests would close this.</p>
<p><bold>Done.</bold> I apologize for the inconvenience. I got confused. I am uploading the file Rcode+package.zip including  i)the new version of the package segmented_2.3-0.tar.gz, and ii)the Rcode.R to replicate the analyses in the paper</p>
</list-item>
<list-item>
<p><sc>recommended</sc> The reproducibility of the printed estimates rests on `segmented.lme()` deriving a seed from the response values, as the text now states. The script does not set `seg.control(seed=...)` explicitly anywhere, so reproduction depends entirely on that implicit behaviour and on the exact `segmented` version. The `sessionInfo()` now pins `segmented_2.3-0`, which helps; consider setting the seed explicitly in the script so the path is fixed independently of the internal default.</p>
<p><bold>Declined.</bold> I have commented in the text the behaviour  of segmented and the possibility of using the &#x27;seg.control(seed=..)&#x27;. I think it is enough. I hope you are fine with my choice</p>
</list-item>
<list-item>
<p><sc>recommended</sc> The new Table 1 supports the recovery claim with bias and a comparison of the mean model-based standard error to the empirical sampling sd over 300 replicates. It does not report the empirical coverage of the Wald intervals, which is the quantity that would directly back the sentence &quot;we can trust the Wald statistic to build confidence intervals.&quot; Add the coverage from the replicates already run.</p>
<p><bold>Done.</bold> Table 1 now includes the coverage levels (last column)</p>
</list-item>
<list-item>
<p><sc>recommended</sc> For κ2 the mean standard error (0.020) is below the empirical sampling sd (0.025), and the mean estimate (-0.186) sits off the true -0.2. The summary &quot;model-based standard errors quantifying rather appropriately the distribution standard deviations&quot; overstates agreement for that term. Name the terms where the model-based SE understates spread.</p>
<p><bold>Done.</bold> I have modified the comments, by underlining the behaviour for kappa1 (and kappa2 too).</p>
</list-item>
<list-item>
<p><sc>recommended</sc> The competing-interests point from the prior round [b6d11824] was declined because the request was unclear, so no statement was added. To be plain about what is meant: you wrote and maintain the segmented package that this paper is a tutorial for, and that is a competing interest a reader should see stated in the paper, separate from the maintainer field on CRAN. Add one line, for example &quot;The author develops and maintains the segmented R package&quot;, to the Acknowledgements or a Competing Interests section.</p>
<p><bold>Done.</bold> Added in the Acknowledgements</p>
</list-item>
<list-item>
<p><sc>recommended</sc> Axis labels give variable names (&quot;time&quot;, &quot;phos&quot;) without units. One phrase in each caption, naming the time unit and that phos is plasma inorganic phosphate, would let the figures stand on their own. This was asked in the previous round and is still open.</p>
<p><bold>Declined.</bold> Yes, it was asked, and in fact I followed such suggestion by specifying the labels in the x- and y-axis (by also adding the units as you suggested) of Figure 1. In Figure 2 , in order to keep simple the relevant code, the labels are the variable names.</p>
</list-item>
<list-item>
<p><sc>optional</sc> One small residual, newly visible now that the grid is denser: each of the 33 panels in Figure 1 still repeats the base-plot &quot;time&quot;/&quot;phos&quot; labels inside the panel, while the units sit only on the outer edges. The panels would read more cleanly with the per-panel &quot;time&quot;/&quot;phos&quot; text suppressed so only the edge labels with units remain. The figure stands as drawn.</p>
<p><bold>Declined.</bold> I am sorry, but  I see no &quot;time&quot;/&quot;phos&quot; labels inside the 33 panels in Figure 1.</p>
</list-item>
<list-item>
<p><sc>recommended</sc> I am assessing from the manuscript and the described public interface. The package source, its help pages, and any `tests/` directory were not supplied, so I cannot confirm that the documented behaviour of `segmented.lme`, `plot.segmented.lme`, `sim.seg`, and `slope` is covered by automated tests. State in the paper whether the demonstrated functions are exercised by the package test suite, and point readers to where those tests live.</p>
<p><bold>Done.</bold> I am uploading the file Rcode+package.zip including  i)the new version of the package segmented_2.3-0.tar.gz, and ii)the Rcode.R to replicate the analyses in the paper</p>
</list-item>
<list-item>
<p><sc>recommended</sc> Axis labels give variable names (&quot;time&quot;, &quot;phos&quot;) without units. One phrase in each caption, naming the time unit and that phos is plasma inorganic phosphate, would let the figures stand on their own.</p>
<p><bold>Done.</bold> In the caption of Figure 2</p>
</list-item>
<list-item>
<p><sc>recommended</sc> Report R version, operating system, and the exact versions of segmented and nlme used, and pin an exact segmented version instead of &quot;2.3-0 or higher&quot; for the numeric outputs.</p>
<p><bold>Done.</bold> At the end of section 3, I report the output of sessionInfo()</p>
</list-item>
</list>
</body>
</sub-article>
<sub-article id="pr-r3-letter" article-type="editor-report">
<front-stub>
<article-id pub-id-type="doi">10.68365/jrepstat.2026.12.r3.letter</article-id>
<title-group>
<article-title>Decision letter, round 3</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<contrib-id contrib-id-type="orcid">https://orcid.org/0000-0002-8638-5276</contrib-id>
<string-name>Matthias Templ</string-name>
<role specific-use="editor">Editor</role>
</contrib>
</contrib-group>
<pub-history>
<event event-type="editor-decision-sent">
<event-desc>Editor decision sent</event-desc>
<date iso-8601-date="2026-11-03"><day>03</day><month>11</month><year>2026</year></date>
</event>
</pub-history>
<related-object document-id="10.68365/jrepstat.2026.12" document-id-type="doi" document-type="peer-reviewed-article"/>
<custom-meta-group>
<custom-meta><meta-name>peer-review-stage</meta-name><meta-value>pre-publication</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-revision-round</meta-name><meta-value>2</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-recommendation</meta-name><meta-value>minor-revision</meta-value></custom-meta>
</custom-meta-group>
</front-stub>
<body>
<p><bold>Minor revision.</bold> Confirmed and signed by Matthias Templ on 2026-11-03.</p>
<p>The editor re-weighted 2 points.</p>
<p>Thank you for the revised version of your manuscript. This is round 3, and we are inviting a further minor revision. This round was read against the list you answered, and the editor has read your response against it in full. What follows is only what remains. An item carried over from the previous round says so.</p>
<p>This paper shows, with one real and one simulated dataset, how to fit and visualise segmented mixed models with random changepoints using segmented.lme in the R package segmented. It matters to applied analysts of longitudinal and clustered data who need subject-specific breakpoints estimated in a likelihood framework. We would be glad to see the revised version.</p>
<p>How to read this letter. The decision rests on the items marked required. If a required item seems wrong to you, or cannot be done within this paper, decline it on the revision page and give the reason. A reasoned decline is a legitimate answer, and the editor weighs it. Reviewers can be mistaken. Items marked recommended or optional are advice from the reviewers. Adopt them, decline them with a sentence, or leave them for later work. None of that counts against the paper. The reviewer reports below carry the same marks. The editor who signs this decision may weigh an item differently in the accompanying message, and that message prevails.</p>
<p><sc>recommended</sc>:</p>
<list list-type="bullet">
  <list-item>
    <p>[software-quality] The submission still carries two stale copies of <monospace>Rcode.R</monospace> that do not match the paper: <monospace>upload: Rcode.R</monospace> (standalone) still fits <monospace>os1&lt;-segmented(o, ...)</monospace> with the wrong starting object the prior round flagged, and <monospace>package+Rscript.zip: Rcode.R</monospace> still calls <monospace>sim.seg(N, nj=12, ...)</monospace> with the wrong argument <monospace>nj</monospace> and the old <monospace>n.plot=c(3,11)</monospace> layout. The author has named <monospace>Rcode+package.zip</monospace> as the reproduction artifact, which resolves the ambiguity, but removing or clearly marking the two superseded copies would stop a reader from running the wrong file.</p>
  </list-item>
  <list-item>
    <p>[software-quality] I am assessing from the manuscript and the described public interface. The package source, its help pages, and any <monospace>tests/</monospace> directory were not supplied, so I cannot confirm that the documented behaviour of <monospace>segmented.lme</monospace>, <monospace>plot.segmented.lme</monospace>, <monospace>sim.seg</monospace>, and <monospace>slope</monospace> is covered by automated tests. State in the paper whether the demonstrated functions are exercised by the package test suite, and point readers to where those tests live. This was asked in the previous round and is still open.</p>
  </list-item>
</list>
<p><sc>optional</sc>:</p>
<list list-type="bullet">
  <list-item>
    <p>[software-quality] The declared reproduction artifact <monospace>Rcode+package.zip: Rcode.R</monospace> sets the simulation covariance as <monospace>S=diag(c(.12,.05,.3,.02)^2)</monospace> in the small simulation loop, so the breakpoint random-effect sd is 0.02. The paper’s printed snippet uses <monospace>S=diag(c(.12,.05,.3,.1)^2)</monospace> and Table 1 reports σk true 0.10 with mean 0.090 and sd 0.011. A run with σk=0.02 cannot produce a mean of 0.090, so the uploaded authoritative script would not reproduce the σk row of Table 1. Set the fourth variance in <monospace>S</monospace> to <monospace>.1</monospace> in the uploaded script, or correct the Table 1 σk entries, so the script and the table agree.</p>
  </list-item>
</list>
<p>We will correct these in production, and you confirm them in the proof:</p>
<list list-type="bullet">
  <list-item>
    <p>[consistency-check] The Section 3.1 text still reads “a less steep left slope (−1.2796 + 0.5461)”, while summary(os1) gives time:groupObese = 0.5460. The text should read 0.5460. This was raised last round (faa3a12a) and the manuscript still carries 0.5461.</p>
  </list-item>
  <list-item>
    <p>[consistency-check] The Section 1 roadmap still states “section 3 reports some analyses on the simulated dataset”, but Section 3 contains Example 1 (real glucoseData) and Example 2 (simulated data). The sentence should name both. Raised last round (5436d34f) and still open.</p>
  </list-item>
  <list-item>
    <p>[consistency-check] In Section 3.2 the profiles are still named “the 6rd, the 5th and the 10th”. The code plot(oseg1, id=c(4,28,6,5,10)) and Figure 3 confirm subject 6, so the ordinal should read “6th”. Raised last round (e3ab272b/f99c9341) and still present.</p>
  </list-item>
  <list-item>
    <p>[methods-soundness] In Section 3.2 the phrase “values quite close to 0.95%” carries a stray percent sign; the nominal level is 0.95 or 95%. The paper itself determines the correct value.</p>
  </list-item>
  <list-item>
    <p>[revision-response-verifier] Several production corrections from the prior round remain unmade in the text, the “0.5461” value (should be 0.5460), the Section 1 roadmap naming both examples, “6rd” (should be 6th), the duplicated “the”, and “e.e” (should be “e.g.”), and should be carried to the proof list.</p>
  </list-item>
  <list-item>
    <p>[Reviewer 1] Section 3.2 still reads “e.e a diagonal matrix”; this should read “e.g. a diagonal matrix”.</p>
  </list-item>
  <list-item>
    <p>[Reviewer 2] Section 3 still reads “even under the the standard Gaussian assumptions”; the duplicated “the” remains.</p>
  </list-item>
  <list-item>
    <p>[revision-response-verifier] (production) The consistency fix for Example 2 introduced “the 6rd”, which should read “6th”. This was asked in the previous round and is still open.</p>
  </list-item>
</list>
</body>
</sub-article>
<sub-article id="pr-r3-report1" article-type="reviewer-report">
<front-stub>
<article-id pub-id-type="doi">10.68365/jrepstat.2026.12.r3.report1</article-id>
<title-group>
<article-title>Report Reviewer 1, round 3</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<collab>JRepStat review engine</collab>
<role specific-use="reviewer" content-type="reviewer-1">Reviewer 1</role>
</contrib>
</contrib-group>
<pub-history>
<event event-type="reviewer-report-received">
<event-desc>Reviewer report received</event-desc>
<date iso-8601-date="2026-11-03"><day>03</day><month>11</month><year>2026</year></date>
</event>
</pub-history>
<related-object document-id="10.68365/jrepstat.2026.12" document-id-type="doi" document-type="peer-reviewed-article"/>
<custom-meta-group>
<custom-meta><meta-name>peer-review-stage</meta-name><meta-value>pre-publication</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-revision-round</meta-name><meta-value>2</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-recommendation</meta-name><meta-value>accept</meta-value></custom-meta>
</custom-meta-group>
</front-stub>
<body>
<p><italic>Written by the journal&#x27;s review engine in the role of the application reviewer, and read by the editor before the decision. How the engine works is on the <ext-link ext-link-type="uri" xlink:href="https://jrepstat.fairpressjournals.com/about/peer-review/">peer review page</ext-link>.</italic></p>
<p>Recommendation: accept.</p>
<p>The one required point is met. The simulation snippet at the end of Section 3.2 now runs: the loop is for(i in 1:B) and V, E and SE are sized by B, so the subscript error at i=4 is gone. The author kept B=3 in the printed block for speed and states in the text that Table 1 rests on 300 runs rather than 3. That is a sound choice for a tutorial, the printed code executes without error, and a reader who wants the table is told to raise B. The uploaded Rcode.R and segmented_2.3-0 archive settle the reproducibility artifact as well. I am content with the resolution.</p>
<p>Two of the three textual corrections I flagged remain. The Acknowledgements now read “The author”. The profile-list typo “6rd” and the “e.e” abbreviation in Section 3.2 are still present in this version. Both are editor_fix items whose correct values the text itself fixes, so they belong on the proof production list rather than holding the paper.</p>
<p>Numbered suggestions to the authors:</p>
<list list-type="order">
  <list-item>
    <p>[editor_fix] Correct “the 6rd” to “the 6th” in Section 3.2 to match the plot call and Figure 3.</p>
  </list-item>
  <list-item>
    <p>[editor_fix] Correct “e.e a diagonal matrix” to “e.g. a diagonal matrix” in Section 3.2.</p>
  </list-item>
</list>
</body>
</sub-article>
<sub-article id="pr-r3-report2" article-type="reviewer-report">
<front-stub>
<article-id pub-id-type="doi">10.68365/jrepstat.2026.12.r3.report2</article-id>
<title-group>
<article-title>Report Reviewer 2, round 3</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<collab>JRepStat review engine</collab>
<role specific-use="reviewer" content-type="reviewer-2">Reviewer 2</role>
</contrib>
</contrib-group>
<pub-history>
<event event-type="reviewer-report-received">
<event-desc>Reviewer report received</event-desc>
<date iso-8601-date="2026-11-03"><day>03</day><month>11</month><year>2026</year></date>
</event>
</pub-history>
<related-object document-id="10.68365/jrepstat.2026.12" document-id-type="doi" document-type="peer-reviewed-article"/>
<custom-meta-group>
<custom-meta><meta-name>peer-review-stage</meta-name><meta-value>pre-publication</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-revision-round</meta-name><meta-value>2</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-recommendation</meta-name><meta-value>accept</meta-value></custom-meta>
</custom-meta-group>
</front-stub>
<body>
<p><italic>Written by the journal&#x27;s review engine in the role of the methodology reviewer, and read by the editor before the decision. How the engine works is on the <ext-link ext-link-type="uri" xlink:href="https://jrepstat.fairpressjournals.com/about/peer-review/">peer review page</ext-link>.</italic></p>
<p>Recommendation: accept.</p>
<p>Of the five production points I raised last round, two are settled and three remain. The acknowledgements now read “The author”, so that one is done. The simulation code no longer crashes: the loop runs over 1:B rather than 1:300, so the subscript error is gone, and the text now records that Table 1 rests on 300 runs while the printed snippet keeps B=3 for speed. That is a reasonable way to leave it, and with the uploaded Rcode.R carrying the full run I am content. A reader who copies the printed snippet verbatim will get a 3-run table rather than the one shown, but the text says so.</p>
<p>Three small demonstrable mismatches between the text and its own outputs are still in the manuscript: the duplicated “the the” in Section 3, “6rd” where “6th” is meant in Section 3.2, and “0.5461” in Section 3.1 against the table value 0.5460. None of these touch a claim or a result. They are production fixes you confirm in the proof, and they do not hold the paper. The methodology, the worked examples, the summary output explanation for the dropped p-values, and the simulation with coverage levels in Table 1 all stand as accepted last round.</p>
<p>Numbered suggestions to the authors:</p>
<list list-type="order">
  <list-item>
    <p>[editor_fix] Remove the duplicated word in “even under the the standard Gaussian assumptions” (Section 3).</p>
  </list-item>
  <list-item>
    <p>[editor_fix] Change “the 6rd” to “the 6th” (Section 3.2) to match id=c(4,28,6,5,10) and Figure 3.</p>
  </list-item>
  <list-item>
    <p>[editor_fix] Reconcile “-1.2796 + 0.5461” in Section 3.1 with the summary coefficient 0.5460.</p>
  </list-item>
</list>
</body>
</sub-article>
<sub-article id="pr-r3-report3" article-type="reviewer-report">
<front-stub>
<article-id pub-id-type="doi">10.68365/jrepstat.2026.12.r3.report3</article-id>
<title-group>
<article-title>Report Reviewer 3, round 3</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<collab>JRepStat review engine</collab>
<role specific-use="reviewer" content-type="reviewer-3">Reviewer 3</role>
</contrib>
</contrib-group>
<pub-history>
<event event-type="reviewer-report-received">
<event-desc>Reviewer report received</event-desc>
<date iso-8601-date="2026-11-03"><day>03</day><month>11</month><year>2026</year></date>
</event>
</pub-history>
<related-object document-id="10.68365/jrepstat.2026.12" document-id-type="doi" document-type="peer-reviewed-article"/>
<custom-meta-group>
<custom-meta><meta-name>peer-review-stage</meta-name><meta-value>pre-publication</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-revision-round</meta-name><meta-value>2</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-recommendation</meta-name><meta-value>accept</meta-value></custom-meta>
</custom-meta-group>
</front-stub>
<body>
<p><italic>Written by the journal&#x27;s review engine in the role of the software reviewer, and read by the editor before the decision. How the engine works is on the <ext-link ext-link-type="uri" xlink:href="https://jrepstat.fairpressjournals.com/about/peer-review/">peer review page</ext-link>.</italic></p>
<p>Recommendation: accept.</p>
<p>The required point is met. The simulation block is now internally consistent and runs as printed: B is set to 3, V, E and SE are sized to B, and the loop iterates 1:B, so there is no subscript error. The author resolved the 3-versus-300 mismatch by keeping the quick B=3 demo in the printed listing and stating in the surrounding text that Table 1 is based on 300 runs. A reader reproducing Table 1 sets B=300, and the provided Rcode.R carries the full run. For a software illustration this is a reasonable resolution, and the defect that made the block error out is gone.</p>
<p>Two of the three editor_fix text errors remain in the current version. Section 3 still reads “even under the the standard Gaussian assumptions”, and Section 3.2 still reads “the 6rd” where “6th” is meant. Both carry values the paper itself fixes, so they belong on the production list for the proof. “Teh author” is corrected.</p>
<p>The seed decline is fine. Commenting the segmented.lme() seed behaviour and pointing to seg.control(seed=) in the text covers the replicability question without a code change, and the Example 1 narrative already explains the response-derived seed.</p>
<p>Numbered suggestions to the authors:</p>
<list list-type="order">
  <list-item>
    <p>[editor_fix] Correct the two remaining text errors for the proof: “under the the standard Gaussian assumptions” (duplicated “the”) in Section 3, and “the 6rd” (should read “6th”) in Section 3.2.</p>
  </list-item>
</list>
</body>
</sub-article>
<sub-article id="pr-r3-response" article-type="author-comment">
<front-stub>
<article-id pub-id-type="doi">10.68365/jrepstat.2026.12.r3.response</article-id>
<title-group>
<article-title>Authors&#x27; response, round 3</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<string-name>Vito M.R. Muggeo</string-name>
<role specific-use="author">Author</role>
</contrib>
</contrib-group>
<pub-history>
<event event-type="author-comment-received">
<event-desc>Author comment received</event-desc>
<date iso-8601-date="2026-11-06"><day>06</day><month>11</month><year>2026</year></date>
</event>
</pub-history>
<related-object document-id="10.68365/jrepstat.2026.12.r3.letter" document-id-type="doi" document-type="editor-report"/>
<related-object document-id="10.68365/jrepstat.2026.12.r3.report1" document-id-type="doi" document-type="reviewer-report"/>
<related-object document-id="10.68365/jrepstat.2026.12.r3.report2" document-id-type="doi" document-type="reviewer-report"/>
<related-object document-id="10.68365/jrepstat.2026.12.r3.report3" document-id-type="doi" document-type="reviewer-report"/>
<custom-meta-group>
<custom-meta><meta-name>peer-review-stage</meta-name><meta-value>pre-publication</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-revision-round</meta-name><meta-value>2</meta-value></custom-meta>
</custom-meta-group>
</front-stub>
<body>
<p>Authors confirm each required point as done or give their reason for declining it. Further answers are voluntary, because the review compares every revision with the previous version and the next round&#x27;s reports say what remains open.</p>
<list list-type="simple">
<list-item>
<p><sc>recommended</sc> The submission still carries two stale copies of `Rcode.R` that do not match the paper: `upload: Rcode.R` (standalone) still fits `os1&lt;-segmented(o, ...)` with the wrong starting object the prior round flagged, and `package+Rscript.zip: Rcode.R` still calls `sim.seg(N, nj=12, ...)` with the wrong argument `nj` and the old `n.plot=c(3,11)` layout. The author has named `Rcode+package.zip` as the reproduction artifact, which resolves the ambiguity, but removing or clearly marking the two superseded copies would stop a reader from running the wrong file.</p>
<p><bold>Declined.</bold> You clearly refer to the Rcode.R of the 1st submission. I really do not understand. I really can&#x27;t see multiple copies of Rcode.R. When I go to submit a revision, I upload the zip file (paperJReprStatOK.zip)  including the paper source files and a zip file (Rcode+package.zip) including the new Rcode.R along with the (updated) segmented package.  I can&#x27;t see (and can&#x27;t cancel) the previous The other Rcode.R</p>
</list-item>
<list-item>
<p><sc>recommended</sc> I am assessing from the manuscript and the described public interface. The package source, its help pages, and any `tests/` directory were not supplied, so I cannot confirm that the documented behaviour of `segmented.lme`, `plot.segmented.lme`, `sim.seg`, and `slope` is covered by automated tests. State in the paper whether the demonstrated functions are exercised by the package test suite, and point readers to where those tests live.</p>
<p><bold>Declined.</bold> I do not understand. When I go for a new the revision, I upload the zip file (paperJReprStatOK.zip)  including the paper source files and a zip file (Rcode+package.zip) including the new Rcode.R along with the (updated) segmented package.  Note that referee 1 writes &quot;The uploaded Rcode.R and segmented_2.3-0 archive settle the reproducibility artifact as well. I am content with the resolution&quot;. Do it seems (s)he is able to run the example.</p>
</list-item>
<list-item>
<p><sc>optional</sc> The declared reproduction artifact `Rcode+package.zip: Rcode.R` sets the simulation covariance as `S=diag(c(.12,.05,.3,.02)^2)` in the small simulation loop, so the breakpoint random-effect sd is 0.02. The paper&#x27;s printed snippet uses `S=diag(c(.12,.05,.3,.1)^2)` and Table 1 reports σk true 0.10 with mean 0.090 and sd 0.011. A run with σk=0.02 cannot produce a mean of 0.090, so the uploaded authoritative script would not reproduce the σk row of Table 1. Set the fourth variance in `S` to `.1` in the uploaded script, or correct the Table 1 σk entries, so the script and the table agree.</p>
<p><bold>Done.</bold> done, thanks for reporting that.</p>
</list-item>
<list-item>
<p><sc>recommended</sc> The package source extracted for this review contained only `Rcode.R`, not the `segmented` help pages or any `tests/` directory, so I cannot confirm that `segmented.lme`, `plot.segmented.lme`, `sim.seg`, `fixef`, `getVarCov`, `slope`, and `breakpoint` are exercised by automated tests. The earlier request (75ae2e1b) asked the paper to state whether these functions are covered by the package test suite and where those tests live; the revised text still does not say. One sentence pointing readers to the tests would close this.</p>
<p><bold>Declined.</bold> I do not understand. When I go for a new the revision, I upload the zip file (paperJReprStatOK.zip)  including the paper source files and a zip file (Rcode+package.zip) including the new Rcode.R along with the (updated) segmented package.  Note that referee 1 writes &quot;The uploaded Rcode.R and segmented_2.3-0 archive settle the reproducibility artifact as well. I am content with the resolution&quot;. Do it seems (s)he is able to run the example.</p>
</list-item>
</list>
</body>
</sub-article>
<sub-article id="pr-r4-letter" article-type="editor-report">
<front-stub>
<article-id pub-id-type="doi">10.68365/jrepstat.2026.12.r4.letter</article-id>
<title-group>
<article-title>Decision letter, round 4</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<contrib-id contrib-id-type="orcid">https://orcid.org/0000-0002-8638-5276</contrib-id>
<string-name>Matthias Templ</string-name>
<role specific-use="editor">Editor</role>
</contrib>
</contrib-group>
<pub-history>
<event event-type="editor-decision-sent">
<event-desc>Editor decision sent</event-desc>
<date iso-8601-date="2026-11-18"><day>18</day><month>11</month><year>2026</year></date>
</event>
</pub-history>
<related-object document-id="10.68365/jrepstat.2026.12" document-id-type="doi" document-type="peer-reviewed-article"/>
<custom-meta-group>
<custom-meta><meta-name>peer-review-stage</meta-name><meta-value>pre-publication</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-revision-round</meta-name><meta-value>3</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-recommendation</meta-name><meta-value>accept</meta-value></custom-meta>
</custom-meta-group>
</front-stub>
<body>
<p><bold>Accepted.</bold> Signed by Matthias Templ on 2026-11-18.</p>
<p>Accepted. All three reviewers recommend acceptance. The author corrected the simulation so that each replicate draws its own data set, and the journal ran his code with his package: Table 1 reproduces exactly from 300 replicates, and the two examples agree.</p>
<p>Congratulations, your manuscript has been accepted for publication in JRepStat. Production begins now.</p>
<p>Where it is not on file yet, we still need the following for production.</p>
<list list-type="bullet">
  <list-item>
    <p>a valid ORCID iD for every author</p>
  </list-item>
  <list-item>
    <p>a captured computational environment (dependencies/lockfile/container)</p>
  </list-item>
  <list-item>
    <p>a signed determinism attestation for the entry-point command</p>
  </list-item>
</list>
</body>
</sub-article>
<sub-article id="pr-r4-report1" article-type="reviewer-report">
<front-stub>
<article-id pub-id-type="doi">10.68365/jrepstat.2026.12.r4.report1</article-id>
<title-group>
<article-title>Report Reviewer 1, round 4</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<collab>JRepStat review engine</collab>
<role specific-use="reviewer" content-type="reviewer-1">Reviewer 1</role>
</contrib>
</contrib-group>
<pub-history>
<event event-type="reviewer-report-received">
<event-desc>Reviewer report received</event-desc>
<date iso-8601-date="2026-11-06"><day>06</day><month>11</month><year>2026</year></date>
</event>
</pub-history>
<related-object document-id="10.68365/jrepstat.2026.12" document-id-type="doi" document-type="peer-reviewed-article"/>
<custom-meta-group>
<custom-meta><meta-name>peer-review-stage</meta-name><meta-value>pre-publication</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-revision-round</meta-name><meta-value>3</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-recommendation</meta-name><meta-value>accept</meta-value></custom-meta>
</custom-meta-group>
</front-stub>
<body>
<p><italic>Written by the journal&#x27;s review engine in the role of the application reviewer, and read by the editor before the decision. How the engine works is on the <ext-link ext-link-type="uri" xlink:href="https://jrepstat.fairpressjournals.com/about/peer-review/">peer review page</ext-link>.</italic></p>
<p>Recommendation: accept.</p>
<p>Both points I raised are met. Section 3.2 now reads “(the 6th, the 5th and the 10th, say)”, matching plot(oseg1, id=c(4,28,6,5,10)) and Figure 3, and the diagonal-matrix sentence now reads “e.g. a diagonal matrix”. Nothing from my report is still open.</p>
<p>The three reproducibility points the author declined belong to other referees, not to me, and the author’s lines there report confusion about which Rcode.R copy is attached rather than a refusal to supply the artifact. On the version in front of me the uploaded Rcode.R and segmented_2.3-0 archive run as I reported last round, so from the application and reproducibility angle I am satisfied. If the submission system is carrying a stale Rcode.R from the first round alongside the current one, that is a matter for the editorial office to resolve at acceptance so the recorded artifact is the one that matches this manuscript.</p>
<p>Numbered suggestions to the authors: (none)</p>
</body>
</sub-article>
<sub-article id="pr-r4-report2" article-type="reviewer-report">
<front-stub>
<article-id pub-id-type="doi">10.68365/jrepstat.2026.12.r4.report2</article-id>
<title-group>
<article-title>Report Reviewer 2, round 4</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<collab>JRepStat review engine</collab>
<role specific-use="reviewer" content-type="reviewer-2">Reviewer 2</role>
</contrib>
</contrib-group>
<pub-history>
<event event-type="reviewer-report-received">
<event-desc>Reviewer report received</event-desc>
<date iso-8601-date="2026-11-06"><day>06</day><month>11</month><year>2026</year></date>
</event>
</pub-history>
<related-object document-id="10.68365/jrepstat.2026.12" document-id-type="doi" document-type="peer-reviewed-article"/>
<custom-meta-group>
<custom-meta><meta-name>peer-review-stage</meta-name><meta-value>pre-publication</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-revision-round</meta-name><meta-value>3</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-recommendation</meta-name><meta-value>accept</meta-value></custom-meta>
</custom-meta-group>
</front-stub>
<body>
<p><italic>Written by the journal&#x27;s review engine in the role of the methodology reviewer, and read by the editor before the decision. How the engine works is on the <ext-link ext-link-type="uri" xlink:href="https://jrepstat.fairpressjournals.com/about/peer-review/">peer review page</ext-link>.</italic></p>
<p>Recommendation: accept.</p>
<p>All three points I left open are settled in this version. Section 3 now reads “even under the standard Gaussian assumptions”. Section 3.2 reads “the 6th, the 5th and the 10th”, matching id=c(4,28,6,5,10) and Figure 3. Section 3.1 now reads “(−1.2796 + 0.5460)”, in agreement with the summary coefficient 0.5460.</p>
<p>The three reproducibility points the author declined were raised by another reviewer, not by me, and concern the upload mechanics for Rcode.R and the segmented archive rather than any methodology question. They do not bear on my assessment. The methodology, the worked examples, the summary-output explanation for the dropped p-values, and the simulation with coverage levels in Table 1 all stand as accepted.</p>
<p>Nothing is open on my lens. I recommend acceptance.</p>
<p>Numbered suggestions to the authors:</p>
</body>
</sub-article>
<sub-article id="pr-r4-report3" article-type="reviewer-report">
<front-stub>
<article-id pub-id-type="doi">10.68365/jrepstat.2026.12.r4.report3</article-id>
<title-group>
<article-title>Report Reviewer 3, round 4</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<collab>JRepStat review engine</collab>
<role specific-use="reviewer" content-type="reviewer-3">Reviewer 3</role>
</contrib>
</contrib-group>
<pub-history>
<event event-type="reviewer-report-received">
<event-desc>Reviewer report received</event-desc>
<date iso-8601-date="2026-11-06"><day>06</day><month>11</month><year>2026</year></date>
</event>
</pub-history>
<related-object document-id="10.68365/jrepstat.2026.12" document-id-type="doi" document-type="peer-reviewed-article"/>
<custom-meta-group>
<custom-meta><meta-name>peer-review-stage</meta-name><meta-value>pre-publication</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-revision-round</meta-name><meta-value>3</meta-value></custom-meta>
<custom-meta><meta-name>peer-review-recommendation</meta-name><meta-value>accept</meta-value></custom-meta>
</custom-meta-group>
</front-stub>
<body>
<p><italic>Written by the journal&#x27;s review engine in the role of the software reviewer, and read by the editor before the decision. How the engine works is on the <ext-link ext-link-type="uri" xlink:href="https://jrepstat.fairpressjournals.com/about/peer-review/">peer review page</ext-link>.</italic></p>
<p>Recommendation: accept.</p>
<p>The one item I left open is met. Section 3 now reads “even under the standard Gaussian assumptions for the ϵ’s” with the duplicated “the” removed, and Section 3.2 now reads “(the 6th, the 5th and the 10th, say)”, which matches the plot call id=c(4,28,6,5,10). Both production corrections are in the current version.</p>
<p>On the reproducibility declines the author recorded: the response explains that each revision upload replaces the prior Rcode.R inside Rcode+package.zip, and that an earlier reference to multiple copies reflected a stale artifact the author cannot see or remove on their end. That reading is consistent with how the submission system versions attachments, and referee 1 confirms the uploaded Rcode.R and segmented_2.3-0 archive run. Those points were recommended, and the explanation convinces me, so I take them as settled.</p>
<p>Numbered suggestions to the authors: (none)</p>
</body>
</sub-article>
</article>
