Skip to content

Commit

Permalink
update predict for srvf option
Browse files Browse the repository at this point in the history
  • Loading branch information
jdtuck committed Dec 30, 2024
1 parent 6f8276e commit bbe39cc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions R/jointfPCA.R
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ jointFPCAh <- function(warp_data,
Psi_h = Psi_h,
sz = sz,
eigs = out.Zo$d,
srvf = srvf,
U = U,
Uh = Uh,
Uz = Uz
Expand Down
14 changes: 12 additions & 2 deletions R/predict.jfpcah.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ predict.jfpcah <- function(object, newdata = NULL, ...) {
if (is.null(newdata)) {
newdata = object$warp_data$f0
}

q1 = f_to_srvf(newdata, object$warp_data$time)
M = length(object$warp_data$time)
N = ncol(newdata)
Expand All @@ -34,8 +35,16 @@ predict.jfpcah <- function(object, newdata = NULL, ...) {
qn[, ii] = f_to_srvf(fn[, ii], object$warp_data$time)
}

m_new <- sign(fn[object$id, ]) * sqrt(abs(fn[object$id, ])) # scaled version
qn1 <- rbind(qn, m_new)
if (object$srvf){

m_new <- sign(fn[object$id, ]) * sqrt(abs(fn[object$id, ])) # scaled version
qn1 <- rbind(qn, m_new)

} else {

qn1 <- fn

}

C <- object$C

Expand All @@ -48,5 +57,6 @@ predict.jfpcah <- function(object, newdata = NULL, ...) {

a = Xi %*% object$Uz


return(a)
}

0 comments on commit bbe39cc

Please sign in to comment.