Description Usage Arguments Value Examples
This function takes a fitted NLint object and can return the posterior probability that any given set of variables are jointly interacting with each other.
1 | InteractionProb(NLmod, Xsub)
|
NLmod |
The fitted NLint object |
Xsub |
The exposures for which you want to evaluate whether there is an interaction |
A number indicating the posterior probability that the exposures in Xsub are jointly interacting together. If Xsub is a scalar then the marginal posterior inclusion probability is returned, while if Xsub is a vector of length 2, the two way interaction is returned and so on.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | n = 200
p = 10
pc = 1
sigma = matrix(0.3, p, p)
diag(sigma) = 1
X = rmvnorm(n, mean=rep(0,p), sigma = sigma)
C = matrix(rnorm(n*pc), nrow=n)
TrueH = function(X) {
return(0.5*(X[,2]*X[,3]) - 0.6*(X[,4]^2 * X[,5]))
}
Y = 5 + C + TrueH(X) + rnorm(n)
NLmod = NLint(Y=Y, X=X, C=C)
## Find 2 way interaction probability between exposure 4 and 5
InteractionProb(NLmod=NLmod, Xsub=c(4,5))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.