Description Usage Arguments Value Author(s) References See Also Examples
It allows to test fixed effect in mixed models. You can test within-unit effects, between-unit and interactions of the two. The response can be uni- or multi-variate. See also examples below.
1 2 3 4 5 |
modelWithin |
When it is a |
X |
The part of the design matrix corresponding to the between-unit
effect that are not null under the alternative hypothesis. If it is a matrix
or a data.frame it must have a number of rows equal to the number of units
or equal to the total number of observations (in the latest case all
elements of the same units must have the same values since they are
between-unit effects). The non-null between-unit covariates of null model
are defined in NOTE: When called from |
Z |
The part of the design matrix corresponding to the non-null
between-unit covariates of the model under the null hypothesis. May be given
as a design matrix or as a half |
units |
Vector of units IDs. May be given as a vector or as a half
|
perms |
The number of permutations to use. The default is |
data |
Same as in the function |
tail |
Same as in the function |
statTest |
For function Both functions allow for vector arguments. |
flipReturn |
Same as in the function |
testType |
See also the function |
Su |
Usually |
equal.se |
Logical. If |
se |
Usually |
replaceNA.coeffWithin |
deafult is |
replaceNA.coeffWithin.se |
deafult is |
... |
Further parameters. See also the function |
flipMix
and flipMixWithin
return an object of class
flip.object
. Several operations and plots can be made from this
object. See also flip.object-class
.
Note that function flipMix
with statTest="t"
or "F"
provides tests for each effect between (and interaction) and also provides
the overall test PC1
and sum
(i.e. all effects ar null, same
as npc
does).
Use npc
with any
comb.funct=c("data.sum","data.linComb","data.pc","data.trace")
to
combine results.
obs2coeffWithin
return a list of objects that can be used as argument
of data
in the function flipMix
and flipMixWithin
.
Livio Finos and Dario Basso
L. Finos and D. Basso (2013) Permutation Tests for Between-Unit Fixed Effects in Multivariate Generalized Linear Mixed Models. Statistics and Computing.
D. Basso, L. Finos (2011) Exact Multivariate Permutation Tests for Fixed Effects in Mixed-Models. Communications in Statistics - Theory and Methods.
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 | N=10
toyData= data.frame(subj=rep(1:N,rep(4,N)), Within=rep(1:2,N*2),
XBetween= rep(1:2,rep(N/2*4,2)),ZBetween= rep(rnorm(N/2),rep(8,N/2)))
toyData= cbind(Y1=rnorm(n=N*4,mean=toyData$subj+toyData$ZBetween+toyData$XBetween),
Y2=rnorm(n=N*4,mean=toyData$subj+toyData$ZBetween+toyData$Within*2),toyData)
(toyData)
#####################
###Testing Between-unit effects
(res=flipMix(modelWithin=as.matrix(toyData[,c("Y1","Y2")])~Within,data=toyData,
X=~XBetween,Z=~ZBetween,units=~subj,perms=1000,testType="permutation",statTest="t"))
#same as:
modelWithin <- lm(as.matrix(toyData[,c("Y1","Y2")])~Within,data=toyData)
(flipMix(modelWithin=modelWithin,data=toyData, X=~XBetween,Z=~ZBetween,units= ~subj,
perms=1000,testType="permutation",statTest="t"))
### Note that this is different from:
modelWithin <- list(Y1=lm(Y1~Within,data=toyData),Y2=lm(Y2~Within,data=toyData))
(flipMix(modelWithin=modelWithin,data=toyData, X=~XBetween,Z=~ZBetween,units= ~subj,
perms=1000,testType="permutation",statTest="t"))
### combining results
(npc(res,"data.pc"))
(npc(res,"data.trace"))
################################
###Testing Within-unit effects
## The resulting test is approximated. The estimate of the variance within units
## takes in account the presence of effects between units.
(flipMix(modelWithin=as.matrix(toyData[,c("Y1","Y2")])~Within,data=toyData,
units= ~subj, perms=1000,testType="permutation",statTest="t"))
###The resulting tests are exact. If effects between are presents,
## statTest="Tnaive" or "TBTWest" are more suitable:
(res=flipMixWithin(modelWithin=as.matrix(toyData[,c("Y1","Y2")])~Within,data=toyData,
units= ~subj, perms=1000,statTest=c("TH1est")))
npc(res)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.