Description Usage Arguments Details Value See Also Examples
This is a special case of the function "CI" in this package. This function is easier to use when studying the difference between two specific treatments/genotype, without specifying the linear combination needed in "CI".
1 | CI_contrast(fit, j1, j2, alpha)
|
fit |
An object of output obtained by function "fanova". |
j1 |
A positive integer, specifying the columns of the design matrix corresponding to one treatment of interest. Users can use the design matrix output from the function fanova( ), to idenfity the value of j1. See the example part for details. |
j2 |
A positive integer different from j1. It specifies the columns of the design matrix corresponding to the other treatment of interest. Users can use the design matrix output from the function fanova( ), to idenfity the value of j2. See the example part for details. |
alpha |
A positive small number between 0 and 1. 1-alpha gives the confidence level. In default, alpha = 0.05. |
We can test the significance of the treatment effects of interest by constructing the corresponding confidence regions with the function ``CI\_contrast (fit, j1, j2, …)", where fit is the output from "fanova ( )", and j1 and j2 specify the columns of the design matrix corresponding to the treatments of interest. This is the simplified version of “'CI\_contrast" by setting the j1th and j2th elements of L being 1 and -1, and all other elements beign 0.
trt |
a t by 1 vector, which refers to the estimated treatment effect, where t is the number of observation time points specified in the argument tt in the function fanova( ). |
lb |
a t by 1 vector, which refers to the lower bound of the (1-alpha) confidence band, where t is the number of observation time points specified in the argument tt in the function fanova( ). |
ub |
a t by 1 vector, which refers to the the upper bound of the (1-alpha) confidence band, where t is the number of observation time points specified in the argument tt in the function fanova( ). |
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 | #load the data
data_new = read.csv(system.file("extdata","data.csv",
package = "implant", mustWork = TRUE))
#The first three columns of data_new refer to the original position of the observations from the
#original dataset, genotype and block, respectively
Y = data_new[,-c(1:3)]
#This step is to factorize each factor
Genotype = as.factor(data_new$Genotype)
Block = as.factor(data_new$Block)
X = data.frame(Genotype,Block)
formula = "~ Genotype + Block"
tt = seq(from = 0, to = 44,by = 2)
#fit anova
fit = fanova(Y.na.mat = Y, X = X, tt = tt, formula, K.int = 6, order = 4, lower = -10, upper = 15)
fit$design_mat
> fit$design_mat
(Intercept) Genotype2 Genotype Block2 Block3
1 1 0 1 0 0
2 1 0 0 0 0
3 1 1 0 0 0
4 1 1 0 1 0
5 1 0 1 1 0
6 1 0 0 1 0
7 1 0 1 0 1
8 1 1 0 0 1
9 1 0 0 0 1
#We want to test the significance between block 2 and block 1,
#that is, we are interested in the 1st, the 4th column of the design matrix.
#Therefore, we can define:
ci_diff = CI_contrast(fit = fit, j1 = 4, j2 = 1, alpha = 0.05)
plot(tt,ci_diff$trt,type = "l")
lines(tt,ci_diff$lb, col = "blue")
lines(tt,ci_diff$ub, col = "blue")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.