simulate_random_gradients: Simulate Random Gradients

simulate_random_gradientsR Documentation

Simulate Random Gradients

Description

This function simulates random expression patterns, computes gradients, and calculates various metrics for evaluating the inferred expression gradients.

Usage

simulate_random_gradients(
  coords_df,
  span,
  expr_est_pos,
  amccd,
  n = 1000,
  seed = 123,
  coef = Inf,
  range = c(0, 1),
  control = SPATA2::sgs_loess_control,
  fn = "runif",
  verbose = TRUE,
  ...
)

Arguments

coords_df

A data frame containing coordinates and distance information.

span

The alpha parameter for the loess smoothing, controlling the degree of smoothness.

n

The number of simulations to perform (default is 1000).

seed

The random seed to ensure reproducibility (default is 123).

range

A numeric vector specifying the range for generating random expression values (default is c(0, 1)).

verbose

A logical value indicating whether to display progress messages (default is TRUE).

...

Additional parameters given to obtain_inferred_gradient().

pred_pos

A numeric vector of positions for which the gradients are inferred.

Value

A list of length n containing information about the simulated gradients, Loess Deviation Scores (LDS), loess models, and total variation for each simulation. The list is named with seed indices to trace the circumstances under which each simulation was conducted.

The output list contains the following components:

gradient

A numeric vector representing the inferred expression gradient.

model

A loess model object fitted to the simulated data.

tot_var

A numeric value representing the total variation of the inferred gradient.


theMILOlab/SPATA2 documentation built on Feb. 8, 2025, 11:41 p.m.