Fstat: Calculation of F statistic by gene given a linear model

Description Usage Arguments Value Author(s) Examples

Description

Calculates F statistic.

Usage

1
Fstat(indata =  M, formula1 = ~as.factor(g), formula0 = "mean", design1 = NULL, design0 = NULL, B = NULL)

Arguments

indata

The data matrix

formula1

a formula descibing the alternative linear model

formula0

a formula describing the nullmodel. Use linear models syntax, except for one-way ANOVA ("mean")

design1

the alternaive design matrix. If not NULL it overrides the formula argument

design0

the null design matrix. If not NULL it overrides the formula argument

B

the number of bootstrap replicates

Value

A list with the components

Fstat

the value of the F statistic

fnum

the numerator degrees of freedom

fdenom

the denominator degrees og freedom

design1

the alternative design matrix

design0

the null design matrix

SS1

the sum of squares in the denominator of the F-statistic

SS0

the sum of squares in the numerator of the F-statistic

pvalue

the p-value for testing the alternative vs the null model

Author(s)

Per Broberg

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
## Annette Dobson (1990) "An Introduction to Generalized Linear Models". 
## Page 9: Plant Weight Data. 
 ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) 
 trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) 
 group <- gl(2,10,20, labels=c("Ctl","Trt")) 
 weight <- c(ctl, trt) 
 anova(lm.D9 <- lm(weight ~ group)) 
# Analysis of Variance Table

# Response: weight
#          Df Sum Sq Mean Sq F value Pr(>F)
#group      1 0.6882  0.6882  1.4191  0.249
#Residuals 18 8.7292  0.4850               

 Fstat(indata = rbind(weight,weight),formula1=~group) # Fstat will need at least two genes to work with #
#$Fstat
#  weight   weight 
#1.419101 1.419101 

#$fnum
#[1] 18

#$fdenom
#[1] 1

#$design1
#   (Intercept) groupTrt
#1            1        0
#2            1        0
#3            1        0
#4            1        0
#5            1        0
#6            1        0
#7            1        0
#8            1        0
#9            1        0
#10           1        0
#11           1        1
#12           1        1
#13           1        1
#14           1        1
#15           1        1
#16           1        1
#17           1        1
#18           1        1
#19           1        1
#20           1        1
#attr(,"assign")
#[1] 0 1

# $design0
# NULL

# $SS1
# weight  weight 
#8.72925 8.72925 

#$SS0
#  weight   weight 
#0.688205 0.688205 

SAGx documentation built on Nov. 8, 2020, 8:18 p.m.