Skip to content

Commit

Permalink
fixes from R CMD Check
Browse files Browse the repository at this point in the history
  • Loading branch information
jdtuck committed Nov 18, 2023
1 parent 3036e95 commit 148213b
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 57 deletions.
4 changes: 2 additions & 2 deletions R/BBridge.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ BBridge <- function(x=0, y=0, t0=0, T=1, N=100){
if(T<= t0) stop("wrong times")
dt <- (T-t0)/N
t <- seq(t0, T, length=N+1)
X <- c(0,cumsum( rnorm(N)*sqrt(dt)))
X <- c(0,cumsum(stats::rnorm(N)*sqrt(dt)))
BB <- x + X - (t-t0)/(T-t0)*(X[N+1]-y+x)
X <- ts(BB, start=t0,deltat=dt)
X <- stats::ts(BB, start=t0,deltat=dt)
return(invisible(X))
}
9 changes: 1 addition & 8 deletions R/LongRunCovMatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
#' @param kern_type Kernel function to be used for the estimation of the long run covariance
#' matrix. The choices are \code{c("BT", "PR", "SP", "FT")} which are respectively, bartlett, parzen, simple and flat-top kernels.
#' By default the function uses a \code{"barlett"} kernel.
#' @param ... Further arguments to pass
#'
#' @return
#'\item{\code{}}{
#' Estimated long run covariance matrix.
#'}
#'

#' @return Returns long run covariance matrix

# this is for the computation of Long Run Variance of \Theta
LongRunCovMatrix <- function(mdobj, h=0, kern_type = "bartlett"){
Expand Down
84 changes: 42 additions & 42 deletions R/elastic_changepoint.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,29 +98,29 @@ elastic_amp_change_ff <- function(f, time, d = 1000, h = 0, smooth_data=FALSE, s

# Plot
if (showplot == TRUE) {
par(mfrow = c(1, 3))
matplot(f, type = "l", col = "grey", main = "Functional Data", ylab = "values")
graphics::par(mfrow = c(1, 3))
graphics::matplot(f, type = "l", col = "grey", main = "Functional Data", ylab = "values")
for (i in 1:ncol(dat.a)) {
lines(dat.a[, i], col = "pink")
graphics::lines(dat.a[, i], col = "pink")
}
for (i in 1:ncol(dat.b)) {
lines(dat.b[, i], col = "lightblue")
graphics::lines(dat.b[, i], col = "lightblue")
}
lines(mean.b, col = "blue")
lines(mean.a, col = "red")
legend("topleft", c("before", "after"), col = c("blue", "red"), lty = c(1, 1), cex = 0.5)
plot(delta, type = "l", main = "Estimated Change Function", ylab = "values")
graphics::lines(mean.b, col = "blue")
graphics::lines(mean.a, col = "red")
graphics::legend("topleft", c("before", "after"), col = c("blue", "red"), lty = c(1, 1), cex = 0.5)
graphics::plot(delta, type = "l", main = "Estimated Change Function", ylab = "values")

matplot(out$warping_functions, type = "l", col = "grey", main = "Warping Functions", ylab = "values")
graphics::matplot(out$warping_functions, type = "l", col = "grey", main = "Warping Functions", ylab = "values")
for (i in 1:ncol(warp.b)) {
lines(warp.b[, i], col = "pink")
graphics::lines(warp.b[, i], col = "pink")
}
for (i in 1:ncol(warp.a)) {
lines(warp.a[, i], col = "lightblue")
graphics::lines(warp.a[, i], col = "lightblue")
}
lines(warp_mean_a, col = "blue")
lines(warp_mean_b, col = "red")
legend("topleft", c("before", "after"), col = c("blue", "red"), lty = c(1, 1), cex = 0.5)
graphics::lines(warp_mean_a, col = "blue")
graphics::lines(warp_mean_b, col = "red")
graphics::legend("topleft", c("before", "after"), col = c("blue", "red"), lty = c(1, 1), cex = 0.5)
}

out <- list(
Expand Down Expand Up @@ -239,29 +239,29 @@ elastic_ph_change_ff <- function(f, time, d = 1000, h = 0, smooth_data=FALSE, sp
# Plot
delta <- mean.a - mean.b
if (showplot == TRUE) {
par(mfrow = c(1, 3))
matplot(f, type = "l", col = "grey", main = "Functional Data", ylab = "values")
graphics::par(mfrow = c(1, 3))
graphics::matplot(f, type = "l", col = "grey", main = "Functional Data", ylab = "values")
for (i in 1:ncol(dat.a)) {
lines(dat.a[, i], col = "pink")
graphics::lines(dat.a[, i], col = "pink")
}
for (i in 1:ncol(dat.b)) {
lines(dat.b[, i], col = "lightblue")
graphics::lines(dat.b[, i], col = "lightblue")
}
lines(mean.b, col = "blue")
lines(mean.a, col = "red")
legend("topleft", c("before", "after"), col = c("blue", "red"), lty = c(1, 1), cex = 0.5)
plot(delta, type = "l", main = "Estimated Change Function", ylab = "values")
graphics::lines(mean.b, col = "blue")
graphics::lines(mean.a, col = "red")
graphics::legend("topleft", c("before", "after"), col = c("blue", "red"), lty = c(1, 1), cex = 0.5)
graphics::plot(delta, type = "l", main = "Estimated Change Function", ylab = "values")

matplot(out$warping_functions, type = "l", col = "grey", main = "Warping Functions", ylab = "values")
graphics::matplot(out$warping_functions, type = "l", col = "grey", main = "Warping Functions", ylab = "values")
for (i in 1:ncol(warp.b)) {
lines(warp.b[, i], col = "pink")
graphics::lines(warp.b[, i], col = "pink")
}
for (i in 1:ncol(warp.a)) {
lines(warp.a[, i], col = "lightblue")
graphics::lines(warp.a[, i], col = "lightblue")
}
lines(warp_mean_a, col = "blue")
lines(warp_mean_b, col = "red")
legend("topleft", c("before", "after"), col = c("blue", "red"), lty = c(1, 1), cex = 0.5)
graphics::lines(warp_mean_a, col = "blue")
graphics::lines(warp_mean_b, col = "red")
graphics::legend("topleft", c("before", "after"), col = c("blue", "red"), lty = c(1, 1), cex = 0.5)
}

out <- list(
Expand Down Expand Up @@ -377,30 +377,30 @@ elastic_change_fpca <- function(f, time, pca.method = "combined", pc = 0.95, d =
# Plot
delta <- mean.a - mean.b
if (showplot == TRUE) {
par(mfrow = c(1, 3))
matplot(f, type = "l", col = "grey", main = "Functional Data", ylab = "values")
graphics::par(mfrow = c(1, 3))
graphics::matplot(f, type = "l", col = "grey", main = "Functional Data", ylab = "values")
for (i in 1:ncol(dat.b)) {
lines(dat.b[, i], col = "pink")
graphics::lines(dat.b[, i], col = "pink")
}
for (i in 1:ncol(dat.a)) {
lines(dat.a[, i], col = "lightblue")
graphics::lines(dat.a[, i], col = "lightblue")
}
lines(mean.a, col = "blue")
lines(mean.b, col = "red")
legend("topleft", c("before", "after"), col = c("blue", "red"), lty = c(1, 1), cex = 0.5)
graphics::lines(mean.a, col = "blue")
graphics::lines(mean.b, col = "red")
graphics::legend("topleft", c("before", "after"), col = c("blue", "red"), lty = c(1, 1), cex = 0.5)

plot(delta, type = "l", main = "Estimated Change Function", ylab = "values")
graphics::plot(delta, type = "l", main = "Estimated Change Function", ylab = "values")

matplot(out$warping_functions, type = "l", col = "grey", main = "Warping Functions", ylab = "values")
graphics::matplot(out$warping_functions, type = "l", col = "grey", main = "Warping Functions", ylab = "values")
for (i in 1:ncol(warp.b)) {
lines(warp.b[, i], col = "pink")
graphics::lines(warp.b[, i], col = "pink")
}
for (i in 1:ncol(warp.a)) {
lines(warp.a[, i], col = "lightblue")
graphics::lines(warp.a[, i], col = "lightblue")
}
lines(warp_mean_a, col = "blue")
lines(warp_mean_b, col = "red")
legend("topleft", c("before", "after"), col = c("blue", "red"), lty = c(1, 1), cex = 0.5)
graphics::lines(warp_mean_a, col = "blue")
graphics::lines(warp_mean_b, col = "red")
graphics::legend("topleft", c("before", "after"), col = c("blue", "red"), lty = c(1, 1), cex = 0.5)
}

out <- list(
Expand Down
6 changes: 1 addition & 5 deletions man/LongRunCovMatrix.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 148213b

Please sign in to comment.