View source: R/model_functions.R
| predict_rinet_1d | R Documentation |
Takes one or more 1D samples and predicts the underlying reference population statistics (mean, std, reference fraction) from a mixture of healthy and pathological measurements.
predict_rinet_1d(
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 numeric vector, matrix, or list of vectors. Each sample should contain observations from a 1D 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 mean (scalar, log-scale if log_scale=TRUE) |
std |
Predicted standard deviation (scalar, log-scale if log_scale=TRUE) |
covariance |
Covariance matrix (1x1 matrix) |
correlation |
Always NA for 1D |
reference_fraction |
Predicted reference component fraction |
reference_interval |
Reference interval 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, std_ci, reference_fraction_ci, reference_interval_lower_ci, reference_interval_upper_ci |
## Not run:
# Single sample (using positive data for log-scale)
sample1 <- exp(rnorm(1000, mean = 2, sd = 0.3))
result <- predict_rinet_1d(sample1)
print(result[[1]]$mean)
# Multiple samples
samples <- list(exp(rnorm(1000, 2, 0.3)), exp(rnorm(1000, 1.5, 0.4)))
results <- predict_rinet_1d(samples)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.