Scale: Automatically Scale Data Calling These Functions: 'anovaVCA',...

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

View source: R/vca.R

Description

This function scales data before fitting a linear mixed model aiming to avoid numerical problems when numbers of the response variable are either very small or very large. It adds attribute "scale" to the resulting 'VCA'-object, which is used by function reScale to transform back the VCA-results of a VCA or VCAinference object that was previously scaled.

Usage

1
Scale(Fun, form, Data, ...)

Arguments

Fun

(expr, function, character) either a complete function call to one of "anovaVCA", "anovaMM", "remlVCA", "remlMM", a character string or just the function name without quotes (see example)

form

(formula) specifying the model to fitted by 'Fun'

Data

(data.frame) with all variables specified via 'Fun'

...

additional arguments applying to one of the four functions anovaVCA,anovaMM, remlVCA, remlMM

Details

NOTE: Scaling is applied on the complete data set, without checking whether there are incomplete observations or not!

Value

(object) of class 'VCA' which can be used as input for function VCAinference

Author(s)

Andre Schuetzenmeister [email protected]

See Also

reScale

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
## Not run: 
data(dataEP05A2_3)

# simulate very large numbers of the response
dat3   <- dataEP05A2_3
dat3$y <- dat3$y * 1e8

# now try to fit 21-day model to this data
fit <- anovaVCA(y~day/run, dat3)

# now use 'Scale' function
fit1 <- Scale("anovaVCA", y~day/run, dat3)
fit2 <- Scale(anovaVCA, y~day/run, dat3)	# also works
fit3 <- Scale(anovaVCA(y~day/run, dat3)) # works as well

# back to original scale
(fit1 <- reScale(fit1))
(fit2 <- reScale(fit2))
(fit3 <- reScale(fit3))

# reference values
fit0 <- anovaVCA(y~day/run, dataEP05A2_3, MME=TRUE)
inf0 <- VCAinference(fit0, VarVC=TRUE)

fit1 <- Scale(anovaVCA(y~day/run, dataEP05A2_3, MME=TRUE))
inf1 <- VCAinference(fit1, VarVC=TRUE)
inf1 <- reScale(inf1)

# compare to reference
print(inf0, what="VC")
print(inf1, what="VC")
print(inf0, what="SD")
print(inf1, what="SD")
print(inf0, what="CV")
print(inf1, what="CV")

# now use REML-based estimation
fit0 <- remlVCA(y~day/run, dataEP05A2_3)
inf0 <- VCAinference(fit0)

fit1 <- Scale("remlVCA", y~day/run, dataEP05A2_3)
inf1 <- VCAinference(fit1)
inf1 <- reScale(inf1)

# compare to reference
print(inf0, what="VC")
print(inf1, what="VC")
print(inf0, what="SD")
print(inf1, what="SD")
print(inf0, what="CV")
print(inf1, what="CV")

# scaling also works with by-processing
data(VCAdata1)
fit <- Scale(anovaVCA(y~(device+lot)/day/run, VCAdata1, by="sample"))
reScale(fit)

## End(Not run)

VCA documentation built on July 12, 2017, 5:02 p.m.

Related to Scale in VCA...