Description Usage Arguments Value Details Examples
Unnormalized log-posterior of a model.
1 | logp.u(model, X, y, lam, w)
|
model |
An integer vector containing the model |
X |
An n x p matrix. Sparse matrices are supported and every care is taken not to make copies of this (typically) giant matrix. No need to center or scale. |
y |
The response vector of length |
lam |
The slab precision parameter. |
w |
The prior inclusion probability of each variable. |
The unnormalized probability of the model (see detail).
The unnormalized posterior probability of the model model
is given by
0.5p_{0}\log(lam) - 0.5*\log\det(A) - 0.5*(n-1)*\log(RSS) + p_{0}*\log(w/(1-w))
where
p_{0} = length(model)
, the model size,
Xs = scale(X[,model])
,
A = crossprod(Xs) + lam I
,
ys = scale(y)
, so that sum(ys^2) = n-1
and
RSS = n-1 - ys^{T}Xs A^{-1}Xs^{T}ys
,
Obviously the computations are not as bruteforce as in pseudocode above.
1 2 3 4 5 6 7 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.