mc_sample_simple: sample Q values to get and analyze a sample of Lambdas with...

View source: R/sample.R

mc_sample_simpleR Documentation

sample Q values to get and analyze a sample of Lambdas with simple (non-mixture) hypotheses

Description

Once you have gotten an object of class Qij from simulate_Qij you can pass that to this function along with instructions on what quantities to compute. This version assumes that the denominator of Lambda and the true relationship can be specified as a a simple, single relationship (typically, and by default, "U"), rather than a mixture of possible relationships. Code for the latter has not yet been implemented.

Usage

mc_sample_simple(
  Q,
  nu,
  de = "U",
  tr = "U",
  method = c("IS", "vanilla", "both")[1],
  pstar = NA,
  FNRs = c(0.3, 0.2, 0.1, 0.05, 0.01),
  lambda_stars = NULL,
  Q_for_fnrs = NULL
)

Arguments

Q

the Qij object that is the output of simulate_Qij.

nu

the name of the relationship that is in the numerator of the likelihood ratio (Lambda) whose distribution you wish to learn about. It is a string, for example "FS", or "PO", or "U". The Q values for that relationship must be included in parameter Q. If this is a vector, then all different values are used in combination with all the values of de, tr, and, possibly, pstar. Corresponds to column "numerator" in the output

de

the relationship that appears in the denominator of Lambda. By default it is "U". Corresponds to column "denominator" in the output. If it is a vector, then all values are done iteratively in combination with other values as described for nu.

tr

the true relationship of the pairs. Default is "U". (i.e. you are going to get samples of Lambda under their distribution when the true relationship is tr). Operates over all values if a vector. Corresponds to column "true_relat" in the output.

method

the Monte Carlo method to use. Either "IS" for importance sampling, "vanilla" for vanilla Monte Carlo—regular Monte Carlo without importance sampling—or or "both". The method that was used for any row of the output is reported in the column "mc_method".

pstar

the relationship used for the importance sampling distribution. If set as NA and importance sampling (method == "IS" or "both") is used, then the value of nu is used as need be. If not NA, then this can be a vector of relationships. Each value will be used in all combinations of pstar, nu, de, and tr. This is reported in column "pstar" in the output. For the vanilla method this is actually set to the be denominator for each lambda.

FNRs

the false negative rates at which to evaluate the false positive rates. These are reported in column "fnr" in the output. These should all be between 0 and 1. By default fnr is c(0.3, 0.2, 0.1, 0.05, 0.01, 0.001).

lambda_stars

Additional values of lambda to consider as cutoffs. The corresponding false negative rates will be computed for each of these and will be presented in the output.

Q_for_fnrs

The Qij struct to use to compute the Lambda values corresponding to the given FNRs. This is used primarily for the situation where you are importance sampling with truth = Unrelated and doing physically linked markers.

Details

The output is a long format data frame.

Value

A long format data frame. It will have a column of tot_loci that gives the total number of loci.


eriqande/CKMRsim documentation built on Aug. 2, 2024, 7:23 a.m.