ngme function performs an analysis of non-gaussian additive models.
It does the maximum likelihood estimation via stochastic gradient descent.
The prediction of unknown location can be performed by leaving the response
variable to be NA. The likelihood is specified by family.
The model estimation control can be setted in control using
control_opt() function, see ?control_opt for details.
See ngme_model_types() for available models.
Usage
ngme(
formula,
data,
family = "normal",
control_opt = NULL,
control_ngme = NULL,
group = NULL,
replicate = NULL,
start = NULL,
moving_window = 1,
debug = FALSE
)Arguments
- formula
formula
- data
a dataframe or a list providing data (Only response variable can contain
NAvalue,NAvalue in other columns will cause problem)- family
likelihood type, same as measurement noise specification. It can be provided as:
a string, e.g.,
"normal","nig","t".an ngme noise object, e.g.,
noise_normal(),noise_nig(mu = 0, sigma = 1, nu = 1),noise_t(nu=5).
- control_opt
control for optimizer. by default it is
control_opt(). See?control_optfor details.- control_ngme
control for ngme model. by default it is
control_ngme(). See?control_ngmefor details.- group
factor, used for bivariate model, indicating which group the observation belongs to
- replicate
factor, used for divide data into different replicates
- start
starting ngme object (usually object from last fit)
- moving_window
number of iterations to average the estimation
- debug
toggle debug mode
Value
random effects (for different replicate) + models(fixed effects, measuremnt noise, and latent process)
Examples
ngme(
formula = Y ~ x1 + f(
x2,
model = "ar1",
noise = noise_nig(),
rho = 0.5
) + f(x1,
model = "rw1",
noise = noise_normal(),
),
family = noise_normal(sd = 0.5),
data = data.frame(Y = 1:5, x1 = 2:6, x2 = 3:7),
control_opt = control_opt(
estimation = FALSE
)
)
#> Error in ngme2::f(x2, model = "ar1", noise = noise_nig(), rho = 0.5, data = structure(list( Y = 1:5, x1 = 2:6, x2 = 3:7), class = "data.frame", row.names = c(NA, -5L)), group = structure(c(1L, 1L, 1L, 1L, 1L), levels = "1", class = "factor"), name = "field1", subset = c(TRUE, TRUE, TRUE, TRUE, TRUE)): unused argument (rho = 0.5)
