CrossGEEKron {CrossCarry}  R Documentation 
Run a GEE model for data from a crossover experiment with repeated measures
Description
Provides a GEE model for the data of a crossover design with S sequences of T periods. There must be at least two observations of each experimental unit in each period.
Usage
CrossGEEKron(
response,
period,
treatment,
id,
time,
carry,
covar = NULL,
data,
family = gaussian(),
correlation = "independence",
formula = NULL,
tol = 1e04,
niter = 100
)
Arguments
response 
A character string specifying the name of the response variable of the crossover experimental design 
period 
A character string specifying the name of vector with the observation period of the responses of the crossover experimental design 
treatment 
A character string specifying the name of vector with the treatment applied at each observation of the crossover experimental design 
id 
A character string specifying the name of vector which identifies the experimental units. The length of ‘id’ should be the same as the number of observations. Data are assumed to be sorted so that observations on each cluster appear as contiguous rows in data. If data is not sorted this way, the function will not identify the clusters correctly. If data is not sorted this way, a warning will be issued. 
time 
A character string specifying the name of the vector with the measurement time within each period 
carry 
A vector of character string specifying the name set of dummy variables that indicates the treatment applied in the previous period of each experimental unit. They must be 0 in period 1 
covar 
A vector of character string specifying the name of possible covariates of the crossover experimental design 
data 
A data frame with all the variables of the crossover experimental design 
family 
See corresponding documentation to 
correlation 
character string specifying the correlation within periods structure. The following are permitted: "independence", "exchangeable", "ar1" and "unstructured". 
formula 
A formula related the response variable with the explanatory
variables. If it is 
tol 
the tolerance used in the fitting algorithm. 
niter 
the maximum number of iterations.

Value
QIC
The QIC of the model: The model are fitted by geeglm
model
The model fitted by geeglm
.
Within
The estimated correlation matrix within the period
with the structure determined by correlation
.
Between
The estimated correlation matrix between periods
Source
https://doi.org/10.1007/s0036202201391z
References
Cruz, N.A., Melo, O.O. & Martinez, C.A. A correlation structure for the analysis of Gaussian and nonGaussian responses in crossover experimental designs with repeated measures. Statistical Papers (2023), 1–28.
Examples
data(Arterial)
carrydata < createCarry(data=Arterial, treatment = "Treatment",
period = "Period",id="Subject")
data < carrydata$data
carry < carrydata$carryover
model < CrossGEEKron(response = "Pressure", treatment = "Treatment",
period = "Period", id="Subject", time="Time",
carry=c("Carry_B","Carry_C"),data=data, correlation = "ar1")
model$QIC
model$Within
model$Between
summary(model$model)
model2 < CrossGEEKron(response = "Pressure", treatment = "Treatment",
period = "Period", id="Subject", time="Time",
carry=c("Carry_B","Carry_C"), data=data,
correlation = "ar1",formula=Pressure ~ Treatment+
Period+ Carry_B+Carry_C)
model2$QIC
model2$Within
model2$Between
summary(model2$model)