Description Usage Arguments Value Author(s) References See Also Examples
This function is a modification from example 7 of the gamSim function available in the mgcv package (Wood, 2017), which is turn is Gu and Wahba 4 univariate example with correlated predictors. Please see the source code for exactly what is simulated. The function is primarily used as the basis for conducting the simulation studies in Hui et al., (2018).
1 |
n |
Sample size. |
extra.X |
Extra covariates, including critically an intercept if is to be included in the linear predictor for the GAM. |
beta |
Regression coefficient estimates. |
dist |
Currently only the "normal", "poisson" or "binomial" corresponding to the binomial distributions are available. |
scale |
Scale parameter in the Normal distribution. |
offset |
This can be used to specify an a-priori known component to be included in the linear predictor during fitting. This should be |
A data frame containing information such as the simulated responses, covariates, each of the 4 "truth" smooths, and the overall linear predictor.
Han Lin Shang [aut, cre, cph] (<https://orcid.org/0000-0003-1769-6430>), Francis K.C. Hui [aut] (<https://orcid.org/0000-0003-0765-3533>)
Hui, F. K. C., You, C., Shang, H. L., and Mueller, S. (2018). Semiparametric regression using variational approximations, Journal of the American Statistical Association, forthcoming.
Wood, S. N. (2017) Generalized Additive Models: An Introduction with R (2nd edition). Chapman and Hall/CRC.
vagam for the main fitting function
1 2 3 4 5 6 7 8 9 10 11 12 13 | normal_dat = gamsim(n = 40, dist = "normal",
extra.X = data.frame(int = rep(1,40), trt = rep(c(0,1), each = 20)),
beta = c(-1, 0.5))
pois_dat = gamsim(n = 40, dist = "poisson",
extra.X = data.frame(int = rep(1, 40), trt = rep(c(0,1), each = 20)),
beta = c(-1, 0.5))
binom_dat = gamsim(n = 40, dist = "binomial",
extra.X = data.frame(int = rep(1, 40), trt = rep(c(0,1), each = 20)),
beta = c(0, 0.5))
## Please see examples in the help file for the vagam function.
|
Loading required package: mgcv
Loading required package: nlme
This is mgcv 1.8-33. For overview type 'help("mgcv-package")'.
Loading required package: gamm4
Loading required package: Matrix
Loading required package: lme4
Attaching package: ‘lme4’
The following object is masked from ‘package:nlme’:
lmList
This is gamm4 0.2-6
Loading required package: mvtnorm
Loading required package: truncnorm
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.