de la Mancha
-
Content Count
3 -
Joined
-
Last visited
Posts posted by de la Mancha
-
-
No problem, I wanted to save time. It's not hard for me R. The program is free. I know the author. Good luck and keep your advice to yourself.
- 1
- 1
-
I try to convert source code in R to Delphi code...
Thank you in advance for your help...
nparACT_IS = function(data_hrs, mean_all, bin_hr){
## ---- IS numerator calculation
result_ISnum <- matrix(NA, nrow = 24)
n <- nrow(data_hrs)
p <- 1440/bin_hr
for (h in 1:24){
s <- ceiling(n/p)
data_hrs3 <- data_hrs
data_hrs3[s*p] <- NA
data_hrs3 <- matrix(data_hrs3)
hrlydat <- data_hrs3[c(seq(h,nrow(data_hrs3),24)),]
hrlymean <- mean(hrlydat, na.rm = T)
x <- (hrlymean-mean_all)^2
result_ISnum[h,] <- x
}
ISnum <- sum(result_ISnum)
ISnumerator <- n*ISnum
## ---- IS denominator calculation
result_ISdenom <- matrix(NA, nrow = n)
for (j in 1:n){
y <- ((data_hrs[j,]-mean_all)^2)
result_ISdenom[j,] <- y
}
ISdenom <- sum(result_ISdenom)
ISdenominator <- p*ISdenom
## -----------------------------
IS <- round(ISnumerator/ISdenominator, digits = 2)
return_IS <- c(IS, ISdenom, n, p)
return(return_IS)
},
Converting code source in R to Delphi
in Algorithms, Data Structures and Class Design
Posted
Thank you for your help. I've written to the author this morning and hope she reply to me. This function compute the Intradaily Variability (IV)