View source: R/model_functions.R
| predict_rinet_2d | R Documentation |
Takes one or more 2D samples and predicts the underlying reference population statistics (means, stds, correlation, reference fraction) from a mixture of healthy and pathological measurements.
predict_rinet_2d(
data,
feature_grid_range = c(-4, 4),
feature_grid_nbins = 100,
verbose = 0,
log_scale = TRUE,
percentiles = c(0.025, 0.975),
n_bootstrap = 0,
confidence_level = 0.95
)
data |
A matrix or list of matrices. Each sample should be a matrix with 2 columns representing observations from a 2D mixture distribution. |
feature_grid_range |
Numeric vector of length 2 specifying the range for histogram binning. Default is c(-4, 4). |
feature_grid_nbins |
Integer specifying the number of histogram bins. Default is 100. |
verbose |
Integer controlling verbosity (0 = silent). Default is 0. |
log_scale |
Logical indicating whether to log-transform the data before prediction. If TRUE (default), returns log-scale statistics and calculates reference intervals in the original scale. Default is TRUE. |
percentiles |
Numeric vector of length 2 specifying the lower and upper percentiles for the reference interval. Default is c(0.025, 0.975). |
n_bootstrap |
Integer specifying the number of bootstrap resamples for confidence intervals. Default is 0 (no bootstrap). When > 0, confidence intervals are computed for all predicted statistics. |
confidence_level |
Numeric specifying the confidence level for bootstrap intervals. Default is 0.95. |
A list of predictions. Each element contains:
mean |
Predicted means (vector of length 2, log-scale if log_scale=TRUE) |
std |
Predicted standard deviations (vector of length 2, log-scale if log_scale=TRUE) |
covariance |
Predicted covariance matrix (2x2 matrix) |
correlation |
Predicted correlation coefficient (scalar) |
reference_fraction |
Predicted reference component fraction |
reference_interval |
Reference region ellipse vertices (100x2 matrix) in original scale (if log_scale=TRUE) |
log_scale |
Logical indicating whether log-scaling was used |
bootstrap_ci |
List of bootstrap confidence intervals (if n_bootstrap > 0): mean_ci (2x2 matrix), std_ci (2x2 matrix), correlation_ci, reference_fraction_ci |
## Not run:
# Single 2D sample (using positive data for log-scale)
sample1 <- exp(matrix(rnorm(2000, mean = 2, sd = 0.3), ncol = 2))
result <- predict_rinet_2d(sample1)
print(result[[1]]$mean)
print(result[[1]]$covariance)
# Multiple samples
samples <- list(exp(matrix(rnorm(2000, mean = 2, sd = 0.3), ncol = 2)),
exp(matrix(rnorm(2000, mean = 2, sd = 0.3), ncol = 2)))
results <- predict_rinet_2d(samples)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.