NLpredict: Predict outcome at a given set of locations

Description Usage Arguments Value Examples

View source: R/main.R

Description

This function takes in new data points and estimates the posterior predictive distribution of outcome at these locations

Usage

1
NLpredict(NLmod = NLmod, X = X, Xnew = Xnew, Cnew = Cnew)

Arguments

NLmod

A model built from the NLint function that predictions will be based on

X

The original matrix of exposures used to build NLmod

Xnew

The new set of exposures at which predictions are to be made for

Cnew

Matrix of additional covariates at which to make predictions

Value

The posterior means, 95 for the predicted outcome

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)

Xnew = matrix(rnorm(200*p), 200, p)
Cnew = rnorm(200)

predictions = NLpredict(NLmod=NLmod,
                        X=X, Xnew=Xnew,
                        Cnew=Cnew)

jantonelli111/NLinteraction documentation built on Aug. 7, 2020, 10:02 p.m.