Learn R Programming

spdgp (version 0.1.0)

make_error: Simulate an error term

Description

Simulate an error term

Usage

make_error(
  n = 10,
  mu = 0,
  var = 1,
  method = c("normal", "laplace", "cauchy", "lognormal")
)

Value

A numeric vector

Arguments

n

the number of values to simulate.

mu

the sample average.

var

the sample variance. The sqrt(var) is passed to rnorm() and rlnorm() for normal and laplace distributions. sqrt(var / 2) is used for laplace() .

method

must be one of "normal", "laplace", "cauchy", or "lognormal".

Details

  • "normal": fit with rnorm()

  • "laplace": fit with smoothmest::rdoublex()

  • "cauchy": fit with rcauchy()

  • "lognormal": fit with rlnorm()