Closed capezza closed 1 year ago
https://github.com/eenticott/gamstackr/blob/0b4e4d35a64624fe3b957c8fbf216f8f984e0b61/R/conversions.R#L5-L6
Maybe it is more stable to do:
nu <- matrix(unlist(list_of_eta), ncol = length(list_of_eta)) nu1 <- cbind(0, nu) # nuCen <- nu1 - matrixStats::rowMaxs(nu1) nuCen <- nu1 - apply(nu1, 1, max) exp_nuCen <- exp(nuCen) a <- exp_nuCen / rowSums(exp_nuCen) return(a)
Thanks, I have implemented this!
https://github.com/eenticott/gamstackr/blob/0b4e4d35a64624fe3b957c8fbf216f8f984e0b61/R/conversions.R#L5-L6
Maybe it is more stable to do: