smplSizPredModel: Generate a Linear Model for Sample Size Prediction

View source: R/smplSizPredModel.R

smplSizPredModelR Documentation

Generate a Linear Model for Sample Size Prediction

Description

This function generates a linear regression model to predict the number of replicates (NoOfReplicates) based on heritability, power, fold change, and tissue type. The model is generated depending on whether the tissue information is provided in the data. The function returns the fitted model.

Usage

smplSizPredModel(
  df4model = df4modelInpt,
  heritabilityClass,
  inptPwr,
  fc,
  trait = NULL,
  tissue = NULL
)

Arguments

df4model

A data frame containing the input data for the model. It should include the following columns: NoOfReplicates, HeritabilityValue, pwr, FoldChange, and optionally, Tissue.

heritabilityClass

A character value indicating the class of heritability used for filtering the data.

inptPwr

A numeric value representing the power used in the model.

fc

A numeric value representing the fold change used in the model.

trait

An optional parameter to specify the trait. If provided, it can be used for further filtering, but it's not currently used in the function.

tissue

An optional parameter specifying the tissue type. If provided, the model will include the tissue information in the regression. If not provided, the model will exclude tissue information.

Value

A linear model object (lm class), which contains the fitted linear regression model for the number of replicates prediction.

References

Sun et al. (2017) \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/nar/gkx204")}

Examples


# Example usage:
df4modelInpt <- data.frame(
    NoOfReplicates = c(3, 5, 7, 9, 11),
    HeritabilityClass = c("high", "mid", "low", "high", "mid"),
    HeritabilityValue = c(0.5, 0.6, 0.7, 0.5, 0.6),
    pwr = c(0.8, 0.9, 0.85, 0.88, 0.86),
    FoldChange = c(2, 3, 2.5, 2.8, 3.2),
    Tissue = c("Liver", "Liver", "Kidney", "Liver", "Kidney")
)

# Fit the model
model <- smplSizPredModel(
    df4model = df4modelInpt,
    heritabilityClass = "high",
    inptPwr = 0.8,
    fc = 2,
    tissue = "Liver"
)

# Summarize the results
summary(model)



HEssRNA documentation built on April 3, 2025, 9:29 p.m.