powered by
Computes \(W = \lambda P + (1-\lambda)\,LT\) row-wise and renormalizes each row to the unit simplex (suma 1). Expects matrices no negativas con las mismas dimensiones \(T \times K\).
posterior_weighted(P, LT, lambda = 0.7)
Posterior matrix \(W\) (\(T \times K\)), filas suman 1.
Prior matrix (\(T \times K\)); filas no negativas.
Likelihood matrix (\(T \times K\)); filas no negativas.
Mixing weight in \([0,1]\) (default 0.7).
0.7
posterior_multiplicative, posterior_dirichlet, posterior_adaptive
posterior_multiplicative
posterior_dirichlet
posterior_adaptive
T <- 5; K <- 3 P <- matrix(runif(T*K), T); P <- P / rowSums(P) LT <- matrix(runif(T*K), T); LT <- LT / rowSums(LT) W <- posterior_weighted(P, LT, 0.6) stopifnot(all(abs(rowSums(W)-1) < 1e-12))
Run the code above in your browser using DataLab