Mathemagician777
Mathemagician777

Reputation: 101

How to analyse a non-inferiority trial using GEE in R?

I'm trying to analyse a non-inferiority trial in R. Since there are correlated observations and a population averaged interpretation seems fine, I want to use GEE.

To illustrate my problem, I will use the muscatine data that is embedded in the gee package in R. The research question can be as follows, I want to investigate if the male participants in the muscatine data have a non-inferior obesity level compared to the females (so equivalent to testing if 'males' is a new, non-inferior drug compared to the standard drug 'females')

The outcome 'obese' and variable 'gender' are both binary, age and occasion are controlled for and continuous (not important tho)

I used the following code:

library(gee)
data(muscatine)

data2 <- muscatine
data2$obese <- ifelse(muscatine$obese == 'yes', 0, 1)

x <- gee(obese ~ gender + age + occasion, id = id, family = binomial, corstr = "exchangeable", data = data2)
summary(x)

This gives me the following output concerning the coefficients:

Coefficients:
            Estimate Naive S.E. Naive z Robust S.E. Robust z
(Intercept)   1.7846     0.1152   15.49      0.1116    16.00
genderF      -0.1521     0.0620   -2.45      0.0626    -2.43
age          -0.0296     0.0113   -2.63      0.0110    -2.68
occasion     -0.0377     0.0298   -1.27      0.0310    -1.22

Thanks in advance to the savior!

Upvotes: 0

Views: 319

Answers (1)

IRTFM
IRTFM

Reputation: 263362

I retracted my closevote, because I think the issue lies in the OP not knowing how to set up an offset term in an R regression formula, so that's an R-centric problem and might be refused by stats.SE. An offset is a parameter in a model that is assumed to be measured with no uncertainty and is typically used to test against an H_0 other than 0. The other consideration in using offsets in R (and any modeling software with GLM's is that the offset needs to be entered with the link function in mind, so with a binomial model the offset needs to be the log of the effect size hypothesized in hte non-transformed data.

(Another issue with the code presented was that muscatine is not a data element in pkg:gee but rather in pkg:geepack)

if(!require(gee)){install.packages("gee"); library(gee)}
if(!require(geepack)){install.packages("geepack"); library(geepack)} # for muscatine
 
 data2 <- muscatine
 data2$obese <- ifelse(muscatine$obese == 'yes', 0, 1)
# add offset term with log of hypothesized H_0
 x <- gee(obese ~ gender + age + occasion+offset(rep(log(0.1), nrow(data2))), id = id, family = binomial, corstr = "exchangeable", data = data2)
#-----message from gee() --------
Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27
running glm to get initial regression estimate
(Intercept)     genderF         age    occasion 
 4.00334630 -0.12601405 -0.02556356 -0.01632539 

 summary(x)
#---------output begins here----------------
 GEE:  GENERALIZED LINEAR MODELS FOR DEPENDENT DATA
 gee S-function, version 4.13 modified 98/01/27 (1998) 

Model:
 Link:                      Logit 
 Variance to Mean Relation: Binomial 
 Correlation Structure:     Exchangeable 

Call:
gee(formula = obese ~ gender + age + occasion + offset(rep(log(0.1), 
    nrow(data2))), id = id, data = data2, family = binomial, 
    corstr = "exchangeable")

Summary of Residuals:
        Min          1Q      Median          3Q         Max 
-0.97960924  0.02160615  0.02569267  0.02857506  0.03592698 


Coefficients:
              Estimate Naive S.E.   Naive z Robust S.E.  Robust z
(Intercept)  4.0872254 0.11518402 35.484310  0.11155396 36.638999
genderF     -0.1520871 0.06198955 -2.453431  0.06261391 -2.428966
age         -0.0295689 0.01126046 -2.625906  0.01102506 -2.681973
occasion    -0.0377399 0.02983178 -1.265090  0.03096084 -1.218956

Estimated Scale Parameter:  0.990456
Number of Iterations:  3

Working Correlation
          [,1]      [,2]      [,3]
[1,] 1.0000000 0.5400174 0.5400174
[2,] 0.5400174 1.0000000 0.5400174
[3,] 0.5400174 0.5400174 1.0000000

Upvotes: 0

Related Questions