Assessing daily patterns using home activity sensors and within period changepoint detection

We consider the problem of ascertaining daily patterns using passive sensors to establish a baseline for elderly people living alone. The data are whether or not some movement, or human related activity, has occurred in the previous 15 min. We seek to segment the broad patterns within a day, for example, awake/sleep times or potentially more activity around meal‐times. To address this problem we use changepoint detection which can segment the day into more/less active times. Traditional changepoint detection methods are inappropriate for these data as they fail to utilize the periodic nature of the data. The traditional assumption of conditional independence of the segments also hampers estimation of the within segment parameters. A new within‐period changepoint detection scheme is proposed that instead assumes a circular perspective of the time axis. This permits the pooling of evidence of changepoint events from across multiple days. Inference is performed within the Bayesian framework by utilizing the reversible jump Markov chain Monte Carlo sampler to explore the variable dimension parameter space. Simulations demonstrate that the sampler achieves high accuracy in approximating the posterior while being able to detect small segments. Application to four individuals from our industrial collaborator provides insights to their daily patterns.


| INTRODUCTION
We live in a world where older generations are often living further away from their children and where over 4 m people over 65 in the UK are living alone (ONS, 2019). In light of this reality, families are seeking a peace of mind that their elderly relatives are living well and maintaining an active lifestyle. This paper proposes a method to ascertain broad patterns of awake/sleep times and other strong within-day routines for example, more activity around meal-times. This problem is motivated from an investigation with our industrial collaborator, Intelestent Ltd., into assessing the daily activity patterns from passive sensors within the home.
When people think about activity detection it is common to think of a wearable device that samples at 100-500 observations per second, but this relies upon the users wearing such devices 24-7. In contrast, our data arise from static infra-red sensors more commonly used in home security systems. The average daily activity, over 56 days, of the motion/non-motion measurements, in 15 min bins, for four individuals are presented in Figure 1. These demonstrate a pattern of abrupt changes that can be attributed to certain regular activities such as sleep, morning routine, mealtime etc. Identification of the times of day where abrupt changes occur between different types of activity can be investigated using changepoints.
Changepoint analysis involves the detection and estimation of the time(s) within a non-stationary signal where the underlying data generation process experiences some abrupt shift. Typically, time is interpreted in a linear sense whereby the data generating process before and after each changepoint event are considered to be independent. This is the natural assumption for many changepoint methods that have been applied to a large number of fields (Truong et al., 2018). Contrary to existing methods, this paper proposes a method to investigate the within-period changepoint structure of periodic time series-where time is not linear.
Traditional methods to investigate the changepoint structure within a binary time series (see Chen & Gupta, 2000) assume that time is linear and so the estimated changepoint events are unlikely to align across days or may fail to be identified due to limited evidence. One method to ensure alignment of events could be to partition the time series into separate periods (days) and perform a multivariate analysis (Zhang et al., 2010). The main issue with this approach is that the arbitrary selection of a point within the period to partition the data, such as midnight, in effect artificially defines a changepoint event which may impede the estimation of nearby true events, such as when they go to sleep.
The limiting factor for the application of traditional changepoint methods is the underlying assumption that time is linear. This paper instead considers a circular perspective of the time axis to achieve the required conditional independence between segments while pooling evidence from multiple periods. The circular perspective also avoids the necessity to define a changepoint event at the start of each period as the axis wraps around on itself. It is worth emphasizing that this paper applies the circular perspective to the time axis across a period rather than the response variable. This is distinctively different to Jammalamadaka and Sengupta (2001) and Price-Williams et al. (2017) where their objective was to estimate the mean shift in directional response data within the traditional linear time perspective. It is also distinctive from circular binary segmentation (Venkatraman & Olshen, 2007), which assumes that the start of the end of the time series have similar behaviour in order to estimate an anomalous segment (two changepoints), that is, observing only a single cycle.
Methods to perform multiple changepoint inference have been developed for both Classical and Bayesian approaches. Notable algorithms within the Classical framework are binary segmentation (BS) (Scott & Knott, 1974) and the pruned exact linear time (PELT) method (Killick et al., 2012). Both methods utilize the conditional independence structure of the linear time perspective by either branching or sequentially trimming the time series into independent segments. In the Bayesian framework, filtering (Fearnhead, 2006) provides a similar mechanism for inference as BS and PELT that requires independence of parameters across consecutive changepoint events. Alternatively, hidden Markov models (HMM) (Rabiner, 1989) approach changepoint analysis under the assumption that there exists some unobserved process that switched between different states according to some unknown transition matrix. This structure permits re-occurrence of certain states and Pierson et al. (2018) propose the cyclic hidden Markov model (CyHMM) where the transition matrix is highly F I G U R E 1 Activity data from four individuals measured at 15 min intervals over 56 days (8 weeks). Black: overall sample proportions, grey: sample proportions evaluated for each week structured to provide a periodic mechanism. The two main disadvantages of this technique are that the number of hidden states must be known, although assessment via cross-validation can be performed, and the overall period length is stochastic. This is not the case for the home sensor time series as it presents a strong daily periodic pattern.
A further technique in approaching changepoint analysis within a Bayesian framework is the reversible jump Markov chain Monte Carlo (RJMCMC) (Green, 1995) sampler. Although not exclusively designed for changepoint analysis, the RJMCMC sampler is highly useful in this field. It is a generic method that permits inference across multi-dimensional spaces in which more/fewer parameters are required when considering the need for more/fewer segments to explain the available data.
The outline of this paper is as follows. Section 2 presents the within-period changepoint methodology by first setting out notation, terminology and the statistical model. The prior distribution for the unknown segment and changepoint parameters are subsequently specified along with derivation of their posterior distribution. The inference mechanism via the RJMCMC sampler is designed in Section 3, presenting the approach to navigate the variable dimension parameter space and derivation of the proposal distribution. The performance of the developed sampler is examined using simulations in Section 4. The case study in Section 5 examines home activity time series and discusses the potential insight into the daily patterns of four individuals. Section 6 concludes the paper with a discussion of the performance of the method in assessing within-period changepoint structure as well as potential future directions for research.

| METHODOLOGY
This section lays the foundations of the changepoint model and details the inference mechanism within the Bayesian framework.

| Periodic binary changepoint model
Let {X t } t=1,…,T be a sequence of binary random variables where each are independently Bernoulli distributed conditional on some unknown probability. We assume that this probability, p(t), is a periodic piecewise constant function of time with a specified fixed period length of N (e.g. daily). In a single reference period the function consists of m segments taking the values 0 , …, m−1 ending at the corresponding changepoint event (0 < ) 0 < … < m−1 ( ≤ N). Periodicity is achieved by specifying that the function takes the value 0 after the m−1 event to match the beginning of the reference period. The changepoint events in other periods are notated according to the relationship i+jm = i + jN for all j ∈ ℤ. This means that the event m describes the first changepoint in the next period while −1 represents the last event in the previous period, which are equivalent to 0 + N and m−1 − N on the linear time axis or 0 and m−1 within the circular reference period respectively. Therefore, we define the part intervals at the beginning and end of the period, namely (0, 0 ] and ( m−1 , N], to represent the same within period segment.
It follows that the probability function is given by: where the indicator function A (x) returns 1 if x ∈ A or 0 otherwise, and the modulus operator a mod N returns the remainder of a after division by N. Figure 2 illustrates the structure of p(t) in both the linear and circular time axes. (1) An additional constraint is applied to the changepoint events such that the duration between any consecutive pair is greater than some minimum, i − i−1 ≥ l. The value for l ≥ 1 is specified based on the context of the application. For example, in Section 5 it is assumed that individuals undertake a particular level of activity for at least an hour and so l is specified appropriately given data frequency.
In summary, the sequence of binary observations is assumed to be partitioned into m groups based on the relative temporal position within the period. On any given segment, say ( i−1 , i ], the observations are independent and identically distributed Bernoulli random variables with probability i irrespective of whether they occur in the same or different periods for example, days. The target for inference are the number of segments that partition the period interval, m, the changepoint events, m = ( 0 , …, m−1 ) and the segment probabilities, m = ( 0 , …, m−1 ). It follows that the likelihood function based on an observed sequence x = (x 1 , …, x T ), for some T ≥ N, is given by: respectively denote the number and sum of observations on the ith segment.
Note that if there is only one segment, m = 1, then the probability function is constant: p( t) = 0 for all t. Consequently there are no changepoint events and so we denote 1 = ∅. Conversely, the most number of segments that can be fit into the period while respecting the minimum segment length constraint is m max = ⌊ N∕l⌋, where ⌊y⌋ denotes the integer part of y.

| Prior distributions
The unknown number of segments m that span the period dictates the dimension of the model being defined. For parsimonious reasons it is desirable to place a higher preference on a simple model specification whenever the evidence from the data equally support two plausible cases. As such, the number of segments in the model is assigned a Poisson(1) prior distribution that is truncated to the interval m = 1, …, m max .
Conditional on the total number of segments, the prior distribution for the changepoint positions is expressed with respect to the transformation i = i − i−1 − l representing the excess segment length after considering the minimum length constraint. The vector m = ( 0 , …, m−1 ) therefore describes how the remaining Δ m = N − lm time points within the period can be randomly partitioned into the m segments. A natural prior distribution for m is the Dirichlet-multinomial distribution with probability distribution function: The shape parameter γ describes the prior preference as to how the changepoint events are to be spread throughout the period interval. If γ < 1 then there is a prior preference to cluster the changepoint events, whereas γ > 1 expresses a preference for the changepoint to be more evenly spread. In balance, a specification of γ = 1 represents a uniform distribution. Note that Equation (4) is a special case of the Dirichletmultinomial distribution where a common shape parameter is specified for each element of m . It is not possible to be more a priori specific about the clustering/repelling of particular groups of changepoint events when the overall number of changepoints is unknown.
The prior distribution for the changepoint positions themselves is complete by specifying a discrete uniform distribution for an anchoring event, ( A ) = 1 N . This anchoring point allows all other changepoint events to be determined according to The marginal prior ( i |m) for each segment i is uniformly distributed and so there is a potential identifiability issue. This is addressed by permuting the vector of changepoints such that 0 corresponds to that which has the smallest reminder after division of the period length N. The Jacobian associated with the transformation ( m , A ) → m is equal to one.
The above prior specification for the changepoint vector m is only applicable when m > 1. In the unique case of a single segment model, m = 1, the probability function (1) is constant and no changepoint events exist. For completeness, a point-mass prior distribution on the empty set is applied: Conditional on the number of changepoint events, the prior distribution for the segment probabilities are independent uniform distributions on the unit interval: As we have now described the building blocks; the likelihood and the prior, the following section elicits the posterior distribution.

| Posterior distribution
The aim for inference is to estimate the posterior distribution for the number and position of changepoint events and the segment probabilities: By factorizing the posterior as ( m , m , m|x) = ( m | x, m , m) ( m , m|x) it is clear from the likelihood function (3) and uniform prior that the conditional posterior for each of the segment probabilities follows the beta distribution: The marginal posterior for the number and position of changepoint events therefore follows from marginalizing m , and is concisely expressed as: where B(a,b) denotes the beta function.
Although evaluation of Equation (7) is trivial to compute for a specific changepoint vector, m , the challenge to inference occurs because the size of the support for the posterior is potentially very large. The total number of possible changepoint vectors for a given period length, N, and minimum segment length l, is bounded from above by the higher-ordered Lucas number l L N (Randic et al., 2008). For example, the size of the posterior support for problems examined in Section 5, where N = 96 and l = 4, contains 27.34 × 10 12 possible cases for m . Thus the following section proposes an efficient way to explore the parameter space of the posterior (7) from which inference on the number and positions of changepoint events, and subsequently segment probabilities, can be evaluated.

CARLO SAMPLER
The goal of the sampler is to approximate the posterior mass function (7) for the changepoint positions within N-periodic binary data where the segments are subject to a minimum length constraint. Direct evaluation of the posterior is not practically feasible because of the size of the sample space. In addition, the dimension of each sample, namely the number of segments to partition the period, is variable. Due to this, a RJMCMC (Green, 1995) is developed in order to explore the parameter space.

| Proposal distribution
Given the current sample of the changepoint vector m , a proposal vector ′ m ′ for which to consider transitioning to is generated according to the proposal distribution q( ′ m ′ | m ). There are many different ways that this proposal distribution could be constructed. The basic properties required are that (i) the number of changepoints should be able to vary, and (ii) changepoint locations can be added, deleted and moved. We choose to create a proposal distribution that satisfies these by acting on a single segment, i as follows.
Here q 1 (i | m ) generates a segment index based on the current partitioning of the period, and q 2 ( ′ m ′ | m , i) describes the range of possible perturbations to make to the current changepoint vector with respect to the aforementioned sampled segment (add, delete, move).
The proposal segment index is uniformly sampled from the segment indices of the current sample, Before defining the proposal q 2 ( ′ m ′ | m , i) it is necessary to first examine the method for augmenting the current changepoint vector in defining the support for the proposal distribution by restricting the search space to the current, one more or one fewer number of changepoints. Let the set  ( m , i ) denote the support for q 2 that is based on the current changepoint vector and the sampled segment according to q 1 . As we are modelling circular time series, we must consider transitioning from m = 1 and m > 1 separately.
When the current sample defines the single segment model, m = 1, there are no changepoint events defined, 1 = ∅. It is clear that it is not possible to further remove changepoints and also that the current changepoint event is the possibility for the single segment model. So, � m � = 1 = ∅ must be within the proposal set  ( 1 , 0). To propose a move to the two-segment model, m � = 2, requires the introduction of two changepoint events. As there is currently no existing knowledge about the position of either changepoint event, the proposal set must contain all possible pairs of the positions that spans the m = 2 model. Hence, For the general m > 1 case, augmentation of the current changepoint vector can be viewed through the typical change or birth-death updating procedure (Green, 1995). In summary, the possibilities for proposing ′ m ′ from m would be to either move the changepoint event, i , that corresponds to the sampled ith segment to a new position, combine the ith segment with the (i + 1)th segment by removing the event i , or introduce a new changepoint event that partitions the sampled segment into two. This method would be applicable if there were no minimum segment length constraint, l = 1, but navigation of the parameter space using these update steps can be impeded when l > 1. For example, consider the case when N = 10 and the changepoint vectors (2,4,9) and (3,9) are highly probable events. The transition between these two events must take at least two iterations under the aforementioned scheme. The number of shortest paths is four when l = 1 (via (2,9), (4,9), (3,4,9) or (2,3,9)), which is reduced to two paths when l = 2 (via (2,9), (4,9)). If the transition probability to these intermediary events is low then there is a risk that the chain could get stuck at one of the highly probable events or that the most efficient path between the events involves more iterations and so the chain becomes highly autocorrelated.
These issues arise because of the pruning effect the minimum segment length condition has on the number of potential paths the RJMCMC could take. To increase the set of potential paths we consider an additional movement to the next changepoint event i+1 in the birth/death moves up to l timepoints. To elaborate further, consider the transition from m to ′ m ′ where m � = m + k for k ∈ {−1, 0, 1}. We select ith segment according to q 1 in Equation (8) as usual. Then the proposal ′ m ′ is drawn from the set  ( m , i) which is formed according to: Partition the sampled segment into two by introducing a new changepoint event while also considering movement of the sampled event, provided that the minimum length constraint is satisfied. Figure 3 depicts the sample space for the proposal changepoints ′ i and � i + 1 in the birth step in relation to the current changepoint vector and the minimum segment length constraint. Note that when the minimum segment length condition is removed in the above scheme, that is, setting l = 1, results in a set representing the standard birth-move-death proposals without perturbation.
The size of the proposal set  ( m , i) according to the above rules is less than (l + 1)N for m > 1 or is less than ( N − l + 1 ) 2 2 when m = 1. The set size for the case studies in Section 5 is sufficiently small such that evaluations of the proportional posterior surface (7) for every � m � ∈  ( m , i) is not a costly computational operation. As such, the proposal distribution q 2 is defined to be proportional to the target posterior as follows: The following section considers the acceptance probability of our sampler.

| Acceptance probability
The acceptance probability for transitioning to the proposal, ′ m ′ , from the current sample, m , based on the proposal distribution given in Section 3.1 is The dashed regions represent the space corresponding to case (A) but which must be truncated due to the respective conditions such that the proposal changepoint vector satisfies the minimum length condition. Note that there are no possible proposal birth events when i = i−1 + l or i+1 < i−1 + 3l Since the segment parameters have been marginalized and the changepoint event space is discrete, the determinant of the Jacobian matrix associated with the trans-dimensional proposals of the RJMCMC algorithm is one.
In the construction of the proposal set we note two properties for m > 1 and m ′ > 1: the set intersection across all segments contains only the current sample, ∩ m − 1 i = 0  ( m , i ) = { m }; and for all other events there exists a unique segment, i ′ , such that m ∈  ( � m � , i � ). The first property ensures that the current sample is always a possibility irrespective of which segment was sampled under q 1 , and so it is clear that the acceptance ratio for the no-change proposal is 1. The second property arises due to the fact that the perturbation applied to the changepoint events in the birth and death proposals occur in opposite directions. This ensures that for each birth (death) proposal there exists a unique returning path to the original sample via a corresponding death (birth) case. As a consequence, the acceptance ratio in Equation (10) simplifies because the indicator functions are all zero except for when segments i and i ′ correspond to the unique path between the events.
To complete, we consider the special case of m = 1 or m � = 1, that is, transitioning into or out of the single segment model. Recall that both changepoints have to be discarded when transitioning to the single segment model, or two changepoints need to be sampled at any valid position when performing the reverse step. It is clear that both of the proposal set properties stated above are violated and the acceptance ratio must be evaluated in full.
Overall, the acceptance ratio (10) is as follows: for some unique i ′ such that m ∈  ( � m � , i � ). The following section examines the performance of this sampler in simulations before considering an application to daily movements.

| SIMULATION STUDY
This section examines the performance of the proposed sampler in approximating the posterior distribution for the within-period changepoint events in binary data. Section 4.1 assesses the Monte Carlo accuracy in estimating the posterior changepoint vector distribution for a data set generated from a simple model with a relatively small sample space where the true posterior can be analytically evaluated in full. The extent to which a changepoint event is detectable in terms of segment length and magnitude change in segment probabilities is investigated in Section 4.2. The third simulation study in Section 4.3 investigates the precision of the posterior when we vary the sample size across period length and number of observed periods.

| Monte Carlo error
We evaluated the sampler's accuracy in approximating the posterior distribution in a simple scenario with N = 24 and l = 4 where the sample space consists of 2263 unique changepoint vectors. This example is small enough in size for the direct evaluation of the posterior in full. The data were generated from a three segment model with evenly spaced events at time points τ = (8, 16, 24) with segment probabilities ϕ = (0.25, 0.5, 0.6). Measurements from 30 complete cycles were generated giving a total of 720 observations. The Monte Carlo uncertainty in approximating the posterior was evaluated from 1000 replications of the sampler based on a uniform spread hyperparameter γ = 1. Two independent chains were performed that were initiated at opposite ends of the sample space; namely the single segment model, ( 1 ) 1 = ∅, and a case where the changepoints are maximally dense for example, ( 2 ) 6 = (4, 8,12,16,20,24). The chains were iterated in batches of 10 4 until there was evidence of similarity in their frequency distributions. A convergence test was performed using the Weiß procedure (Deonovic & Smith, 2017) for discrete variable chains. This applies a conservative asymptotic Pearson chi-squared test which is adjusted for autocorrelation.
Bias and root mean square error (RMSE) estimates in Table 1 demonstrate that the sampler performs well in approximating the posterior probability for each changepoint vector. Furthermore, the overall performance of the sampler in approximating the whole posterior is also good with low expected bias, −0.329 × 10 − 6 , and expected RMSE, 5.878 × 10 − 3 with respect to the true posterior distribution.

| Estimation accuracy
The performance of the sampler in terms of estimation accuracy is assessed for a variety of two segment models, emulating wake/sleep. We set the period length N = 96, emulating 15 min observations per day, and minimum segment length l = 4, sustained increased/decreased activity for an hour.
Without loss of generality, the position of the first changepoint takes each of the time points , 8, 16, 24, 32, 48 } and the other is set at 1 = 96. The first case, 0 = 4, represents the shortest permitted under the minimum length constraint, whereas the last case, 0 = 48, is positioned such that the lengths of the two segments are equal. The segment parameters were specified as ϕ = ((1 + d)/2, (1−d)/2) which are centred about 0.5 but are separated by some distance d ∈ {0.0, 0.1, 0.2, 0.3, 0.4}. The first distance, d = 0.0, represents the single segment case irrespective of the position of 0 .
We generated 1000 data sets consisting of 35 complete cycles, 2880 observations. The spread of changepoint events around the period was again specified as uniform with hyperparameter γ = 1. Note  that for the later values of 0 , γ > 1 is more appropriate and for the earlier values, γ < 1. Two chains were evaluated and tested for convergence using the same procedure described in Section 4.1. Table  2 summarizes the posterior draws across the data sets for each model by three statistics: the average posterior probability for the true changepoint vector; the proportion of data sets where the posterior mode correctly identify the true changepoint positions; and the average size of the 95% highest posterior credible set (HPCS). This HPCS describes the smallest number of unique changepoint vectors that contain at least 95% of the posterior samples. The sampler performs extremely well in estimating the single segment model, d = 0; the truth is correctly identified as the mode in almost all cases and with high estimated posterior probability.
Turning to the changepoint results, as expected, when the change in segment probabilities is small there is little evidence for the change. The associated large coverage of the HPCS when d = 0.1 occurs due to high uncertainty in the location for both changepoint events, or in fact whether there are any changepoints. As expected, the ability to detect the truth improves with large changes in segment probabilities, d. Similarly, identifying the true changepoint events improves as the distance between the events increases too. The uncertainty in the posterior is broadly constant across well-separated changepoints for large d, but there is a notable reduction in HPCS coverage when the changepoint events are close due to a small curtailing effect resulting from the minimum segment length condition. The broad constant feature, however, is most likely attributable to the assessment of two segment models where all observations fall on the current or following segment and therefore each providing information about both changepoint events irrespective of position.
To assess the sensitivity of the posterior estimates to the spread parameter we repeated the above study for γ ∈ {0.5, 1, 2}. These represent the prior preferences that the changepoint events are clustered, uniformly at random and more evenly spread around the period respectively. No sensitivity was  identified with respect to the change in segment probabilities, but Figure 4 presents a subtle dependence of the posterior estimates when regarding changepoint positions. As may be expected, early positions, 0 = 4, favour the prior spread of γ = 0.5 which results in subtly higher rates of identifying the truth and a smaller HPCS coverage. Conversely, the HPCS coverage when the changepoint events are as far apart as possible, 0 = 48, is more likely on average to be smaller for γ = 2. This observed relationship is as expected due to the effect of γ on the prior as discussed in Section 2.2.

| Period and sample sizes
Thus far we have considered a single N = 96 and 30 cycles of data. In this section we vary this to assess the effect on estimation accuracy. Motivated by our application, the increase in period length shall relate to a lower sampling frequency such as once, N = 24, or twice, N = 48, per hour. For each comparison we then vary the number of cycles to represent the same overall time frame. For consistency, the minimum segment constraint is appropriately scaled to l = N/24 that is, sustained activity over an hour. The data are sampled from a two segment model with evenly spaced changepoint events τ = (N/2,N) and segment probabilities ϕ = (0.3,0.7). As with Section 4.2, 1000 data sets were generated independently for each scenario. The RJMCMC sampler was performed on each data set with a uniform prior spread γ = 1 and were iterated until convergence was satisfied.
Uncertainty in the posterior estimate over the different period lengths was assessed by evaluating the marginal distribution of the position of any changepoint event within the period. Table 3 presents the average 95% HPCS coverage of this distribution as a proportion of period length. It is clear that the uncertainty in the marginal posterior decreases with respect to both increases in period length and the observed number of cycles. Interestingly, across cases that have the same overall number of observations there is a slight reduction in the coverage proportions when the measurement frequency is high, that is, for larger N.

| CASE STUDY: HOME ACTIVIT Y
The passive home sensor system developed by Intelesant Ltd. consists of a suite of sensors that monitor the activity within the home for the purpose of identifying abnormal patterns of behaviour. These abnormal patterns could indicate a decline in health or well-being in an older person. This section applies the periodic changepoint analysis developed in this paper to gain insight into baseline behaviour of individuals in determining their normal daily patterns of activity. The data for this study were collected from four individuals over 56 days (summer 2018). Each data point indicates whether or not any of the sensors measured some sort of activity within a sequence of 15 min intervals. Figure 1 summarizes the data by averaging the activity over the 56 days. What is immediate is that the activity during the early hours is very low, indicative of sleeping, whereas the activity during daylight hours is more varied over time and individuals. When considering human activity, the requirement of consistent daily activity over the 8-week period can be seen as a strong assumption. Permutation tests presented in Appendix A based on the weekly estimated sample proportions, illustrated in Figure 1, all but person 3 present consistent long term behaviour. Closer inspection of person 3 identifies that there was only 1 week that exhibited a different pattern.
The period length for the analysis is specified at N = 96; 15 min intervals and we are interested in daily patterns. It is assumed that any change in activity level must be sustained for at least 1 hour, hence we set l = 4. The Dirichlet hyperparameter is set at γ = 1 for all individuals to demonstrate no prior clustering preference of the changepoint events. Other choices for prior preference on clustering were investigated, but the posterior inference was robust to this decision. As in the simulations, two chains were initiated and tested for convergence. Estimates of the segment probability parameters were subsequently evaluated from the conditional beta posterior in Equation (6).
Results of the periodic changepoint method, Figure 5, identifies two events for each individual representing a reduction in activity in the late evening and corresponding increase in activity in the morning that is indicative of the individual's sleep pattern.
The daytime behaviour for individual 1 is broadly low at a probability of 21%, but there is some evidence of a slight rise in activity to 30% around midday potentially attributable to preparing and eating lunch. Interestingly, a pair of changepoint events for individual 1 identify a short interval around 03:00 where the individual may occasionally get up in the night, representing a slight raise in the probability of sensor-detectable activity from 2% to 11%.
In contrast individual 2 is very active during daylight hours with the probability function varying between 61 and 88% at four distinct times. Similarly, individual 3 has a high daytime activity that increases from 44% to 82% at two events around 12:30 and 16:45. Individual 4 is the most varied in their daily activity in that the most probable number of changepoint events was identified to be 11 with a posterior probability of 49%. This is likely to be an overestimation for the number of within period changepoint events as some may be related slight variation in the probability function between weekdays (see Appendix A).

| DISCUSSION
This paper presents a novel approach for identifying within-period changepoint events for binary data. Unlike traditional changepoint methods, the proposed model permits the pooling of evidence F I G U R E 5 Posterior activity estimates for four individuals. Points: averaged activity data over 56 days at 15 min intervals. Radial barchart: estimated probability that a changepoint event occurs at that time point. Lines: pointwise median (solid) and 95% credible interval (dashed) of the segment probability parameter across multiple periods by applying a circular rather than linear perspective of time. We developed a RJMCMC sampler to traverse the complex sample space, where care is taken in defining the proposal distribution to account for the restriction imposed by the minimum segment length. Simulations demonstrate that the sampler performs well in approximating the posterior distribution, at least for problems with moderate sized support. The inference capabilities of the proposed method were investigated via simulations with respect to the change in segment probabilities, segment duration, period length and overall number of observations. Posterior estimates correctly identified the truth across the vast majority of cases. However, potential inaccuracies to inference occurred principally for the anticipated scenarios where the change in the probability function across segments is small, and when segment durations are short or at the minimum segment length requirement. We also noted that the length of the data set has a significant impact on estimation accuracy as more days are pooled together to increase estimation accuracy. Similarly we noted a small improvement on inference accuracy occurs for longer period lengths in contrast to observing a larger number of periods.
The approach presented was motivated by an investigation of home activity data. We presented interesting insights into the regular periodic patterns of four individuals. The regular night-time period was easily identified for each individual as well as their broad daily patterns of activity that varied substantially across individuals. The resulting estimates provide a useful baseline as part of a longitudinal investigation where assessments of future periods provide insight into an individual's maintained or deteriorating daily behaviour.
In conclusion, the presented novel methodology for detecting periodic changepoint events provides a framework from which further extensions are possible. One such extension is to investigate nonbinary data, which is achievable if the segment parameters can be marginalized from the joint posterior. Thus the presented methodology for approximating the posterior for the number of changepoints and their positions could be applied under the appropriately defined marginalized posterior. Another possible extension would be to consider covariates such as the day of the week to allow individuals to have different probability patterns on different days.