ngme.par: Parameter estimation.

View source: R/ngme.par.R

ngme.parR Documentation

Parameter estimation.

Description

Maximum likelihood model estimation using parallel runs of stochastic gradient estimation. See ngme and ngme.spatial for explanation of the model specification.

Usage

ngme.par(
  n.cores = 4,
  std.lim = 0.1,
  trend.lim = 0.01,
  max.rep = 10,
  controls = NULL,
  controls.init = NULL,
  use.process = TRUE,
  nIter = 1000,
  timeVar = NULL,
  location.names = NULL,
  init.fit = NULL,
  silent = FALSE,
  plot.type = "All",
  save.tracks = FALSE,
  ...
)

Arguments

n.cores

Number of cores, and the number of parallel chains, to use. Default is 4.

std.lim

Parameter for first convergence criterium. The estimation is stopped when the estimated Monte Carlo standard deviation for each parameter is less than std.lim times the parameter value. Default is 0.1.

trend.lim

Parameter for second convergence criterium. The estimation is stopped when the rate of change per batch of nIter iterations is not significantly larger than trend.lim times the current parameter value. Default is 0.01.

max.rep

The total number of iterations that is run is given by nIter*max.rep. Convergence is checked after every nIter iterations, and max.rep thus sets how many batches of nIter iterations that should be run at most. Default is 10.

nIter

The number of iterations per batch of runs. Default is 1000.

plot.type

Set to "All" to get parameter trajectories of all estimated parameters. However, at most 16 parameters are plotted at once. Set to "TRUE" or "Fixed" to get plots of only the fixed effects.

save.tracks

Save the individual parameter tracks for the parallel runs? Default FALSE.

...

Other parameter needed by ngme

Details

The function calls ngme or ngme.spatial internally. See these functions for further information on the actual model specification. When plots of parameter trajectories are shown, the gray lines show the trajectories of the individual runs and the black curve is the estimate obtained by averaging the individual trajectories. The green lines show approximate 95 percent confidence bands for the estimate.

Value

A list of outputs.

Author(s)

David Bolin davidbolin@gmail.com

See Also

ngme, ngme.spatial

Examples

  ## Not run: 
  data(srft_data)
  
  #Consider a subsample of the data
  rs_id <- sample(unique(srft_data$id), 731, replace = FALSE)
  srft_data_sub <- srft_data[srft_data$id %in% rs_id, ]

  # fit the model with normal assumption for random effects, process and error
  fit_normal <- ngme.par(fixed = log(egfr) ~ sex + bage + fu + pwl,
                         random = ~ 1|id,
                         data = srft_data_sub,
                         reffects = "Normal",
                         process = c("Normal", "fd2"),
                         error = "Normal",
                         timeVar = "fu",
                         n.cores = 5, 
                         std.lim = 100,
                         max.rep = 20,
                         nIter = 500,
                         use.process = TRUE,
                         silent = FALSE,
                         mesh = list(cutoff = 1/365, max.dist = 1/12, extend = 0.01),
                         controls = list(pSubsample = 0.1))
                     

## End(Not run)

davidbolin/ngme documentation built on Dec. 5, 2023, 11:48 p.m.