Description Usage Arguments Details Value References Examples
Fit the regression function based on multivariate adaptive splines.
1 2 |
data |
a data.frame including one column of ID of the observations, covariates, time, and response. |
col |
a charater vector indicating each column in the |
maxterm |
the maximum number of terms allowed in the model during the forward step. The default is |
maxinteraction |
the maximum number of interactive predictors allowed in the model. The default is |
varhat |
a vector of length three indicating whether any of the three random effects should be considered. A value of ‘1’ or ‘0’ indicates whether the corresponding term should be included or not. The default is |
forced_num |
the number of the covariates that a user wishes to force into the |
maxiter |
the maximum number of iterations between the surface estimation and covariance estimation. The default is 2. |
For cross-sectional data, function masal
fits a nonparametric surface for a continuous response variable. For longitudinal data, masal
provides a surface that depends on time and selected covariates, and their interactions are allowed. The regression surface is based on the multivariate adaptive splines.
The data should include the identification (ID) number that links possibly multiple observations from the same unit of observation, the covariates, the time of each observation, and the response variables. For categorical covariates, dummy variables should be created before input.
fitted |
the fitted fixed-effect function f. |
masaled.values |
the fitted values with the formula obtained by |
masaled.residuals |
the residuals from |
sigma |
a vector of 4 containing the estimated parameters related to the random effects. |
cov_matrix |
the estimated covariance matrix depending on |
regression |
an indicator for whether some of the three random effects in the model has been included. A value of ‘1’ means yes and ‘0’ otherwise. |
call |
the call by which this object is generated. |
nsub |
the number of subjects contained by input |
nobs |
the number of observations, i.e., the number of rows of |
ntime |
a vector that indicates the number of observations for each subject of |
Mobs |
the maximum number of |
learning.data |
the data that are actually used in |
Zhang, H. (1997) Multivariate adaptive splines for analysis of longitudinal data.
Zhang, H. and Singer, B. (1999) Recursive partitioning in the health sciences. Springer Verlag.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | library("macs")
set.seed(123)
data <- data.frame(ID = sort(rep(1:100, 5)),
X1 = runif(500, min = 0, max = 1),
X2 = runif(500, min = 0, max = 2),
X3 = runif(500, min = 0, max = 4),
X4 = rnorm(500, mean = 0, sd = 1),
X5 = rnorm(500, mean = 0, sd = 2),
X6 = rnorm(500, mean = 0, sd = 3),
time = rep(1:5, 100),
Y = rnorm(500, mean = 40, sd = 10))
result <- masal(data, col = NULL, maxterm = 20, maxinteraction = 2,
varhat = c(1, 1, 1), forced_num = NULL, maxiter = 2)
plot(result)
forecast(result)
summary(result)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.