0% found this document useful (0 votes)
3 views11 pages

Cross Carry

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 11

Package ‘CrossCarry’

April 11, 2023


Type Package
Title Analysis of Data from a Crossover Design with GEE
Version 0.1.0
Description Analyze data from a crossover design using generalized estimation equations (GEE), in-
cluding carryover effects and various correlation structures based on the Kronecker prod-
uct. It contains functions for semiparametric estimates of carry-over effects in repeated mea-
sures and allows estimation of complex carry-over effects. Related work in-
cludes: a) Cruz N.A., Melo O.O., Martinez C.A. (2023). ``CrossCarry: An R pack-
age for the analysis of data from a crossover de-
sign with GEE''. <arXiv:2304.02440v1>. b) Cruz N.A., Melo O.O., Mar-
tinez C.A. (2023). ``A correlation structure for the analysis of Gaussian and non-Gaussian re-
sponses in crossover experimental designs with repeated measures''. <doi:10.1007/s00362-022-
01391-z> and c) Cruz N.A., Melo O.O., Martinez C.A. (2023). ``Semiparametric generalized es-
timating equations for repeated measurements in cross-over de-
signs''. <doi:10.1177/09622802231158736>.
License GPL (>= 3)
Encoding UTF-8
LazyData true
Depends R (>= 4.0)
Imports dplyr, gee, geepack, ggplot2, splines, stats
Suggests testthat (>= 3.0.0)
Config/testthat/edition 3
RoxygenNote 7.2.3
NeedsCompilation no
Author Nelson Alirio Cruz Gutierrez [aut, cre, cph],
Oscar Orlando Melo [aut],
Carlos Alberto Martinez [aut]
Maintainer Nelson Alirio Cruz Gutierrez <neacruzgu@unal.edu.co>
Repository CRAN
Date/Publication 2023-04-11 08:00:02 UTC

1
2 Arterial

R topics documented:
Arterial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
createCarry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
CrossGEE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
CrossGEEKron . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
CrossGEESP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Water . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

Index 11

Arterial Arterial pressure data of crossover design

Description
Data of a crossover experiment with three treatments to control arterial pressure: treatment A is a
placebo, treatments B and C are 20 and 40 mg doses of a test drug. Thus, there were six three-
period sequences: ABC, ACB, BCA, BAC, CAB and CBA, each one of them was applied to two
individuals lasting six weeks each. Due to ethical reasons, there was no washout period between the
treatments. In each period, 10 consecutive measurements of diastolic arterial pressure were taken:
30 and 15 minutes before, and 15, 30, 45, 60, 75, 90, 120 and 240 minutes after the administration
of the treatment

Usage
Arterial

Format
A data frame with 360 rows and 5 columns:

Subject The unique identifier of each of the patients


Period The period of application of each treatment
Treatment A is a placebo, treatments B and C are 20 and 40 mg doses of a test drug
Pressure diastolic arterial pressure
Time Measurement time

Source
Jones, B. and Kenward, M. G. (2015). Design and Analysis of Cross-Over Trials Third Edition.
Chapman & Hall/CRC, Boca Raton
createCarry 3

createCarry Add carryover dummy variables

Description

Create dummy variables associated with first-order carryover effect in a Crossover Design

Usage

createCarry(data, treatment, period, id, carrySimple = TRUE)

Arguments

data A data frame with the variables 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
period A character string specifying the name of vector with the observation period of
the responses of the crossover experimental design
id A character string specifying the name of vector which identifies the experimen-
tal units.
carrySimple TRUE = simple carry-over, where the residual effect of a treatment affects equally
each of the treatments that are preceded by it, and FALSE = carry-over complex,
where the residual effect of the treatment affects each of the other treatments
differently.

Value

data A data frame with all the variables of the crossover experimental design and the carryover
variables
carryover The new carryover variables

Examples
data(Water)
carryover <- createCarry(data=Water,
treatment = "Treatment", id = "ID",
period = "Period", carrySimple = FALSE)
carryover$carryover
carryover$data
4 CrossGEE

CrossGEE Run a GEE model for data from a crossover experiment

Description
Provides a GEE model for the data of a crossover design with S sequences of T periods. There must
be one observation of each experimental unit in each period.

Usage
CrossGEE(
response,
period,
treatment,
id,
carry,
covar = NULL,
data,
family = gaussian(),
correlation = "independence",
formula = NULL
)

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 experimen-
tal 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 con-
tiguous 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.
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 glm
correlation a character string specifying the correlation structure. The following are permit-
ted: "independence", "exchangeable", "ar1" and "unstructured"
CrossGEEKron 5

formula A formula related the response variable with the explanatory variables. If it is
NULL, formula response~period+treatment+carry+covar will be evaluated

Value
QIC The QIC of the models: The model are fitted by geeglm
model The model fitted by geeglm.

Examples
data(Water)
model <- CrossGEE(response="LCC", covar=c("Age"), period="Period",
treatment = "Treatment", id="ID", carry="Carry_Agua",
family=gaussian(),correlation ="ar1" ,data=Water)

model$QIC
model$model

summary(model$model)

CrossGEEKron 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 = 1e-04,
niter = 100
)
6 CrossGEEKron

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 experimen-
tal 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 con-
tiguous 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 glm.
correlation character string specifying the correlation within periods structure. The follow-
ing are permitted: "independence", "exchangeable", "ar1" and "unstructured".
formula A formula related the response variable with the explanatory variables. If it is
NULL the formula, response~period+treatment+carry+time+covar will be
evaluated
tol the tolerance used in the fitting algorithm.
niter the maximum number of iterations. response~period+treatment+carry+time+covar
will be evaluated

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/s00362-022-01391-z

References
Cruz, N.A., Melo, O.O. & Martinez, C.A. A correlation structure for the analysis of Gaussian
and non-Gaussian responses in crossover experimental designs with repeated measures. Statistical
Papers (2023), 1–28.
CrossGEESP 7

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)

CrossGEESP Run a semi-parametric GEE model for data from a crossover experi-
ment 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. The effect of time within
period and the possible carryover effects are modeled by means of splines.

Usage
CrossGEESP(
response,
period,
treatment,
id,
time,
carry,
covar = NULL,
data,
8 CrossGEESP

family = gaussian,
correlation = "independence",
formula = NULL,
tol = 1e-04,
niter = 100,
nodes = NULL
)

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 experimen-
tal 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 con-
tiguous 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 glm
correlation character string specifying the correlation within periods structure. The follow-
ing are permitted: "independence", "exchangeable", "ar1" and "unstructured"
formula A formula related the response variable with the explanatory variables. If it is
NULL, formula response~period+treatment+carry+time+covar will be eval-
uated.
tol the tolerance used in the fitting algorithm.
niter the maximum number of iterations.
nodes Number of nodes in the estimation of the splines. By default, the base 2 loga-
rithm of the number of observations per period is used.

Value
QIC The QIC of the model: The model are fitted by geeglm
model The model fitted by geeglm.
Water 9

graphs The graphs estimated by splines. In position 1 the graph of the effect of time appears and
from then on, it appears one for each carryover effect declared in the carry option. The graphs are
built with ggplot2, therefore they allow manipulation of axes and other graphic parameters of that
library.

Source

https://doi.org/10.1177/09622802231158736

References

Cruz Gutierrez NA, Melo OO, Martinez CA. Semiparametric generalized estimating equations for
repeated measurements in cross-over designs. Statistical Methods in Medical Research. 2023;0(0).

Examples
data(Arterial)

carrydata <- createCarry(data=Arterial, treatment = "Treatment",


period = "Period",id="Subject", carrySimple = FALSE)
data <- carrydata$data
carry <- carrydata$carryover
model1 <- CrossGEESP(response = "Pressure", treatment = "Treatment",
period = "Period", id="Subject", time="Time",
carry=carrydata$carryover,data=data,
correlation = "exchangeable")

model2 <- CrossGEESP(response = "Pressure", treatment = "Treatment",


period = "Period", id="Subject", time="Time",
carry=carrydata$carryover,data=data, correlation = "ar1")

model1$QIC
model2$QIC
summary(model1$model)
summary(model2$model)
model1$graph[[1]]
model1$graph[[2]]
plot <- model1$graph[[1]] + ggplot2::xlab("Time in minutes")+
ggplot2::ylab("Change in systolic blood pressure")
plot

Water Water student data of crossover design


10 Water

Description
A pilot study to investigate the impact of providing supplementary drinking water on the cognitive
performance of pupils of two school grades (5 and 6) in water-scarce schools in rural Mali. 47
students were assigned to take the control treatment (normal conditions) on the first day and receive
the treatment (controlled hydration) on the second day. 60 received the treatments in reverse (Hy-
dration the first day and control the second day). One part of this test assesses visual attention. This
test assesses visual attention. Pupils were given a grid containing target letters randomly dispersed
among non-target letters and were given one minute to cross out as many target letters as possible.
Scores were calculated by subtracting the number of non-target letters identified from the number
of target letters identified; the maximum test score was 38.

Usage
Water

Format
A data frame with 214 rows and 10 columns:
ID The unique identifier of each of the students
Age The age in years of each of the students
LCS Letter Cancel incorrect (raw score)
LCC Letter Cancel correct (raw score)
LCI Letter Cancel score (LCC-LCI)
sex f=female, 1=male
school school indicator A or B
Treatment Condition indicator 0=Control 1=Water
Period date of visit
Carry_Agua Carry indicator 0=First period, 1=Water in the first period, -1 = Control in the first
period

Source
<https://journals.plos.org/plosone/article/authors?id=10.1371/journal.pone.0210568>
Index

∗ datasets
Arterial, 2
Water, 9

Arterial, 2

createCarry, 3
CrossGEE, 4
CrossGEEKron, 5
CrossGEESP, 7

Water, 9

11

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy