PhenTestResult-class {PhenStat} | R Documentation

## Class "PhenTestResult"

### Description

A list-based S4 class for storing of model fitting results and other information like dependent variable, method used to build a model, etc. Helps to support operations needed for model fitting process and modelling/testing results storage. In the package PhenTestResult object is created by function `testDataset`.

### Explore PhenTestResult object

PhenTestResults object instance contains the following slots:

1. "analysedDataset" contains subdataset that was used for the modelling/testing:

`analysedDataset(phenTestResult)`

2. "depVariable" contains dependent variable that was tested: `getVariable(phenTestResult)`

3. "refGenotype" contains reference genotype which is usually is wildtype: `refGenotype(phenTestResult)`

4. "testGenotype" contains test genotype: `testGenotype(phenTestResult)`

5. "method" contains method name that was used for modelling/testing: `method(phenTestResult)`

6. "transformationRequired" contains TRUE/FALSE value indicating transofrmation of dependent variable:

`transformationText(phenTestResult)` or `phenTestResult@transformationRequired`

7. "lambdaValue" contains lambda value for the Box-Cox transformation:

`transformationText(phenTestResult)` or `phenTestResult$lambdaValue`

8. "scaleShift" contains the value of scale shift for Box-Cox transformation:

`transformationText(phenTestResult)` or `phenTestResult@scaleShift`

9. "transformationCode" contains the code of transformation. Possible values:

0 - transformation is not applicable (methods "FE", "RR", "LR") or switched off by user 1 - transformation is not needed (1 is within the 95 2 - log transformation 3 - power transformation 4 - transformation is not performed since optimal lambda value is not found (-5 > lambda > 5)

`transformationText(phenTestResult)` or `phenTestResult@transformationCode`

10. "parameters" contains the parameters used during method application, e.g. pThreshold for MM and TF:

`parameters(phenTestResult)`

11. Modelling/testing results are stored in the sections "analysisResults": `analysisResults(phenTestResult)`

The contents of the analysisResults slot depend on framework that was used.

The results of MM and TF frameworks: 1. Equation used during linear modeling: `analysisResults(phenTestResult)$equation`

2. Batch effect significance: `analysisResults(phenTestResult)$model.effect.batch`

3. Variance equality: `analysisResults(phenTestResult)$model.effect.variance`

4. Weight effect significance: `analysisResults(phenTestResult)$model.effect.weight`

5. Sex effect significance: `analysisResults(phenTestResult)$model.effect.interaction`

6. Evidence of sex effect (p-value): `analysisResults(phenTestResult)$model.output.interaction`

7. Evidence of genotype effect (p-value): `analysisResults(phenTestResult)$model.output.genotype.nulltest.pVal`

8. Formula for the final genotype model: `analysisResults(phenTestResult)$model.formula.genotype`

9. Formula for the final null model: `analysisResults(phenTestResult)$model.formula.null`

10. Model fitting output: `analysisResults(phenTestResult)$model.output`

11. Model fitting summary: `summary(analysisResults(phenTestResult)$model.output)$tTable`

The results of FE and RR frameworks are stored as a list of htestPhenStat S4 objects: `analysisResults(phenTestResult)[[1]]`.

Each one htestPhenStat object contains:

1. Output of Fisher Exact Test: `pvalue(analysisResults(phenTestResult)[[1]])`.

2. Effect size: `ES(analysisResults(phenTestResult)[[1]])`.

3. Name of the table analysed (all, males, females): `analysedSubset(analysisResults(phenTestResult)[[1]])`.

4. Comparison, used for RR only (High vs Normal/Low, Low vs High/Normal): `comparison(analysisResults(phenTestResult)[[1]])`.

5. Matrix of counts: `matrixCount(analysisResults(phenTestResult)[[1]])`.

### Slots

`analysedDataset`:

  Object of class `"data.frame"` ~~ analysed dataset

`transformationRequired`:

  Object of class `"logical"` ~~ flag indicating was or not transformation performed

`lambdaValue`:

  Object of class `"numeric"` ~~ Box-Cox transform lambda value

`scaleShift`:

  Object of class `"numeric"` ~~ Box-Cox transform scale shift

`transformationCode`:

  Object of class `"numeric"` ~~ code explaining the transformation output

`depVariable`:

  Object of class `"character"` ~~ dependent variable

`refGenotype`:

  Object of class `"character"` ~~ reference genotype

`testGenotype`:

  Object of class `"character"` ~~ test genotype

`method`:

  Object of class `"character"` ~~ analysis method

`parameters`:

  Object of class `"matrix"` ~~ parameters of method

`analysisResults`:

  Object of class `"list"` ~~ results of the analysis

### Methods

getVariable

  (accessor): Returns dependent variable

refGenotype

  (accessor): Returns reference genotype

testGenotype

  (accessor): Returns test genotype

method

  (accessor): Returns method used

methodText

  (accessor): Returns full name of the method used

parameters

  (accessor): Returns parameteres used during the method application

analysisResults

  (accessor): Returns analysis results depending on method

analysedDataset

  (accessor): Returns analysed dataset

transformationText

  (accessor): Returns the info about transformation

batchIn

  Returns TRUE if the batch is in the dataset, FALSE otherwise

weightIn

  Returns TRUE if the weight is in the dataset, FALSE otherwise

noSexes

  Returns number of sexes in the dataset

show

  Prints out the PhenTestResult object

getCountMatrices

  Returns count matrices if they are present (for methods "FE" and "RR"), NULL otherwise.

### Author(s)

Natalja Kurbatova

### Examples

        # Mixed Model framework
        file <- system.file("extdata", "test1.csv", package="PhenStat")
        test <- PhenStat:::PhenList(dataset=read.csv(file,na.strings = '-'),
                testGenotype="Sparc/Sparc")
        result <- PhenStat:::testDataset(test,
                equation="withoutWeight",
                depVariable="Bone.Area")
        PhenStat:::getVariable(result)
        PhenStat:::method(result)
        # Batch effect is significant
        PhenStat:::analysisResults(result)$model.effect.batch
        # Variance homogeneosity
        PhenStat:::analysisResults(result)$model.effect.variance
        # Weight effect is significant
        PhenStat:::analysisResults(result)$model.effect.weight
        # Sex effect is significant
        PhenStat:::analysisResults(result)$model.effect.interaction
        # Sex effect p-value - the result of the test
        PhenStat:::analysisResults(result)$model.output.interaction
        # Genotype effect p-value
        PhenStat:::analysisResults(result)$model.output.genotype.nulltest.pVal
        # Final model formula with genotype
        PhenStat:::analysisResults(result)$model.formula.genotype
        # Final model formula without genotype
        PhenStat:::analysisResults(result)$model.formula.null
        # Final model fitting output
        # result$model.output
        # Final model fitting summary
        # summary(result$model.output)$tTable

        # Fisher Exact Test framework
        file <- system.file("extdata", "test_categorical.csv", package="PhenStat")
        test <- PhenStat:::PhenList(dataset=read.csv(file,na.strings = '-'),
                testGenotype="Aff3/Aff3")
        result <- PhenStat:::testDataset(test,
                depVariable="Thoracic.Processes",
                method="FE")
        PhenStat:::getVariable(result)
        PhenStat:::method(result)
        for (i in seq_along(analysisResults(result))) {
            val <- PhenStat:::analysisResults(result)[[i]]
            val
        }

[Package PhenStat version 2.17.0 Index]