Skip to content

Commit b3ba288

Browse files
committed
Modified single.meanvar.pp to be nevents instead of n, nevents=n-2
1 parent 34c9f15 commit b3ba288

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

R/poissonprocess.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,17 @@ single.meanvar.pp<-function(data,penalty="MBIC",pen.value=0,class=TRUE,param.est
8383
else{
8484
tmp=single.meanvar.poisson.calc(data,extrainf=TRUE,minseglen)
8585
if(penalty=="MBIC"){
86-
tmp[,3]=tmp[,3]+log(tmp[,1])+log(n-2-tmp[,1]+1) # -2 for start and end
86+
tmp[,3]=tmp[,3]+log(tmp[,1])+log(nevents-tmp[,1]+1)
8787
# this may not be correct if each dimension has a different n (but matrix input),
8888
# need to add a caveat to the documentation to cover this case and suggest lapply instead
8989
}
90-
ans=decision(tmp[,1],tmp[,2],tmp[,3],penalty,n-2,diffparam=1,pen.value) # -2 for start and end
90+
ans=decision(tmp[,1],tmp[,2],tmp[,3],penalty,nevents,diffparam=1,pen.value)
9191
if(class==TRUE){
9292
rep=nrow(data)
9393
out=list()
9494
for(i in 1:rep){
9595
# RK: need to change class_input for PP and include/not include cpt
96-
out[[i]]=class_input(data[i,], cpttype="mean and variance", method="AMOC", test.stat="Poisson", penalty=penalty, pen.value=ans$pen, minseglen=minseglen, param.estimates=param.estimates, out=c(0,ans$cpt[i]))
96+
out[[i]]=class_input(data[i,], cpttype="mean and variance", method="AMOC", test.stat="Poisson", penalty=penalty, pen.value=ans$pen, minseglen=minseglen, param.estimates=param.estimates, out=c(coredata(data[i,1]),ans$cpt[i]))
9797
}
9898
return(out)
9999
}

0 commit comments

Comments
 (0)