Last data update: 2014.03.03

R: Class "PhenTestResult"
PhenTestResult-classR 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 <- PhenList(dataset=read.csv(file),
            testGenotype="Sparc/Sparc")
    result <- testDataset(test,
            equation="withoutWeight",
            depVariable="Bone.Area")
    getVariable(result)
    method(result)
    # Batch effect is significant
    analysisResults(result)$model.effect.batch    
    # Variance homogeneosity 
    analysisResults(result)$model.effect.variance
    # Weight effect is significant
    analysisResults(result)$model.effect.weight     
    # Sex effect is significant 
    analysisResults(result)$model.effect.interaction    
    # Sex effect p-value - the result of the test 
    analysisResults(result)$model.output.interaction
    # Genotype effect p-value    
    analysisResults(result)$model.output.genotype.nulltest.pVal
    # Final model formula with genotype
    analysisResults(result)$model.formula.genotype 
    # Final model formula without genotype    
    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 <- PhenList(dataset=read.csv(file),
            testGenotype="Aff3/Aff3")
    result <- testDataset(test,
            depVariable="Thoracic.Processes",
            method="FE") 
    getVariable(result)
    method(result)       
    for (i in seq_along(analysisResults(result))) {
        val <- analysisResults(result)[[i]]
        val
    }

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(PhenStat)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/PhenStat/PhenTestResult-class.Rd_%03d_medium.png", width=480, height=480)
> ### Name: PhenTestResult-class
> ### Title: Class "PhenTestResult"
> ### Aliases: PhenTestResult-class getVariable,PhenTestResult-method
> ###   refGenotype,PhenTestResult-method testGenotype,PhenTestResult-method
> ###   parameters,PhenTestResult-method method,PhenTestResult-method
> ###   methodText,PhenTestResult-method
> ###   analysisResults,PhenTestResult-method
> ###   analysedDataset,PhenTestResult-method
> ###   transformationText,PhenTestResult-method show,PhenTestResult-method
> ###   getCountMatrices,PhenTestResult-method
> ###   getGenotypeEffect,PhenTestResult-method
> ### Keywords: classes methods
> 
> ### ** Examples
> 
>     # Mixed Model framework
>     file <- system.file("extdata", "test1.csv", package="PhenStat")
>     test <- PhenList(dataset=read.csv(file),
+             testGenotype="Sparc/Sparc")
Warning:
Dataset's column 'Assay.Date' has been renamed to 'Batch' and will be used for the batch effect modelling.

Information:
Dataset's 'Genotype' column has following values: '+/+', 'Sparc/Sparc'

Information:
Dataset's 'Sex' column has following value(s): 'Female', 'Male'

>     result <- testDataset(test,
+             equation="withoutWeight",
+             depVariable="Bone.Area")
Information:
Dependent variable: 'Bone.Area'.

Information:
Perform all MM framework stages: startModel and finalModel.

Information:
Method: Mixed Model framework.

Information:
Equation: 'withoutWeight'.

Information:
Calculated values for model effects are: keepBatch=TRUE, keepEqualVariance=TRUE, keepWeight=FALSE, keepSex=TRUE, keepInteraction=FALSE.

>     getVariable(result)
[1] "Bone.Area"
>     method(result)
[1] "MM"
>     # Batch effect is significant
>     analysisResults(result)$model.effect.batch    
[1] TRUE
>     # Variance homogeneosity 
>     analysisResults(result)$model.effect.variance
[1] TRUE
>     # Weight effect is significant
>     analysisResults(result)$model.effect.weight     
[1] FALSE
>     # Sex effect is significant 
>     analysisResults(result)$model.effect.interaction    
[1] FALSE
>     # Sex effect p-value - the result of the test 
>     analysisResults(result)$model.output.interaction
[1] 0.1740753
>     # Genotype effect p-value    
>     analysisResults(result)$model.output.genotype.nulltest.pVal
[1] 0.008274361
>     # Final model formula with genotype
>     analysisResults(result)$model.formula.genotype 
Bone.Area ~ Genotype + Sex
<environment: 0x738c7b0>
>     # Final model formula without genotype    
>     analysisResults(result)$model.formula.null 
Bone.Area ~ Sex
<environment: 0x738c7b0>
>     # 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 <- PhenList(dataset=read.csv(file),
+             testGenotype="Aff3/Aff3")
Warning:
Dataset's column 'Assay.Date' has been renamed to 'Batch' and will be used for the batch effect modelling.

Warning:
Dataset has been cleaned by filtering out records with genotype value other than test genotype 'Aff3/Aff3' or reference genotype '+/+'.

Warning:
Dataset's 'Weight' column is missed.
You can define 'dataset.colname.weight' argument to specify column for the weight effect modeling.

Information:
Dataset's 'Genotype' column has following values: '+/+', 'Aff3/Aff3'

Information:
Dataset's 'Sex' column has following value(s): 'Female', 'Male'

Warning:
Weight column is not present in the database.

>     result <- testDataset(test,
+             depVariable="Thoracic.Processes",
+             method="FE") 
Information:
Dependent variable: 'Thoracic.Processes'.

Information:
Method: Fisher Exact Test framework with filtered dataset.

>     getVariable(result)
[1] "Thoracic.Processes"
>     method(result)       
[1] "FE"
>     for (i in seq_along(analysisResults(result))) {
+         val <- analysisResults(result)[[i]]
+         val
+     }
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>