Description Usage Arguments Details Value Author(s) References See Also Examples
Update hyperparameters Update shape (alpha) and scale (beta) parameters of the inverse gamma distribution.
1 | hyperparameter.update(dat, alpha, beta, th = 0.01)
|
dat |
A probes x samples matrix (probeset). |
alpha |
Shape parameter of inverse gamma density for the probe variances. |
beta |
Scale parameter of inverse gamma density for the probe variances. |
th |
Convergence threshold. |
Shape update: alpha <- alpha + T/2; Scale update: beta <- alpha * s2 where s2 is the updated variance for each probe (the mode of variances is given by beta/alpha). The variances (s2) are updated by EM type algorithm, see s2.update.
A list with elements alpha, beta (corresponding to the shape and scale parameters of inverse gamma distribution, respectively).
Leo Lahti leo.lahti@iki.fi
See citation("RPA")
s2.update, rpa.online
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #
## Generate and fit toydata, learn hyperparameters
#set.seed(11122)
#P <- 11 # number of probes
#N <- 5000 # number of arrays
#real <- sample.probeset(P = P, n = N, shape = 3, scale = 1, mu.real = 4)
#dat <- real$dat # probes x samples#
#
## Set priors
#alpha <- 1e-2
#beta <- rep(1e-2, P)
## Operate in batches
#step <- 1000
#for (ni in seq(1, N, step)) {
# batch <- ni:(ni+step-1)
# hp <- hyperparameter.update(dat[,batch], alpha, beta, th = 1e-2)
# alpha <- hp$alpha
# beta <- hp$beta
#}
## Final variance estimate
#s2 <- beta/alpha
#
## Compare real and estimated variances
#plot(sqrt(real$tau2), sqrt(s2), main = cor(sqrt(real$tau2), sqrt(s2))); abline(0,1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.