From 9de3ea00d3d5909c407ed48a6699863a1f5a4650 Mon Sep 17 00:00:00 2001 From: Vladislav Nachev Date: Mon, 2 May 2016 17:56:25 +0200 Subject: [PATCH] Support for continuous data, t test, K-S test, additional data sets --- DESCRIPTION | 25 +- NAMESPACE | 2 +- R/cp_wrapper.R | 195 +++++++--- R/cpdetectorr.R | 59 ++- R/cpfinders.R | 51 ++- R/logits.R | 164 +++++++- README-unnamed-chunk-10-1.png | Bin 0 -> 7185 bytes README-unnamed-chunk-11-1.png | Bin 0 -> 6306 bytes README-unnamed-chunk-8-1.png | Bin 6058 -> 6159 bytes README-unnamed-chunk-9-1.png | Bin 5724 -> 5358 bytes README-unnamed-chunk-9-2.png | Bin 6129 -> 5447 bytes README.Rmd | 63 +++- README.md | 119 ++++-- data/feedingpref.RData | 686 ++++++++++++++++++++++++++++++++++ data/hopperentry.RData | 289 ++++++++++++++ data/matching.RData | 645 ++++++++++++++++++++++++++++++++ data/watermaze.RData | 78 ++++ man/KS.Rd | 26 ++ man/chi2logit.Rd | 2 +- man/cp_wrapper.Rd | 45 ++- man/cpc.Rd | 28 ++ man/cpd.Rd | 4 +- man/cpdetectorr.Rd | 9 +- man/cpt.Rd | 28 ++ man/eyeblink.Rd | 8 +- man/feedingpref.Rd | 22 ++ man/hopperentry.Rd | 22 ++ man/matching.Rd | 23 ++ man/plusmaze.Rd | 8 +- man/rrc.Rd | 25 ++ man/rrd.Rd | 2 +- man/trun.Rd | 2 +- man/watermaze.Rd | 25 ++ 33 files changed, 2484 insertions(+), 171 deletions(-) create mode 100644 README-unnamed-chunk-10-1.png create mode 100644 README-unnamed-chunk-11-1.png create mode 100644 data/feedingpref.RData create mode 100644 data/hopperentry.RData create mode 100644 data/matching.RData create mode 100644 data/watermaze.RData create mode 100644 man/KS.Rd create mode 100644 man/cpc.Rd create mode 100644 man/cpt.Rd create mode 100644 man/feedingpref.Rd create mode 100644 man/hopperentry.Rd create mode 100644 man/matching.Rd create mode 100644 man/rrc.Rd create mode 100644 man/watermaze.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 3648988..1682d4a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,20 +1,25 @@ Package: cpdetectorr Type: Package Title: Change point estimation from sequences of choices -Version: 0.1.0.9000 +Version: 1.0.0.0000 Date: 2015-09-25 Authors@R: person("Vladislav", "Nachev", email = "vladislav.nachev@gmail.com", role = c("aut", "cre")) URL: http://github.com/ontogenerator/cpdetectorr BugReports: http://github.com/ontogenerator/cpdetectorr/issues -Description: An R implementation of the learning curve analysis method published in Gallistel et al. (2004). - From a sequence of responses the changes in response (e.g. from one response frequency to another or from - one response level to another) are estimated using different statistical tests and a threshold criterion. - Currently only discrete binary responses are handled. Contact the author if you would like to request - the implementation of continuous responses. +Description: An R implementation of the learning curve analysis method published + in Gallistel et al. (2004). From a sequence of responses the changes in response + (e.g. from one response frequency to another or from one response level to + another) are estimated using different statistical tests and a threshold + criterion. References: Gallistel CR, Fairhurst S, Balsam P (2004) The learning curve: - Implications of a quantitative analysis. PNAS 101:13124-13131. doi: 10.1073/pnas.0404965101 -Depends: R (>= 3.2.2) -Imports: dplyr -Suggests: ggplot2 + Implications of a quantitative analysis. PNAS 101:13124-13131. doi: 10.1073/ + pnas.0404965101 +Depends: + R (>= 3.2.2) +Imports: + dplyr +Suggests: + ggplot2 License: GPL (>=2) LazyData: TRUE +RoxygenNote: 5.0.1 diff --git a/NAMESPACE b/NAMESPACE index dfef53b..2d32b40 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,4 +1,4 @@ -# Generated by roxygen2 (4.1.1): do not edit by hand +# Generated by roxygen2: do not edit by hand export(cp_wrapper) import(dplyr) diff --git a/R/cp_wrapper.R b/R/cp_wrapper.R index 0a9b65c..1163849 100644 --- a/R/cp_wrapper.R +++ b/R/cp_wrapper.R @@ -1,33 +1,44 @@ #' Find change points in a sequence of choices based on given test and decision criterion #' @param input A vector of correct or incorrect decisions, coded as 1s and 0s -#' @param test Name of the test to be performed. Currently the following tests are implemented: "binomial", "chisquare". +#' @param isDiscrete A boolean parameter, true if the data to be analyzed are discrete, +#' false if continuous, e.g. succesive intervals +#' @param test Name of the test to be performed. The following tests are implemented: +#' "binomial" (random rate), "chisquare", "ttest", "KS" (Komolgorov-Smirnov). The binomial test is +#' used for finding changes in the rate parameter of a random rate process, either intermittently +#' (isDiscrete = TRUE) or continuously (isDiscrete = FALSE) sampled. The chi square test is used with +#' data where there has been a frequency change, as in, e.g. correct choices. The t test should be +#' used for normally distributed data. The Komolgorov-Smirnof test is used for data with nonnormal or +#' unknown distribution. #' @param Crit A real-valued decision criterion on logit. Values recommended by Gallistel et al. (2004) #' are between 1.3 and 6, which correspond to p values of 0.05 and 0.000001, respectively. #' The values are the logarithms of the odds against the null (no-change) hypothesis. #' logit = log[(1-p)/p], where p is the desired significance level #' @return A data frame with the number of Trials (Trial) for each change point detected, -#' the cumulative number of correct responses, or successes, (CumSs), and the ratio of correct/total choices (Slopes) -#' for the trials since the last change point and the current change point. +#' the cumulative number of correct responses, or successes, (CumSs), +#' and the ratio of correct/total choices (Slopes) for the trials since the last change point +#' and the current change point +#' @references Gallistel CR, Fairhurst S, Balsam P (2004) The learning curve: +#' Implications of a quantitative analysis. PNAS 101:13124-13131. doi: 10.1073/pnas.0404965101 #' @examples #' # generate dummy data with a change point at trial 120 #' input <- c(rbinom(120,1,0.5),rbinom(200,1,0.8)) -#' cp_wrapper(input, "chisquare", 3) -#' cp_wrapper(input, "binomial", 3) +#' cp_wrapper(input, TRUE, "chisquare", 3) +#' cp_wrapper(input, TRUE, "binomial", 3) #' #' # use included eyeblink data set: #' eyeblink[,] # inspect data set -#' cp_wrapper(eyeblink, "chisquare", 4) +#' cp_wrapper(eyeblink, TRUE, "chisquare", 4) #' # using small criterion, e.g. 2, fails due to computational problems #' # better use "binomial" instead -#' cp_wrapper(eyeblink, "binomial", 2) +#' cp_wrapper(eyeblink, TRUE, "binomial", 2) #' #' # use included plusmaze data set: #' plusmaze[,] # inspect data set -#' (cp.1 <- cp_wrapper(plusmaze, "binomial", 1.3)) +#' (cp.1 <- cp_wrapper(plusmaze, TRUE, "binomial", 1.3)) #' # decrease sensitivity and detect different change points -#' (cp.2 <- cp_wrapper(plusmaze, "binomial", 2)) +#' (cp.2 <- cp_wrapper(plusmaze, TRUE, "binomial", 2)) #' # the chisquare test detects more change points even with higher criterion -#' (cp.3 <- cp_wrapper(plusmaze, "chisquare", 2)) +#' (cp.3 <- cp_wrapper(plusmaze, TRUE, "chisquare", 2)) #' #' # plotting data with ggplot2 #' library(ggplot2) @@ -40,29 +51,30 @@ #' geom_point(data=cp.2, aes(Trial, CumSs), shape=2, size = 3, color = "green") + #' geom_point(data=cp.3, aes(Trial, CumSs), shape=3, size = 3, color = "red") #' -#' # plot average response rate per trial, with dplyr::lead -#' ggplot() + geom_step(data=cp.1, aes(Trial,dplyr::lead(Slopes))) + -#' ylab("Average Response Rate per Trial") # ignore Warning message +#' # plot average response rate per trial +#' ggplot() + geom_step(data=cp.1, aes(Trial,Slopes)) + +#' ylab("Average Response Rate per Trial") #' #' @export -cp_wrapper <- function(input, test, Crit) +cp_wrapper <- function(input, isDiscrete, test, Crit) { + if(!is.logical(isDiscrete)) stop("Second input (isDiscrete) must be boolean") + input <- unlist(input, use.names = FALSE) Cum <- unlist(cumsum(input),use.names = FALSE) - if ((test=="binomial")&(!identical(input %% 1,mat.or.vec(length(input),nc=1)))) + if ((test=="binomial")&(!identical(input %% 1,mat.or.vec(length(input),nc=1)))&(isDiscrete)) stop("When the binomial test is used with discrete-trial data, the data must be integer valued") + if (isDiscrete==0 & test=="chisquare") + stop("Cannot use chi square test when data are successive intervals") + if ((test=="chisquare")&(sum(input + !input)!=length(input))) stop("When chi square test is used, data must be binary, i.e. 0 or 1") - outputlist <- c() - outputlist <- list(Cumt = Cum) # Initializiing for while loop. The Cumt vector will - # be truncated as change points are found - switch(test, binomial = { CritLength <- 1 # When binomial test is used, there must be at least two data @@ -71,45 +83,120 @@ cp_wrapper <- function(input, test, Crit) CritLength <- 7 # A test of differences of frequency cannot be significant when # the total number of observations is less than 8 }, - stop("Test can only be 'binomial' or 'chisquare' ") + KS = { + CritLength <- 7 # K-S test is not valid when there are fewer than 4 data in either + # of the two samples + }, + ttest = { + CritLength <- 2 # when t test is used there must be at least 3 data + }, + stop("Test can only be 'binomial', 'chisquare', 'ttest', or 'KS' ") ) - CP <- matrix(c(0,0),ncol=2) - outputlist$r <- 1 # Initializing for while loop + outputlist <- c() # resetting the output + + if (test=="chisquare"|test=="binomial") + { + CP <- matrix(c(0,0),ncol=2) + outputlist <- list(Cumt = Cum) # Initializiing for while loop. The Cumt vector will + # be truncated as change points are found + outputlist$r <- 1 # Initializing for while loop + + while (!is.null(outputlist$r)&(length(outputlist$Cumt)>CritLength)) + { + if (!isDiscrete){ # data are continuous + R <- cpc(outputlist$Cumt) # putative inflection points + L <- rrc(outputlist$Cumt, R) # logit vector for continuous case + } else { # data are discrete + R <- cpd(outputlist$Cumt) # putative inflection points - while (!is.null(outputlist$r)&(length(outputlist$Cumt)>CritLength)) + switch(test, + binomial = { # if binomial test is to be used + L <- rrd(outputlist$Cumt,R) # logit vector + }, + chisquare={ # if chisquare test is to be used + L <- chi2logit(outputlist$Cumt,R) # logit vector + }, + stop("For discrete data test can only be 'binomial' or 'chisquare' ") + ) + } + outputlist <- trun(outputlist$Cumt,R,L,Crit) #Cumt is the truncated cumulative + # record; Lt is the logit vector up to the point of + # truncation (not used); r is the change point; r is empty if there is + # no significant change point + + if (!is.null(outputlist$r)){ # if there is a change point, update change-point array + if(!isDiscrete) # In the continuous case, the row count goes in the + # y-column of the output array (the event count); in all other cases, it goes + # in the x column. In the continuous case, the x column + # contains the successive event times + { + cumrCP <- CP[length(CP[,1]),2] + outputlist$r # Add Cumt row for latest change point + # to last change point to get Cum row of latest change point + CP <- rbind(CP,c(Cum[cumrCP], cumrCP)) # Value of cumulative record at the change point + }else{# In the discrete case, the row data go in the first column of CP + cumrCP <- CP[length(CP[,1]),1] + outputlist$r # Add Cumt row for latest change point + # to last change point to get Cum row of latest change point + CP <- rbind(CP,c(cumrCP, Cum[cumrCP])) # Value of cumulative record at the change point + } + + } # end of updating change-point array + + } # end of while loop for finding successive change points when the binomial test is used + } # end of section that computes change-point array when binomial or chi square test is used + + if (test=="ttest"|test=="KS") { - R <- cpd(outputlist$Cumt) # putative inflection points - - switch(test, - binomial = { # if binomial test is to be used - L <- rrd(outputlist$Cumt,R) # logit vector - }, - chisquare={ # if chisquare test is to be used - L <- chi2logit(outputlist$Cumt,R) # logit vector - }, - stop("Test can only be 'binomial' or 'chisquare' ") - ) - - outputlist <- trun(outputlist$Cumt,R,L,Crit) #Cumt is the truncated cumulative - # record; Lt is the logit vector up to the point of - # truncation (not used); r is the change point; r is empty if there is - # no significant change point - - if (!is.null(outputlist$r)){ # if there is a change point, update change-point array - # In the discrete case, the row data go in the first column of CP - cumrCP <- CP[length(CP[,1]),1]+outputlist$r # Add Cumt row for latest change point - # to last change point to get Cum row of latest change point - CP <- rbind(CP,c(cumrCP, Cum[cumrCP])) # Value of cumulative - #record at the change point - } # end of updating change-point array - - } # end of while loop for finding successive change points when the binomial test is used + outputlist <- list(newinput = input) # Initializing for while loop. These vectors will be + # truncated as CPs are found out + CP <- matrix(c(0,0),ncol=2) # Initializing for while loop + outputlist$r <- 1 # Initializing for while loop + + while (!is.null(outputlist$r)&(length(outputlist$newinput)>CritLength)) + { + outputlist$newCum <- cumsum(outputlist$newinput) + if (!isDiscrete){ # data are continuous + R <- cpc(outputlist$newCum) # putative inflection points + } else { # data are discrete + R <- cpd(outputlist$newCum) # putative inflection points + } #computing R vector + + switch(test, + KS = { # if K-S test is to be used + outputlist$r <- KS(outputlist$newinput,R, Crit) # logit vector + }, + ttest={ # if t test is to be used + outputlist$r <- cpt(outputlist$newinput,R, Crit) # logit vector + } + ) # end of computing new changepoint + if (!is.null(outputlist$r)){ # if there is a change point, update change-point array and + # truncate newinput + cumrCP <- CP[length(CP[,1]),1] + outputlist$r # Add Cumt row for latest change point + # to last change point to get Cum row of latest change point + CP <- rbind(CP,c(cumrCP, Cum[cumrCP])) # Value of cumulative record at the change point + outputlist$newinput <- + outputlist$newinput[(outputlist$r+1):length(outputlist$newinput)] # Truncated data vector + + } # end of updating change-point array & truncating + } # end of while loop for computing CP array when K-S or t test are used + } # end of section that computes CP array when K-S or t test are used # Adding final point to output array - CP <- as.data.frame(rbind(CP, c(length(Cum), Cum[length(Cum)]))) - names(CP) <- c("Trial", "CumSs") - # last row of CP array gives coordinates of final point in cumulative record - CP %>% mutate_(Slopes = ~(CumSs-lag(CumSs))/(Trial-lag(Trial))) - #depends on the dplyr package + if(isDiscrete) # + { + CP <- as.data.frame(rbind(CP, c(length(Cum), Cum[length(Cum)]))) # last row of CP array + # gives coordinates of final point in cumulative record + names(CP) <- c("Trial", "CumSs") + # last row of CP array gives coordinates of final point in cumulative record + CP %>% mutate_(Slopes = ~(CumSs-lead(CumSs))/(Trial-lead(Trial)), + Slopes = ~ifelse(is.na(Slopes), lag(Slopes), Slopes)) + #depends on the dplyr package + } else { # in continuous case, row count goes in y column + CP <- as.data.frame(rbind(CP, c(Cum[length(Cum)], length(Cum)))) # last row of CP array + # gives coordinates of final point in cumulative record + names(CP) <- c("Time", "Events") + # last row of CP array gives coordinates of final point in cumulative record + CP %>% mutate_(Slopes = ~(Events-lead(Events))/(Time-lead(Time)), + Slopes = ~ifelse(is.na(Slopes), lag(Slopes), Slopes)) + } } diff --git a/R/cpdetectorr.R b/R/cpdetectorr.R index e4c9a7c..787d8d4 100644 --- a/R/cpdetectorr.R +++ b/R/cpdetectorr.R @@ -1,14 +1,15 @@ -#' cpdetector: Change point estimation in learning curves. +#' cpdetector: Change point estimation in learning curves #' -#' The code is adapted from Gallistel et al. (2004). -#' The package consists of a few internal functions and one wrapper function, cp_wrapper. +#' The code is from Gallistel et al. (2004), translated from Matlab to R, with large portions of +#' comments and original code preserved. The package consists of a few internal functions and one +#' wrapper function, cp_wrapper. #' #' @docType package #' @name cpdetectorr #' @import dplyr NULL -#' Data on rabbit eyeblink conditioning. +#' Data on rabbit eyeblink conditioning #' #' Data from Gallistel et al. (2004). Original data description: "[Data] are binary, 1 or 0, according #' as a conditioned blink did or did not occur on a trial. They are discrete-trial data, so the @@ -20,7 +21,7 @@ NULL #' @source \url{http://www.pnas.org/content/suppl/2004/08/31/0404965101.DC1/04965DataSet5.txt/} "eyeblink" -#' Data on correct choices in a + maze. +#' Data on correct choices in a + maze #' #' Data from Gallistel et al. (2004). Original data description: "These are #' frequencies, so, in principle, a chisquare test is appropriate to test for changes in the @@ -40,3 +41,51 @@ NULL #' #' @source \url{http://www.pnas.org/content/suppl/2004/08/31/0404965101.DC1/04965DataSet3.txt/} "plusmaze" + +#' Data on interreward intervals in a matching experiment with concurrent variable +#' interval schedules +#' +#' Data from Gallistel et al. (2004). Original data description: "These are an example of a +#' continuous-time data record: the successive entries are the durations of the successive +#' interreward intervals. Thus, the putative change points must be found by [setting isDiscrete = FALSE]. +#' The interevent intervals are approximately exponentially distributed [...]. Thus, the process +#' approximates a random rate process and the random rate logit method is appropriate [...]." +#' +#' @source \url{http://www.pnas.org/content/suppl/2004/08/31/0404965101.DC1/04965DataSet1.txt/} +"matching" + +#' Data on successive hopper-entry speeds +#' +#' Data from Gallistel et al. (2004). Original data description: "A hopper entry speed is the +#' reciprocal of the latency between the rise of the grain bin into the feeding hopper and the +#' entry of the pigeon's head into the hopper. These data are an example of a discrete-time +#' data record. [...] The entry speeds are approximately normally distributed [... t]hus, the the t-test +#' is appropriate for testing for a change in the mean entry latency." +#' +#' @source \url{http://www.pnas.org/content/suppl/2004/08/31/0404965101.DC1/04965DataSet2.txt/} +"hopperentry" + +#' Data on feeding-by-feeding preference scores in a mouse matching experiment +#' +#' Data from Gallistel et al. (2004). Original data description: "The side-preference score during +#' any one interfeeding interval is the difference between the amounts of time spent at each +#' feeding hopper divided by their sum. These are discrete-trial, real-valued measures [...] +#' They do not obey any standard distribution, so the Kolmogorov-Smirnov test is appropriate +#' for comparing the distributions before and after a putative change point." +#' +#' @source \url{http://www.pnas.org/content/suppl/2004/08/31/0404965101.DC1/04965DataSet4.txt/} +"feedingpref" + +#' Data on swim efficiencies in a rat learning a water maze +#' +#' Data from Gallistel et al. (2004). Original data description: "The swim efficiency is the +#' straight-line distance between where the rat is placed in the tank and the location of the +#' platform divided by the distance actually swum in reaching the platform. These are again +#' discrete-trial data. The measures can fall anywhere in the interval from 0 to 1. They do +#' not appear to be normally distributed, so one might want to use the K-S statistic. However, +#' there are only 32 trials (data) and the K-S test requires a minimum of 4 data in each sample +#' (before and after a putative change point), so one might also want to try the t test on +#' these data." +#' +#' @source \url{http://www.pnas.org/content/suppl/2004/08/31/0404965101.DC1/04965DataSet6.txt/} +"watermaze" diff --git a/R/cpfinders.R b/R/cpfinders.R index de711d5..11eed0f 100644 --- a/R/cpfinders.R +++ b/R/cpfinders.R @@ -2,7 +2,7 @@ #' @param Cum Input vector of cumulative response counts #' @return R A vector with the same length as Cum, with putative change points for each #' trial. These correspond to the preceding trial at which the deviation of the -#' observed count from the expected count is maximal. +#' observed count from the expected count is maximal #' @details Not normally called directly, but via the cp_wrapper function instead. cpd <- function(Cum) @@ -32,8 +32,55 @@ cpd <- function(Cum) R <- left_join(data.frame(col=1:length(Cum)), as.data.frame(which(Devs == mx & mx > 0, arr.ind=TRUE)),by="col") %>% rename_(R = "row", N = "col") - # R at this stage is is a data.frame with columns N, and R. R has the trial numbers of the + # R at this stage is a data.frame with columns N, and R. R has the trial numbers of the # putative change points and N - the trial numbers. This and further data manipulations + # depend on the dplyr package + + unlist(R %>% group_by(N) %>% summarise_(R = ~min(R)) %>% select_("R"), use.names = FALSE) + #return only R as a vector +} + +#' Find putative change point in continuous-time cumulative records +#' @param Cum Input vector of the cumulative interevent intervals +#' @return R A vector with the same length as Cum, with putative change points for each +#' event. The putative change point corresponding to the Nth +#' event is the preceding event at which the deviation of the observed event count +#' from the expected event count is maximal. The expected event count +#' at any earlier event, n, is Cum[n], the interval up to the nth event, +#' divided by the average interevent interval over the range from n = 0 to n = N +#' The deviation from expectation is n - this expectation. R is the value of n at +#' which this deviation is maximal +#' @details Not normally called directly, but via the cp_wrapper function instead + +cpc <- function(Cum) +{ + N <- 1:length(Cum) # Event count vector + Slopes <- N/Cum # Average slope up to given point in cumulative function + + M <- diag(length(Cum)) + M[upper.tri(M)] <- 1 # Mask with ones on and above diagonal & zeros below + + Diagonal <- M * matrix(rep(Slopes, length(Slopes)), nrow = length(Slopes), byrow = TRUE) + # Creates an array in which successive cols have successive slopes of the cumulative record. + # The slope for a given col fills all the cells on and above the main diagonal + + Preds <- Cum * Diagonal + # Creates diagonal array of the predicted numbers of events at each time in Cum + + Obs <- 1:length(Slopes) * M + # Diagonal array with actual numbers of events + + Devs<- abs(Obs-Preds) # Diagonal array of deviations from expectations + + mx <- M * matrix(rep((apply(Devs,2,max)), length(Slopes)), nrow = length(Slopes), byrow = TRUE) + + # mx is a matrix listing the maxima of the deviations + + R <- left_join(data.frame(col=1:length(Cum)), + as.data.frame(which(Devs == mx & mx > 0, arr.ind=TRUE)),by="col") %>% + rename_(R = "row", N = "col") + # R at this stage is a data.frame with columns N, and R. R has the cumulative inter-event intervals + # of the putative change points and N - the event numbers. This and further data manipulations # depend on the dplyr package. unlist(R %>% group_by(N) %>% summarise_(R = ~min(R)) %>% select_("R"), use.names = FALSE) diff --git a/R/logits.R b/R/logits.R index c3956fa..e888eed 100644 --- a/R/logits.R +++ b/R/logits.R @@ -38,7 +38,48 @@ rrd <- function(Cum, R) c(0,log10(Peqorl/Peqorm)) # Vector of the pseudologits +} + +#' Compute the pseudologit vector for continuous random rate case +#' @param Cum A cumulative interevent interval vector +#' @param R A vector with trial numbers of putative change points +#' @return L A vector giving for each trial the pseudologit, approximately +#' the log of the odds that there has been a change point +#' @details For use when finding changes in the rate parameter of a random rate process. +#' Not normally called directly, but via the cp_wrapper function instead + +rrc <- function(Cum, R) +{ + # The output is the vector giving for each event the pseudologit--log[P/(1-P+p)]-- + # for the probability of observing n_a or fewer post-CP responses if lambda_a/lambda_b = 1 + # where lambda_a and lambda_b are the rates of responding before and after + # the putative change point; P is the probability of observing N-R or fewer + # events after the putative change point; and p is the probability of + # observing exactly N-R events after the putative change point. + # Note that the numerator and denominator of the pseudologit are not complementary + # probabilities, as they are in a true logit; they both include the probability of observing + # exactly N-R events, where N is the total number of events at the moment of calculation. + # The putative change point is the row (R=event number) at which + # the difference between (N/Cum[N])*(Cum[R]) and Cum[R] is maximal + # N/Cum[N] is the slope of the cumulative record up to the Nth event + # Cum[R] is the time up to the Rth event + # A negative pseudologit means that n_a is less than expected + + Ta <- Cum-Cum[R] # the interval elapsed since the putative CP + p <- Ta/Cum # probability of any one event falling after the putative CP + N <- 1:length(Cum) # event count vector + Na <- N - R # vector giving number of events since putative CP + + + Peqorl <- pbinom(Na,N,p)[-1] + # Probability of observing Na or fewer events in the interval Ta + + Peqorm <- 1 - Peqorl + dbinom(Na,N,p)[-1] # Probability of observing Na or more events + # in the interval Ta. Note that this probability overlaps the "complementary" probability; + # both include the probability of observing exactly Na events. + + c(0,log10(Peqorl/Peqorm)) # Vector of the pseudologits } @@ -59,7 +100,7 @@ chi2logit <- function(Cum, R) # and NV gives the rows for which the chi square test cannot # validly be performed (because at least one cell has an expectation # less than 5). - N<-1:length(Cum) # The trial count vector + N <- 1:length(Cum) # The trial count vector Level1<- min(which(N>6)) # Finds the row @@ -93,17 +134,122 @@ chi2logit <- function(Cum, R) # a data frame for the output is created, with each row representing a contingency table # for the subsequent tests. Further calculations depend on the dplyr package. mutate_(pchisq = + # a column with the (simulated) p values from chi square test is added ~ifelse(N > Level, chisq.test(cbind(c(Onespre, Onespost), c(Zeroespre, Zeroespost)), simulate.p.value = TRUE, B = 1000)$p.value,1)) %>% - # a column with the (simulated) p values from chi square test is added mutate_(pchisq = - ~ifelse(N <= Level & N > Level1,fisher.test( - cbind(c(Onespre, Onespost),c(Zeroespre, Zeroespost)), - simulate.p.value = TRUE, B = 1000)$p.value,pchisq), - Lgt = ~ifelse(pchisq == 1,0,log10(pchisq*(1-pchisq)))) - # For the cases in which chi square is invalid, calculate p values from Fisher's exact test - # Zeros logit values for the initial string of observations within which - # there are too few observations to do even Fisher's exact test + # For the cases in which chi square is invalid, calculate p values from + # Fisher's exact test. Zeros logit values are given for the initial string of + # observations within which there are too few observations to do even Fisher's exact test + ~ifelse(N <= Level & N > Level1,fisher.test( + cbind(c(Onespre, Onespost),c(Zeroespre, Zeroespost)), + simulate.p.value = TRUE, B = 1000)$p.value,pchisq), + Lgt = ~ifelse(pchisq == 1,0,log10(pchisq/(1-pchisq)))) + unlist(Output %>% select_("Lgt"), use.names = FALSE) } + + +#' Uses t test to find first significant change point +#' @param Data A vector of trial by trial measures or successive intervals +#' @param R A vector of putative change points +#' @param Crit Decision criterion, the value the logit must exceed +#' for the function to return a significant change point +#' @return CP The first significant change point +#' @details This test is appropriate if one is looking for a change in the expectation of a +#' renewal event-generating process, where the interevent intervals are normally (rather than +#' exponentially) distributed.Not normally called directly, but via the cp_wrapper function instead. + +cpt <- function(Data, R, Crit) +{ + Data <- unlist(Data, use.names = FALSE) + L <- c(0,0) # initialization of the logit vector up to and including + # the row where the significance criterion (Crit) was exceeded + r <- 3 # Initializing for while loop, with index r + + while(abs(L[length(L)]) < Crit) + { # loop that ends when critical L found or end of data reached + if (!is.na(R[r])) # if R[r] is NA skip to next r + { + if ((sum(sd(Data[1:R[r]]),sd(Data[(R[r]+1):r]), na.rm=TRUE)>0) & + (length(Data[1:R[r]]) > 1) & (length(Data[(R[r]+1):r]) > 1))# test cannot be run when + # there is no variance on either side of putative CP, for + # example, in the sequence 0 0 0 3 3 3 or from a single observation e.g. 0 vs 3 2 5 + { + pb <- t.test(Data[1:R[r]],Data[(R[r]+1):r],"greater")$p.value # Probability + # that the mean after the putative change point is greater than the + # mean up to and including the putative change point + pl <- t.test(Data[1:R[r]],Data[(R[r]+1):r],"less")$p.value # Probability + # that the mean after the putative change point is less than the + # mean up to and including the putative change point + L[r] <- log10(pb/pl) # Latest logit + } else { + L[r] <- 0 + } # end of if that computes individual logit (L) values + } # end of if that checks if R[r] is NA + + + r <- r + 1 # Incrementing latest row for next iteration + if (r>length(Data)) break # end of data reached + + } # end of while loop + + if (abs(L[length(L)])>Crit) CP <- R[r-1] else CP <- NULL # if no significant change point, CP empty + CP +} + + +#' Uses Komolgorov-Smirnov test to find first significant change point +#' @param Data A vector of trial by trial measures or successive intervals +#' @param R A vector of putative change points +#' @param Crit Decision criterion, the value the logit must exceed +#' for the function to return a significant change point +#' @return r1 the change point row when the decision criterion is exceeded +#' @details Not normally called directly, but via the cp_wrapper function instead. + +KS <- function(Data, R, Crit) +{ + # L is the pseudologit vector for rows where the + # approximation formula for the Kolmogorov-Smirnov p is valid. + # Its final value is the first value to exceed the decision criterion + # t is the col vector of rows for which L is defined + # r1 is the change point row when the decision criterion is exceeded + # r2 is the row at which the decision criterion is exceeded + # If there are no testable rows or if the decision criterion is never + # exceeded, the variables are returned empty + + N <- 1:length(Data) # Number of rows in Data vector + r1 <- c() + r2 <- c() + t <- c() + L <- rep(0,length(N)) # initialization of the logit vector + + Na <- N - R # Col vector giving for each row in Data the number of rows + # after the putative change point. So R gives the number of + # rows before the change point and Na the number after + + Test <- which(Na*R/(Na+R)>=4) # For the approximation to the KS + # probability to be valid, the product of the two n's divided by + # the sum must be greater than or equal to 4. Test is the col + # vector of rows that satisfy this constraint--the row numbers(!), + # not the entries themselves + + if (length(Test)>0){ # check if any rows satisfy the constraint and proceed + for (T in 1:length(Test)){ + pval <- suppressWarnings(ks.test(Data[1:R[Test[T]]], + Data[(R[Test[T]]+1):Test[T]], exact = FALSE)$p.value) + L[T] <- log10((1-pval)/pval) + t[T] <- Test[T] # The row to which the latest value of L[T] "belongs" + + if (L[T]>Crit) # Value of logit exceeds decision criterion + { + r2 <- Test[T] # the row (in Data) at which the criterion is exceeded + r1 <- R[Test[T]] # the change point when the criterion is exceeded + L <- L[1:T] # Drop rows of L after row in which decision criterion reached + break # Break out of loop when decision criterion exceeded + } + } + } + r1 +} diff --git a/README-unnamed-chunk-10-1.png b/README-unnamed-chunk-10-1.png new file mode 100644 index 0000000000000000000000000000000000000000..1e0aadf00355ab09475693df889066b604c2e3c6 GIT binary patch literal 7185 zcmZu$2{=^U8^3qV*q1`qET4Tzg|TEE6(KZ93o6-1F1+RaHeEv;ZwFz(p&j$DH;@G&hejC+3+) z)w|H?TuP|O5Ye1SG>;+@^N4x%#Jr&>I#HB)R8&1RMhl3EK~|T<^icDN=6N)tsJ!~T zydi3d3sBW~gLd$1No78>k`0;#k>95V_+pv1R<(B?@2yHt653KnDarRyGipnG(N}KCKWJDcGDyWE zul9?!w*8ihC8r#uQZeAx0@CqFPc1fvEhB^z&yku#Ai6f~M$(<{d7zYos|`gj3ue>O zn3-{>5mx!GW?k;`m-fPQTs1#6O`hm+^atB+Fyhu?+(aBZy-ZQ7^G&B!sJ;uc&X0RH z9t~B46h_1^XEa89yiIV^3{e_`Id-1$Dt-N{SfT3^a1t>>23)6ujqh@V({0`XbCAG5tabCUDg&*88Ei z4IbzYHFJ!-d&Kl(6YD?U<(5fugnKIPzshjmu0~K-#<2)|JtfSv2$p z*-RVvNZ-~Lw$Z^AxeeK55jzGvC$d)&k!oj%9h_Tk>Qn1HUv^Sk93-f4lrDdoE9BM# zbK{{&fxOS~;FMJJ$FqMYoB+n9E(w!m5D~&AI7#UkiE6IoM8PX&`XiY6mFsAnAfhV= znGfNr&JBf$as$Jvs}1x1Um6=p-9{*iltZK_m)CoJ$i5zK z#U`Y9n|B5A6Rs(n2P$#(y4qEYI-?@`UFC`F4^R>$%qxkGKR$Ps*m1_*GCFwe{0Pr7 z=geBnm?b7nB2|g-(%Q}LqPSs@n97F5(svJr2N!js+sldx-Dt)RnC}KWS_#8%gxSwIMf#K6cq#6tfwc#7aSzt3 zL|ufaaeZ=de7uuifNovJA<;~i>^-i~cl7+Vf-IgIGc%(~GsRX56*j`T7&I<9(k5A5 zuN~^=XBwRw?wT0A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%Mq+oboT;Kf5KUL|hgJ{gYYity^&b#SY&}*$(u7XI;Fqp34QjV74#8Z))jz5B4bIo$qADjQ$ zm~FstycLd zAGssQ2JJ3Ii<-F;s)X#XlJU3~WfQ8Se6R%gOYE?x;p%v^jV$xiS6;<1D!#dGgh3VVffNN4{J5KOerA1C)rRtb{@}&O`6u=NmL=E;kCoQB-Lz`wKd+$vSL^?IL-m^) ZDLD8&#kJ}7+M^CdH7PuzW~pU0muLV literal 0 HcmV?d00001 diff --git a/README-unnamed-chunk-11-1.png b/README-unnamed-chunk-11-1.png new file mode 100644 index 0000000000000000000000000000000000000000..a5a19bd5c86d768e23a95d3d6e54305345f0fcc3 GIT binary patch literal 6306 zcmb7J2|UzW-#@e1DoR9+q7Yf48tW8B%amf8o24tslZvs-NVXzoZhJ%_$uj&!$b`zE zA>6JxGOZ%2TwuNeK0KycQK?oDR4V+-q%wICLXHTlhzP+fGop(B00$lvJb1w6GpSZg z0aFAs!irhNWb$}S9>2f^6!7^~5mr@vKKB8R%P-*a`8+0-$LEiXjKE}=1{2^ZK3~8H zbHQ{zpMU-zq@Q7XB`zMZ_W?kvT=0je^vXOBfPB2gL35kSiDL{&2d+`ut?ow!+-Vf9 zdw;P)L0t%b8+I2S^9P@QPC=cBIZ+$AouQ&plsr;$WNvKVR3f%Ca%aUWCMM;EZG{d< zF-7b+dJ2R_$^1Xt)+C!r9Ca*{~Wi#;w+r z!~6J-+rPB6-Nf*xn%*Q{ks zjQ-AN-1a2`FoH`?1zVaq<|_eABl~!TT}&j&1D}!1Z%+K2k?b|x5j!=Tn&Z^ay7v!d zmbC{y;M=)in(>kmbuclxPhk)DexK9bZw(vvuwy@Kb*M4$s|wqxuS_Jj3!` ze8$jlR5~_r^Dt%Q5^!j+TK>D@6e2-@dlWl)%}?=8l89m$%vDbvD9{?M-8LPgCZyi1>v=5{`;Ez0yaK`%EE4vPpG3mKo))sF zs70^oPoCs2rZ~Ng+8lhT3|I8-P2ycykFqNtOxD9WRr~4rS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KL;ZBopIA3gCx{3vwUS3a6nTA(P!j*of3Q!xa8g6Ze2G z`T?)r6rZT^ESGg~?9NR6&_CVWxjWsoY({C`iyyFRjOW&DeFRs9-w=?nf zLj=YDi@v%@{->vs%@n`Lv<{a8$GA`IGIm18rO3-FgN=-s0M^rL76M+U0r`&hQz&ddt*G2?r)_AQ$66^mbcq9Nx6i9x13 ztt~ohe)8L5`H;Ee@qQY?4qizCI3=T4voo|}3ZYTy_TiVz+Cwmm4Y&SQI7_RiSw6~J zG+dceLqUn%ViNd@7RkXeZ2#;5SnROq^e11_8~dN-!!Wj+uJb7F_vXL9k^gA_pD*Y$ aw5BC8|9IoYKEeMQEDjM5=IsB+wf_MfNwZ)8 literal 0 HcmV?d00001 diff --git a/README-unnamed-chunk-8-1.png b/README-unnamed-chunk-8-1.png index 122c34e7bb966283481f3e56d24a38cabab0cd28..0ce4d4e280a0d85ca1b204ba3455fa03f0671121 100644 GIT binary patch literal 6159 zcma)Adpy+H`#&>6A!;MJ)wV=K*oJ6E_>^)P28|@^wv}Nb6hjgDY!_`8_t`8`Q@KUh z24mfK+btT>Bt}fMEB8wh(%gDF9%Z0AT)FD*-uVilG#IR5?2wIRu{o5CQN5#3bOyHZn4T10o<2fgdr6 zPZs?JlgSC>;6idjqn{Y(#}-0XFgZAwoDduge}%z?eFv*jQND*H_plWcvYj5|PbMVhe?h3FJnhke@{4CqXQmFBJ9_2KNbtqobn` z2dCkjkk5x)p-=>eSO^gcg%@q}_e0y)ow0Qf13>-{(LbgkB;OZ+&5L#i_a8ZbXFN;x zLi=;2Lz3H#_wGZF)XH$D z#6M57*L#+xdtbzGcM&Nwqfsv$0?&QY2l~23=`0~Pz3t;C5AfX)zi)F)?}Cg&Hk{xr z%T>bBYwbOdVP(T{)If7n($%7lcOF$fvy%R_cwD?fkGe$+B;^?}oWRTbnmP8$%{u4+ zH<{(7e13t@)-o?vlZwZ}=?9wBLV3icsadYJ?DX=9!y3=T&``HbH=~m+mYQSHbU@;G z1^N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c)f=4U6msXp|-ul#<8{HLE9HWa_ESMuIp zx$w(&W0k9d(Cu?$P5boxo{&3;;S*cMyfuAu#G>uSJll(c;`FunHAa~%58rKsk#Dbe zOtr**FnsaWef~!l?MJ8}sn2mcvi;D`)Gy$5R>A(X%zOWQ<$S-1$`wP;r22Et0 zYs+iegsGQ`6A?as zS*;=QIt9VEaGvKx=|RKZq}-?;@wt*{Zol)5V*A7~Pu)SUohE`cQ{MO5W7qbo+bqa9 zA1An6i2nOqfQm##qXC2X-jjU;joVvp>6RP<#$J6y*>CwTN1D#AeigYkAE_^jIh65# zUYv3)#_T%|tgV?jBPhE6tjBnC*6$0DJUiXwcG==MNr?)Tkr5wB#NAtKsJoo?pnB#* zYklm?LyH>`%jIxEvEuZXi8*%CDu;oow^qkVN~@r<220*?Zp1)$c`U0cG%N-Ugz4N9 zPNE2Z>e$e`}ty`bSL`axhg=g03o7J<6_whQ5B zFj^=En?Xx*3mV_Nd0mE@FXP|d|NiIZI728N;5@z~TAC_{-MQOX*qaxcdLjP>n@{AQ diff --git a/README-unnamed-chunk-9-1.png b/README-unnamed-chunk-9-1.png index aacd07e0702082b82332dacc5a85589e75b078f2..cc8789d7d82397d7e9e1f8700136b4bbf8f97d46 100644 GIT binary patch literal 5358 zcmeHL2~?9;77j=Z21L{Vjt)c}mLN1Jaa;m|KY|h@Bp^$XtsMnotBDqrRiMF<3N>U9 zMNl9jh!Q~^kVTd_hf;R<6)6LupfN}Q6_F+EnfE88we2it&Y3wgbIx$W`QN+mzW46C z_q*SH|9^q*a$qHPJr;#Rt)w{GyP;63JQPahx%x67p}JWt2aj61v%3R$qEKWMDhNg9 zqJm0EBogS5QDibIh|CpIkv}Gt%Aqp(R8B(>&?}XJK9kC1QaMZ}`0<&1F-NY!p>jBg zl+S69amgqy7c5Z970UQbDj(6~@Htd|1D`Jz^To2#AXI5kP$`#OD&&^RWDOi@gG?sm zl7(C_qf{u9iTO;iOg1ty0#s$Cr9cA=%Y;HOAd?|8fI85U$z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{QUA+og_dWC(=|!9n5au_DahPNDah^ zY@_Pt Trial CumSs Slopes -#> 1 0 0 NA -#> 2 48 13 0.2708333 -#> 3 100 54 0.7884615 +#> 1 0 0 0.2916667 +#> 2 48 14 0.9038462 +#> 3 100 61 0.9038462 # so the output will differ every time the code is executed ``` @@ -35,18 +35,16 @@ or a data frame: d_responses <- data.frame(Responses = c(rbinom(50,1,0.3), rbinom(50,1,0.8))) #these data are randomly generated # so the output will differ every time the code is executed -cp_wrapper(d_responses, "chisquare",2) -#> Trial CumSs Slopes -#> 1 0 0 NA -#> 2 36 7 0.1944444 -#> 3 40 11 1.0000000 -#> 4 48 12 0.1250000 -#> 5 100 57 0.8653846 +cp_wrapper(d_responses, TRUE, "chisquare", 2) +#> Trial CumSs Slopes +#> 1 0 0 0.254902 +#> 2 51 13 0.755102 +#> 3 100 50 0.755102 ``` -For the same value of the criterion, the chi square test usually gives a higher number of change points (in this case, false positives). The value of the criterion should lie between 1.3 and 6, corresponding to p values of 0.05 and 0.000001, respectively. These values are the logarithms of the odds against the null (no-change) hypothesis. +For the same value of the criterion, the chi square test usually gives a higher number of change points (in this case, false positives) than the binomial test. The value of the criterion should lie between 1.3 and 6, corresponding to p values of 0.05 and 0.000001, respectively. These values are the logarithms of the odds against the null (no-change) hypothesis. -Let us look first at the included eyeblink data set: +Let us look first at the included `eyeblink` data set: ``` r eyeblink[,] # inspect data set @@ -70,25 +68,25 @@ eyeblink[,] # inspect data set Gallistel et al. advise against using the chi square test on these data. Indeed, with a criterion of 2, the test fails: ``` r -cp_wrapper(eyeblink, "chisquare", 2) +cp_wrapper(eyeblink, TRUE, "chisquare", 2) ``` However, using either a higher criterion or the "binomial" test gives a result: ``` r -cp_wrapper(eyeblink, "chisquare", 4) +cp_wrapper(eyeblink, TRUE, "chisquare", 3) #> Trial CumSs Slopes -#> 1 0 0 NA -#> 2 65 0 0.0000000 +#> 1 0 0 0.0000000 +#> 2 65 0 0.6528736 #> 3 500 284 0.6528736 -cp_wrapper(eyeblink, "binomial", 2) +cp_wrapper(eyeblink, TRUE, "binomial", 2) #> Trial CumSs Slopes -#> 1 0 0 NA -#> 2 65 0 0.0000000 -#> 3 259 169 0.8711340 -#> 4 411 279 0.7236842 -#> 5 419 284 0.6250000 +#> 1 0 0 0.0000000 +#> 2 65 0 0.8711340 +#> 3 259 169 0.7236842 +#> 4 411 279 0.6250000 +#> 5 419 284 0.0000000 #> 6 500 284 0.0000000 ``` @@ -98,15 +96,15 @@ With ggplot we can visualize the results by first generating a `data.frame` with library(ggplot2) # load the ggplot package eyeblinkdata <- data.frame(Trial = 1:length(eyeblink[,]), CumRespMeasure = cumsum(eyeblink)[,]) -changepoints <- cp_wrapper(eyeblink, "binomial", 4) # save the output of the change point analysis +changepoints <- cp_wrapper(eyeblink, TRUE, "binomial", 4) # save the output of the change point analysis #generate a cumulative response vs trial plot: ggplot(eyeblinkdata) + geom_line(aes(Trial, CumRespMeasure)) + geom_point(data = changepoints, aes(Trial, CumSs), size = 3) ``` -![](README-unnamed-chunk-8-1.png) +![](README-unnamed-chunk-8-1.png) -Another type of plot one can look at is the average response rate per trial vs trial. In this example we use the plusmaze data set included with the package. +Another type of plot one can look at is the average response rate per trial vs trial. The `plusmaze` data set included with the package contains frequency data, that are again preferrably analyzed with the random rate (binomial) test. ``` r plusmaze[,] # inspect data set @@ -116,19 +114,18 @@ plusmaze[,] # inspect data set #> [106] 0 1 1 0 1 0 1 1 1 1 0 0 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 0 0 1 1 1 1 0 #> [141] 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 0 1 1 0 1 0 0 #> [176] 0 1 1 1 1 1 0 1 1 1 0 0 1 1 1 1 1 0 1 1 0 1 1 1 1 -(cp.1 <- cp_wrapper(plusmaze, "binomial", 1.3)) #find the change points +(cp.1 <- cp_wrapper(plusmaze, TRUE, "binomial", 1.3)) #find the change points #> Trial CumSs Slopes -#> 1 0 0 NA -#> 2 22 9 0.4090909 -#> 3 36 9 0.0000000 +#> 1 0 0 0.4090909 +#> 2 22 9 0.0000000 +#> 3 36 9 0.6341463 #> 4 200 113 0.6341463 -# plot average response rate per trial, with dplyr::lead -ggplot() + geom_step(data=cp.1, aes(Trial,dplyr::lead(Slopes))) + - ylab("Average Response Rate per Trial") # ignore Warning message -#> Warning: Removed 1 rows containing missing values (geom_path). +# plot average response rate per trial +ggplot() + geom_step(data=cp.1, aes(Trial,Slopes)) + + ylab("Average Response Rate per Trial") ``` -![](README-unnamed-chunk-9-1.png) +![](README-unnamed-chunk-9-1.png) ``` r # for comparison, the cumulative response vs trial plot, as in the example above: @@ -138,7 +135,53 @@ ggplot(plusmazedata) + geom_line(aes(Trial, CumRespMeasure)) + geom_point(data = cp.1, aes(Trial, CumSs), size = 3) ``` -![](README-unnamed-chunk-9-2.png) +![](README-unnamed-chunk-9-2.png) + +The attached data set `hopperentry` contains hopper-entry speeds from pigeons, an example of normally distributed data. Consequently the t test can be used. + +``` r +(cp.2 <- cp_wrapper(hopperentry, TRUE, "ttest", 4)) #find the change points +#> Trial CumSs Slopes +#> 1 0 0.00000 0.7132600 +#> 2 42 29.95692 0.8891728 +#> 3 100 81.52894 0.9880297 +#> 4 244 223.80522 0.9880297 +# cumulative response vs trial plot +hedata <- data.frame(Trial = 1:length(hopperentry[,]), + CumRespMeasure = cumsum(hopperentry)[,]) +pl1 <- ggplotGrob(ggplot(hedata) + geom_line(aes(Trial, CumRespMeasure)) + + geom_point(data = cp.2, aes(Trial, CumSs), size = 3)) +# plot average response rate per trial +pl2 <- ggplotGrob(ggplot(cp.2) + geom_step(aes(Trial,Slopes)) + + ylab("Average Response Rate per Trial")) +# stack the two plots vertically using the grid package +grid::grid.draw(rbind(pl1,pl2, size = "first")) +``` + +![](README-unnamed-chunk-10-1.png) + +An example for continuous data is the attached `matching` data set. The plots need different axes and labels: + +``` r +(cp.3 <- cp_wrapper(matching, FALSE, "binomial", 2)) #find the change points +#> Time Events Slopes +#> 1 0.00000 0 1.934973 +#> 2 36.17621 70 5.898969 +#> 3 47.53413 137 9.559500 +#> 4 53.07835 190 6.138859 +#> 5 119.86601 600 6.138859 +# cumulative response vs trial plot +matchingdata <- data.frame(Events = 1:length(matching[,]), + Time = cumsum(matching)[,]) +pl3 <- ggplotGrob(ggplot(matchingdata) + geom_line(aes(Time, Events)) + + geom_point(data = cp.3, aes(Time, Events), size = 3)) +# plot average response rate per trial +pl4 <- ggplotGrob(ggplot(cp.3) + geom_step(aes(Time,Slopes)) + + ylab("Events per Unit Time")) +grid::grid.draw(rbind(pl3,pl4, size = "first")) +``` + +![](README-unnamed-chunk-11-1.png) References ========== diff --git a/data/feedingpref.RData b/data/feedingpref.RData new file mode 100644 index 0000000..10f3991 --- /dev/null +++ b/data/feedingpref.RData @@ -0,0 +1,686 @@ +RDA2 +A +2 +197125 +131840 +1026 +1 +262153 +11 +feedingpref +787 +1 +14 +641 +0.48614 +-0.97393 +0.33333 +0.98895 +-0.90218 +0.90396 +0.82691 +-0.9847900000000001 +-0.96226 +-0.98332 +-0.9958 +0.11611 +0.97499 +-0.95581 +-0.423 +-0.9994499999999999 +0.57834 +0.33981 +0.68738 +-0.98368 +-0.99124 +0.35691 +0.98188 +-0.009901 +0.80809 +-0.48236 +0.56745 +0.88243 +-0.90123 +0.94538 +-0.026598 +0.97887 +0.75926 +0.8274 +0.93141 +0.22535 +0.97033 +0.7006 +0.9730799999999999 +0.84572 +0.96304 +-0.80621 +0.75671 +0.33333 +0.969 +-0.1236 +0.69074 +-0.17603 +0.70309 +0.9157999999999999 +0.65698 +0.96125 +0.90261 +0.95909 +0.76045 +0.25149 +0.25828 +0.94123 +0.86705 +-0.6902700000000001 +0.93292 +0.95973 +0.72142 +0.013649 +0.6414299999999999 +0.97122 +0.9174099999999999 +-0.06906900000000001 +0.91001 +0.81404 +0.95974 +0.65359 +0.84654 +0.74188 +-0.0089172 +0.98859 +0.88515 +0.88454 +0.73339 +0.92982 +0.90428 +0.28205 +0.8541 +0.9370000000000001 +-0.30699 +0.16717 +0.058824 +0.86347 +0.96876 +0.99168 +0.86588 +0.57613 +0.98693 +-0.73363 +-0.55378 +0.85838 +0.9181 +0.80154 +0.4439 +0.95652 +0.64067 +0.87909 +0.48928 +0.11966 +0.84073 +0.36255 +0.71773 +0.79264 +0.98117 +0.81715 +0.92366 +0.94201 +0.98467 +0.9573 +0.67527 +0.7337900000000001 +0.82112 +0.2894 +0.79528 +0.9445 +0.92513 +0.91509 +-0.32653 +0.14493 +0.11409 +-0.3027 +0.94881 +0.89894 +0.70683 +-0.536 +0.94371 +0.81909 +0.43563 +-0.077295 +-0.3871 +0.84365 +0.31868 +-0.93031 +0.37838 +0.55361 +-0.041096 +-0.013838 +0.23232 +0.90996 +0.55466 +0.78495 +0.95538 +0.83231 +0.022074 +-0.99039 +0.045455 +-0.92405 +0.52885 +-0.030303 +0.72527 +0.97761 +0.30435 +0.76983 +-0.11111 +-0.06051 +0.44928 +0.2093 +0.30715 +-0.90909 +-0.020104 +0.8814 +-0.9004799999999999 +0.73444 +-0.80804 +-0.11602 +0.8471 +-0.36207 +-0.52212 +0.48794 +0.89239 +-0.69841 +0.83607 +-0.05848 +0.70813 +-0.88063 +0.36778 +0.72727 +0.067358 +0.96653 +-0.46784 +0.85049 +0.044248 +0.87525 +0.74679 +-0.93311 +0.65817 +0.53455 +0.71308 +0.27092 +0.65246 +0.82581 +0.73783 +0.45763 +0.94911 +-0.37079 +-0.28508 +0.91815 +-0.55636 +0.53846 +-0.5 +-0.38222 +0.42253 +-0.60156 +0.52698 +-0.74298 +-0.93666 +0.83146 +0.68326 +-0.88624 +-0.39101 +0.10345 +0.37778 +0.86963 +-0.7973 +0.10204 +0.34351 +0.45143 +-0.43854 +-0.22222 +-0.11524 +0.7685999999999999 +-0.95014 +0.86207 +-0.073569 +0.87807 +0.36617 +0.62292 +0.50381 +0.71887 +-0.50649 +-0.016393 +-0.75854 +0.30659 +0.7027600000000001 +0.17949 +0.86185 +-0.043478 +0.75996 +0.96201 +0.52239 +-0.074823 +0.98036 +0.78512 +0.58185 +0.78205 +-0.98659 +0.82423 +-0.71266 +0.92805 +0.90164 +0.95838 +-0.0399 +0.022255 +0.10407 +0.98431 +-0.73281 +-0.76292 +-0.48853 +0.5935 +0.5071099999999999 +0.20588 +-0.16154 +0.81952 +-0.17476 +0.62656 +0.06087 +-0.2133 +0.72356 +0.2701 +0.79723 +0.19749 +0.44 +0.61491 +0.41221 +-0.7168099999999999 +0.7744799999999999 +-0.18826 +0.99629 +0.33953 +0.061644 +0.9758599999999999 +0.51832 +0.7961 +0.6140600000000001 +-0.53586 +0.58724 +0.9549800000000001 +0.89627 +0.70795 +0.96729 +0.97131 +0.83679 +-0.31148 +0.14085 +0.11573 +0.62037 +-0.083333 +0.68436 +0.6166700000000001 +0.78703 +0.88757 +0.63188 +0.63745 +0.7230799999999999 +0.9564 +0.71145 +0.84082 +0.20779 +0.3131 +0.66325 +0.84712 +-0.0021142 +0.6166700000000001 +0.64391 +-0.25971 +0.75378 +0.095238 +0.82877 +0.79517 +0.48138 +0.94353 +0.44325 +0.55796 +0.76658 +0.74168 +0.78022 +0.90568 +0.94924 +0.16993 +0.2332 +0.92871 +0.9441000000000001 +0.6199 +0.93311 +0.8910400000000001 +0.57114 +0.051995 +0.97455 +0.91487 +0.75401 +0.39873 +0.26027 +0.4124 +0.2833 +0.54688 +0.3829 +0.70248 +0.8 +0.69351 +0.46237 +0.8186099999999999 +0.85376 +0.25072 +0.89003 +0.42857 +0.80829 +0.5555600000000001 +-0.3 +0.6506 +0.64362 +0.79892 +0.93505 +0.014805 +0.17241 +-0.74468 +0.5982499999999999 +0.014245 +0.625 +0.54839 +0.51724 +0.59151 +0.8777199999999999 +0.75562 +0.82796 +0.71578 +0.012658 +0.73248 +0.9728599999999999 +0.92676 +0.89236 +0.56098 +0.8892099999999999 +-0.38435 +0.34772 +0.81707 +0.76211 +0.5115 +0.8914299999999999 +0.77698 +0.89431 +0.13998 +0.81982 +0.97672 +0.60305 +-0.42657 +0.10714 +0.84091 +0.33333 +-0.65328 +0.90991 +0.6926099999999999 +0.80357 +0.034483 +0.7594 +0.96923 +0.044665 +0.36399 +-0.231 +0.42183 +0.96552 +0.73409 +0.86349 +-0.18987 +0.46667 +0.23836 +0.8242699999999999 +0.33288 +0.69811 +0.7451 +0.8294899999999999 +0.33333 +0.6 +0.96258 +0.33488 +0.09604500000000001 +0.97223 +0.48916 +-0.61842 +0.45299 +0.81699 +0.92444 +0.77612 +-0.42669 +0.85327 +-0.25673 +0.88952 +0.42473 +0.04644 +0.9776 +0.026846 +0.65957 +0.77754 +0.23499 +0.4137 +0.87713 +0.63636 +-0.57895 +-0.36364 +0.82873 +0.29412 +0.65579 +0.74823 +0.64636 +0.95767 +0.81076 +0.98062 +0.83774 +0.66326 +0.7428900000000001 +0.13937 +0.82857 +0.10833 +0.95987 +0.78456 +-0.99783 +0.94715 +0.49889 +0.28436 +0.35075 +0.36996 +-0.11377 +0.36815 +0.7226900000000001 +-0.48126 +0.15432 +0.94629 +-0.070423 +0.59748 +-0.16838 +0.43396 +0.84541 +-0.52137 +-0.032419 +0.7714299999999999 +-0.40909 +-0.26606 +0.34426 +0.92073 +0.17341 +-0.1164 +-0.7029300000000001 +-0.010799 +0.34118 +-0.79814 +-0.45174 +0.0721 +0.038391 +0.92238 +0.46176 +-0.15 +-0.39098 +0.7931 +-0.13146 +-0.11282 +0.19385 +0.63435 +-0.7352300000000001 +0.9488799999999999 +0.81681 +-0.34247 +0.066038 +0.65468 +-0.15405 +0.36406 +-0.59754 +0.91618 +-0.13901 +0.35461 +0.875 +-0.12903 +-0.049383 +-0.49672 +0.012158 +0.10651 +0.3124 +0.88889 +0.17871 +-0.53943 +-0.5806 +0.47005 +-0.0022173 +0.095611 +0.9628 +0.84828 +0.92245 +-0.14098 +-0.10462 +-0.68285 +-0.18325 +0.96205 +0.60359 +0.6899999999999999 +-0.56784 +-0.81679 +0.92698 +0.69737 +-0.92362 +0.61468 +0.83822 +-0.60643 +-0.022152 +0.5720499999999999 +-0.037694 +0.56005 +-0.19774 +0.38504 +-0.49535 +-0.22857 +-0.21173 +0.014577 +0.45893 +0.23611 +-0.009746599999999999 +0.36343 +0.78378 +0.20628 +0.86982 +-0.26163 +0.52857 +0.28964 +0.57838 +-0.15897 +0.92196 +0.8278799999999999 +0.77133 +-0.12903 +0.6823900000000001 +0.35714 +0.7389 +0.33333 +0.1391 +0.85263 +0.7027 +0.69231 +0.70414 +0.70113 +-0.09407699999999999 +0.87017 +0.49242 +0.37722 +-0.29358 +0.70909 +-0.16693 +0.74497 +0.010309 +-0.15323 +-0.65261 +0.79636 +-0.50604 +0.90998 +-0.96462 +0.856 +0.81818 +0.37699 +-0.64912 +-0.034483 +0.79825 +0.46225 +0.88764 +0.46939 +-0.92708 +-0.27103 +-0.72679 +-0.15493 +-0.6805099999999999 +-0.82969 +0.30508 +-0.28691 +0.79858 +0.13588 +0.7907 +0.92176 +0.37089 +0.9633699999999999 +0.80042 +0.67363 +-0.57633 +0.70567 +-0.8919899999999999 +0.78523 +0.98692 +0.94938 +0.98586 +0.98409 +-0.066667 +0.37881 +1026 +1 +262153 +5 +names +16 +1 +262153 +9 +Responses +1026 +1 +262153 +9 +row.names +13 +2 +NA +-641 +1026 +1 +262153 +5 +class +16 +1 +262153 +10 +data.frame +254 +254 diff --git a/data/hopperentry.RData b/data/hopperentry.RData new file mode 100644 index 0000000..e1ff3b1 --- /dev/null +++ b/data/hopperentry.RData @@ -0,0 +1,289 @@ +RDA2 +A +2 +197125 +131840 +1026 +1 +262153 +11 +hopperentry +787 +1 +14 +244 +0.07734000000000001 +0.5988 +0.11001 +0.369 +0.60606 +0.78125 +1.2346 +0.84034 +0.70423 +1.9608 +0.28571 +1.1364 +0.8547 +0.5988 +0.5988 +0.73529 +0.32051 +0.44643 +0.57803 +1.1765 +0.625 +0.6756799999999999 +0.7194199999999999 +0.83333 +0.73529 +0.90909 +0.81301 +0.75188 +0.7194199999999999 +0.625 +0.75758 +0.45455 +0.6896600000000001 +0.29326 +0.83333 +0.93458 +0.83333 +1 +0.70423 +0.38168 +0.93458 +0.7194199999999999 +0.9009 +0.93458 +0.90909 +1.0204 +0.74074 +0.90909 +0.76336 +0.80645 +1.0638 +0.9901 +0.93458 +0.75758 +0.70423 +1.2658 +0.96154 +0.9901 +0.88496 +1.2195 +0.86207 +0.90909 +1.0989 +1.0989 +0.75188 +0.83333 +0.86207 +1.1364 +0.9901 +0.93458 +0.90909 +0.90909 +0.46512 +0.93458 +1.0309 +0.88496 +1.1765 +1.0204 +0.93458 +0.77519 +0.81301 +1.1364 +0.55866 +1.0204 +0.96154 +0.81301 +0.96154 +0.28571 +1.0989 +0.90909 +0.93458 +0.28571 +0.6756799999999999 +0.87719 +0.83333 +0.86207 +0.56818 +0.83333 +0.93458 +0.93458 +1.1765 +1.0526 +0.93458 +0.6896600000000001 +0.93458 +1.1364 +1.1364 +0.93458 +1.2195 +0.77519 +1.1765 +1 +1.2821 +0.93458 +0.74074 +0.93458 +0.96154 +1.1765 +1.2195 +1.2346 +0.96154 +1.2195 +1 +0.9009 +0.96154 +0.81301 +1.2346 +0.96154 +1.1364 +1.2658 +1.1765 +1.2195 +1.5873 +0.97087 +1.2195 +1.1364 +0.90909 +0.73529 +0.96154 +1.0638 +0.93458 +1.2195 +1.0989 +1.0204 +0.7194199999999999 +0.625 +1.1765 +1.1765 +0.96154 +0.93458 +0.96154 +0.28571 +0.90909 +1.2821 +0.90909 +1 +1.2195 +1.1364 +0.81301 +0.96154 +0.49505 +1.0526 +1.1765 +0.5128200000000001 +1.1765 +1.1364 +0.9901 +0.96154 +1.0204 +1.0309 +0.93458 +0.90909 +1.0638 +0.64516 +0.96154 +1.0638 +1.2658 +1.1765 +0.72464 +0.96154 +1.0638 +0.84034 +0.5376300000000001 +0.90909 +0.81301 +0.93458 +0.79365 +1.1765 +1.0526 +1.1364 +0.44643 +0.90909 +0.81301 +1.0989 +0.6756799999999999 +0.75188 +0.93458 +0.93458 +1.1364 +1.0204 +0.93458 +1.0526 +1.0989 +0.9901 +0.90909 +0.93458 +1.0638 +0.70423 +1.0989 +1.0989 +1.0309 +1.0638 +0.41152 +1.1765 +1.1364 +1.2195 +1.0309 +1.1364 +0.93458 +1.1364 +0.87719 +1.0989 +1.1364 +0.90909 +0.96154 +1.1364 +0.86207 +1.1364 +1.1364 +0.79365 +1.1765 +0.90909 +0.3268 +0.88496 +1.1364 +1.0638 +0.90909 +0.97087 +1.1364 +0.93458 +0.81301 +0.9009 +1.1364 +1.0989 +1026 +1 +262153 +5 +names +16 +1 +262153 +9 +Responses +1026 +1 +262153 +9 +row.names +13 +2 +NA +-244 +1026 +1 +262153 +5 +class +16 +1 +262153 +10 +data.frame +254 +254 diff --git a/data/matching.RData b/data/matching.RData new file mode 100644 index 0000000..8e51c78 --- /dev/null +++ b/data/matching.RData @@ -0,0 +1,645 @@ +RDA2 +A +2 +197125 +131840 +1026 +1 +262153 +8 +matching +787 +1 +14 +600 +0.0788 +0.051017 +0.37073 +0.42917 +0.47678 +2.1334 +0.5579 +0.5028 +1.3541 +0.34535 +0.32993 +0.35822 +0.7315 +0.4154 +0.01765 +1.2423 +1.06 +0.45813 +1.2054 +0.49048 +1.4537 +0.1385 +0.5272 +0.73768 +0.18927 +0.14382 +0.2161 +0.37328 +0.12078 +0.27873 +0.56677 +0.46087 +0.017667 +0.31073 +1.6018 +0.41348 +0.4452 +0.33488 +0.87758 +0.27367 +0.17205 +0.597 +0.42103 +0.92788 +0.17488 +0.12673 +0.44363 +0.4189 +0.51975 +0.18942 +0.17028 +0.29557 +0.97888 +0.24385 +0.33065 +0.6085 +0.2796 +0.44432 +0.017667 +0.23007 +0.18365 +0.25505 +0.96672 +0.48632 +0.1662 +0.74417 +0.38182 +0.8874300000000001 +0.78233 +1.6411 +0.18395 +0.16923 +0.16783 +0.12155 +0.14943 +0.017667 +0.12835 +0.25307 +0.27892 +0.017667 +0.15953 +0.29155 +0.034367 +0.45603 +0.017667 +0.18378 +0.034367 +0.1551 +0.16798 +0.44937 +0.13038 +0.034367 +0.14938 +0.28647 +0.18192 +0.12172 +0.051067 +0.19393 +0.49893 +0.14222 +0.017667 +0.17258 +0.12108 +0.14265 +0.1526 +0.034367 +0.13963 +0.051067 +0.053017 +0.13383 +0.25145 +0.36222 +0.051067 +0.39213 +0.21983 +0.18648 +0.1692 +0.12682 +0.034367 +0.034367 +0.30683 +0.15882 +0.098067 +0.50693 +0.19028 +0.034367 +0.017667 +0.30215 +0.17627 +0.28202 +0.06776699999999999 +0.19035 +0.0177 +0.21808 +0.11263 +0.26885 +0.33493 +0.10843 +0.051083 +0.13402 +0.14502 +0.15125 +0.017667 +0.18347 +0.051067 +0.051067 +0.11795 +0.034367 +0.12955 +0.13452 +0.017667 +0.40465 +0.017667 +0.33297 +0.034367 +0.16797 +0.10008 +0.017667 +0.051067 +0.11505 +0.13457 +0.05105 +0.35195 +0.034367 +0.06775 +0.017667 +0.25582 +0.017667 +0.05395 +0.051067 +0.12 +0.017667 +0.14483 +0.051067 +0.12725 +0.15442 +0.1342 +0.119 +0.11797 +0.14538 +0.017667 +0.14092 +0.12997 +0.034367 +0.017667 +0.14537 +0.11917 +0.034367 +0.1341 +0.034367 +0.25385 +0.06776699999999999 +0.14457 +0.16043 +0.45312 +0.11753 +0.14803 +0.06775 +0.040183 +0.47038 +0.35903 +0.16645 +0.26848 +0.034367 +0.13318 +0.3091 +0.017667 +0.051083 +0.23967 +0.28482 +0.14888 +0.017667 +0.17242 +0.2862 +0.06776699999999999 +0.13712 +0.28517 +0.051067 +0.16267 +0.18648 +0.034383 +0.14973 +0.017667 +0.07275 +0.12455 +0.37018 +0.16203 +0.15847 +0.034383 +0.17828 +0.034367 +0.26128 +0.215 +0.2973 +0.15753 +0.051067 +0.08445 +0.15488 +0.017667 +0.37782 +0.017667 +0.06776699999999999 +0.09611699999999999 +0.1557 +0.017667 +0.13163 +0.017667 +0.0844 +0.23478 +0.18433 +0.017667 +0.06776699999999999 +0.034367 +0.5147699999999999 +0.16122 +0.10902 +0.06876699999999999 +0.122 +0.24025 +0.034383 +0.29078 +0.14478 +0.14342 +0.31772 +0.3857 +0.29335 +0.28135 +0.26372 +0.15337 +0.06776699999999999 +0.16797 +0.1502 +0.06776699999999999 +0.14165 +0.055767 +0.1353 +0.15382 +0.017667 +0.13387 +0.096167 +0.13307 +0.1516 +0.017667 +0.43077 +0.084467 +0.27583 +0.16267 +0.084483 +0.15125 +0.060817 +0.25545 +0.16797 +0.017667 +0.1679 +0.051067 +0.27965 +0.15267 +0.44195 +0.1266 +0.017667 +0.40547 +0.19452 +0.15653 +0.017667 +0.081667 +0.15432 +0.084467 +0.036667 +0.17915 +0.27607 +0.051067 +0.21332 +0.06776699999999999 +0.29132 +0.26688 +0.084483 +0.1395 +0.072867 +0.11857 +0.23533 +0.6426500000000001 +0.13457 +0.68058 +0.13458 +0.138 +0.034367 +0.15125 +0.1716 +0.14102 +0.27968 +0.20618 +0.24672 +0.30503 +0.16822 +0.28753 +0.1647 +0.15127 +0.18505 +0.17092 +0.1756 +0.084483 +0.15515 +0.17482 +0.3889 +0.30798 +0.20002 +0.19795 +0.15875 +0.034367 +0.2046 +0.15702 +0.44548 +0.15792 +0.68333 +0.54945 +0.067783 +0.14562 +0.06776699999999999 +0.09420000000000001 +0.30142 +0.017667 +0.1738 +0.17032 +0.14635 +0.15717 +0.36837 +0.06776699999999999 +0.20088 +0.3222 +0.16857 +0.067783 +0.0598 +0.18845 +0.14317 +0.051067 +0.38142 +0.20192 +0.21795 +0.15092 +0.23363 +0.051067 +0.19435 +0.15902 +0.20903 +0.2105 +0.1947 +0.051083 +0.41112 +0.034367 +0.37297 +0.31538 +0.051067 +0.1684 +0.034367 +0.084467 +0.33255 +0.16475 +0.017667 +0.53282 +0.017667 +0.017667 +0.18763 +0.034367 +0.1723 +0.017667 +0.080317 +0.017667 +0.12543 +0.017667 +0.097067 +0.034383 +0.26815 +0.20825 +0.21052 +0.13935 +0.2663 +0.13462 +0.17542 +0.3302 +0.034367 +0.06776699999999999 +0.16287 +0.10395 +0.24228 +0.13457 +0.034367 +0.30997 +0.06776699999999999 +0.15127 +0.1002 +0.16795 +0.0177 +0.05105 +0.1345 +0.65932 +0.017667 +0.17522 +0.16977 +0.3434 +0.06776699999999999 +0.16598 +0.29565 +0.051067 +0.04235 +0.19057 +0.17708 +0.44843 +0.017667 +0.16598 +0.095433 +0.22637 +0.27648 +0.10283 +0.13455 +0.2474 +0.034367 +0.20252 +0.10188 +0.017667 +0.084467 +0.14827 +0.017667 +0.1681 +0.57025 +0.017667 +0.22048 +0.051067 +0.23332 +0.3132 +0.16905 +0.16183 +0.17303 +0.47957 +0.25933 +0.034367 +0.14027 +0.034383 +0.049217 +0.034367 +0.034367 +0.27965 +0.21803 +0.09735000000000001 +0.13673 +0.21278 +0.3987 +0.034367 +0.26743 +0.051067 +0.18727 +0.017667 +0.1785 +0.11732 +0.10143 +0.017667 +0.0435 +0.20048 +0.27777 +0.18467 +0.1763 +0.15022 +0.034367 +0.048983 +0.22548 +0.14278 +0.08674999999999999 +0.20805 +0.13385 +0.32178 +0.0566 +0.034367 +0.17345 +0.10123 +0.13363 +0.034383 +0.15213 +0.113 +0.21637 +0.051067 +0.034367 +0.1207 +0.034367 +0.017667 +0.017667 +0.15805 +0.06776699999999999 +0.017667 +0.12453 +0.31827 +0.40762 +0.034383 +0.31237 +0.034367 +0.064383 +0.38582 +0.017667 +0.15932 +0.034367 +0.2384 +0.23477 +0.051067 +0.04275 +0.18468 +0.067783 +0.18468 +0.0511 +0.14013 +0.1402 +0.14685 +0.086717 +0.18468 +0.093517 +0.17315 +0.15238 +0.40175 +0.15667 +0.017667 +0.25355 +0.3382 +0.05105 +0.017667 +1.0375 +0.1921 +0.18757 +0.18647 +0.017667 +0.13455 +0.4457 +0.16795 +0.11762 +0.22143 +0.17482 +0.20623 +0.084467 +0.051067 +0.1448 +0.017667 +0.2112 +0.1899 +0.23785 +0.017667 +0.1771 +0.084567 +0.18417 +0.017667 +0.048933 +0.13982 +0.051067 +0.38503 +0.06776699999999999 +0.034367 +0.21317 +0.051067 +0.16883 +0.034367 +0.17357 +0.58868 +0.017667 +0.0641 +0.017667 +1026 +1 +262153 +5 +names +16 +1 +262153 +9 +Responses +1026 +1 +262153 +9 +row.names +13 +2 +NA +-600 +1026 +1 +262153 +5 +class +16 +1 +262153 +10 +data.frame +254 +254 diff --git a/data/watermaze.RData b/data/watermaze.RData new file mode 100644 index 0000000..97a3fbf --- /dev/null +++ b/data/watermaze.RData @@ -0,0 +1,78 @@ +RDA2 +A +2 +197125 +131840 +1026 +1 +262153 +9 +watermaze +787 +1 +14 +33 +0.04083 +0.11581 +0.12349 +0.39963 +0.068338 +0.092764 +0.10148 +0.93244 +0.020988 +0.42531 +0.24039 +0.11025 +0.065429 +0.045212 +0.18832 +0.46497 +0.071594 +0.29189 +0.23923 +0.76896 +0.20733 +0.27389 +0.079821 +0.53286 +0.18305 +0.29511 +0.156 +0.42802 +0.70889 +0.27772 +0.27741 +0.86353 +0.39592 +1026 +1 +262153 +5 +names +16 +1 +262153 +9 +Responses +1026 +1 +262153 +9 +row.names +13 +2 +NA +-33 +1026 +1 +262153 +5 +class +16 +1 +262153 +10 +data.frame +254 +254 diff --git a/man/KS.Rd b/man/KS.Rd new file mode 100644 index 0000000..b033ac8 --- /dev/null +++ b/man/KS.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/logits.R +\name{KS} +\alias{KS} +\title{Uses Komolgorov-Smirnov test to find first significant change point} +\usage{ +KS(Data, R, Crit) +} +\arguments{ +\item{Data}{A vector of trial by trial measures or successive intervals} + +\item{R}{A vector of putative change points} + +\item{Crit}{Decision criterion, the value the logit must exceed +for the function to return a significant change point} +} +\value{ +r1 the change point row when the decision criterion is exceeded +} +\description{ +Uses Komolgorov-Smirnov test to find first significant change point +} +\details{ +Not normally called directly, but via the cp_wrapper function instead. +} + diff --git a/man/chi2logit.Rd b/man/chi2logit.Rd index febd2c6..2b3b51f 100644 --- a/man/chi2logit.Rd +++ b/man/chi2logit.Rd @@ -1,4 +1,4 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/logits.R \name{chi2logit} \alias{chi2logit} diff --git a/man/cp_wrapper.Rd b/man/cp_wrapper.Rd index 7543912..66c1572 100644 --- a/man/cp_wrapper.Rd +++ b/man/cp_wrapper.Rd @@ -1,15 +1,24 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/cp_wrapper.R \name{cp_wrapper} \alias{cp_wrapper} \title{Find change points in a sequence of choices based on given test and decision criterion} \usage{ -cp_wrapper(input, test, Crit) +cp_wrapper(input, isDiscrete, test, Crit) } \arguments{ \item{input}{A vector of correct or incorrect decisions, coded as 1s and 0s} -\item{test}{Name of the test to be performed. Currently the following tests are implemented: "binomial", "chisquare".} +\item{isDiscrete}{A boolean parameter, true if the data to be analyzed are discrete, +false if continuous, e.g. succesive intervals} + +\item{test}{Name of the test to be performed. The following tests are implemented: +"binomial" (random rate), "chisquare", "ttest", "KS" (Komolgorov-Smirnov). The binomial test is +used for finding changes in the rate parameter of a random rate process, either intermittently +(isDiscrete = TRUE) or continuously (isDiscrete = FALSE) sampled. The chi square test is used with +data where there has been a frequency change, as in, e.g. correct choices. The t test should be +used for normally distributed data. The Komolgorov-Smirnof test is used for data with nonnormal or +unknown distribution.} \item{Crit}{A real-valued decision criterion on logit. Values recommended by Gallistel et al. (2004) are between 1.3 and 6, which correspond to p values of 0.05 and 0.000001, respectively. @@ -18,8 +27,9 @@ logit = log[(1-p)/p], where p is the desired significance level} } \value{ A data frame with the number of Trials (Trial) for each change point detected, -the cumulative number of correct responses, or successes, (CumSs), and the ratio of correct/total choices (Slopes) -for the trials since the last change point and the current change point. +the cumulative number of correct responses, or successes, (CumSs), +and the ratio of correct/total choices (Slopes) for the trials since the last change point +and the current change point } \description{ Find change points in a sequence of choices based on given test and decision criterion @@ -27,23 +37,23 @@ Find change points in a sequence of choices based on given test and decision cri \examples{ # generate dummy data with a change point at trial 120 input <- c(rbinom(120,1,0.5),rbinom(200,1,0.8)) -cp_wrapper(input, "chisquare", 3) -cp_wrapper(input, "binomial", 3) +cp_wrapper(input, TRUE, "chisquare", 3) +cp_wrapper(input, TRUE, "binomial", 3) # use included eyeblink data set: eyeblink[,] # inspect data set -cp_wrapper(eyeblink, "chisquare", 4) +cp_wrapper(eyeblink, TRUE, "chisquare", 4) # using small criterion, e.g. 2, fails due to computational problems # better use "binomial" instead -cp_wrapper(eyeblink, "binomial", 2) +cp_wrapper(eyeblink, TRUE, "binomial", 2) # use included plusmaze data set: plusmaze[,] # inspect data set -(cp.1 <- cp_wrapper(plusmaze, "binomial", 1.3)) +(cp.1 <- cp_wrapper(plusmaze, TRUE, "binomial", 1.3)) # decrease sensitivity and detect different change points -(cp.2 <- cp_wrapper(plusmaze, "binomial", 2)) +(cp.2 <- cp_wrapper(plusmaze, TRUE, "binomial", 2)) # the chisquare test detects more change points even with higher criterion -(cp.3 <- cp_wrapper(plusmaze, "chisquare", 2)) +(cp.3 <- cp_wrapper(plusmaze, TRUE, "chisquare", 2)) # plotting data with ggplot2 library(ggplot2) @@ -56,8 +66,13 @@ ggplot(my.data) + geom_line(aes(Trial,CumRespMeasure)) + geom_point(data=cp.2, aes(Trial, CumSs), shape=2, size = 3, color = "green") + geom_point(data=cp.3, aes(Trial, CumSs), shape=3, size = 3, color = "red") -# plot average response rate per trial, with dplyr::lead -ggplot() + geom_step(data=cp.1, aes(Trial,dplyr::lead(Slopes))) + - ylab("Average Response Rate per Trial") # ignore Warning message +# plot average response rate per trial +ggplot() + geom_step(data=cp.1, aes(Trial,Slopes)) + + ylab("Average Response Rate per Trial") + +} +\references{ +Gallistel CR, Fairhurst S, Balsam P (2004) The learning curve: +Implications of a quantitative analysis. PNAS 101:13124-13131. doi: 10.1073/pnas.0404965101 } diff --git a/man/cpc.Rd b/man/cpc.Rd new file mode 100644 index 0000000..35d1e99 --- /dev/null +++ b/man/cpc.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/cpfinders.R +\name{cpc} +\alias{cpc} +\title{Find putative change point in continuous-time cumulative records} +\usage{ +cpc(Cum) +} +\arguments{ +\item{Cum}{Input vector of the cumulative interevent intervals} +} +\value{ +R A vector with the same length as Cum, with putative change points for each +event. The putative change point corresponding to the Nth +event is the preceding event at which the deviation of the observed event count +from the expected event count is maximal. The expected event count +at any earlier event, n, is Cum[n], the interval up to the nth event, +divided by the average interevent interval over the range from n = 0 to n = N +The deviation from expectation is n - this expectation. R is the value of n at +which this deviation is maximal +} +\description{ +Find putative change point in continuous-time cumulative records +} +\details{ +Not normally called directly, but via the cp_wrapper function instead +} + diff --git a/man/cpd.Rd b/man/cpd.Rd index e4f9dd5..48ca77b 100644 --- a/man/cpd.Rd +++ b/man/cpd.Rd @@ -1,4 +1,4 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/cpfinders.R \name{cpd} \alias{cpd} @@ -12,7 +12,7 @@ cpd(Cum) \value{ R A vector with the same length as Cum, with putative change points for each trial. These correspond to the preceding trial at which the deviation of the -observed count from the expected count is maximal. +observed count from the expected count is maximal } \description{ Find putative change point in discrete-time cumulative records diff --git a/man/cpdetectorr.Rd b/man/cpdetectorr.Rd index ea6e33b..4bfd1ec 100644 --- a/man/cpdetectorr.Rd +++ b/man/cpdetectorr.Rd @@ -1,12 +1,13 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/cpdetectorr.R \docType{package} \name{cpdetectorr} \alias{cpdetectorr} \alias{cpdetectorr-package} -\title{cpdetector: Change point estimation in learning curves.} +\title{cpdetector: Change point estimation in learning curves} \description{ -The code is adapted from Gallistel et al. (2004). -The package consists of a few internal functions and one wrapper function, cp_wrapper. +The code is from Gallistel et al. (2004), translated from Matlab to R, with large portions of +comments and original code preserved. The package consists of a few internal functions and one +wrapper function, cp_wrapper. } diff --git a/man/cpt.Rd b/man/cpt.Rd new file mode 100644 index 0000000..2fbce36 --- /dev/null +++ b/man/cpt.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/logits.R +\name{cpt} +\alias{cpt} +\title{Uses t test to find first significant change point} +\usage{ +cpt(Data, R, Crit) +} +\arguments{ +\item{Data}{A vector of trial by trial measures or successive intervals} + +\item{R}{A vector of putative change points} + +\item{Crit}{Decision criterion, the value the logit must exceed +for the function to return a significant change point} +} +\value{ +CP The first significant change point +} +\description{ +Uses t test to find first significant change point +} +\details{ +This test is appropriate if one is looking for a change in the expectation of a + renewal event-generating process, where the interevent intervals are normally (rather than + exponentially) distributed.Not normally called directly, but via the cp_wrapper function instead. +} + diff --git a/man/eyeblink.Rd b/man/eyeblink.Rd index 65edd44..9fe1fae 100644 --- a/man/eyeblink.Rd +++ b/man/eyeblink.Rd @@ -1,12 +1,10 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/cpdetectorr.R \docType{data} \name{eyeblink} \alias{eyeblink} -\title{Data on rabbit eyeblink conditioning.} -\format{\preformatted{'data.frame': 500 obs. of 1 variable: - $ Responses: int 0 0 0 0 0 0 0 0 0 0 ... -}} +\title{Data on rabbit eyeblink conditioning} +\format{An object of class \code{data.frame} with 500 rows and 1 columns.} \source{ \url{http://www.pnas.org/content/suppl/2004/08/31/0404965101.DC1/04965DataSet5.txt/} } diff --git a/man/feedingpref.Rd b/man/feedingpref.Rd new file mode 100644 index 0000000..5663d1f --- /dev/null +++ b/man/feedingpref.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/cpdetectorr.R +\docType{data} +\name{feedingpref} +\alias{feedingpref} +\title{Data on feeding-by-feeding preference scores in a mouse matching experiment} +\format{An object of class \code{data.frame} with 641 rows and 1 columns.} +\source{ +\url{http://www.pnas.org/content/suppl/2004/08/31/0404965101.DC1/04965DataSet4.txt/} +} +\usage{ +feedingpref +} +\description{ +Data from Gallistel et al. (2004). Original data description: "The side-preference score during +any one interfeeding interval is the difference between the amounts of time spent at each +feeding hopper divided by their sum. These are discrete-trial, real-valued measures [...] +They do not obey any standard distribution, so the Kolmogorov-Smirnov test is appropriate +for comparing the distributions before and after a putative change point." +} +\keyword{datasets} + diff --git a/man/hopperentry.Rd b/man/hopperentry.Rd new file mode 100644 index 0000000..3d985fe --- /dev/null +++ b/man/hopperentry.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/cpdetectorr.R +\docType{data} +\name{hopperentry} +\alias{hopperentry} +\title{Data on successive hopper-entry speeds} +\format{An object of class \code{data.frame} with 244 rows and 1 columns.} +\source{ +\url{http://www.pnas.org/content/suppl/2004/08/31/0404965101.DC1/04965DataSet2.txt/} +} +\usage{ +hopperentry +} +\description{ +Data from Gallistel et al. (2004). Original data description: "A hopper entry speed is the +reciprocal of the latency between the rise of the grain bin into the feeding hopper and the +entry of the pigeon's head into the hopper. These data are an example of a discrete-time +data record. [...] The entry speeds are approximately normally distributed [... t]hus, the the t-test +is appropriate for testing for a change in the mean entry latency." +} +\keyword{datasets} + diff --git a/man/matching.Rd b/man/matching.Rd new file mode 100644 index 0000000..1f11423 --- /dev/null +++ b/man/matching.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/cpdetectorr.R +\docType{data} +\name{matching} +\alias{matching} +\title{Data on interreward intervals in a matching experiment with concurrent variable +interval schedules} +\format{An object of class \code{data.frame} with 600 rows and 1 columns.} +\source{ +\url{http://www.pnas.org/content/suppl/2004/08/31/0404965101.DC1/04965DataSet1.txt/} +} +\usage{ +matching +} +\description{ +Data from Gallistel et al. (2004). Original data description: "These are an example of a +continuous-time data record: the successive entries are the durations of the successive +interreward intervals. Thus, the putative change points must be found by [setting isDiscrete = FALSE]. +The interevent intervals are approximately exponentially distributed [...]. Thus, the process +approximates a random rate process and the random rate logit method is appropriate [...]." +} +\keyword{datasets} + diff --git a/man/plusmaze.Rd b/man/plusmaze.Rd index da4895d..44a9df5 100644 --- a/man/plusmaze.Rd +++ b/man/plusmaze.Rd @@ -1,12 +1,10 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/cpdetectorr.R \docType{data} \name{plusmaze} \alias{plusmaze} -\title{Data on correct choices in a + maze.} -\format{\preformatted{'data.frame': 200 obs. of 1 variable: - $ Responses: int 0 1 0 0 1 0 0 1 1 0 ... -}} +\title{Data on correct choices in a + maze} +\format{An object of class \code{data.frame} with 200 rows and 1 columns.} \source{ \url{http://www.pnas.org/content/suppl/2004/08/31/0404965101.DC1/04965DataSet3.txt/} } diff --git a/man/rrc.Rd b/man/rrc.Rd new file mode 100644 index 0000000..b8cf138 --- /dev/null +++ b/man/rrc.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/logits.R +\name{rrc} +\alias{rrc} +\title{Compute the pseudologit vector for continuous random rate case} +\usage{ +rrc(Cum, R) +} +\arguments{ +\item{Cum}{A cumulative interevent interval vector} + +\item{R}{A vector with trial numbers of putative change points} +} +\value{ +L A vector giving for each trial the pseudologit, approximately +the log of the odds that there has been a change point +} +\description{ +Compute the pseudologit vector for continuous random rate case +} +\details{ +For use when finding changes in the rate parameter of a random rate process. +Not normally called directly, but via the cp_wrapper function instead +} + diff --git a/man/rrd.Rd b/man/rrd.Rd index b31b916..240ce35 100644 --- a/man/rrd.Rd +++ b/man/rrd.Rd @@ -1,4 +1,4 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/logits.R \name{rrd} \alias{rrd} diff --git a/man/trun.Rd b/man/trun.Rd index ae1a9b1..b8f3eb5 100644 --- a/man/trun.Rd +++ b/man/trun.Rd @@ -1,4 +1,4 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/cpfinders.R \name{trun} \alias{trun} diff --git a/man/watermaze.Rd b/man/watermaze.Rd new file mode 100644 index 0000000..812c15b --- /dev/null +++ b/man/watermaze.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/cpdetectorr.R +\docType{data} +\name{watermaze} +\alias{watermaze} +\title{Data on swim efficiencies in a rat learning a water maze} +\format{An object of class \code{data.frame} with 33 rows and 1 columns.} +\source{ +\url{http://www.pnas.org/content/suppl/2004/08/31/0404965101.DC1/04965DataSet6.txt/} +} +\usage{ +watermaze +} +\description{ +Data from Gallistel et al. (2004). Original data description: "The swim efficiency is the +straight-line distance between where the rat is placed in the tank and the location of the +platform divided by the distance actually swum in reaching the platform. These are again +discrete-trial data. The measures can fall anywhere in the interval from 0 to 1. They do +not appear to be normally distributed, so one might want to use the K-S statistic. However, +there are only 32 trials (data) and the K-S test requires a minimum of 4 data in each sample +(before and after a putative change point), so one might also want to try the t test on +these data." +} +\keyword{datasets} +