Description Usage Arguments Value Examples
This function takes in the observed data (y, x, c) and estimates a potentially nonlinear, interactive effect between x and y while adjusting for c linearly
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
Y |
The outcome to be analyzed. |
X |
an n by p matrix of exposures to evaluate. These should be continuous. |
C |
An n by q matrix of additional covariates to adjust for. If there are no additional covariates (i.e q=0), then C should be set to NULL when specifying the model |
nBurn |
The number of MCMC scans that will be dropped as a burn-in. |
thin |
This number represents how many iterations between each scan. |
c |
The first hyperparameter of the inverse gamma prior on the residual variance |
d |
The second hyperparameter of the inverse gamma prior on the residual variance |
sigB |
Either a numeric value to be used for the value of sigma_beta, the variance of the slab distribution, or "EB" is specified to indicate that it will be estimated via empirical Bayes. We recommend "EB" unless the user has strong prior beliefs about the magnitude of the nonzero regression coefficients |
k |
The number of total components to allow in the model |
ns |
The degrees of freedom of the splines used to estimate nonlinear functions of the exposures |
alph |
The first hyperparameter for the beta prior on the probability of an exposure being included in a given component |
gamm |
The second hyperparameter for the beta prior on the probability of an exposure being included in a given component |
threshold |
thresholding parameter when finding the lower bound for the slab variance. This parameter represents the percentage of time a null association enters the model when tau_h = 0.5. Smaller values are more conservative and prevent false discoveries. We recommend either 0.25 or 0.1. This lower bound is only calculated if the "EB" option is selected, as it is used to make sure the empirical Bayes variance isn't too small |
intMax |
The highest order interaction the user wants to allow in the model. This can be set to p to allow any order interaction, though the default is 3. |
speed |
Default is set to speed=TRUE. We have two approaches to sampling from our model. The faster option is approximate, though we have found it gives nearly identical answers in all scenarios explored. The slower option is theoretically guaranteed to sample from the correct target distribution, but can be slower in certain scenarios. |
nScans |
The number of MCMC scans to run. |
A list containing the full posterior draws of all parameters in the model, the waic associated with the model, the posterior inclusion probabilities (PIPs) for each exposure entering into the model, and the matrix of 2-way interaction probabilities
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 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)
## Print posterior inclusion probabilities
NLmod$MainPIP
## Show the two way interaction probability matrix
NLmod$InteractionPIP
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.