2
$\begingroup$

I am running a Monte Carlo simulation, using the results of a GAM (response) as the basis for my overall model. I would like to incorporate the error in the GAM into the final result. Since predict.gam (mgcv) includes se.fit, is there a way to resample the response around this standard error? I was thinking of using a random normal distribution based on the mean response and the standard error, but I don't know if that is valid, given that the standard error is calculated from a covariance matrix and not a population (code below). The R2 of the GAM is something like .87; is there a standard way to account for this unaccounted for variance in the response?

My pseudo code (R):

library(mgcv) 
model = gam(B ~  s(C) + s(log(D)), data=data.B, family=gaussian, 
            link="identity") 

loop:

a= predict.gam(model, newdata = input, type="response",
               na.action=na.pass, se.fit=T) 

a_se = rnorm(a$fit, mean=a$fit, sd=(a$se.fit*(????))) 

Many thanks

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.