single.mean.norm.calc(data, extrainf = TRUE)
The returned likelihoods are scaled so that a test can be directly performed using the log of the likelihood ratio, $\lambda=\frac{1}{\sigma^2}\left{null-alt\right}$, which should be maximised.
In reality this function should not be used unless you are performing a changepoint test using the output supplied. This function is used in the "see also" functions that perform various changepoint tests, ideally these should be used.
single.mean.norm
, cpt.mean
# Example of a change in mean at 100 in simulated normal data
set.seed(1)
x=c(rnorm(100,0,1),rnorm(100,10,1))
single.mean.norm.calc(x,extrainf=FALSE) # finds change at 100
single.mean.norm.calc(x) # finds change at 100 and gives null likelihood as 5025.0857 and
#alternative likelihood as 170.7051
# Example of no change in mean in simulated normal data
set.seed(1)
x=rnorm(100,0,1)
single.mean.norm.calc(x,extrainf=FALSE) # finds change at 96, this is the most probable point of
#change but if a changepoint test is performed then no change will be found.
single.mean.norm.calc(x)# change at 96, null liklihood is 79.86945 and alternative is 75.73725
Run the code above in your browser using DataLab