simulate_spatiotemporal_data {BKTR}R Documentation

Simulate Spatiotemporal Data Using Kernel Covariances.

Description

Simulate Spatiotemporal Data Using Kernel Covariances.

Usage

simulate_spatiotemporal_data(
  nb_locations,
  nb_time_points,
  nb_spatial_dimensions,
  spatial_scale,
  time_scale,
  spatial_covariates_means,
  temporal_covariates_means,
  spatial_kernel,
  temporal_kernel,
  noise_variance_scale
)

Arguments

nb_locations

Integer: Number of spatial locations

nb_time_points

Integer: Number of time points

nb_spatial_dimensions

Integer: Number of spatial dimensions

spatial_scale

Numeric: Spatial scale

time_scale

Numeric: Time scale

spatial_covariates_means

Vector: Spatial covariates means

temporal_covariates_means

Vector: Temporal covariates means

spatial_kernel

Kernel: Spatial kernel

temporal_kernel

Kernel: Temporal kernel

noise_variance_scale

Numeric: Noise variance scale

Value

A list containing 4 dataframes: - 'data_df' contains the response variable and the covariates - 'spatial_positions_df' contains the spatial locations and their coordinates - 'temporal_positions_df' contains the time points and their coordinates - 'beta_df' contains the true beta coefficients

Examples


# Simulate data with 20 locations, 30 time points, in 2D spatial dimensions
# with 3 spatial covariates and 2 temporal covariates
simu_data <- simulate_spatiotemporal_data(
   nb_locations=20,
   nb_time_points=30,
   nb_spatial_dimensions=2,
   spatial_scale=10,
   time_scale=10,
   spatial_covariates_means=c(0, 2, 4),
   temporal_covariates_means=c(1, 3),
   spatial_kernel=KernelMatern$new(),
   temporal_kernel=KernelSE$new(),
   noise_variance_scale=1)

# The dataframes are similar to bixi_data, we have:
# - data_df
head(simu_data$data_df)
# - spatial_positions_df
head(simu_data$spatial_positions_df)
# - temporal_positions_df
head(simu_data$temporal_positions_df)

# We also obtain the true beta coefficients used to simulate the data
head(simu_data$beta_df)


[Package BKTR version 0.1.1 Index]