Skip to content

Commit

Permalink
SH: Preparing for release
Browse files Browse the repository at this point in the history
  • Loading branch information
hojsgaard committed Sep 29, 2022
1 parent e8bfe9b commit 4a5ee4c
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 33 deletions.
6 changes: 3 additions & 3 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 1.3.8
Date: 2022-08-16 03:34:46 UTC
SHA: e2ebf823a279f0fec0351964321b2aec8c3a0b62
Version: 1.3.9
Date: 2022-08-16 07:10:15 UTC
SHA: e8bfe9b9a5e45a270940b1cbc3555361956f5b5e
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: geepack
Version: 1.3.9
Version: 1.3.10
Title: Generalized Estimating Equation Package
Authors@R: c(
person(given = "Søren", family = "Højsgaard",
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# geepack v1.3.10 (2022-09-29)

* Update of vignette.

# geepack v1.3.9 (2022-08-16)

* QIC now takes environment argument because the function is called from another function in another package.
Expand Down
63 changes: 34 additions & 29 deletions vignettes/geepack-manual.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ prettyVersion <- packageDescription("geepack")$Version
prettyDate <- format(Sys.Date())
@

\SweaveOpts{keep.source=T,prefix.string=figures/LSmeans}
%% ,prefix.string=figures/geepack

\SweaveOpts{keep.source=T}

\title{On the usage of the \texttt{geepack} }
\author{S\o ren H\o jsgaard and Ulrich Halekoh}
\date{\pkg{geepack} version \Sexpr{prettyVersion} as of \Sexpr{prettyDate}}


\begin{document}
\SweaveOpts{concordance=TRUE}

\parindent0pt\parskip4pt

Expand All @@ -49,15 +52,13 @@ prettyDate <- format(Sys.Date())

\section{Introduction}
\label{sec:introduction}
\label{sec:intro}

This note contains a few extra examples. We illustrate the usage of a
the |waves| argument and the |zcor| argument together with a fixed
working correlation matrix for the |geeglm()| function.


\label{sec:intro}


\section{Citing \texttt{geepack}}
\subsection{Citing \texttt{geepack}}


The primary reference for the |geepack| package is
Expand All @@ -78,6 +79,20 @@ citation("geepack")
If you use |geepack| in your own work, please do cite the above
reference.

\subsection{When do GEE's work best?}
\label{sec:when-do-gees}


\begin{enumerate}
\item GEEs work best when you have relatively many relatively small clusters of about equal size in your data.

\item If all your clusters are of size one you should not use GEEs; if all clusters are of size one a GEE corresponds to a generalized linear model.

\item If you only have very few clusters (and in the extreme case only one cluster) you are likely to encounter numerical difficulties.
\end{enumerate}

NOTICE: Care must be taken with respect to the order in which the clusters appear in the dataset. See Section \ref{sec:waves} for details.


\section{Simulating a dataset}
\label{sec:simulating}
Expand All @@ -86,18 +101,21 @@ reference.
To illustrate the usage of
the |waves| argument and the |zcor| argument together with a fixed
working correlation matrix for the |geeglm()|
we simulate some data suitable for a regression model.
we simulate data suitable for a regression model.

@
<<>>=
library(geepack)
timeorder <- rep(1:5, 6)
n_cluster <- 6
n_time <- 5
set.seed(1213)
timeorder <- rep(1:n_time, n_cluster)
tvar <- timeorder + rnorm(length(timeorder))
idvar <- rep(1:6, each=5)
uuu <- rep(rnorm(6), each=5)
yvar <- 1 + 2*tvar + uuu + rnorm(length(tvar))
idvar <- rep(1:n_cluster, each=n_time)
uuu <- rep(rnorm(n_cluster), each=n_time) # A 'random intercept'
yvar <- 1 + 2 * tvar + uuu + rnorm(length(tvar))
simdat <- data.frame(idvar, timeorder, tvar, yvar)
head(simdat,12)
head(simdat, 12)
@ %def

Notice that clusters of data appear together in |simdat| and that
Expand All @@ -116,7 +134,7 @@ each subject in the dataset.


\section{Using the \texttt{waves} argument}
\label{sec:xxx}
\label{sec:waves}


If observatios were not ordered according to cluster and time within
Expand All @@ -126,18 +144,15 @@ wrong result:
@
<<>>=
set.seed(123)
## library(doBy)
simdatPerm <- simdat[sample(nrow(simdat)),]
## simdatPerm <- orderBy(~idvar, simdatPerm)
simdatPerm <- simdatPerm[order(simdatPerm$idvar),]
head(simdatPerm)
@ %def

Notice that in |simdatPerm| data is ordered according to subject but
the time ordering within subject is random.

Fitting the model as
before gives
Fitting the model as before gives

@
<<>>=
Expand All @@ -150,12 +165,11 @@ wrong result (the clusters are not recognized):

@
<<>>=
## simdatPerm2 <- orderBy(~timeorder, data=simdat)
simdatPerm2 <- simdat[order(simdat$timeorder),]
head(simdatPerm2)
geeglm(yvar~tvar, id=idvar, data=simdatPerm2, corstr="ar1")
@ %def


To obtain the right result we must give the |waves| argument:

@
Expand All @@ -167,7 +181,7 @@ mod3
@ %def

\section{Using a fixed correlation matrix and the \texttt{zcor} argument}
\label{sec:xxx}
\label{sec:zcor}

Suppose we want to use a fixed working correlation matrix:

Expand Down Expand Up @@ -202,13 +216,4 @@ mod4 <- geeglm(yvar~tvar, id=idvar, data=simdatPerm, corstr="fixed", zcor=zcor)
mod4
@ %def


\section{When do GEE's work best?}
\label{sec:when-do-gees}

GEEs work best when you have relatively many relativly small clusters in your data.




\end{document}

0 comments on commit 4a5ee4c

Please sign in to comment.