Skip to contents

Simulate data with measurment error from a Gaussian process regression

Usage

sim_gp(
  n_sim = 50,
  min_x = 0,
  max_x = 2,
  alpha = 0,
  sigma_g = 2,
  phi = 2,
  sigma = 0.1,
  x_err = 0.1,
  y_err = 0.1
)

Arguments

n_sim

number of data points to simulate

min_x

Minimum x value

max_x

Maximum x value

alpha

regression intercept

sigma_g

GP variance parameter

phi

GP correlation parameter

sigma

nugget variation

x_err

x measurement error

y_err

y measurement error

Value

Simulated dataset with columns x, x_err, y, y_err

Examples

sim_gp(n_sim = 50)
#> Compiling rjags model...
#> Calling the simulation using the rjags method...
#> Note: the model did not require adaptation
#> Burning in the model for 4000 iterations...
#> Running the model for 1 iterations...
#> Simulation complete
#> Finished running the simulation
#> # A tibble: 50 × 6
#>          x x_err       y y_err true_y true_x
#>      <dbl> <dbl>   <dbl> <dbl>  <dbl>  <dbl>
#>  1  0.0492   0.1 -0.769    0.1 -0.750 0.0120
#>  2  0.0507   0.1  0.287    0.1  0.278 0.156 
#>  3  0.212    0.1  0.319    0.1  0.289 0.158 
#>  4 -0.0126   0.1  0.933    0.1  0.827 0.241 
#>  5  0.487    0.1  1.25     0.1  1.23  0.341 
#>  6  0.462    0.1  1.34     0.1  1.23  0.343 
#>  7  0.402    0.1  1.22     0.1  1.27  0.415 
#>  8  0.293    0.1  1.36     0.1  1.24  0.432 
#>  9  0.312    0.1  1.21     0.1  0.976 0.509 
#> 10  0.622    0.1 -0.0588   0.1  0.224 0.622 
#> # … with 40 more rows