R/auxiliary_p_i_j_k_function.R

Defines functions p_i_j_k_function

p_i_j_k_function <- function(series, i_cat, j_cat, k = 1) {

series_length <- length(series$Value) # Series length
a <- series$Value[(k + 1) : series_length]
b <- series$Value[1 : (series_length - k)]


number <- series_length - k
count <- numeric(number)

for (i in 1 : number) {

  if (a[i] == i_cat & b[i] == j_cat) {

    count[i] <- 1

  } else {

    count[i] <- 0

  }

}


return(sum(count)/(series_length-k))

}

Try the ctsfeatures package in your browser

Any scripts or data that you put into this service are public.

ctsfeatures documentation built on May 29, 2024, 11:37 a.m.