Displaying 1 result from an estimated 1 matches for "myhubers".
Did you mean:
hubers
2007 Jan 19
1
Suggestion on how to improve efficiency when using MASS:::hubers on high-dimensional arrays
...> 200000
Thank you very much for any suggestion.
benilton
## begin toy example
set.seed(1)
N <- 100
S <- 5
D <- 2
outcome <- array(rnorm(N*S*D), dim=c(N, S, D))
classes <- matrix(sample(c(1:3, NA), N*S, rep=T), ncol=S)
results <- array(NA, dim=c(N, D, 3, 2))
library(MASS)
myHubers <- function(x)
if (length(x)>1) as.numeric(hubers(x)) else c(NA, NA)
for (n in 1:N)
for (d in 1:D){
tmp <- outcome[n,,d]
grp <- classes[n,]
results[n, d,,] <- t(sapply(split(tmp, factor(grp, levels=1:3)),
myHubers))
}
## end
--
Benilton Carvalho
PhD Candi...