Description Usage Arguments Details Value Author(s) References See Also Examples
wgee
fits weighted generalized estimating equations (WGEE) with Newton Raphson algorithm. wgee
has a syntax similar to glm
and returns an object similar to a glm
object.
1 |
model |
an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. |
data |
a data frame containing the variables in the model. |
id |
a vector which identifies the clusters. The length of "id" should be the same as the number of observations. Data are assumed to be sorted so that observations on a cluster are contiguous rows for all entities in the formula. |
family |
a description of the error distribution and link function to be used in the model. This is a character string naming a family function. The following are permitted: "gaussian", "binomial", "poisson". |
corstr |
a character string specifies the working correlation structure. The following are permitted: "independence", "exchangeable", "ar1","unstructured". |
scale |
a numeric variable giving the value to which the scale parameter should be fixed; if NA, the scale parameter is not fixed. |
mismodel |
an object of class "formula" (or one that can be coerced to that class): a symbolic description of the missingness model to be fitted. |
maxit |
maximum iteration number for Newton-Raphson algorithm. |
tol |
the tolorance for the Newton-Raphson algorithm to converge. |
wgee
analyzes longitudinal data with missing values by weighted genralized estimating equations (WGEE), proposed by Robins, Totnizky and Zhao (1995). WGEE can handle missing at random problem. The standard error of the estimates are calculated as described in (Fitzmaurice, Laird, and Ware, 2011) and Preisser, Lohman, and Rathouz (2002).
beta |
covariate effect estimates |
var |
variance covariances estimates for beta |
w_r_square |
weighted R square for continuous data |
mu_fit |
fitted values of response |
scale |
scale estimates |
rho |
rho estimates |
weight |
The weight of response y |
model |
WGEE model structure |
x |
covariates in WGEE |
y |
response in WGEE |
mis_fit |
esimates of the missingness model |
call |
the function to be called |
id |
as input |
data |
as input |
family |
as input |
corstr |
as input |
Zheng Li, Cong Xu and Ming Wang
Fitzmaurice, G.M., Laird, N.M. and Ware, J.H., 2012. Applied longitudinal analysis (Vol. 998). John Wiley & Sons.
Liang, K.Y. and Zeger, S.L., 1986. Longitudinal data analysis using generalized linear models. Biometrika, pp.13-22.
Preisser, J.S., Lohman, K.K. and Rathouz, P.J., 2002. Performance of weighted estimating equations for longitudinal binary data with drop-outs missing at random. Statistics in medicine, 21(20), pp.3035-3054.
Robins, J.M., Rotnitzky, A. and Zhao, L.P., 1995. Analysis of semiparametric regression models for repeated outcomes in the presence of missing data. Journal of the American Statistical Association, 90(429), pp.106-121.
Rubin, D.B., 1976. Inference and missing data. Biometrika, pp.581-592.
geeglm
(geepack)
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 37 38 | ####Example1
data(imps)
fit <- wgee(IMPS79 ~ Drug+Sex+Time, data=imps, id=imps$ID, family="gaussian",
corstr="exchangeable", scale=NULL, mismodel= R ~ Drug+Time)
#####Example2
data(seizure)
###reshapre the seizure data to "long" format
seiz.long <- reshape(seizure,
varying=list(c("base","y1", "y2", "y3", "y4")),
v.names="y", times=0:4, direction="long")
seiz.long <- seiz.long[order(seiz.long$id, seiz.long$time),]
###create missing value for seiz.long dataset
set.seed(12345)
obs <- exp(9+seiz.long$age*(-0.2))/(1+exp(9+seiz.long$age*(-0.2)))
R <- lapply(unique(seiz.long$id),function(x){
idx=which(seiz.long$id==x)
r=c()
r[1]=1
for(j in 2:length(idx)){
if(r[j-1]==1){
r[j]=rbinom(1,1,obs[idx[j]])
}
else r[j]=0
}
return(r)
})
remove_id <- which(sapply(R,sum)==1)
remove_idx <- which(seiz.long$id %in% remove_id==1)
seiz.long <- cbind(seiz.long,R=unlist(R))[-remove_idx,]
seiz.long$y_mis <- ifelse(seiz.long$R,seiz.long$y,NA)
###fit WGEE, not run ###
fit <- wgee(y_mis ~ age + trt + time, data=seiz.long, id=seiz.long$id,family="poisson",
corstr="exchangeable",scale=NULL, mismodel= R ~ age)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.