mr_ratio {comorbidPGS} | R Documentation |
Mendelian Randomization ratio method with external PGS
Description
mr_ratio()
takes a distribution of PGS, an Exposure (Phenotype), an Outcome (Phenotype).
Returns a data frame showing the Mendelian Randomization ratio methods using PGS
Usage
mr_ratio(
df = NULL,
prs_col = "SCORESUM",
exposure_col = NA,
outcome_col = NA,
scale = TRUE,
verbose = TRUE,
log = ""
)
Arguments
df |
a dataframe with individuals on each row, and at least the following columns:
|
prs_col |
a character specifying the PGS column name |
exposure_col |
a character specifying the Exposure (Phenotype) column name |
outcome_col |
a character specifying the Outcome (Phenotype) column name |
scale |
a boolean specifying if scaling of PGS should be done before testing |
verbose |
a boolean (TRUE by default) to write in the console/log messages. |
log |
a connection, or a character string naming the file to print to. If "" (by default), it prints to the standard output connection, the console unless redirected by sink. |
Value
return a data frame with the Mendelian Randomization association result using the ratio method with the following columns:
PGS: the name of the PGS used
Exposure: the name of Phenotype used as Exposure
Outcome: the name of Phenotype used as Outcome
Method: the MR method used (here Ratio)
N_cases: if Phenotype_type is Cases/Controls, the number of cases
N_controls: if Phenotype_type is Cases/Controls, the number of controls
N: the number of individuals/samples
MR_estimate: the MR estimate (beta) using the ratio method
SE: the associated standard error (second order)
F_stat: the F-statistic of the Exposure ~ PGS association
Examples
result <- mr_ratio(
df = comorbidData,
prs_col = "ldl_PGS",
exposure_col = "log_ldl",
outcome_col = "bmi",
scale = TRUE
)
print(result)