startModel: Method "startModel"

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/MMFramework.R

Description

This is an internal function run within MM framework. It completes the testing stage of which effects are significant. As an internal function, it doesn't include extensive error testing of inputs. Please use cautiously if calling directly.

It creates start model and modify it after testing of different hypothesis (the model fixed effects).

The model random effects are:

-batch effect (TRUE if batch variation is significant, FALSE if not)

The model fixed effects are:

-variance effect (TRUE if residual variances for genotype groups are homogeneous and FALSE if they are heterogeneous),

-interaction effect (TRUE if genotype by sex interaction is significant),

-sex effect (TRUE if sex is significant),

-weight effect (TRUE if weight is significant).

If user would like to assign other TRUE/FALSE values to the fixed effects of the model then he or she has to define keepList argument which is vector of TRUE/FALSE values.

If user has defined model fixed effects (keepList argument) then function prints out calculated and user defined effects (only when outputMessages argument is set to TRUE), checks user defined effects for consistency (for instance, if there are no "Weight" column in the dataset then weight effect can't be assigned to TRUE, etc.) and modifies start model according to user defined effects.

As the result PhenTestResult object that contains calculated or user defined model fixed effects and MM start model is created.

Usage

1
2
3
4
5
    startModel(phenList, depVariable,
            equation="withWeight", outputMessages=TRUE,
            pThreshold=0.05, keepList=NULL,modelWeight = NULL,
            threshold = 10^-18,
            check = 1)

Arguments

phenList

instance of the PhenList class; mandatory argument

depVariable

a character string defining the dependent variable of interest; mandatory argument

equation

a character string defining the equation to use. Possible values "withWeight" (default),"withoutWeight"

outputMessages

flag: "FALSE" value to suppress output messages; "TRUE" value to show output messages ; default value TRUE

pThreshold

a numerical value for the p-value threshold used to determine which fixed effects to keep in the model, default value 0.05

keepList

a logical vector defining the significance of different model effects: keep_batch, keep_equalvar, keep_weight, keep_sex, keep_interaction; default value NULL

modelWeight

a vector of positive values for weights in the mixed model. The sum of the values must be one.

threshold

a single positive value. The threshold for the ModelWeights to consider as zero (see modelWeight)

check

Only useful when modelWeight is included. Select between 0, 1, 2 to impose different weighting strategies on the Linear Mixed model. check=1 (default) selects the weights that are greater than the threshold (above) and keeps the batches that include more than one single sample. check=2 keeps only the weights that are greater than the threshold but ignores the single sample batches. check=0 to disable the function.

Value

Returns results stored in instance of the PhenTestResult class

Author(s)

Natalja Kurbatova, Natasha Karp, Jeremy Mason

References

Karp N, Melvin D, Sanger Mouse Genetics Project, Mott R (2012): Robust and Sensitive Analysis of Mouse Knockout Phenotypes. PLoS ONE 7(12): e52410. doi:10.1371/journal.pone.0052410

West B, Welch K, Galecki A (2007): Linear Mixed Models: A practical guide using statistical software New York: Chapman & Hall/CRC 353 p.

See Also

PhenList

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
    file <- system.file("extdata", "test1.csv", package="PhenStat")
    test <- PhenStat:::PhenList(dataset=read.csv(file,na.strings = '-'),
            testGenotype="Sparc/Sparc")
    # when "testDataset" function's argument "callAll" is set to FALSE
    # only "startModel" function is called - the first step of MM framework
    result <- PhenStat:::testDataset(test,
            depVariable="Lean.Mass",
            callAll=FALSE)
    # print out formula that has been created
    PhenStat:::analysisResults(result)$model.formula.genotype
    # print out batch effect's significance
    PhenStat:::analysisResults(result)$model.effect.batch
    # change the model
    result <- PhenStat:::testDataset(test,
            depVariable="Lean.Mass",
            equation="withWeight",
            callAll=FALSE)
    # print out new formula
    PhenStat:::analysisResults(result)$model.formula.genotype

PhenStat documentation built on Nov. 8, 2020, 8:13 p.m.