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.

ngme(
  formula,
  data,
  family = "normal",
  control_opt = NULL,
  control_ngme = NULL,
  group = NULL,
  replicate = NULL,
  start = NULL,
  debug = FALSE
)

Arguments

formula

formula

data

a dataframe or a list providing data (Only response variable can contain NA value, NA value in other columns will cause problem)

family

likelihood type, same as measurement noise specification, 1. string 2. ngme noise obejct

control_opt

control for optimizer. by default it is control_opt(). See ?control_opt for details.

control_ngme

control for ngme model. by default it is control_ngme(). See ?control_ngme for 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)

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
 )
)
#> *** Ngme object ***
#> 
#> Fixed effects: 
#> (Intercept)          x1 
#>       7.365      -0.869 
#> 
#> Models: 
#> $field1
#>   Model type: AR(1)
#>       rho = 0.5
#>   Noise type: NIG
#>   Noise parameters: 
#>       mu = 0
#>       sigma = 1
#>       nu = 1
#> 
#> $field2
#>   Model type: Random walk (order 1)
#>       No parameter.
#>   Noise type: NORMAL
#>   Noise parameters: 
#>       sigma = 1
#> 
#> Measurement noise: 
#>   Noise type: NORMAL
#>   Noise parameters: 
#>       sigma = 1
#> 
#> 
#> Number of replicates is  1