Binary files /tmp/tmpe1yWSp/fZKVysurZs/r-cran-geepack-1.3-1/build/vignette.rds and /tmp/tmpe1yWSp/pXjo6nLBsf/r-cran-geepack-1.3-2/build/vignette.rds differ diff -Nru r-cran-geepack-1.3-1/ChangeLog r-cran-geepack-1.3-2/ChangeLog --- r-cran-geepack-1.3-1/ChangeLog 2019-12-12 21:42:42.000000000 +0000 +++ r-cran-geepack-1.3-2/ChangeLog 2020-12-13 05:15:02.000000000 +0000 @@ -1,3 +1,9 @@ +2019-12-18 Søren Højsgaard + + * Improved doc of dietox. + + + 2019-12-10 Søren Højsgaard * PROTECT / UNPROTECT imbalance fixed diff -Nru r-cran-geepack-1.3-1/debian/changelog r-cran-geepack-1.3-2/debian/changelog --- r-cran-geepack-1.3-1/debian/changelog 2020-05-31 06:14:55.000000000 +0000 +++ r-cran-geepack-1.3-2/debian/changelog 2021-01-15 19:07:57.000000000 +0000 @@ -1,14 +1,13 @@ -r-cran-geepack (1.3-1-1build2) groovy; urgency=medium +r-cran-geepack (1.3-2-1) unstable; urgency=medium - * No-change rebuild against r-api-4.0 + * Team upload. + * New upstream version + * Standards-Version: 4.5.1 (routine-update) + * debhelper-compat 13 (routine-update) + * Add salsa-ci file (routine-update) + * Rules-Requires-Root: no (routine-update) - -- Steve Langasek Sun, 31 May 2020 06:14:55 +0000 - -r-cran-geepack (1.3-1-1build1) focal; urgency=medium - - * No-change rebuild for libgcc-s1 package name change. - - -- Matthias Klose Sun, 22 Mar 2020 16:55:42 +0100 + -- Andreas Tille Fri, 15 Jan 2021 20:07:57 +0100 r-cran-geepack (1.3-1-1) unstable; urgency=medium diff -Nru r-cran-geepack-1.3-1/debian/control r-cran-geepack-1.3-2/debian/control --- r-cran-geepack-1.3-1/debian/control 2020-05-31 06:14:55.000000000 +0000 +++ r-cran-geepack-1.3-2/debian/control 2021-01-15 19:07:57.000000000 +0000 @@ -1,20 +1,20 @@ Source: r-cran-geepack -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Debian R Packages Maintainers +Maintainer: Debian R Packages Maintainers Uploaders: Chris Lawrence Section: gnu-r Testsuite: autopkgtest-pkg-r Priority: optional -Build-Depends: debhelper-compat (= 12), +Build-Depends: debhelper-compat (= 13), dh-r, r-base-dev, r-cran-mass, r-cran-broom, r-cran-magrittr -Standards-Version: 4.4.1 +Standards-Version: 4.5.1 Vcs-Browser: https://salsa.debian.org/r-pkg-team/r-cran-geepack Vcs-Git: https://salsa.debian.org/r-pkg-team/r-cran-geepack.git Homepage: https://cran.r-project.org/package=geepack +Rules-Requires-Root: no Package: r-cran-geepack Architecture: any diff -Nru r-cran-geepack-1.3-1/debian/salsa-ci.yml r-cran-geepack-1.3-2/debian/salsa-ci.yml --- r-cran-geepack-1.3-1/debian/salsa-ci.yml 1970-01-01 00:00:00.000000000 +0000 +++ r-cran-geepack-1.3-2/debian/salsa-ci.yml 2021-01-15 19:07:57.000000000 +0000 @@ -0,0 +1,4 @@ +--- +include: + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml diff -Nru r-cran-geepack-1.3-1/DESCRIPTION r-cran-geepack-1.3-2/DESCRIPTION --- r-cran-geepack-1.3-1/DESCRIPTION 2019-12-13 05:40:17.000000000 +0000 +++ r-cran-geepack-1.3-2/DESCRIPTION 2020-12-18 06:20:11.000000000 +0000 @@ -1,5 +1,5 @@ Package: geepack -Version: 1.3-1 +Version: 1.3-2 Title: Generalized Estimating Equation Package Authors@R: c( person(given = "Søren", family = "Højsgaard", @@ -22,11 +22,11 @@ NeedsCompilation: yes Depends: R (>= 3.5.0), methods Imports: MASS, broom, magrittr -RoxygenNote: 7.0.1 -Packaged: 2019-12-12 21:44:03 UTC; sorenh +RoxygenNote: 7.1.1 +Packaged: 2020-12-17 16:53:19 UTC; sorenh Author: Søren Højsgaard [aut, cre, cph], Ulrich Halekoh [aut, cph], Jun Yan [aut, cph], Claus Ekstrøm [ctb] Repository: CRAN -Date/Publication: 2019-12-13 05:40:17 UTC +Date/Publication: 2020-12-18 06:20:11 UTC Binary files /tmp/tmpe1yWSp/fZKVysurZs/r-cran-geepack-1.3-1/inst/doc/geepack-manual.pdf and /tmp/tmpe1yWSp/pXjo6nLBsf/r-cran-geepack-1.3-2/inst/doc/geepack-manual.pdf differ diff -Nru r-cran-geepack-1.3-1/inst/doc/geepack-manual.R r-cran-geepack-1.3-2/inst/doc/geepack-manual.R --- r-cran-geepack-1.3-1/inst/doc/geepack-manual.R 2019-12-12 21:44:03.000000000 +0000 +++ r-cran-geepack-1.3-2/inst/doc/geepack-manual.R 2020-12-17 16:53:19.000000000 +0000 @@ -1,5 +1,4 @@ ### R code from vignette source 'geepack-manual.Rnw' -### Encoding: UTF-8 ################################################### ### code chunk number 1: geepack-manual.Rnw:16-19 diff -Nru r-cran-geepack-1.3-1/man/compCoef.Rd r-cran-geepack-1.3-2/man/compCoef.Rd --- r-cran-geepack-1.3-1/man/compCoef.Rd 2017-04-12 14:20:30.000000000 +0000 +++ r-cran-geepack-1.3-2/man/compCoef.Rd 2020-12-13 06:10:37.000000000 +0000 @@ -1,48 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/geese.R \name{compCoef} \alias{compCoef} -\title{ -Compare Regression Coefficiente between Nested Models -} -\description{ -Comparing regression coefficients between models -when one model is nested within another for clustered data. -} +\title{Compare Regression Coefficiente between Nested Models} \usage{ compCoef(fit0, fit1) } \arguments{ - \item{fit0}{ - a fitted object of class \code{geese} - } - \item{fit1}{ - another fitted object of class \code{geese} - } +\item{fit0}{a fitted object of class \code{geese}} + +\item{fit1}{another fitted object of class \code{geese}} } \value{ - a list of two components: - \item{delta}{estimated difference in the coefficients of common - covariates from \code{fit0} and \code{fit1}} - \item{variance}{estimated variance matrix of delta} +a list of two components: \item{delta}{estimated difference + in the coefficients of common covariates from \code{fit0} and + \code{fit1}} \item{variance}{estimated variance matrix of + delta} } -\references{ - Allison, P. D. (1995). The impact of random predictors on comparisons - of coefficients between models: Comment on Clogg, Petkova, and - Haritou. \emph{American Journal of Sociology}, \bold{100}(5), - 1294--1305. - - Clogg, C. C., Petkova, E., and Haritou, A. (1995). Statistical methods - for comparing regression coefficients between models. - \emph{American Journal of Sociology}, \bold{100}(5), 1261--1293. - - Yan, J., Aseltine, R., and Harel, O. (2011). Comparing Regression - Coefficients Between Nested Linear Models for Clustered Data with - Generalized Estimating Equations. \emph{Journal of Educational and - Behaviorial Statistics}, Forthcoming. -} -\author{ - Jun Yan \email{jyan.stat@gmail.com} +\description{ +Comparing regression coefficients between models when one model is nested +within another for clustered data. } \examples{ + ## generate clustered data gendat <- function(ncl, clsz) { ## ncl: number of clusters @@ -67,5 +47,24 @@ fit0 <- geese(y ~ x1, id = id, data = simdat, corstr = "un") fit1 <- geese(y ~ x1 + x2, id = id, data = simdat, corstr = "un") compCoef(fit0, fit1) + +} +\references{ +Allison, P. D. (1995). The impact of random predictors + on comparisons of coefficients between models: Comment on + Clogg, Petkova, and Haritou. \emph{American Journal of + Sociology}, \bold{100}(5), 1294--1305. + +Clogg, C. C., Petkova, E., and Haritou, A. (1995). Statistical methods for +comparing regression coefficients between models. \emph{American Journal of +Sociology}, \bold{100}(5), 1261--1293. + +Yan, J., Aseltine, R., and Harel, O. (2011). Comparing Regression +Coefficients Between Nested Linear Models for Clustered Data with +Generalized Estimating Equations. \emph{Journal of Educational and +Behaviorial Statistics}, Forthcoming. +} +\author{ +Jun Yan \email{jyan.stat@gmail.com} } \keyword{models} diff -Nru r-cran-geepack-1.3-1/man/dietox.Rd r-cran-geepack-1.3-2/man/dietox.Rd --- r-cran-geepack-1.3-1/man/dietox.Rd 2019-12-11 06:40:37.000000000 +0000 +++ r-cran-geepack-1.3-2/man/dietox.Rd 2020-12-13 05:42:08.000000000 +0000 @@ -4,18 +4,20 @@ \name{dietox} \alias{dietox} \title{Growth curves of pigs in a 3x3 factorial experiment} -\format{This data frame contains the following columns: +\format{ +This data frame contains the following columns: \describe{ -\item{Weight}{Weight} -\item{Feed}{Cumulated feed intake} +\item{Weight}{Weight in Kg} +\item{Feed}{Cumulated feed intake in Kg} \item{Time}{Time (in weeks) in the experiment} -\item{Pig}{Id of each pig} -\item{Evit}{Vitamin E dose} -\item{Cu}{Copper dose} +\item{Pig}{Factor; id of each pig} +\item{Evit}{Factor; vitamin E dose; see 'details'.} +\item{Cu}{Factor, copper dose; see 'details'} \item{Start}{Start weight in experiment, i.e. weight at week 1.} -\item{Litter}{Id of litter of each pig} -}} +\item{Litter}{Factor, id of litter of each pig} +} +} \source{ Lauridsen, C., Højsgaard, S.,Sørensen, M.T. C. (1999) Influence of Dietary Rapeseed Oli, Vitamin E, and Copper on Performance and @@ -38,9 +40,14 @@ \examples{ data(dietox) -str(dietox) ; -plot(dietox) - - +head(dietox) +\dontrun{ +if (require(ggplot2)){ + qplot(Time, Weight, data=dietox, col=Pig) + geom_line() + + theme(legend.position = "none") + facet_grid(Evit~Cu) +} else { + coplot(Weight ~ Time | Evit * Cu, data=dietox) +} +} } \keyword{datasets} diff -Nru r-cran-geepack-1.3-1/man/fixed2Zcor.Rd r-cran-geepack-1.3-2/man/fixed2Zcor.Rd --- r-cran-geepack-1.3-1/man/fixed2Zcor.Rd 2019-07-30 04:42:25.000000000 +0000 +++ r-cran-geepack-1.3-2/man/fixed2Zcor.Rd 2020-12-13 05:33:09.000000000 +0000 @@ -48,8 +48,6 @@ mod4 <- geeglm(yvar~tvar, id=idvar, data=simdatPerm, corstr="fixed", zcor=zcor) mod4 - - } \seealso{ \code{\link{genZcor}}, \code{\link{geeglm}} diff -Nru r-cran-geepack-1.3-1/man/geese.control.Rd r-cran-geepack-1.3-2/man/geese.control.Rd --- r-cran-geepack-1.3-1/man/geese.control.Rd 2017-04-12 14:20:30.000000000 +0000 +++ r-cran-geepack-1.3-2/man/geese.control.Rd 2020-12-13 06:10:37.000000000 +0000 @@ -1,41 +1,57 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/geese.R \name{geese.control} \alias{geese.control} -%- Also NEED an `\alias' for EACH other topic documented here. \title{Auxiliary for Controlling GEE Fitting} -\description{ - Auxiliary function as user interface for `gee' fitting. Only used when - calling `geese' or `geese.fit'. -} \usage{ -geese.control(epsilon = 1e-04, maxit = 25, trace = FALSE, - scale.fix = FALSE, jack = FALSE, j1s = FALSE, fij = FALSE) +geese.control( + epsilon = 1e-04, + maxit = 25, + trace = FALSE, + scale.fix = FALSE, + jack = FALSE, + j1s = FALSE, + fij = FALSE +) } -%- maybe also `usage' for other objects documented here. \arguments{ - \item{epsilon}{positive convergence tolerance epsilon; the iterations - converge when the absolute value of the difference in parameter - estimate is below \code{epsilon}.} - \item{maxit}{integer giving the maximal number of Fisher Scoring iteration.} - \item{trace}{logical indicating if output should be produced for each iteration.} - \item{scale.fix}{logical indicating if the scale should be fixed.} - \item{jack}{logical indicating if approximate jackknife variance - estimate should be computed.} - \item{j1s}{logical indicating if 1-step jackknife variance estimate - should be computed.} - \item{fij}{logical indicating if fully iterated jackknife variance - estimate should be computed.} +\item{epsilon}{positive convergence tolerance epsilon; the +iterations converge when the absolute value of the difference +in parameter estimate is below \code{epsilon}.} + +\item{maxit}{integer giving the maximal number of Fisher Scoring +iteration.} + +\item{trace}{logical indicating if output should be produced for +each iteration.} + +\item{scale.fix}{logical indicating if the scale should be fixed.} + +\item{jack}{logical indicating if approximate jackknife variance +estimate should be computed.} + +\item{j1s}{logical indicating if 1-step jackknife variance estimate +should be computed.} + +\item{fij}{logical indicating if fully iterated jackknife variance +estimate should be computed.} +} +\value{ +A list with the arguments as components. +} +\description{ +Auxiliary function as user interface for `gee' fitting. Only used when +calling `geese' or `geese.fit'. } \details{ - When `trace' is true, output for each iteration is printed to the - screen by the c++ code. Hence, `options(digits = *)' does not control - the precision. +When `trace' is true, output for each iteration is printed to the screen by +the c++ code. Hence, `options(digits = *)' does not control the precision. } -\value{ - A list with the arguments as components. +\seealso{ +`geese.fit', the fitting procedure used by `geese'. +} +\author{ +Jun Yan \email{jyan.stat@gmail.com} } -\author{Jun Yan \email{jyan.stat@gmail.com} } -\seealso{`geese.fit', the fitting procedure used by `geese'.} -% \examples{ -% } -\keyword{optimize} \keyword{models} +\keyword{optimize} diff -Nru r-cran-geepack-1.3-1/man/geese.Rd r-cran-geepack-1.3-2/man/geese.Rd --- r-cran-geepack-1.3-1/man/geese.Rd 2019-12-07 22:50:01.000000000 +0000 +++ r-cran-geepack-1.3-2/man/geese.Rd 2020-12-13 07:18:13.000000000 +0000 @@ -1,168 +1,160 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/geese.R \name{geese} \alias{geese} \alias{geese.fit} \alias{print.geese} \alias{summary.geese} \alias{print.summary.geese} -\title{Function to solve a Generalized Estimating Equation Model} -\description{ - Produces an object of class `geese' which is a Generalized Estimating - Equation fit of the data. -} +\title{Function to fit a Generalized Estimating Equation Model} \usage{ -geese(formula = formula(data), sformula = ~1, id, waves = NULL, - data = parent.frame(), subset = NULL, na.action = na.omit, - contrasts = NULL, weights = NULL, zcor = NULL, corp = NULL, - control = geese.control(...), b = NULL, alpha = NULL, gm = NULL, - family = gaussian(), mean.link = NULL, variance = NULL, - cor.link = "identity", sca.link = "identity", link.same = TRUE, - scale.fix = FALSE, scale.value = 1, corstr = "independence", ...) - -geese.fit(x, y, id, offset = rep(0, N), soffset = rep(0, N), - weights = rep(1,N), waves = NULL, zsca = matrix(1, N, 1), - zcor = NULL, corp = NULL, control = geese.control(...), - b = NULL, alpha = NULL, gm = NULL, family = gaussian(), - mean.link = NULL, variance = NULL, cor.link = "identity", - sca.link = "identity", link.same = TRUE, scale.fix = FALSE, - scale.value = 1, corstr = "independence", ...) +geese( + formula = formula(data), + sformula = ~1, + id, + waves = NULL, + data = parent.frame(), + subset = NULL, + na.action = na.omit, + contrasts = NULL, + weights = NULL, + zcor = NULL, + corp = NULL, + control = geese.control(...), + b = NULL, + alpha = NULL, + gm = NULL, + family = gaussian(), + mean.link = NULL, + variance = NULL, + cor.link = "identity", + sca.link = "identity", + link.same = TRUE, + scale.fix = FALSE, + scale.value = 1, + corstr = "independence", + ... +) } \arguments{ - \item{formula}{a formula expression as for \code{glm}, of the form - \code{response ~ predictors}. See the documentation of lm and - formula for details. As for glm, this specifies the linear predictor - for modeling the mean. A term of the form \code{offset(expression)} - is allowed. - } - \item{sformula}{a formula expression of the form \code{ ~ predictor}, - the response being ignored. This specifies the linear predictor for - modeling the dispersion. A term of the form - \code{offset(expression)} is allowed. - } - \item{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. - } - \item{waves}{an integer vector which identifies components in - clusters. The length of \code{waves} should be the same as the - number of observation. components with the same \code{waves} value - will have the same link functions. - } - \item{data}{ - an optional data frame in which to interpret the variables occurring - in the \code{formula}, along with the \code{id} and \code{n} variables. - } - \item{subset}{ - expression saying which subset of the rows of the data should be used - in the fit. This can be a logical vector (which is replicated to have - length equal to the number of observations), or a numeric vector - indicating which observation numbers are to be included, or a - character vector of the row names to be included. - All observations are included by default. - } - \item{na.action}{ - a function to filter missing data. For \code{gee} only \code{na.omit} - should be used here. - } - \item{contrasts}{ - a list giving contrasts for some or all of the factors appearing - in the model formula. The elements of the list should have the - same name as the variable and should be either a contrast matrix - (specifically, any full-rank matrix with as many rows as there are - levels in the factor), or else a function to compute such a matrix - given the number of levels. - } - \item{weights}{an optional vector of weights to be used - in the fitting process. The length of \code{weights} should be the - same as the number of observations. This weights is not (yet) the - weight as in sas proc genmod, and hence is not recommended to use. - } - \item{zcor}{a design matrix for correlation parameters.} - \item{corp}{known parameters such as coordinates used for correlation - coefficients. - } - \item{control}{a list of iteration and algorithmic constants. See - \code{\link{geese.control}} for their names and default - values. These can also be set as arguments to \code{geese} itself. - } - \item{b}{an initial estimate for the mean parameters.} - \item{alpha}{an initial estimate for the correlation parameters.} - \item{gm}{an initial estimate for the scale parameters.} - \item{family}{a description of the error distribution and link - function to be used in the model, as for \code{\link{glm}}. - } - \item{mean.link}{a character string specifying the link function for - the means. The following are allowed: - \code{"identity"}, \code{"logit"}, \code{"probit"}, - \code{"cloglog"}, \code{"log"}, and \code{"inverse"}. - The default value is determined from family. - } - \item{variance}{a character string specifying the variance function - in terms of the mean. The following are allowed: - \code{"gaussian"}, \code{"binomial"}, \code{"poisson"}, and - \code{"gamma"}. The default value is determined from family. - } - \item{cor.link}{a character string specifying the link function for - the correlation coefficients. The following are allowed: - \code{"identity"}, and \code{"fisherz"}. - } - \item{sca.link}{a character string specifying the link function for - the scales. The following are allowed: - \code{"identity"}, and \code{"log"}. - } - \item{link.same}{a logical indicating if all the components in a - cluster should use the same link. - } - \item{scale.fix}{ - a logical variable; if true, the scale parameter is fixed at - the value of \code{scale.value}. - } - \item{scale.value}{ - numeric variable giving the value to which the scale parameter - should be fixed; used only if \code{scale.fix == TRUE}. - } - \item{corstr}{ - a character string specifying the correlation structure. - The following are permitted: - \code{"independence"}, - \code{"exchangeable"}, - \code{"ar1"}, - \code{"unstructured"}, - \code{"userdefined"}, and - \code{"fixed"} - } - \item{x, y}{ - \code{x} is a design matrix of dimension \code{n * p}, and \code{y} - is a vector of observations of length \code{n}. - } - \item{offset, soffset}{ - vector of offset for the mean and for the scale, respectively. - } - \item{zsca}{ - a design matrix of dimension \code{n * r} for the scales. - } - \item{\dots}{further arguments passed to or from other methods.} +\item{formula}{a formula expression as for \code{glm}, of the form +\code{response ~ predictors}. See the documentation of lm and +formula for details. As for glm, this specifies the linear +predictor for modeling the mean. A term of the form +\code{offset(expression)} is allowed.} + +\item{sformula}{a formula expression of the form \code{ ~ +predictor}, the response being ignored. This specifies the +linear predictor for modeling the dispersion. A term of the +form \code{offset(expression)} is allowed.} + +\item{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.} + +\item{waves}{an integer vector which identifies components in +clusters. The length of \code{waves} should be the same as the +number of observation. components with the same \code{waves} +value will have the same link functions.} + +\item{data}{an optional data frame in which to interpret the +variables occurring in the \code{formula}, along with the +\code{id} and \code{n} variables.} + +\item{subset}{expression saying which subset of the rows of the +data should be used in the fit. This can be a logical vector +(which is replicated to have length equal to the number of +observations), or a numeric vector indicating which observation +numbers are to be included, or a character vector of the row +names to be included. All observations are included by +default.} + +\item{na.action}{a function to filter missing data. For \code{gee} +only \code{na.omit} should be used here.} + +\item{contrasts}{a list giving contrasts for some or all of the +factors appearing in the model formula. The elements of the +list should have the same name as the variable and should be +either a contrast matrix (specifically, any full-rank matrix +with as many rows as there are levels in the factor), or else a +function to compute such a matrix given the number of levels.} + +\item{weights}{an optional vector of weights to be used in the +fitting process. The length of \code{weights} should be the +same as the number of observations. This weights is not (yet) +the weight as in sas proc genmod, and hence is not recommended +to use.} + +\item{zcor}{a design matrix for correlation parameters.} + +\item{corp}{known parameters such as coordinates used for +correlation coefficients.} + +\item{control}{a list of iteration and algorithmic constants. See +\code{\link{geese.control}} for their names and default +values. These can also be set as arguments to \code{geese} +itself.} + +\item{b}{an initial estimate for the mean parameters.} + +\item{alpha}{an initial estimate for the correlation parameters.} + +\item{gm}{an initial estimate for the scale parameters.} + +\item{family}{a description of the error distribution and link +function to be used in the model, as for \code{\link{glm}}.} + +\item{mean.link}{a character string specifying the link function +for the means. The following are allowed: \code{"identity"}, +\code{"logit"}, \code{"probit"}, \code{"cloglog"}, +\code{"log"}, and \code{"inverse"}. The default value is +determined from family.} + +\item{variance}{a character string specifying the variance function +in terms of the mean. The following are allowed: +\code{"gaussian"}, \code{"binomial"}, \code{"poisson"}, and +\code{"gamma"}. The default value is determined from family.} + +\item{cor.link}{a character string specifying the link function for +the correlation coefficients. The following are allowed: +\code{"identity"}, and \code{"fisherz"}.} + +\item{sca.link}{a character string specifying the link function for +the scales. The following are allowed: \code{"identity"}, and +\code{"log"}.} + +\item{link.same}{a logical indicating if all the components in a +cluster should use the same link.} + +\item{scale.fix}{a logical variable; if true, the scale parameter +is fixed at the value of \code{scale.value}.} + +\item{scale.value}{numeric variable giving the value to which the +scale parameter should be fixed; used only if \code{scale.fix +== TRUE}.} + +\item{corstr}{a character string specifying the correlation +structure. The following are permitted: \code{"independence"}, +\code{"exchangeable"}, \code{"ar1"}, \code{"unstructured"}, +\code{"userdefined"}, and \code{"fixed"}} + +\item{\dots}{further arguments passed to or from other methods.} } \value{ - An object of class \code{"geese"} representing the fit. -} -\details{ - when the correlation structure is \code{fixed}, the specification - of \code{Zcor} should be a vector of length - \code{sum(clusz * (clusz - 1)) / 2.} +An object of class \code{"geese"} representing the fit. } -\references{ - Yan, J. and J.P. Fine (2004) - Estimating Equations for Association Structures. - \emph{Statistics in Medicine}, \bold{23}, 859--880. - +\description{ +Produces an object of class `geese' which is a Generalized Estimating +Equation fit of the data. } -\author{Jun Yan \email{jyan.stat@gmail.com}} -\seealso{ - \code{\link{glm}}, \code{\link{lm}}, \code{\link{ordgee}}. +\details{ +when the correlation structure is \code{fixed}, the specification of +\code{Zcor} should be a vector of length \code{sum(clusz * (clusz - 1)) / +2.} } - \examples{ + data(seizure) ## Diggle, Liang, and Zeger (1994) pp166-168, compare Table 8.10 seiz.l <- reshape(seizure, @@ -250,6 +242,18 @@ sformula = ~ x1, corstr="ar1", jack = TRUE, j1s = TRUE, fij = TRUE)) + +} +\references{ +Yan, J. and J.P. Fine (2004) Estimating Equations for + Association Structures. \emph{Statistics in Medicine}, + \bold{23}, 859--880. +} +\seealso{ +\code{\link{glm}}, \code{\link{lm}}, \code{\link{ordgee}}. +} +\author{ +Jun Yan \email{jyan.stat@gmail.com} } -\keyword{nonlinear} \keyword{models} +\keyword{nonlinear} diff -Nru r-cran-geepack-1.3-1/man/genZcor.Rd r-cran-geepack-1.3-2/man/genZcor.Rd --- r-cran-geepack-1.3-1/man/genZcor.Rd 2017-04-12 14:20:30.000000000 +0000 +++ r-cran-geepack-1.3-2/man/genZcor.Rd 2020-12-13 06:16:48.000000000 +0000 @@ -1,41 +1,35 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/genZcor.R \name{genZcor} \alias{genZcor} \alias{humbelbee} \title{genZcor} -\description{ - constructs the design matrix for the correlation structures: - independence, echangeable, ar1 and unstructured - The user will need this function only as a basis to construct a user defined - correlation structure: use genZcor to get the design matrix Z for - the unstructured correlation and define the specific correlation structure by - linear combinations of the columns of Z. - -} \usage{ genZcor(clusz, waves, corstrv) } - \arguments{ - \item{clusz}{integer vector giving the number of observations in each cluster} - \item{waves}{integer vector, obervations in the same cluster with - values of wave i and j have the correlation \eqn{latex}{sigma_ij}} - \item{corstrv}{correlation - structures: 1=independence,2=exchangeable,3=ar1, - 4=unstructured} +\item{clusz}{integer vector giving the number of observations in +each cluster} + +\item{waves}{integer vector, obervations in the same cluster with +values of wave i and j have the correlation +\eqn{latex}{sigma_ij}} + +\item{corstrv}{correlation structures: +1=independence,2=exchangeable,3=ar1, 4=unstructured} } -% \details{ -% } \value{ - \item{}{the design matrix for the correlation structure} +\item{}{the design matrix for the correlation structure} +} +\description{ +constructs the design matrix for the correlation structures: independence, +echangeable, ar1 and unstructured The user will need this function only as a +basis to construct a user defined correlation structure: use genZcor to get +the design matrix Z for the unstructured correlation and define the specific +correlation structure by linear combinations of the columns of Z. } -%\references{ a } -\author{Jun Yan \email{jyan.stat@gmail.com}} -% \note{ } - - - -\seealso{\code{\link{fixed2Zcor}} } \examples{ + #example to construct a Toeplitz correlation structure # sigma_ij=sigma_|i-j| @@ -66,5 +60,12 @@ corstr = "userdefined", zcor = zcor.toep) + +} +\seealso{ +\code{\link{fixed2Zcor}} +} +\author{ +Jun Yan \email{jyan.stat@gmail.com} } -\keyword{ regression }% at least one, from doc/KEYWORDS +\keyword{regression} diff -Nru r-cran-geepack-1.3-1/man/koch.Rd r-cran-geepack-1.3-2/man/koch.Rd --- r-cran-geepack-1.3-1/man/koch.Rd 2019-12-11 06:40:37.000000000 +0000 +++ r-cran-geepack-1.3-2/man/koch.Rd 2020-12-13 05:33:09.000000000 +0000 @@ -4,13 +4,15 @@ \name{koch} \alias{koch} \title{Ordinal Data from Koch} -\format{This data frame contains the following columns: +\format{ +This data frame contains the following columns: \describe{ \item{trt}{a numeric vector} \item{day}{a numeric vector} \item{y}{an ordered factor with levels: \code{1} < \code{2} < \code{3}} \item{id}{a numeric vector} -}} +} +} \usage{ koch } diff -Nru r-cran-geepack-1.3-1/man/muscatine.Rd r-cran-geepack-1.3-2/man/muscatine.Rd --- r-cran-geepack-1.3-1/man/muscatine.Rd 2019-12-11 06:43:18.000000000 +0000 +++ r-cran-geepack-1.3-2/man/muscatine.Rd 2020-12-14 05:47:36.000000000 +0000 @@ -4,7 +4,8 @@ \name{muscatine} \alias{muscatine} \title{Data on Obesity from the Muscatine Coronary Risk Factor Study.} -\format{A dataframe with 14568 rows and 7 variables: +\format{ +A dataframe with 14568 rows and 7 variables: \describe{ \item{id}{identifier of child.} @@ -21,7 +22,8 @@ \item{numobese}{obese in numerical form: 1 corresponds to 'yes' and 0 corresponds to 'no'.} -}} +} +} \source{ \url{https://content.sph.harvard.edu/fitzmaur/ala2e/muscatine.txt} @@ -45,8 +47,6 @@ not obese. } \examples{ - - muscatine$cage <- muscatine$age - 12 muscatine$cage2 <- muscatine$cage^2 diff -Nru r-cran-geepack-1.3-1/man/ohio.Rd r-cran-geepack-1.3-2/man/ohio.Rd --- r-cran-geepack-1.3-1/man/ohio.Rd 2019-12-11 06:40:37.000000000 +0000 +++ r-cran-geepack-1.3-2/man/ohio.Rd 2020-12-13 05:33:09.000000000 +0000 @@ -4,7 +4,8 @@ \name{ohio} \alias{ohio} \title{Ohio Children Wheeze Status} -\format{This data frame contains the following columns: +\format{ +This data frame contains the following columns: \describe{ @@ -16,7 +17,8 @@ \item{smoke}{an indicator of maternal smoking at the first year of the study} -}} +} +} \usage{ ohio } diff -Nru r-cran-geepack-1.3-1/man/ordgee.Rd r-cran-geepack-1.3-2/man/ordgee.Rd --- r-cran-geepack-1.3-1/man/ordgee.Rd 2017-04-12 14:20:30.000000000 +0000 +++ r-cran-geepack-1.3-2/man/ordgee.Rd 2020-12-13 06:19:17.000000000 +0000 @@ -1,106 +1,125 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/ordgee.R \name{ordgee} \alias{ordgee} \title{GEE for Clustered Ordinal Responses} -\description{ - Produces an object of class `geese' which is a Generalized Estimating - Equation fit of the clustered ordinal data. -} \usage{ -ordgee(formula = formula(data), ooffset = NULL, id, waves = NULL, - data = parent.frame, subset = NULL, na.action = na.omit, - contrasts = NULL, weights = NULL, z = NULL, - mean.link = "logit", corstr = "independence", - control = geese.control(...), b = NA, alpha = NA, - scale.fix = TRUE, scale.val = 1, int.const = TRUE, - rev = FALSE,...) +ordgee( + formula = formula(data), + ooffset = NULL, + id, + waves = NULL, + data = parent.frame, + subset = NULL, + na.action = na.omit, + contrasts = NULL, + weights = NULL, + z = NULL, + mean.link = "logit", + corstr = "independence", + control = geese.control(...), + b = NA, + alpha = NA, + scale.fix = TRUE, + scale.val = 1, + int.const = TRUE, + rev = FALSE, + ... +) } \arguments{ - \item{formula}{a formula expression as for \code{glm}, of the form - \code{response ~ predictors}. See the documentation of lm and - formula for details. As for glm, this specifies the linear predictor - for modelling the mean. A term of the form \code{offset(expression)} - is allowed. - } - \item{ooffset}{vector of offset for the odds ratio model.} - \item{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.} - \item{waves}{an integer vector which identifies components in - clusters. The length of \code{waves} should be the same as the - number of observation. components with the same \code{waves} value - will have the same link functions. } - \item{data}{ - an optional data frame in which to interpret the variables occurring - in the \code{formula}, along with the \code{id} and \code{n} variables. - } - \item{subset}{ - expression saying which subset of the rows of the data should be used - in the fit. This can be a logical vector (which is replicated to have - length equal to the number of observations), or a numeric vector - indicating which observation numbers are to be included, or a - character vector of the row names to be included. - All observations are included by default. - } - \item{na.action}{ - a function to filter missing data. For \code{gee} only \code{na.omit} - should be used here. - } - \item{contrasts}{ - a list giving contrasts for some or all of the factors appearing - in the model formula. The elements of the list should have the - same name as the variable and should be either a contrast matrix - (specifically, any full-rank matrix with as many rows as there are - levels in the factor), or else a function to compute such a matrix - given the number of levels. - } - \item{weights}{an optional vector of weights to be used - in the fitting process. The length of \code{weights} should be the - same as the number of observations. - } - \item{z}{a design matrix for the odds ratio model. The number of rows - of z is \deqn{c^2 \sum n_i(n_i - 1)/2,} where \eqn{n_i} is the cluster - size, and \eqn{c} is the number of categories minus 1. - } - \item{mean.link}{a character string specifying the link function for - the means. The following are allowed: - \code{"logit"}, \code{"probit"}, and \code{"cloglog"}. - } - \item{corstr}{a character string specifying the log odds. The - following are allowed: - \code{"independence"}, \code{"exchangeable"}, \code{"unstructured"}, - and \code{"userdefined"}. - } - \item{control}{a list of iteration and algorithmic constants. See - \code{\link{geese.control}} for their names and default - values. These can also be set as arguments to \code{geese} itself. - } - \item{b}{an initial estimate for the mean parameters.} - \item{alpha}{an initial estimate for the odds ratio parameters.} - \item{scale.fix}{a logical variable indicating if scale is fixed; it - is set at TRUE currently (it can not be FALSE yet!).} - \item{scale.val}{this argument is ignored currently.} - \item{int.const}{a logical variable; if true, the intercepts are - constant, and if false, the intercepts are different for different - components in the response.} - \item{rev}{a logical variable. For example, for a three level ordered - response Y = 2, the accumulated indicator is coded as (1, 0, 0) if - true and (0, 1, 1) if false.} - \item{\dots}{further arguments passed to or from other methods.} +\item{formula}{a formula expression as for \code{glm}, of the form +\code{response ~ predictors}. See the documentation of lm and +formula for details. As for glm, this specifies the linear +predictor for modelling the mean. A term of the form +\code{offset(expression)} is allowed.} + +\item{ooffset}{vector of offset for the odds ratio model.} + +\item{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.} + +\item{waves}{an integer vector which identifies components in +clusters. The length of \code{waves} should be the same as the +number of observation. components with the same \code{waves} +value will have the same link functions.} + +\item{data}{an optional data frame in which to interpret the +variables occurring in the \code{formula}, along with the +\code{id} and \code{n} variables.} + +\item{subset}{expression saying which subset of the rows of the +data should be used in the fit. This can be a logical vector +(which is replicated to have length equal to the number of +observations), or a numeric vector indicating which observation +numbers are to be included, or a character vector of the row +names to be included. All observations are included by +default.} + +\item{na.action}{a function to filter missing data. For \code{gee} +only \code{na.omit} should be used here.} + +\item{contrasts}{a list giving contrasts for some or all of the +factors appearing in the model formula. The elements of the +list should have the same name as the variable and should be +either a contrast matrix (specifically, any full-rank matrix +with as many rows as there are levels in the factor), or else a +function to compute such a matrix given the number of levels.} + +\item{weights}{an optional vector of weights to be used in the +fitting process. The length of \code{weights} should be the +same as the number of observations.} + +\item{z}{a design matrix for the odds ratio model. The number of +rows of z is \deqn{c^2 \sum n_i(n_i - 1)/2,} where \eqn{n_i} is +the cluster size, and \eqn{c} is the number of categories minus +1.} + +\item{mean.link}{a character string specifying the link function +for the means. The following are allowed: \code{"logit"}, +\code{"probit"}, and \code{"cloglog"}.} + +\item{corstr}{a character string specifying the log odds. The +following are allowed: \code{"independence"}, +\code{"exchangeable"}, \code{"unstructured"}, and +\code{"userdefined"}.} + +\item{control}{a list of iteration and algorithmic constants. See +\code{\link{geese.control}} for their names and default +values. These can also be set as arguments to \code{geese} +itself.} + +\item{b}{an initial estimate for the mean parameters.} + +\item{alpha}{an initial estimate for the odds ratio parameters.} + +\item{scale.fix}{a logical variable indicating if scale is fixed; +it is set at TRUE currently (it can not be FALSE yet!).} + +\item{scale.val}{this argument is ignored currently.} + +\item{int.const}{a logical variable; if true, the intercepts are +constant, and if false, the intercepts are different for +different components in the response.} + +\item{rev}{a logical variable. For example, for a three level +ordered response Y = 2, the accumulated indicator is coded as +(1, 0, 0) if true and (0, 1, 1) if false.} + +\item{\dots}{further arguments passed to or from other methods.} } \value{ - An object of class \code{"geese"} representing the fit. +An object of class \code{"geese"} representing the fit. } -\references{ - Heagerty, P.J. and Zeger, S.L. (1996) - Marginal regression models for clustered ordinal measurements. - \emph{JASA}, \bold{91} 1024--1036. -} -\author{Jun Yan \email{jyan.stat@gmail.com}} -\seealso{ - \code{\link{glm}}, \code{\link{lm}}, \code{\link{geese}}. +\description{ +Produces an object of class `geese' which is a + Generalized Estimating Equation fit of the clustered ordinal + data. } \examples{ + data(respdis) resp.l <- reshape(respdis, varying =list(c("y1", "y2", "y3", "y4")), v.names = "resp", direction = "long") @@ -112,6 +131,18 @@ ohio$resp <- ordered(as.factor(ohio$resp)) fit <- ordgee(resp ~ age + smoke + age:smoke, id = id, data=ohio) summary(fit) + +} +\references{ +Heagerty, P.J. and Zeger, S.L. (1996) Marginal + regression models for clustered ordinal measurements. + \emph{JASA}, \bold{91} 1024--1036. +} +\seealso{ +\code{\link{glm}}, \code{\link{lm}}, \code{\link{geese}}. +} +\author{ +Jun Yan \email{jyan.stat@gmail.com} } -\keyword{nonlinear} \keyword{models} +\keyword{nonlinear} diff -Nru r-cran-geepack-1.3-1/man/QIC.Rd r-cran-geepack-1.3-2/man/QIC.Rd --- r-cran-geepack-1.3-1/man/QIC.Rd 2019-12-09 23:00:05.000000000 +0000 +++ r-cran-geepack-1.3-2/man/QIC.Rd 2020-12-13 06:39:09.000000000 +0000 @@ -16,16 +16,17 @@ QIC(object, tol = .Machine$double.eps, ...) } \arguments{ -\item{object}{a fitted GEE model from the geepack package. Currently only -works on geeglm objects} +\item{object}{a fitted GEE model from the geepack +package. Currently only works on geeglm objects} \item{tol}{the tolerance used for matrix inversion} \item{\dots}{optionally more fitted geeglm model objects} } \value{ -A vector or matrix with the QIC, QICu, quasi likelihood, CIC, the -number of mean effect parameters, and the corrected QIC for each GEE object +A vector or matrix with the QIC, QICu, quasi likelihood, + CIC, the number of mean effect parameters, and the corrected + QIC for each GEE object } \description{ Function for calculating the quasi-likelihood under the independence model @@ -58,13 +59,17 @@ } \references{ Pan, W. (2001). \emph{Akaike's information criterion in -generalized estimating equations}. Biometrics, 57, 120-125.\cr Hardin, J.W. -and Hilbe, J.M. (2012). \emph{Generalized Estimating Equations, 2nd -Edition}, Chapman and Hall/CRC: New York. \cr Hin, L.-Y. and Wang, Y-G. -(2009). \emph{Working-correlation-structure identification in generalized -estimating equations}, Statistics in Medicine 28: 642-658. \cr Thall, P.F. -and Vail, S.C. (1990). \emph{Some Covariance Models for Longitudinal Count -Data with Overdispersion}. Biometrics, 46, 657-671. + generalized estimating equations}. Biometrics, 57, 120-125.\cr + Hardin, J.W. and Hilbe, J.M. (2012). \emph{Generalized + Estimating Equations, 2nd Edition}, Chapman and Hall/CRC: New + York. \cr + + Hin, L.-Y. and Wang, Y-G. + (2009). \emph{Working-correlation-structure identification in + generalized estimating equations}, Statistics in Medicine 28: + 642-658. \cr Thall, P.F. and Vail, S.C. (1990). \emph{Some + Covariance Models for Longitudinal Count Data with + Overdispersion}. Biometrics, 46, 657-671. } \seealso{ \code{geeglm} diff -Nru r-cran-geepack-1.3-1/man/relRisk.Rd r-cran-geepack-1.3-2/man/relRisk.Rd --- r-cran-geepack-1.3-1/man/relRisk.Rd 2017-04-12 14:20:30.000000000 +0000 +++ r-cran-geepack-1.3-2/man/relRisk.Rd 2020-12-13 06:13:17.000000000 +0000 @@ -1,68 +1,60 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/relative-risk-regression.R \name{relRisk} \alias{relRisk} -\title{ -Fit a Relative Risk Model for Binary data with Log Link -} -\description{ -Fit a Relative Risk Model for Binary data with Log Link using the COPY method. -} +\title{Fit a Relative Risk Model for Binary data with Log Link} \usage{ -relRisk(formula, id, waves = NULL, data = parent.frame(), - subset = NULL, contrasts = NULL, na.action = na.omit, - corstr = "indep", ncopy = 1000, - control = geese.control(), b = NULL, alpha = NULL) +relRisk( + formula, + id, + waves = NULL, + data = parent.frame(), + subset = NULL, + contrasts = NULL, + na.action = na.omit, + corstr = "indep", + ncopy = 1000, + control = geese.control(), + b = NULL, + alpha = NULL +) } \arguments{ - \item{formula}{ - same as in \code{geese} - } - \item{id}{ - same as in \code{geese} - } - \item{waves}{ - same as in \code{geese} - } - \item{data}{ - same as in \code{geese} - } - \item{subset}{ - same as in \code{geese} - } - \item{contrasts}{ - same as in \code{geese} - } - \item{na.action}{ - same as in \code{geese} - } - \item{corstr}{ - same as in \code{geese} - } - \item{ncopy}{ - the number of copies of the original data in constructing weight. - } - \item{control}{ - same as in \code{geese} - } - \item{b}{ - initial values for regression coefficients as in \code{geese} - but more difficult to obtain due to the log link. - } - \item{alpha}{ - same as in \code{geese} - } +\item{formula}{same as in \code{geese}} + +\item{id}{same as in \code{geese}} + +\item{waves}{same as in \code{geese}} + +\item{data}{same as in \code{geese}} + +\item{subset}{same as in \code{geese}} + +\item{contrasts}{same as in \code{geese}} + +\item{na.action}{same as in \code{geese}} + +\item{corstr}{same as in \code{geese}} + +\item{ncopy}{the number of copies of the original data in +constructing weight.} + +\item{control}{same as in \code{geese}} + +\item{b}{initial values for regression coefficients as in +\code{geese} but more difficult to obtain due to the log link.} + +\item{alpha}{same as in \code{geese}} } \value{ - An object of class \code{"geese"} representing the fit. -} -\references{ - Lumley, T., Kornmal, R. and Ma, S. (2006). Relative risk regression in - medical research: models, contrasts, estimators, and algorithms. UW - Biostatistics Working Paper Series 293, University of Washington. +An object of class \code{"geese"} representing the fit. } -\author{ - Jun Yan \email{jyan.stat@gmail.com} +\description{ +Fit a Relative Risk Model for Binary data with Log + Link using the COPY method. } \examples{ + ## this example was used in Yu and Yan (2010, techreport) data(respiratory) respiratory$treat <- relevel(respiratory$treat, ref = "P") @@ -79,5 +71,15 @@ ## fit <- relRisk(outcome ~ treat + center + sex + age + baseline + visit, ## id = id, corstr = "indep", data = respiratory) ## summary(fit) + +} +\references{ +Lumley, T., Kornmal, R. and Ma, S. (2006). Relative + risk regression in medical research: models, contrasts, + estimators, and algorithms. UW Biostatistics Working Paper + Series 293, University of Washington. +} +\author{ +Jun Yan \email{jyan.stat@gmail.com} } \keyword{models} diff -Nru r-cran-geepack-1.3-1/man/respdis.Rd r-cran-geepack-1.3-2/man/respdis.Rd --- r-cran-geepack-1.3-1/man/respdis.Rd 2019-12-11 06:40:37.000000000 +0000 +++ r-cran-geepack-1.3-2/man/respdis.Rd 2020-12-13 05:33:09.000000000 +0000 @@ -4,7 +4,8 @@ \name{respdis} \alias{respdis} \title{Clustered Ordinal Respiratory Disorder} -\format{This data frame contains the following columns: +\format{ +This data frame contains the following columns: \describe{ \item{y1, y2, y3, y4}{ordered factor measured at 4 visits for the response with @@ -14,7 +15,8 @@ \item{trt}{a factor for treatment with levels, 1 = active, 0 = placebo.} -}} +} +} \usage{ respdis } diff -Nru r-cran-geepack-1.3-1/man/respiratory.Rd r-cran-geepack-1.3-2/man/respiratory.Rd --- r-cran-geepack-1.3-1/man/respiratory.Rd 2019-12-11 06:40:37.000000000 +0000 +++ r-cran-geepack-1.3-2/man/respiratory.Rd 2020-12-13 05:33:09.000000000 +0000 @@ -6,7 +6,8 @@ \alias{respiratoryWide} \title{Data from a clinical trial comparing two treatments for a respiratory illness} -\format{A data frame with 444 observations on the following 8 variables. +\format{ +A data frame with 444 observations on the following 8 variables. \describe{ @@ -19,7 +20,8 @@ \item{visit}{id of each of four visits} \item{outcome}{respiratory status at each visit} -}} +} +} \usage{ respiratory } diff -Nru r-cran-geepack-1.3-1/man/seizure.Rd r-cran-geepack-1.3-2/man/seizure.Rd --- r-cran-geepack-1.3-1/man/seizure.Rd 2019-12-11 06:40:37.000000000 +0000 +++ r-cran-geepack-1.3-2/man/seizure.Rd 2020-12-13 05:33:09.000000000 +0000 @@ -4,14 +4,16 @@ \name{seizure} \alias{seizure} \title{Epiliptic Seizures} -\format{This data frame contains the following columns: \describe{ +\format{ +This data frame contains the following columns: \describe{ \item{y1}{the number of epiliptic seizures in the 1st 2-week interval} \item{y2}{the number of epiliptic seizures in the 2nd 2-week interval} \item{y3}{the number of epiliptic seizures in the 3rd 2-week interval} \item{y4}{the number of epiliptic seizures in the 4th 2-week interval} \item{trt}{an indicator of treatment} \item{base}{the number of epilitic seizures in a baseline 8-week interval} \item{age}{a numeric vector of - subject age} }} + subject age} } +} \source{ Thall, P.F. and Vail S.C. (1990) Some covariance models for longitudinal count data with overdispersion. \emph{Biometrics} \bold{46}: diff -Nru r-cran-geepack-1.3-1/man/sitka89.Rd r-cran-geepack-1.3-2/man/sitka89.Rd --- r-cran-geepack-1.3-1/man/sitka89.Rd 2019-12-11 06:40:37.000000000 +0000 +++ r-cran-geepack-1.3-2/man/sitka89.Rd 2020-12-13 05:33:09.000000000 +0000 @@ -4,7 +4,8 @@ \name{sitka89} \alias{sitka89} \title{Growth of Sitka Spruce Trees} -\format{A dataframe +\format{ +A dataframe \describe{ \item{size:}{size of the tree measured in \eqn{log(height*diamter^2)}} @@ -15,7 +16,8 @@ \item{treat:}{ozone: grown under ozone environment, control: ozone free} -}} +} +} \usage{ sitka89 } diff -Nru r-cran-geepack-1.3-1/man/spruce.Rd r-cran-geepack-1.3-2/man/spruce.Rd --- r-cran-geepack-1.3-1/man/spruce.Rd 2019-12-11 06:40:37.000000000 +0000 +++ r-cran-geepack-1.3-2/man/spruce.Rd 2020-12-13 05:33:09.000000000 +0000 @@ -4,7 +4,8 @@ \name{spruce} \alias{spruce} \title{Log-size of 79 Sitka spruce trees} -\format{This data frame contains the following columns: +\format{ +This data frame contains the following columns: \describe{ @@ -20,7 +21,8 @@ \item{wave}{a numeric vector of the measurement number} \item{logsize}{a numeric vector of the log-size} -}} +} +} \source{ Diggle, P.J., Liang, K.Y., and Zeger, S.L. (1994) Analysis of Longitudinal Data, Clarendon Press. diff -Nru r-cran-geepack-1.3-1/MD5 r-cran-geepack-1.3-2/MD5 --- r-cran-geepack-1.3-1/MD5 2019-12-13 05:40:17.000000000 +0000 +++ r-cran-geepack-1.3-2/MD5 2020-12-18 06:20:11.000000000 +0000 @@ -1,21 +1,22 @@ -66cd9637e197570d6d84fa103a4bd77b *ChangeLog -049f1cecc24d76131e2d60788f128b00 *DESCRIPTION -6968d2705a6db88020e86038059ebcb3 *NAMESPACE -cba1d0ce531b0580249a8acd89c0a974 *R/data-geepack.R -2213be6307e3a2aea7a7192c0792e7f6 *R/fixed2Zcor.R -7af855a49a1b2d81e28184326fefdc94 *R/geeglm-anova.R -3a4323e187059cffc6a8e604a8387638 *R/geeglm.R -ddf37741699715e86dbbca6d49bbaa91 *R/geem-interface.R +2c7ec897a3bb657e2353fc328fb40ab5 *ChangeLog +ef6b0f23337b172f4db09933bd10c194 *DESCRIPTION +883312468fef336ca79944040ab1a68b *NAMESPACE +d427d66b05a8c2d9eea1593a22452d32 *NEWS +0a48d3c82f8be0d26ed94eb3808b2c25 *R/NAMESPACE.R +0eb1bec600f9f4b30342b62b0eb6d48c *R/data-geepack.R +146562842fedadc277416dbbbdce1be1 *R/fixed2Zcor.R +445c4293d9603e4818df48a352ec3c32 *R/geeglm-anova.R +57d076bb993259cbbe974e25d77b7964 *R/geeglm.R f847934588f95a5754e8524f4015382c *R/geepack-package.R -fc55db5af93e4d973728b2e1b830a430 *R/geese.R -d91773471e0231cd2d10a849f9dce6e7 *R/internal.R -c4ec4a9e2a1eb93ec4d0a18f4d7f030a *R/ordgee.R -3d47f108f8f53ae4ced4e3de45f8fa6a *R/qic.R -4fd4b963396597358da2839b5e1a8cbf *R/rrr.R -a5dd2d22cc31c489b3737e1beae008d5 *R/summary.R +e06964d406046a745ffe88f2278a82e8 *R/geese.R +d48fd13031191743c51f8b5fe3c5bfba *R/genZcor.R +de7d23a336fdac7cb4fa286070d1d0f0 *R/ordgee.R +eb39939c02f905d3d6de878a88555a97 *R/qic.R +72fa2bc5761ae49107cd18252263ff8c *R/relative-risk-regression.R +903668733f4bb12da2f0f83a65931116 *R/summary.R 6505166c78c1a08e723f0ab1ab6c1608 *R/zzz.R 09025c52708dd8f6d43340f2828e57d6 *README.md -3a00491ed04f3f0cc52ee035d66d2bd9 *build/vignette.rds +d2c097da889c843ee0eb771f69f03110 *build/vignette.rds 830f7fc69c5afa1a23e8991d77e0b101 *data/dietox.rda 4db449d2d05821a059969ee34818c48a *data/koch.RData 331c55a17b264d413792bc3503e6c7df *data/muscatine.rda @@ -26,9 +27,9 @@ 8a96e06b08ac07da63c409f539a6a969 *data/sitka89.RData c573873a4bf48e2169119cfea4496143 *data/spruce.RData 6143f183f04ed5831f485164d9e39c17 *inst/CITATION -3510afd3d14751e2371c1833a5bd066b *inst/doc/geepack-manual.R +1c3565e2258a180cd9dc80a1b1c94c6a *inst/doc/geepack-manual.R ad435dfdb769fa1e9d406a5eadb0e308 *inst/doc/geepack-manual.Rnw -a7b04298b2bcc6f7df0152ee4ea0ade3 *inst/doc/geepack-manual.pdf +d4e3047041b2a883180470e04147f337 *inst/doc/geepack-manual.pdf 9828f5a1fa7e645dee75d7651986c9d0 *inst/include/famstr.h 17b2a8381b909ce542221d3cc6a2ca86 *inst/include/gee2.h 7d1cfd53a00f4edb17e31b0ac3fadd26 *inst/include/geese.h @@ -61,31 +62,31 @@ ab5be7c78471fb94e662157f3aa1ddc2 *inst/include/tnt/version.h 53e679a09c916c1eeba60897a83b3fcb *inst/include/tntsupp.h 047879e877ce84a2a9f9aec073ea4478 *inst/include/utils.h -c7a3b519e61c96c098a3cf3fc40b4d59 *man/QIC.Rd -98ef5da28dd7104a90ad29c2ad0838f2 *man/compCoef.Rd -7f7386c715e03890d08a93f07eb23027 *man/dietox.Rd -013a2417a6f07cca980a4a10d9e7f838 *man/fixed2Zcor.Rd +8bc41533c252039da9c281986016fe33 *man/QIC.Rd +dbf80500a44743bab74e96dbdd1efd29 *man/compCoef.Rd +c7656f8709a83d94f8a8d538c5ed4c64 *man/dietox.Rd +4776c4c312fbb0da835c05074b495f9a *man/fixed2Zcor.Rd 6dbb878cc505ac1d10b1de93cc514a57 *man/geeglm.Rd 02fc86310bdffb9b7a04b81b1128ffde *man/geepack-internal.Rd -5580465bd6f874e95daf1141fbcd971a *man/geese.Rd -3d8545e43e7f566655f2446b5503e6d5 *man/geese.control.Rd -1ff73e824bef44fc1faee6982f5263f8 *man/genZcor.Rd -b5be33d336201b81131a09852abd661f *man/koch.Rd -cf30959b339a5c06e2e03a7630c6f0fa *man/muscatine.Rd -2885735c11f76a0342d232e6505d81f7 *man/ohio.Rd -fc018aaf2c11e1857c0bb1146123f95d *man/ordgee.Rd -54b06bbedd91bf0aa774ee7e05a435fc *man/relRisk.Rd -56a078b984cf64094a9adaa871385112 *man/respdis.Rd -5000b6b6d8ddd8dffce51e02d88dede4 *man/respiratory.Rd -2cfbb09a36279c66c6c0bf6d5fceea05 *man/seizure.Rd -68823df4acf1732cfa7fab6816e7074b *man/sitka89.Rd -533d09d4c3f452d8fdb592e9274fce88 *man/spruce.Rd +f05480355f1795500beecc3470aaf528 *man/geese.Rd +2b182fc1f37be8266a0f0c3c18686562 *man/geese.control.Rd +e13e2ee40cd61f5fdd3d4538e7c6d2f0 *man/genZcor.Rd +79ed548437238dd87136c8f4b6fa29a6 *man/koch.Rd +5bddd7bb33d4bd17d450cf40c52a7fbb *man/muscatine.Rd +4329e14dacdfd0067a0236ecc71c2031 *man/ohio.Rd +e0b11254f10f6603fa3249a486f02f0b *man/ordgee.Rd +0fdb92fead1de05d14468ef135297eac *man/relRisk.Rd +27b78f03c75e708aa0dbcccf3486b983 *man/respdis.Rd +e291c80dba9d4a9b1aa49be9d88c2c46 *man/respiratory.Rd +fcaf82388434308232e83636002cec39 *man/seizure.Rd +b534395033d50fd0eedacc1dff559b7c *man/sitka89.Rd +5e340fecd2453fc2a22e83f70cbaa8d8 *man/spruce.Rd 8bb53f14cf0f67b02bdd966aadb484a2 *src/Makevars cdc0cc143af33cd5665ac112d92afdc9 *src/famstr.cc 5168e2d9f382ebf53283c076b9b98515 *src/gee2.cc a03f71117e827c1b67df1c8d0b2ebc50 *src/geesubs.cc 4396f72dfbbdf9480432e6eb1422d549 *src/init.c -1dc510e0620a09ddc528412e5ff37287 *src/inter.cc +17a857f9403c048971f3be32702cc5aa *src/inter.cc 2ab3cc479e9a32206dae9c3405bdf61d *src/ordgee.cc cc4f054a5e831b0dccda7ffe2398143b *src/param.cc aa7d692722f3b034aa4ff9dbe6851947 *src/utils.cc diff -Nru r-cran-geepack-1.3-1/NAMESPACE r-cran-geepack-1.3-2/NAMESPACE --- r-cran-geepack-1.3-1/NAMESPACE 2019-12-11 19:37:19.000000000 +0000 +++ r-cran-geepack-1.3-2/NAMESPACE 2020-12-14 05:50:37.000000000 +0000 @@ -1,44 +1,60 @@ -useDynLib(geepack) - -import(methods) -importFrom("MASS", ginv) - -importFrom("graphics", "abline", "lines", "plot") -importFrom("stats", "binomial", "coef", "fitted", "formula", - "gaussian", "glm.fit", "is.empty.model", "lm.fit", "lowess", - "model.extract", "model.matrix", "model.offset", - "model.response", "model.weights", "na.omit", "naresid", - "pchisq", "printCoefmat", "quasi", "residuals", - "summary.glm", "var", "family") - -importFrom("utils", "head") -importFrom("broom", tidy) +# Generated by roxygen2: do not edit by hand -# maintained by Soren -export(geeglm, fixed2Zcor, anovageePrim2) -export(QIC) -export(tidy) - -importFrom(magrittr, "%>%") +S3method(QIC,geeglm) +S3method(QIC,geekin) +S3method(QIC,ordgee) +S3method(anova,geeglm) +S3method(plot,geeglm) +S3method(print,geeglm) +S3method(print,geese) +S3method(print,summary.geeglm) +S3method(print,summary.geese) +S3method(residuals,geeglm) +S3method(summary,geeglm) +S3method(summary,geese) +S3method(vcov,geeglm) export("%>%") - -S3method(anova, geeglm) -S3method(print, geeglm) -S3method(residuals, geeglm) -S3method(summary, geeglm) -S3method(print, summary.geeglm) -S3method(vcov, geeglm) - -S3method(QIC, geeglm) -S3method(QIC, ordgee) - - -# maintained by Jun -export(geese, geese.fit, ordgee, geese.control) -export(genZcor, genZodds) -export(relRisk) +export(QIC) export(compCoef) -S3method(print, geese) -S3method(summary, geese) -S3method(print, summary.geese) - +export(fixed2Zcor) +export(geeglm) +export(geese) +export(geese.control) +export(geese.fit) +export(genZcor) +export(ordgee) +export(relRisk) +export(tidy) +import(methods) +importFrom(MASS,ginv) +importFrom(broom,tidy) +importFrom(graphics,abline) +importFrom(graphics,lines) +importFrom(graphics,plot) +importFrom(magrittr,"%>%") +importFrom(stats,binomial) +importFrom(stats,coef) +importFrom(stats,family) +importFrom(stats,fitted) +importFrom(stats,formula) +importFrom(stats,gaussian) +importFrom(stats,glm.fit) +importFrom(stats,is.empty.model) +importFrom(stats,lm.fit) +importFrom(stats,lowess) +importFrom(stats,model.extract) +importFrom(stats,model.matrix) +importFrom(stats,model.offset) +importFrom(stats,model.response) +importFrom(stats,model.weights) +importFrom(stats,na.omit) +importFrom(stats,naresid) +importFrom(stats,pchisq) +importFrom(stats,printCoefmat) +importFrom(stats,quasi) +importFrom(stats,residuals) +importFrom(stats,summary.glm) +importFrom(stats,var) +importFrom(utils,head) +importFrom(utils,str) +useDynLib(geepack) diff -Nru r-cran-geepack-1.3-1/NEWS r-cran-geepack-1.3-2/NEWS --- r-cran-geepack-1.3-1/NEWS 1970-01-01 00:00:00.000000000 +0000 +++ r-cran-geepack-1.3-2/NEWS 2020-12-17 16:52:52.000000000 +0000 @@ -0,0 +1,254 @@ +geepack v1.3.2 (Release date: 2020-12-18) +========================================= + +* NAMESPACE and all .Rd files are now auto generated. +* PROTECT / UNPROTECT issue fixed (in file inter.cc) +* Improved documentation of dietox. + + +geepack v1.3.1 (Release date: 2019-12-13) +========================================= + +* PROTECT / UNPROTECT imbalance fixed +* Version 1.3-1 uploaded + +geepack v1.3.0 (Release date: 2019-12-10) +========================================= + +* Migrated to use roxygen +* Improved documentation of geeglm +* Check for data being sorted by 'id' i geeglm; a warning is issued if not. +* QIC added; thanks to Claus Ekstrøm who is now a contributor. +* tidy function from broom package is imported. +* muscatine data added +* Version 1.3-0 uploaded + +geepack v1.2.1 (Release date: 2014-09-13) +========================================= + +* geeglm objects now inherits from lm also (to prevent warning when + calling predict). + +geepack v1.2.0 (Release date: 2014-09-13) +========================================= + +* Maintainer of geepack is now Søren Højsgaard +* Location of vignette fixed +* Version 1.2-0 uploaded + + + + + +Legacy from when Jun Yan was maintainer: +======================================== + +2012-01-27 Jun Yan + + * Commented out #undef NDEBUG in geesubs.cc. + * Added a VecPrint function in utils.cc to print DVector; + this replaces usage of cerr. + +2012-01-09 Jun Yan + + * Thank Jeffrey Horner + and Cole Beck for fixing the + undefined symbol error (see 2011-11-14 entry: + _Z5ValidIiEN3TNT6VectorIT_EERS3_RNS1_IiEE). + The template function "Valid" (in original geesubs.cc) + should actually be in the header file. + This may fix the compilation error on ubuntu 11.10 too. + +2011-11-21 Jun Yan + + * Added an example to function relRisk. + +2011-11-21 Jun Yan + + * Added an example to function compCoef. + + * Changed the JSS paper year from 2005 to 2006 in CITATION. + +2011-11-16 Jun Yan + + * Added function relRisk for relative risk regression + --- regression for binary response with log link. + + * Added function relRisk for relative risk regression + --- regression for binary response with log link. + + * Added function compCoef for comparing coefficients + of the same sets of covariates between nested models. + This implements the method of Yan, Aseltine, and Harel + (2011, JEBS); for independent data, the method reduces + to Allison (1995, American Journal of Sociology). + + * Fixed a bug in c++ code in constructing the working + covariance structure using the regression model of scale. + Simulation tests show improved efficiency in mean parameter + estimation when scale regression is present. + +2011-11-15 Soren Hojsgaard + + * Dependence on the doBy package has been removed. + +2011-11-14 Jun Yan + + * Added NAMESPACE for to comply with the requirement of R-2.14.0. + + * Removed the "assert" lines in utils.cc in order not to crash R, + which is quite rude practice. A "-DNDEBUG" has been added to the + cppflags in Makevars for a better solution. Due to many asserts + in tnt, we cannot get rid of the NOTE message completely: + Found ‘_ZSt4cerr’, possibly from ‘std::cerr’ (C++) + Found ‘__assert_fail’, possibly from ‘assert’ (C) + + * Added quote in statements like + extract(m, "response") to get rid of NOTE: + geese: no visible binding for global variable ‘response’ + + * Added a line of + #undef NDEBUG + to the beginning of geesubs.cc; thank Brian Ripley for the NMU. + Still unclear why the error without this line: + undefined symbol: _Z5ValidIiEN3TNT6VectorIT_EERS3_RNS1_IiEE + + +2011-02-23 Søren Højsgaard + + * In geeglm is checked if the model matrix is rank deficient; if + so then geeglm exits. Thanks to Jason D Thorpe for pointing this out. + + * Bug in anova fixed. Thanks to Stefan Boehringer for pointing + this out. + + * Version 1.0-18 uploaded. + + +2010-01-26 Søren Højsgaard + + * fixed2Zcor function has been added. This function makes it + easier to work with a fixed correlation matrix (in particular when + cluster sizes are not equal). + + * A vignette on models with unequal cluster size, fixed + correlation matrices etc. has been added. + + * Version 1.0-17 uploaded + +2008-12-08 Søren Højsgaard + + * Bugfix in 1.0.15 caused problem in binomial case using + cbind(pos,neg). Thanks to Tobias Verbeke. Fixed now. + + * Bugfix in 1.0.15 caused problem when using variables derived + from gam package call to geeglm. Thanks to Eric Rexstad. Fixed now. + + * Using scale.fix argument gave problem in geeglm. Thanks to + Tobias Verbeke. Fixed now. + + * Fitting large data set with binomial model and 3 measurements + per unit using unstructured correlation crashes R. Thanks to + Tobias Verbeke. Problem has *NOT* been solved but a remark has + been added to doc file. + + * Version 1.0-16 uploaded + +2008-12-01 Søren Højsgaard + + * When a factor has unused levels, the underlying C code + fails. This is now catured in geeglm. Thanks to Janet Young + + * tests directory added to package + + * Version 1.0-15 uploaded + +2007-07-13 Søren Højsgaard + + * Smaller 'standardization' changes implemented. Thanks to Achim + + * Version 1.0-14 uploaded + +2007-03-21 Søren Højsgaard + + * A remark on fixed correlation structures has been added to the + geeglm.Rd doc file. + + * A Wishlist file has been added + + * Version 1.0-13 uploaded + +2007-03-21 Søren Højsgaard + + * Bug in geeglm fixed so that it now works with a fixed + correlation structure. Thanks to Ulrich Halekoh for the fix. + + +2006-02-13 Jun Yan + + * Bug in genZcor and genZodds fixed. + Thanks to Chongzhi Di . + Previously, the matrice generated by genZcor/genZodds are + wrong when the number of unique waves is greater than or + equal to 10. + +2006-01-24 Søren Højsgaard + + * Bug in anova.geeglm fixed (showed up when there was only one + term on the right hand side of ~). + + * geeglm only works on complete data. This has been pointed out in + the man pages. (At some point of time, a proper na.action should be + taken). + + * All datasets are saved as .txt files (previously some were saved + as .rda files but that caused problems in building the package on + windows xp). + +2005-08-13 Jun Yan + + * The working correlation structure can now be "fixed". + + +2005-06-13 Søren Højsgaard + + * Søren Højsgaard has modified the geeglm function so that it can + take the 'waves' argument which is used for explicitely specifying + the ordering of repeated measurements on the same unit. geeglm can + also take the 'zcor' argument for a user defined working + correlation structure. + + * A documentation file for the genZcor + function has been added. + + * All data sets provided are now saved as + text files. + + * ordgee has been modified to check if the response variable is an + ordered factor. + + * geeglm can now take the argument std.err which specifies the + type of variance estimate to be calculated. + +2005-05-11 Søren Højsgaard + + * Søren Højsgaard has modified the anova function to make it + calculate the correct degrees of freedom. + + +2005-04-11 Jun Yan + + * Søren Højsgaard made some minor changes to geeglm - + basically, that geese.control did not work. Now it does. + + +2005-02-09 Jun Yan + + * Søren Højsgaard joined the development with geeglm, which + "works like" glm and returns an object which is similar to + a glm object. Residuals and predicted values can be extracted + using the generic functions as with a glm object. + + * An important feature of geeglm, is that an anova method + exists for these models. + diff -Nru r-cran-geepack-1.3-1/R/data-geepack.R r-cran-geepack-1.3-2/R/data-geepack.R --- r-cran-geepack-1.3-1/R/data-geepack.R 2019-12-11 06:43:25.000000000 +0000 +++ r-cran-geepack-1.3-2/R/data-geepack.R 2020-12-14 05:41:46.000000000 +0000 @@ -13,14 +13,14 @@ #' @format This data frame contains the following columns: #' #' \describe{ -#' \item{Weight}{Weight} -#' \item{Feed}{Cumulated feed intake} +#' \item{Weight}{Weight in Kg} +#' \item{Feed}{Cumulated feed intake in Kg} #' \item{Time}{Time (in weeks) in the experiment} -#' \item{Pig}{Id of each pig} -#' \item{Evit}{Vitamin E dose} -#' \item{Cu}{Copper dose} +#' \item{Pig}{Factor; id of each pig} +#' \item{Evit}{Factor; vitamin E dose; see 'details'.} +#' \item{Cu}{Factor, copper dose; see 'details'} #' \item{Start}{Start weight in experiment, i.e. weight at week 1.} -#' \item{Litter}{Id of litter of each pig} +#' \item{Litter}{Factor, id of litter of each pig} #' } #' #' @source Lauridsen, C., Højsgaard, S.,Sørensen, M.T. C. (1999) Influence of @@ -30,12 +30,19 @@ #' @examples #' #' data(dietox) -#' str(dietox) ; -#' plot(dietox) -#' -#' +#' head(dietox) +#' \dontrun{ +#' if (require(ggplot2)){ +#' qplot(Time, Weight, data=dietox, col=Pig) + geom_line() + +#' theme(legend.position = "none") + facet_grid(Evit~Cu) +#' } else { +#' coplot(Weight ~ Time | Evit * Cu, data=dietox) +#' } +#' } "dietox" + + #' Ordinal Data from Koch #' #' The \code{koch} data frame has 288 rows and 4 columns. @@ -99,8 +106,6 @@ #' Series A, 147, 87-99. #' #' @examples -#' -#' #' muscatine$cage <- muscatine$age - 12 #' muscatine$cage2 <- muscatine$cage^2 #' diff -Nru r-cran-geepack-1.3-1/R/fixed2Zcor.R r-cran-geepack-1.3-2/R/fixed2Zcor.R --- r-cran-geepack-1.3-1/R/fixed2Zcor.R 2017-04-12 14:20:30.000000000 +0000 +++ r-cran-geepack-1.3-2/R/fixed2Zcor.R 2020-12-13 05:20:49.000000000 +0000 @@ -47,22 +47,19 @@ #' mod4 <- geeglm(yvar~tvar, id=idvar, data=simdatPerm, corstr="fixed", zcor=zcor) #' mod4 #' -#' -#' #' @export fixed2Zcor fixed2Zcor <- function(cor.fixed, id, waves){ - zcor<-NULL - cnt <- 1 + zcor <- NULL + cnt <- 1 uniq.id <- unique(id) for (ii in uniq.id){ cwaves <- waves[id==ii] - if (length(cwaves)>1) { - for (kk in 1: (length(cwaves)-1)) { - for (mm in (kk+1) : length(cwaves)) { - vvv <- cor.fixed[cwaves[mm],cwaves[kk]] - zcor<-c(zcor,vvv) - - } + if (length(cwaves) > 1) { + for (kk in 1:(length(cwaves) - 1)){ + for (mm in (kk + 1):length(cwaves)){ + vvv <- cor.fixed[cwaves[mm], cwaves[kk]] + zcor<-c(zcor, vvv) + } } } } diff -Nru r-cran-geepack-1.3-1/R/geeglm-anova.R r-cran-geepack-1.3-2/R/geeglm-anova.R --- r-cran-geepack-1.3-1/R/geeglm-anova.R 2019-07-29 14:45:33.000000000 +0000 +++ r-cran-geepack-1.3-2/R/geeglm-anova.R 2020-12-13 07:24:53.000000000 +0000 @@ -116,7 +116,7 @@ return(value) } - +#' @export anova.geeglm<-function (object, ..., dispersion = NULL, test = NULL) { diff -Nru r-cran-geepack-1.3-1/R/geeglm.R r-cran-geepack-1.3-2/R/geeglm.R --- r-cran-geepack-1.3-1/R/geeglm.R 2019-12-10 23:57:36.000000000 +0000 +++ r-cran-geepack-1.3-2/R/geeglm.R 2020-12-14 05:50:19.000000000 +0000 @@ -139,14 +139,16 @@ corstr <- CORSTRS[corstrv] call <- match.call(expand.dots = TRUE) + glmcall <- call glmcall$id <- glmcall$jack <- glmcall$control <- glmcall$corstr <- glmcall$waves <- glmcall$zcor <- glmcall$std.err <- glmcall$scale.fix <- glmcall$scale.value <- NULL glmcall[[1]] <- as.name("glm") glmFit <- eval(glmcall, parent.frame()) - mf <- call - mf[[1]] <- as.name("model.frame") + + + modelmat <- model.matrix(glmFit) qqrr <- qr(modelmat) @@ -154,7 +156,11 @@ print(head(modelmat)) stop("Model matrix is rank deficient; geeglm can not proceed\n") } - + + + mf <- call + mf[[1]] <- as.name("model.frame") + mftmp <- mf mftmp$family <- mftmp$corstr <- mftmp$control <- mftmp$zcor <- mftmp$std.err <- NULL @@ -211,7 +217,7 @@ "na.action") cnames <- names(call) cnames <- cnames[match(mnames, cnames, 0)] - mcall <- call[cnames] + mcall <- call[cnames] mcall$drop.unused.levels <- TRUE mcall[[1]] <- as.name("model.frame") mcall$formula <- formula @@ -224,17 +230,15 @@ colnames(zsca) <- c("(Intercept)") w <- model.weights(mf) - if (is.null(w)) - w <- rep(1, N) + if (is.null(w)) w <- rep(1, N) offset <- model.offset(mf) - if (is.null(offset)) - offset <- rep(0, N) + if (is.null(offset)) offset <- rep(0, N) if (glmFit$family$family == "binomial") { if (is.matrix(yy) && ncol(yy) == 2) { w <- apply(yy, 1, sum) - yy <- yy[, 1]/w + yy <- yy[, 1] / w } } @@ -246,6 +250,9 @@ if (is.null(start)) start <- glmFit$coef + + ## cat("KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK\n") + ## print(id) ans <- geese.fit(xx, yy, id, offset, soffset, w, waves = waves, zsca, zcor = zcor, corp = NULL, control = control, b = start, @@ -288,16 +295,12 @@ value } - - - - - +#' @export vcov.geeglm <- function(object, ...){ out <- switch(object$std.err, 'jack'={object$geese$vbeta.ajs}, - 'j1s'={object$geese$vbeta.j1s}, - 'fij'={object$geese$vbeta.fij}, + 'j1s' ={object$geese$vbeta.j1s}, + 'fij' ={object$geese$vbeta.fij}, object$geese$vbeta ) pn <- names(coef(object)) @@ -305,25 +308,23 @@ out } - - - +#' @export summary.geeglm <- function(object,...){ - v1 <- summary.geese(object$geese) + class(object) <- "glm" value <- summary.glm(object) class(object) <- c("geeglm","glm") class(value) <- "summary.geeglm" - toDelete <- c("deviance","aic","null.deviance","iter","df.residual","df.null", - "converged","boundary") - idx <- match(toDelete,names(value)) + toDelete <- c("deviance", "aic", "null.deviance", "iter", "df.residual", + "df.null", "converged", "boundary") + idx <- match(toDelete, names(value)) value[idx] <- NULL covmat <- switch(object$std.err, 'jack'={object$geese$vbeta.ajs}, - 'j1s'={object$geese$vbeta.j1s}, - 'fij'={object$geese$vbeta.fij}, + 'j1s' ={object$geese$vbeta.j1s}, + 'fij' ={object$geese$vbeta.fij}, object$geese$vbeta ) value$cov.scaled <- value$cov.unscaled <- covmat @@ -336,17 +337,17 @@ value$coefficients <- mean.sum - covmatgam <- switch(object$std.err, 'jack'={object$geese$vgamma.ajs}, - 'j1s'={object$geese$vgamma.j1s}, - 'fij'={object$geese$vgamma.fij}, + 'j1s' ={object$geese$vgamma.j1s}, + 'fij' ={object$geese$vgamma.fij}, object$geese$vgamma ) + scale.sum <- data.frame(Estimate = object$geese$gamma, Std.err=sqrt(diag(covmatgam))) - #scale.sum$wald <- (scale.sum$Estimate / scale.sum$Std.err)^2 - #scale.sum$p <- 1 - pchisq(scale.sum$wald, df=1) + ##scale.sum$wald <- (scale.sum$Estimate / scale.sum$Std.err)^2 + ##scale.sum$p <- 1 - pchisq(scale.sum$wald, df=1) if (!is.null(object$geese$zsca.names)) rownames(scale.sum) <- object$geese$zsca.names value$dispersion <- scale.sum @@ -354,21 +355,22 @@ covmatalpha <- switch(object$std.err, 'jack'={object$geese$valpha.ajs}, - 'j1s'={object$geese$valpha.j1s}, - 'fij'={object$geese$valpha.fij}, + 'j1s' ={object$geese$valpha.j1s}, + 'fij' ={object$geese$valpha.fij}, object$geese$valpha ) corr.sum <- data.frame(Estimate = object$geese$alpha, Std.err=sqrt(diag(covmatalpha))) - #corr.sum$wald <- (corr.sum$Estimate / corr.sum$Std.err)^2 - #corr.sum$p <- 1 - pchisq(corr.sum$wald, df=1) - #if (nrow(corr.sum) > 0) rownames(corr.sum) <- object$geese$zcor.names + ##corr.sum$wald <- (corr.sum$Estimate / corr.sum$Std.err)^2 + ##corr.sum$p <- 1 - pchisq(corr.sum$wald, df=1) + ##if (nrow(corr.sum) > 0) rownames(corr.sum) <- object$geese$zcor.names value$corr <- corr.sum - value$corstr <- object$geese$model$corstr value$scale.fix <- object$geese$model$scale.fix - value$cor.link <- object$geese$model$cor.link + value$cor.link <- object$geese$model$cor.link + + v1 <- summary.geese(object$geese) value$clusz <- v1$clusz value$error <- object$geese$error @@ -379,7 +381,7 @@ # colnames(mean.sum) <- c("Estimate","Std.Error","ajs.SE","j1s.SE","fij.SE", # "Wald","Pr(>|z|)") - +#' @export print.summary.geeglm <- function (x, digits = max(3, getOption("digits") - 3), quote = FALSE, prefix = "", ...) # Thanks, Achim... @@ -415,38 +417,46 @@ } +#' @export print.geeglm <- function (x, digits = NULL, quote = FALSE, prefix = "", ...) { - xg <- x$geese - if (is.null(digits)) - digits <- options()$digits + + xg <- x$geese + if (is.null(digits)) + digits <- options()$digits else options(digits = digits) - cat("\nCall:\n"); print(x$call) - cat("\nCoefficients:\n") - print(unclass(x$coefficients), digits = digits) - - cat("\nDegrees of Freedom:", length(x$y), "Total (i.e. Null); ", - x$df.residual, "Residual\n") - - if (!xg$model$scale.fix) { - cat("\nScale Link: ", xg$model$sca.link) - cat("\nEstimated Scale Parameters: ") - print(as.numeric(unclass(xg$gamma)), digits = digits) - } - else cat("\nScale is fixed.\n") - - cat("\nCorrelation: Structure =",xg$model$corstr, " ") - if (pmatch(xg$model$corstr, "independence", 0) == 0) { - cat(" Link =", xg$model$cor.link, "\n") - cat("Estimated Correlation Parameters:\n") - print(unclass(xg$alpha), digits = digits) - } - cat("\nNumber of clusters: ", length(xg$clusz), " Maximum cluster size:", - max(xg$clusz), "\n\n") - invisible(x) + + + cat("\nCall:\n") + print(x$call) + cat("\nCoefficients:\n") + print(unclass(x$coefficients), digits = digits) + + cat("\nDegrees of Freedom:", length(x$y), "Total (i.e. Null); ", + x$df.residual, "Residual\n") + + + + if (!xg$model$scale.fix) { + cat("\nScale Link: ", xg$model$sca.link) + cat("\nEstimated Scale Parameters: ") + print(as.numeric(unclass(xg$gamma)), digits = digits) + } + else cat("\nScale is fixed.\n") + + cat("\nCorrelation: Structure =",xg$model$corstr, " ") + if (pmatch(xg$model$corstr, "independence", 0) == 0) { + cat(" Link =", xg$model$cor.link, "\n") + cat("Estimated Correlation Parameters:\n") + print(unclass(xg$alpha), digits = digits) + } + cat("\nNumber of clusters: ", length(xg$clusz), " Maximum cluster size:", + max(xg$clusz), "\n\n") + invisible(x) } +#' @export residuals.geeglm <- function (object, type = c("pearson", "working", "response"), ...) { type <- match.arg(type) @@ -473,6 +483,7 @@ res } +#' @export plot.geeglm <- function(x,...){ xx <- fitted(x) rp <- residuals(x, "pearson") diff -Nru r-cran-geepack-1.3-1/R/geem-interface.R r-cran-geepack-1.3-2/R/geem-interface.R --- r-cran-geepack-1.3-1/R/geem-interface.R 2019-12-10 22:37:13.000000000 +0000 +++ r-cran-geepack-1.3-2/R/geem-interface.R 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -## Coerce between geeglm and geem objects -## - -## as.geem <- function(object) UseMethod("as.geem") - -## as.geem.geeglm <- function(object){ -## object2 <- object$call -## object2[[1]] <- as.name("geem") -## eval(object2) -## } - -## as.geeglm <- function(object) UseMethod("as.geeglm") - -## as.geem.geem <- function(object){ -## object2 <- object$call -## object2[[1]] <- as.name("geeglm") -## eval(object2) -## } diff -Nru r-cran-geepack-1.3-1/R/geese.R r-cran-geepack-1.3-2/R/geese.R --- r-cran-geepack-1.3-1/R/geese.R 2017-04-12 14:20:30.000000000 +0000 +++ r-cran-geepack-1.3-2/R/geese.R 2020-12-13 07:18:06.000000000 +0000 @@ -1,94 +1,107 @@ -#' Function to solve a Generalized Estimating Equation Model +#' @title Function to fit a Generalized Estimating Equation Model #' -#' Produces an object of class `geese' which is a Generalized Estimating +#' @description Produces an object of class `geese' which is a Generalized Estimating #' Equation fit of the data. -#' +#' +#' @details #' when the correlation structure is \code{fixed}, the specification of #' \code{Zcor} should be a vector of length \code{sum(clusz * (clusz - 1)) / #' 2.} #' -#' @aliases geese geese.fit print.geese summary.geese print.summary.geese +#' @aliases geese geese.fit print.geese summary.geese +#' print.summary.geese +#' #' @param formula a formula expression as for \code{glm}, of the form -#' \code{response ~ predictors}. See the documentation of lm and formula for -#' details. As for glm, this specifies the linear predictor for modeling the -#' mean. A term of the form \code{offset(expression)} is allowed. -#' @param sformula a formula expression of the form \code{ ~ predictor}, the -#' response being ignored. This specifies the linear predictor for modeling the -#' dispersion. A term of the form \code{offset(expression)} is allowed. -#' @param 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. -#' @param waves an integer vector which identifies components in clusters. The -#' length of \code{waves} should be the same as the number of observation. -#' components with the same \code{waves} value will have the same link -#' functions. -#' @param data an optional data frame in which to interpret the variables -#' occurring in the \code{formula}, along with the \code{id} and \code{n} -#' variables. -#' @param subset expression saying which subset of the rows of the data should -#' be used in the fit. This can be a logical vector (which is replicated to -#' have length equal to the number of observations), or a numeric vector -#' indicating which observation numbers are to be included, or a character -#' vector of the row names to be included. All observations are included by -#' default. -#' @param na.action a function to filter missing data. For \code{gee} only -#' \code{na.omit} should be used here. -#' @param contrasts a list giving contrasts for some or all of the factors -#' appearing in the model formula. The elements of the list should have the -#' same name as the variable and should be either a contrast matrix -#' (specifically, any full-rank matrix with as many rows as there are levels in -#' the factor), or else a function to compute such a matrix given the number of -#' levels. -#' @param weights an optional vector of weights to be used in the fitting -#' process. The length of \code{weights} should be the same as the number of -#' observations. This weights is not (yet) the weight as in sas proc genmod, -#' and hence is not recommended to use. +#' \code{response ~ predictors}. See the documentation of lm and +#' formula for details. As for glm, this specifies the linear +#' predictor for modeling the mean. A term of the form +#' \code{offset(expression)} is allowed. +#' @param sformula a formula expression of the form \code{ ~ +#' predictor}, the response being ignored. This specifies the +#' linear predictor for modeling the dispersion. A term of the +#' form \code{offset(expression)} is allowed. +#' @param 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. +#' @param waves an integer vector which identifies components in +#' clusters. The length of \code{waves} should be the same as the +#' number of observation. components with the same \code{waves} +#' value will have the same link functions. +#' @param data an optional data frame in which to interpret the +#' variables occurring in the \code{formula}, along with the +#' \code{id} and \code{n} variables. +#' @param subset expression saying which subset of the rows of the +#' data should be used in the fit. This can be a logical vector +#' (which is replicated to have length equal to the number of +#' observations), or a numeric vector indicating which observation +#' numbers are to be included, or a character vector of the row +#' names to be included. All observations are included by +#' default. +#' @param na.action a function to filter missing data. For \code{gee} +#' only \code{na.omit} should be used here. +#' @param contrasts a list giving contrasts for some or all of the +#' factors appearing in the model formula. The elements of the +#' list should have the same name as the variable and should be +#' either a contrast matrix (specifically, any full-rank matrix +#' with as many rows as there are levels in the factor), or else a +#' function to compute such a matrix given the number of levels. +#' @param weights an optional vector of weights to be used in the +#' fitting process. The length of \code{weights} should be the +#' same as the number of observations. This weights is not (yet) +#' the weight as in sas proc genmod, and hence is not recommended +#' to use. #' @param zcor a design matrix for correlation parameters. -#' @param corp known parameters such as coordinates used for correlation -#' coefficients. +#' @param corp known parameters such as coordinates used for +#' correlation coefficients. #' @param control a list of iteration and algorithmic constants. See -#' \code{\link{geese.control}} for their names and default values. These can -#' also be set as arguments to \code{geese} itself. +#' \code{\link{geese.control}} for their names and default +#' values. These can also be set as arguments to \code{geese} +#' itself. #' @param b an initial estimate for the mean parameters. #' @param alpha an initial estimate for the correlation parameters. #' @param gm an initial estimate for the scale parameters. -#' @param family a description of the error distribution and link function to -#' be used in the model, as for \code{\link{glm}}. -#' @param mean.link a character string specifying the link function for the -#' means. The following are allowed: \code{"identity"}, \code{"logit"}, -#' \code{"probit"}, \code{"cloglog"}, \code{"log"}, and \code{"inverse"}. The -#' default value is determined from family. -#' @param variance a character string specifying the variance function in terms -#' of the mean. The following are allowed: \code{"gaussian"}, -#' \code{"binomial"}, \code{"poisson"}, and \code{"gamma"}. The default value -#' is determined from family. -#' @param cor.link a character string specifying the link function for the -#' correlation coefficients. The following are allowed: \code{"identity"}, and -#' \code{"fisherz"}. -#' @param sca.link a character string specifying the link function for the -#' scales. The following are allowed: \code{"identity"}, and \code{"log"}. -#' @param link.same a logical indicating if all the components in a cluster -#' should use the same link. -#' @param scale.fix a logical variable; if true, the scale parameter is fixed -#' at the value of \code{scale.value}. -#' @param scale.value numeric variable giving the value to which the scale -#' parameter should be fixed; used only if \code{scale.fix == TRUE}. -#' @param corstr a character string specifying the correlation structure. The -#' following are permitted: \code{"independence"}, \code{"exchangeable"}, -#' \code{"ar1"}, \code{"unstructured"}, \code{"userdefined"}, and -#' \code{"fixed"} -#' @param x,y \code{x} is a design matrix of dimension \code{n * p}, and -#' \code{y} is a vector of observations of length \code{n}. -#' @param offset,soffset vector of offset for the mean and for the scale, -#' respectively. -#' @param zsca a design matrix of dimension \code{n * r} for the scales. +#' @param family a description of the error distribution and link +#' function to be used in the model, as for \code{\link{glm}}. +#' @param mean.link a character string specifying the link function +#' for the means. The following are allowed: \code{"identity"}, +#' \code{"logit"}, \code{"probit"}, \code{"cloglog"}, +#' \code{"log"}, and \code{"inverse"}. The default value is +#' determined from family. +#' @param variance a character string specifying the variance function +#' in terms of the mean. The following are allowed: +#' \code{"gaussian"}, \code{"binomial"}, \code{"poisson"}, and +#' \code{"gamma"}. The default value is determined from family. +#' @param cor.link a character string specifying the link function for +#' the correlation coefficients. The following are allowed: +#' \code{"identity"}, and \code{"fisherz"}. +#' @param sca.link a character string specifying the link function for +#' the scales. The following are allowed: \code{"identity"}, and +#' \code{"log"}. +#' @param link.same a logical indicating if all the components in a +#' cluster should use the same link. +#' @param scale.fix a logical variable; if true, the scale parameter +#' is fixed at the value of \code{scale.value}. +#' @param scale.value numeric variable giving the value to which the +#' scale parameter should be fixed; used only if \code{scale.fix +#' == TRUE}. +#' @param corstr a character string specifying the correlation +#' structure. The following are permitted: \code{"independence"}, +#' \code{"exchangeable"}, \code{"ar1"}, \code{"unstructured"}, +#' \code{"userdefined"}, and \code{"fixed"} +## ' @param x,y \code{x} is a design matrix of dimension \code{n * p}, +## ' and \code{y} is a vector of observations of length \code{n}. +## ' @param offset,soffset vector of offset for the mean and for the +## ' scale, respectively. +## ' @param zsca a design matrix of dimension \code{n * r} for the +## ' scales. #' @param \dots further arguments passed to or from other methods. #' @return An object of class \code{"geese"} representing the fit. #' @author Jun Yan \email{jyan.stat@@gmail.com} #' @seealso \code{\link{glm}}, \code{\link{lm}}, \code{\link{ordgee}}. #' @references Yan, J. and J.P. Fine (2004) Estimating Equations for -#' Association Structures. \emph{Statistics in Medicine}, \bold{23}, 859--880. +#' Association Structures. \emph{Statistics in Medicine}, +#' \bold{23}, 859--880. #' @keywords nonlinear models #' @examples #' @@ -254,6 +267,7 @@ ans } +#' @export geese.fit <- function(x, y, id, offset=rep(0,N), soffset=rep(0,N), weights=rep(1,N), waves = NULL, zsca = matrix(1,N,1), @@ -392,31 +406,33 @@ -#' Auxiliary for Controlling GEE Fitting +#' @title Auxiliary for Controlling GEE Fitting #' -#' Auxiliary function as user interface for `gee' fitting. Only used when +#' @description Auxiliary function as user interface for `gee' fitting. Only used when #' calling `geese' or `geese.fit'. #' -#' When `trace' is true, output for each iteration is printed to the screen by +#' @details When `trace' is true, output for each iteration is printed to the screen by #' the c++ code. Hence, `options(digits = *)' does not control the precision. #' -#' @param epsilon positive convergence tolerance epsilon; the iterations -#' converge when the absolute value of the difference in parameter estimate is -#' below \code{epsilon}. -#' @param maxit integer giving the maximal number of Fisher Scoring iteration. -#' @param trace logical indicating if output should be produced for each -#' iteration. +#' @param epsilon positive convergence tolerance epsilon; the +#' iterations converge when the absolute value of the difference +#' in parameter estimate is below \code{epsilon}. +#' @param maxit integer giving the maximal number of Fisher Scoring +#' iteration. +#' @param trace logical indicating if output should be produced for +#' each iteration. #' @param scale.fix logical indicating if the scale should be fixed. -#' @param jack logical indicating if approximate jackknife variance estimate -#' should be computed. -#' @param j1s logical indicating if 1-step jackknife variance estimate should -#' be computed. -#' @param fij logical indicating if fully iterated jackknife variance estimate -#' should be computed. +#' @param jack logical indicating if approximate jackknife variance +#' estimate should be computed. +#' @param j1s logical indicating if 1-step jackknife variance estimate +#' should be computed. +#' @param fij logical indicating if fully iterated jackknife variance +#' estimate should be computed. #' @return A list with the arguments as components. #' @author Jun Yan \email{jyan.stat@@gmail.com} #' @seealso `geese.fit', the fitting procedure used by `geese'. #' @keywords optimize models +#' #' @export geese.control geese.control <- function (epsilon = 1e-04, maxit = 25, trace = FALSE, scale.fix = FALSE, jack = FALSE, @@ -433,22 +449,23 @@ ## compare coefficients - -#' Compare Regression Coefficiente between Nested Models +#' @title Compare Regression Coefficiente between Nested Models #' -#' Comparing regression coefficients between models when one model is nested +#' @description Comparing regression coefficients between models when one model is nested #' within another for clustered data. #' -#' #' @param fit0 a fitted object of class \code{geese} #' @param fit1 another fitted object of class \code{geese} -#' @return a list of two components: \item{delta}{estimated difference in the -#' coefficients of common covariates from \code{fit0} and \code{fit1}} -#' \item{variance}{estimated variance matrix of delta} +#' +#' @return a list of two components: \item{delta}{estimated difference +#' in the coefficients of common covariates from \code{fit0} and +#' \code{fit1}} \item{variance}{estimated variance matrix of +#' delta} #' @author Jun Yan \email{jyan.stat@@gmail.com} -#' @references Allison, P. D. (1995). The impact of random predictors on -#' comparisons of coefficients between models: Comment on Clogg, Petkova, and -#' Haritou. \emph{American Journal of Sociology}, \bold{100}(5), 1294--1305. +#' @references Allison, P. D. (1995). The impact of random predictors +#' on comparisons of coefficients between models: Comment on +#' Clogg, Petkova, and Haritou. \emph{American Journal of +#' Sociology}, \bold{100}(5), 1294--1305. #' #' Clogg, C. C., Petkova, E., and Haritou, A. (1995). Statistical methods for #' comparing regression coefficients between models. \emph{American Journal of @@ -458,6 +475,7 @@ #' Coefficients Between Nested Linear Models for Clustered Data with #' Generalized Estimating Equations. \emph{Journal of Educational and #' Behaviorial Statistics}, Forthcoming. +#' #' @keywords models #' @examples #' @@ -487,6 +505,7 @@ #' compCoef(fit0, fit1) #' #' @export compCoef +#' compCoef <- function(fit0, fit1) { v0 <- names(fit0$beta) v1 <- names(fit1$beta) diff -Nru r-cran-geepack-1.3-1/R/genZcor.R r-cran-geepack-1.3-2/R/genZcor.R --- r-cran-geepack-1.3-1/R/genZcor.R 1970-01-01 00:00:00.000000000 +0000 +++ r-cran-geepack-1.3-2/R/genZcor.R 2020-12-13 06:16:15.000000000 +0000 @@ -0,0 +1,114 @@ + +#' genZcor +#' +#' constructs the design matrix for the correlation structures: independence, +#' echangeable, ar1 and unstructured The user will need this function only as a +#' basis to construct a user defined correlation structure: use genZcor to get +#' the design matrix Z for the unstructured correlation and define the specific +#' correlation structure by linear combinations of the columns of Z. +#' +#' +#' @aliases genZcor humbelbee +#' @param clusz integer vector giving the number of observations in +#' each cluster +#' @param waves integer vector, obervations in the same cluster with +#' values of wave i and j have the correlation +#' \eqn{latex}{sigma_ij} +#' @param corstrv correlation structures: +#' 1=independence,2=exchangeable,3=ar1, 4=unstructured +#' @return \item{}{the design matrix for the correlation structure} +#' @author Jun Yan \email{jyan.stat@@gmail.com} +#' @seealso \code{\link{fixed2Zcor}} +#' @keywords regression +#' @examples +#' +#' #example to construct a Toeplitz correlation structure +#' # sigma_ij=sigma_|i-j| +#' +#' #data set with 5 clusters and maximally 4 observations (visits) per cluster +#' gendat <- function() { +#' id <- gl(5, 4, 20) +#' visit <- rep(1:4, 5) +#' y <- rnorm(id) +#' dat <- data.frame(y, id, visit)[c(-2,-9),] +#' } +#' +#' set.seed(88) +#' dat<-gendat() +#' +#' #generating the design matrix for the unstructured correlation +#' zcor <- genZcor(clusz = table(dat$id), waves = dat$visit, corstrv=4) +#' # defining the Toeplitz structure +#' zcor.toep<-matrix(NA, nrow(zcor),3) +#' zcor.toep[,1]<-apply(zcor[,c(1,4,6)],1,sum) +#' zcor.toep[,2]<-apply(zcor[,c(2,5)],1,sum) +#' zcor.toep[,3]<-zcor[,3] +#' +#' zfit1 <- geese(y ~ 1,id = id, data = dat, +#' corstr = "userdefined", zcor = zcor.toep) +#' +#' +#' zfit2 <- geeglm(y ~ 1,id = id, data = dat, +#' corstr = "userdefined", zcor = zcor.toep) +#' +#' +#' +#' @export genZcor +genZcor <- function(clusz, waves, corstrv) { + if (corstrv == 1) return (matrix(0,0,0)) + crs <- clusz * (clusz - 1) / 2 + if (corstrv == 2 || corstrv == 3) { + ans <- matrix(1, length(clusz), 1) + ##ans <- matrix(1, sum(crs), 1) + colnames(ans) <- c("alpha") + } + else { + id <- rep(1:length(clusz), clusz) + z1 <- unlist(lapply(split(waves, id), crossutri)) + z2 <- unlist(crossutri(1:max(clusz))) + z <- factor(z1,levels=unique.default(z2)) + ans <- model.matrix(~z - 1) + znames <- paste("alpha", z2, sep = ".") + colnames(ans) <- znames + } + ans +} + + +genZodds <- function(clusz, waves, corstrv, ncat) { + if (corstrv == 1) return (matrix(0,0,0)) + crs <- clusz * (clusz - 1) / 2 + c2 <- ncat * ncat + if (corstrv == 2 | corstrv == 3) { + ans <- matrix(1, sum(crs) * c2, 1) + colnames(ans) <- c("alpha") + } + else { + id <- rep(1:length(clusz), clusz) + z1 <- unlist(lapply(split(waves, id), crossutri)) + z2 <- unlist(crossutri(1:max(clusz))) + z <- factor(z1,levels=unique.default(z2)) + z <- model.matrix(~z - 1) + ind <- gl(sum(crs), c2) + ans <- z[ind,] + colnames(ans) <- paste("alpha", 1:dim(ans)[2], sep=".") + } + ans +} + + + +crossutri <- function(wave) { + n <- length(wave) + if (n == 1) return(NULL) + ans <- rep(0, n*(n-1)/2) + k <- 1 + for (i in 1:(n-1)) + for (j in (i+1):n) { + ans[k] <- paste(wave[i], wave[j], sep=":") + k <- k + 1 + } + ans +} + + diff -Nru r-cran-geepack-1.3-1/R/internal.R r-cran-geepack-1.3-2/R/internal.R --- r-cran-geepack-1.3-1/R/internal.R 2017-04-12 14:20:30.000000000 +0000 +++ r-cran-geepack-1.3-2/R/internal.R 1970-01-01 00:00:00.000000000 +0000 @@ -1,110 +0,0 @@ -crossutri <- function(wave) { - n <- length(wave) - if (n == 1) return(NULL) - ans <- rep(0, n*(n-1)/2) - k <- 1 - for (i in 1:(n-1)) - for (j in (i+1):n) { - ans[k] <- paste(wave[i], wave[j], sep=":") - k <- k + 1 - } - ans -} - - - -#' genZcor -#' -#' constructs the design matrix for the correlation structures: independence, -#' echangeable, ar1 and unstructured The user will need this function only as a -#' basis to construct a user defined correlation structure: use genZcor to get -#' the design matrix Z for the unstructured correlation and define the specific -#' correlation structure by linear combinations of the columns of Z. -#' -#' -#' @aliases genZcor humbelbee -#' @param clusz integer vector giving the number of observations in each -#' cluster -#' @param waves integer vector, obervations in the same cluster with values of -#' wave i and j have the correlation \eqn{latex}{sigma_ij} -#' @param corstrv correlation structures: 1=independence,2=exchangeable,3=ar1, -#' 4=unstructured -#' @return \item{}{the design matrix for the correlation structure} -#' @author Jun Yan \email{jyan.stat@@gmail.com} -#' @seealso \code{\link{fixed2Zcor}} -#' @keywords regression -#' @examples -#' -#' #example to construct a Toeplitz correlation structure -#' # sigma_ij=sigma_|i-j| -#' -#' #data set with 5 clusters and maximally 4 observations (visits) per cluster -#' gendat <- function() { -#' id <- gl(5, 4, 20) -#' visit <- rep(1:4, 5) -#' y <- rnorm(id) -#' dat <- data.frame(y, id, visit)[c(-2,-9),] -#' } -#' -#' set.seed(88) -#' dat<-gendat() -#' -#' #generating the design matrix for the unstructured correlation -#' zcor <- genZcor(clusz = table(dat$id), waves = dat$visit, corstrv=4) -#' # defining the Toeplitz structure -#' zcor.toep<-matrix(NA, nrow(zcor),3) -#' zcor.toep[,1]<-apply(zcor[,c(1,4,6)],1,sum) -#' zcor.toep[,2]<-apply(zcor[,c(2,5)],1,sum) -#' zcor.toep[,3]<-zcor[,3] -#' -#' zfit1 <- geese(y ~ 1,id = id, data = dat, -#' corstr = "userdefined", zcor = zcor.toep) -#' -#' -#' zfit2 <- geeglm(y ~ 1,id = id, data = dat, -#' corstr = "userdefined", zcor = zcor.toep) -#' -#' -#' -#' @export genZcor -genZcor <- function(clusz, waves, corstrv) { - if (corstrv == 1) return (matrix(0,0,0)) - crs <- clusz * (clusz - 1) / 2 - if (corstrv == 2 || corstrv == 3) { - ans <- matrix(1, length(clusz), 1) - ##ans <- matrix(1, sum(crs), 1) - colnames(ans) <- c("alpha") - } - else { - id <- rep(1:length(clusz), clusz) - z1 <- unlist(lapply(split(waves, id), crossutri)) - z2 <- unlist(crossutri(1:max(clusz))) - z <- factor(z1,levels=unique.default(z2)) - ans <- model.matrix(~z - 1) - znames <- paste("alpha", z2, sep = ".") - colnames(ans) <- znames - } - ans -} - - -genZodds <- function(clusz, waves, corstrv, ncat) { - if (corstrv == 1) return (matrix(0,0,0)) - crs <- clusz * (clusz - 1) / 2 - c2 <- ncat * ncat - if (corstrv == 2 | corstrv == 3) { - ans <- matrix(1, sum(crs) * c2, 1) - colnames(ans) <- c("alpha") - } - else { - id <- rep(1:length(clusz), clusz) - z1 <- unlist(lapply(split(waves, id), crossutri)) - z2 <- unlist(crossutri(1:max(clusz))) - z <- factor(z1,levels=unique.default(z2)) - z <- model.matrix(~z - 1) - ind <- gl(sum(crs), c2) - ans <- z[ind,] - colnames(ans) <- paste("alpha", 1:dim(ans)[2], sep=".") - } - ans -} diff -Nru r-cran-geepack-1.3-1/R/NAMESPACE.R r-cran-geepack-1.3-2/R/NAMESPACE.R --- r-cran-geepack-1.3-1/R/NAMESPACE.R 1970-01-01 00:00:00.000000000 +0000 +++ r-cran-geepack-1.3-2/R/NAMESPACE.R 2020-12-13 07:29:07.000000000 +0000 @@ -0,0 +1,24 @@ +#' @useDynLib geepack + +#' @import methods +#' @importFrom MASS ginv +#' +#' @importFrom graphics abline lines plot +#' +#' @importFrom stats binomial coef fitted formula gaussian +#' glm.fit is.empty.model lm.fit lowess +#' model.extract model.matrix model.offset +#' model.response model.weights na.omit naresid +#' pchisq printCoefmat quasi residuals summary.glm +#' var family +#' +#' @importFrom utils head str +#' @importFrom broom tidy +#' @export tidy +#' @importFrom magrittr %>% +#' @export %>% + + + + +.dumfunction_afterimportFrom <- function(){} diff -Nru r-cran-geepack-1.3-1/R/ordgee.R r-cran-geepack-1.3-2/R/ordgee.R --- r-cran-geepack-1.3-1/R/ordgee.R 2017-04-12 14:20:30.000000000 +0000 +++ r-cran-geepack-1.3-2/R/ordgee.R 2020-12-13 06:18:48.000000000 +0000 @@ -1,71 +1,78 @@ -#' GEE for Clustered Ordinal Responses +#' @title GEE for Clustered Ordinal Responses #' -#' Produces an object of class `geese' which is a Generalized Estimating -#' Equation fit of the clustered ordinal data. +#' @description Produces an object of class `geese' which is a +#' Generalized Estimating Equation fit of the clustered ordinal +#' data. #' #' #' @param formula a formula expression as for \code{glm}, of the form -#' \code{response ~ predictors}. See the documentation of lm and formula for -#' details. As for glm, this specifies the linear predictor for modelling the -#' mean. A term of the form \code{offset(expression)} is allowed. +#' \code{response ~ predictors}. See the documentation of lm and +#' formula for details. As for glm, this specifies the linear +#' predictor for modelling the mean. A term of the form +#' \code{offset(expression)} is allowed. #' @param ooffset vector of offset for the odds ratio model. -#' @param 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. -#' @param waves an integer vector which identifies components in clusters. The -#' length of \code{waves} should be the same as the number of observation. -#' components with the same \code{waves} value will have the same link -#' functions. -#' @param data an optional data frame in which to interpret the variables -#' occurring in the \code{formula}, along with the \code{id} and \code{n} -#' variables. -#' @param subset expression saying which subset of the rows of the data should -#' be used in the fit. This can be a logical vector (which is replicated to -#' have length equal to the number of observations), or a numeric vector -#' indicating which observation numbers are to be included, or a character -#' vector of the row names to be included. All observations are included by -#' default. -#' @param na.action a function to filter missing data. For \code{gee} only -#' \code{na.omit} should be used here. -#' @param contrasts a list giving contrasts for some or all of the factors -#' appearing in the model formula. The elements of the list should have the -#' same name as the variable and should be either a contrast matrix -#' (specifically, any full-rank matrix with as many rows as there are levels in -#' the factor), or else a function to compute such a matrix given the number of -#' levels. -#' @param weights an optional vector of weights to be used in the fitting -#' process. The length of \code{weights} should be the same as the number of -#' observations. -#' @param z a design matrix for the odds ratio model. The number of rows of z -#' is \deqn{c^2 \sum n_i(n_i - 1)/2,} where \eqn{n_i} is the cluster size, and -#' \eqn{c} is the number of categories minus 1. -#' @param mean.link a character string specifying the link function for the -#' means. The following are allowed: \code{"logit"}, \code{"probit"}, and -#' \code{"cloglog"}. -#' @param corstr a character string specifying the log odds. The following are -#' allowed: \code{"independence"}, \code{"exchangeable"}, -#' \code{"unstructured"}, and \code{"userdefined"}. +#' @param 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. +#' @param waves an integer vector which identifies components in +#' clusters. The length of \code{waves} should be the same as the +#' number of observation. components with the same \code{waves} +#' value will have the same link functions. +#' @param data an optional data frame in which to interpret the +#' variables occurring in the \code{formula}, along with the +#' \code{id} and \code{n} variables. +#' @param subset expression saying which subset of the rows of the +#' data should be used in the fit. This can be a logical vector +#' (which is replicated to have length equal to the number of +#' observations), or a numeric vector indicating which observation +#' numbers are to be included, or a character vector of the row +#' names to be included. All observations are included by +#' default. +#' @param na.action a function to filter missing data. For \code{gee} +#' only \code{na.omit} should be used here. +#' @param contrasts a list giving contrasts for some or all of the +#' factors appearing in the model formula. The elements of the +#' list should have the same name as the variable and should be +#' either a contrast matrix (specifically, any full-rank matrix +#' with as many rows as there are levels in the factor), or else a +#' function to compute such a matrix given the number of levels. +#' @param weights an optional vector of weights to be used in the +#' fitting process. The length of \code{weights} should be the +#' same as the number of observations. +#' @param z a design matrix for the odds ratio model. The number of +#' rows of z is \deqn{c^2 \sum n_i(n_i - 1)/2,} where \eqn{n_i} is +#' the cluster size, and \eqn{c} is the number of categories minus +#' 1. +#' @param mean.link a character string specifying the link function +#' for the means. The following are allowed: \code{"logit"}, +#' \code{"probit"}, and \code{"cloglog"}. +#' @param corstr a character string specifying the log odds. The +#' following are allowed: \code{"independence"}, +#' \code{"exchangeable"}, \code{"unstructured"}, and +#' \code{"userdefined"}. #' @param control a list of iteration and algorithmic constants. See -#' \code{\link{geese.control}} for their names and default values. These can -#' also be set as arguments to \code{geese} itself. +#' \code{\link{geese.control}} for their names and default +#' values. These can also be set as arguments to \code{geese} +#' itself. #' @param b an initial estimate for the mean parameters. #' @param alpha an initial estimate for the odds ratio parameters. -#' @param scale.fix a logical variable indicating if scale is fixed; it is set -#' at TRUE currently (it can not be FALSE yet!). +#' @param scale.fix a logical variable indicating if scale is fixed; +#' it is set at TRUE currently (it can not be FALSE yet!). #' @param scale.val this argument is ignored currently. -#' @param int.const a logical variable; if true, the intercepts are constant, -#' and if false, the intercepts are different for different components in the -#' response. -#' @param rev a logical variable. For example, for a three level ordered -#' response Y = 2, the accumulated indicator is coded as (1, 0, 0) if true and -#' (0, 1, 1) if false. +#' @param int.const a logical variable; if true, the intercepts are +#' constant, and if false, the intercepts are different for +#' different components in the response. +#' @param rev a logical variable. For example, for a three level +#' ordered response Y = 2, the accumulated indicator is coded as +#' (1, 0, 0) if true and (0, 1, 1) if false. #' @param \dots further arguments passed to or from other methods. #' @return An object of class \code{"geese"} representing the fit. #' @author Jun Yan \email{jyan.stat@@gmail.com} #' @seealso \code{\link{glm}}, \code{\link{lm}}, \code{\link{geese}}. -#' @references Heagerty, P.J. and Zeger, S.L. (1996) Marginal regression models -#' for clustered ordinal measurements. \emph{JASA}, \bold{91} 1024--1036. +#' @references Heagerty, P.J. and Zeger, S.L. (1996) Marginal +#' regression models for clustered ordinal measurements. +#' \emph{JASA}, \bold{91} 1024--1036. #' @keywords nonlinear models #' @examples #' @@ -227,21 +234,21 @@ clusz, ncat, rev, geestr, corr, param, control, PACKAGE = "geepack") - names(ans) <- c("beta", "alpha", "gamma", "vbeta", "valpha", "vgamma", + names(ans) <- c("beta", "alpha", "gamma", "vbeta", "valpha", "vgamma", "vbeta.naiv", "valpha.naiv", "valpha.stab", "vbeta.ajs", "valpha.ajs", "vgamma.ajs", "vbeta.j1s", "valpha.j1s", "vgamma.j1s", "vbeta.fij", "valpha.fij", "vgamma.fij", "error") - ans$xnames <- dimnames(xmat)[[2]] - ans$zcor.names <- dimnames(z)[[2]] - names(ans$beta) <- ans$xnames - names(ans$alpha) <- ans$zcor.names + ans$xnames <- dimnames(xmat)[[2]] + ans$zcor.names <- dimnames(z)[[2]] + names(ans$beta) <- ans$xnames + names(ans$alpha) <- ans$zcor.names - ans <- c(ans, list(call=scall, clusz=clusz, control=control, + ans <- c(ans, list(call=scall, clusz=clusz, control=control, model=list(mean.link=mean.link, - variance="binomial", sca.link=NULL, - cor.link="log", corstr=corstr, scale.fix=scale.fix))) - class(ans) <- "geese" - ans + variance="binomial", sca.link=NULL, + cor.link="log", corstr=corstr, scale.fix=scale.fix))) + class(ans) <- "geese" + ans } diff -Nru r-cran-geepack-1.3-1/R/qic.R r-cran-geepack-1.3-2/R/qic.R --- r-cran-geepack-1.3-1/R/qic.R 2019-01-06 20:42:52.000000000 +0000 +++ r-cran-geepack-1.3-2/R/qic.R 2020-12-13 06:36:45.000000000 +0000 @@ -19,22 +19,27 @@ #' used. #' #' @aliases QIC QIC.geeglm QIC.geekin QIC.ordgee -#' @param object a fitted GEE model from the geepack package. Currently only -#' works on geeglm objects +#' @param object a fitted GEE model from the geepack +#' package. Currently only works on geeglm objects #' @param tol the tolerance used for matrix inversion #' @param \dots optionally more fitted geeglm model objects -#' @return A vector or matrix with the QIC, QICu, quasi likelihood, CIC, the -#' number of mean effect parameters, and the corrected QIC for each GEE object +#' @return A vector or matrix with the QIC, QICu, quasi likelihood, +#' CIC, the number of mean effect parameters, and the corrected +#' QIC for each GEE object #' @author Claus Ekstrom \email{claus@@rprimer.dk} #' @seealso \code{geeglm} #' @references Pan, W. (2001). \emph{Akaike's information criterion in -#' generalized estimating equations}. Biometrics, 57, 120-125.\cr Hardin, J.W. -#' and Hilbe, J.M. (2012). \emph{Generalized Estimating Equations, 2nd -#' Edition}, Chapman and Hall/CRC: New York. \cr Hin, L.-Y. and Wang, Y-G. -#' (2009). \emph{Working-correlation-structure identification in generalized -#' estimating equations}, Statistics in Medicine 28: 642-658. \cr Thall, P.F. -#' and Vail, S.C. (1990). \emph{Some Covariance Models for Longitudinal Count -#' Data with Overdispersion}. Biometrics, 46, 657-671. +#' generalized estimating equations}. Biometrics, 57, 120-125.\cr +#' Hardin, J.W. and Hilbe, J.M. (2012). \emph{Generalized +#' Estimating Equations, 2nd Edition}, Chapman and Hall/CRC: New +#' York. \cr +#' +#' Hin, L.-Y. and Wang, Y-G. +#' (2009). \emph{Working-correlation-structure identification in +#' generalized estimating equations}, Statistics in Medicine 28: +#' 642-658. \cr Thall, P.F. and Vail, S.C. (1990). \emph{Some +#' Covariance Models for Longitudinal Count Data with +#' Overdispersion}. Biometrics, 46, 657-671. #' @keywords htest #' @examples #' diff -Nru r-cran-geepack-1.3-1/R/relative-risk-regression.R r-cran-geepack-1.3-2/R/relative-risk-regression.R --- r-cran-geepack-1.3-1/R/relative-risk-regression.R 1970-01-01 00:00:00.000000000 +0000 +++ r-cran-geepack-1.3-2/R/relative-risk-regression.R 2020-12-13 06:12:55.000000000 +0000 @@ -0,0 +1,105 @@ +## This is a wrapper function for relative risk regression +## for binary data with log link using the copy method + + +#' @title Fit a Relative Risk Model for Binary data with Log Link +#' +#' @description Fit a Relative Risk Model for Binary data with Log +#' Link using the COPY method. +#' +#' @param formula same as in \code{geese} +#' @param id same as in \code{geese} +#' @param waves same as in \code{geese} +#' @param data same as in \code{geese} +#' @param subset same as in \code{geese} +#' @param contrasts same as in \code{geese} +#' @param na.action same as in \code{geese} +#' @param corstr same as in \code{geese} +#' @param ncopy the number of copies of the original data in +#' constructing weight. +#' @param control same as in \code{geese} +#' @param b initial values for regression coefficients as in +#' \code{geese} but more difficult to obtain due to the log link. +#' @param alpha same as in \code{geese} +#' @return An object of class \code{"geese"} representing the fit. +#' @author Jun Yan \email{jyan.stat@@gmail.com} +#' +#' @references Lumley, T., Kornmal, R. and Ma, S. (2006). Relative +#' risk regression in medical research: models, contrasts, +#' estimators, and algorithms. UW Biostatistics Working Paper +#' Series 293, University of Washington. +#' @keywords models +#' @examples +#' +#' ## this example was used in Yu and Yan (2010, techreport) +#' data(respiratory) +#' respiratory$treat <- relevel(respiratory$treat, ref = "P") +#' respiratory$sex <- relevel(respiratory$sex, ref = "M") +#' respiratory$center <- as.factor(respiratory$center) +#' ## 1 will be the reference level +#' +#' fit <- relRisk(outcome ~ treat + center + sex + age + baseline + visit, +#' id = id, corstr = "ar1", data = respiratory, ncopy=10000) +#' summary(fit) +#' ## fit <- relRisk(outcome ~ treat + center + sex + age + baseline + visit, +#' ## id = id, corstr = "ex", data = respiratory) +#' ## summary(fit) +#' ## fit <- relRisk(outcome ~ treat + center + sex + age + baseline + visit, +#' ## id = id, corstr = "indep", data = respiratory) +#' ## summary(fit) +#' +#' @export relRisk +relRisk<- function(formula, id, waves = NULL, + data = parent.frame(), subset = NULL, + contrasts = NULL, na.action = na.omit, + corstr = "indep", + ncopy = 1000, control = geese.control(), + b = NULL, alpha = NULL) { + + family <- binomial("log") ## fixed + + scall <- match.call() + mnames <- c("", "formula", "data", "offset", "subset", "na.action", "id", "waves") + cnames <- names(scall) + cnames <- cnames[match(mnames,cnames,0)] + mcall <- scall[cnames] + if (is.null(mcall$id)) mcall$id <- as.name("id") + mcall[[1]] <- as.name("model.frame") + m <- eval(mcall, parent.frame()) + + y <- model.extract(m, "response") + if (is.null(dim(y))) N <- length(y) else N <- dim(y)[1] + mterms <- attr(m, "terms") + x <- model.matrix(mterms, m, contrasts) + offset <- model.extract(m, "offset") + if (is.null(offset)) offset <- rep(0, N) + + w <- rep(1 - 1 / ncopy, N) + w.copy <- rep(1 / ncopy, N) + + y.copy <- 1 - y + id <- model.extract(m, id) + waves <- model.extract(m, waves) + + ## augmented data + Y <- c(y, y.copy) + W <- c(w, w.copy) + X <- rbind(x, x) + ID <- c(id, id + max(id)) + Waves <- c(waves, waves) + Offset <- c(offset, offset) + Freq <- rep(c(2, 1), each = N) + + ## get initial values + fit0 <- glm.fit(X, Y, offset = Offset, weights = Freq, family = family) + fit1 <- glm.fit(X, Y, offset = Offset, family = family, weights = W, start = fit0$coefficients) + + ## feed geese + ans <- geese.fit(X, Y, ID, Offset, weights = W, waves = Waves, + family = family, control = control, corstr = corstr, + b = fit1$coefficients, scale.fix = TRUE) + ans <- c(ans, list(call=scall, formula=formula)) + class(ans) <- "geese" + ans + +} diff -Nru r-cran-geepack-1.3-1/R/rrr.R r-cran-geepack-1.3-2/R/rrr.R --- r-cran-geepack-1.3-1/R/rrr.R 2017-04-12 14:20:30.000000000 +0000 +++ r-cran-geepack-1.3-2/R/rrr.R 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -## This is a wrapper function for relative risk regression -## for binary data with log link using the copy method - - -#' Fit a Relative Risk Model for Binary data with Log Link -#' -#' Fit a Relative Risk Model for Binary data with Log Link using the COPY -#' method. -#' -#' -#' @param formula same as in \code{geese} -#' @param id same as in \code{geese} -#' @param waves same as in \code{geese} -#' @param data same as in \code{geese} -#' @param subset same as in \code{geese} -#' @param contrasts same as in \code{geese} -#' @param na.action same as in \code{geese} -#' @param corstr same as in \code{geese} -#' @param ncopy the number of copies of the original data in constructing -#' weight. -#' @param control same as in \code{geese} -#' @param b initial values for regression coefficients as in \code{geese} but -#' more difficult to obtain due to the log link. -#' @param alpha same as in \code{geese} -#' @return An object of class \code{"geese"} representing the fit. -#' @author Jun Yan \email{jyan.stat@@gmail.com} -#' @references Lumley, T., Kornmal, R. and Ma, S. (2006). Relative risk -#' regression in medical research: models, contrasts, estimators, and -#' algorithms. UW Biostatistics Working Paper Series 293, University of -#' Washington. -#' @keywords models -#' @examples -#' -#' ## this example was used in Yu and Yan (2010, techreport) -#' data(respiratory) -#' respiratory$treat <- relevel(respiratory$treat, ref = "P") -#' respiratory$sex <- relevel(respiratory$sex, ref = "M") -#' respiratory$center <- as.factor(respiratory$center) -#' ## 1 will be the reference level -#' -#' fit <- relRisk(outcome ~ treat + center + sex + age + baseline + visit, -#' id = id, corstr = "ar1", data = respiratory, ncopy=10000) -#' summary(fit) -#' ## fit <- relRisk(outcome ~ treat + center + sex + age + baseline + visit, -#' ## id = id, corstr = "ex", data = respiratory) -#' ## summary(fit) -#' ## fit <- relRisk(outcome ~ treat + center + sex + age + baseline + visit, -#' ## id = id, corstr = "indep", data = respiratory) -#' ## summary(fit) -#' -#' @export relRisk -relRisk<- function(formula, id, waves = NULL, - data = parent.frame(), subset = NULL, - contrasts = NULL, na.action = na.omit, - corstr = "indep", - ncopy = 1000, control = geese.control(), - b = NULL, alpha = NULL) { - - family <- binomial("log") ## fixed - - scall <- match.call() - mnames <- c("", "formula", "data", "offset", "subset", "na.action", "id", "waves") - cnames <- names(scall) - cnames <- cnames[match(mnames,cnames,0)] - mcall <- scall[cnames] - if (is.null(mcall$id)) mcall$id <- as.name("id") - mcall[[1]] <- as.name("model.frame") - m <- eval(mcall, parent.frame()) - - y <- model.extract(m, "response") - if (is.null(dim(y))) N <- length(y) else N <- dim(y)[1] - mterms <- attr(m, "terms") - x <- model.matrix(mterms, m, contrasts) - offset <- model.extract(m, "offset") - if (is.null(offset)) offset <- rep(0, N) - - w <- rep(1 - 1 / ncopy, N) - w.copy <- rep(1 / ncopy, N) - - y.copy <- 1 - y - id <- model.extract(m, id) - waves <- model.extract(m, waves) - - ## augmented data - Y <- c(y, y.copy) - W <- c(w, w.copy) - X <- rbind(x, x) - ID <- c(id, id + max(id)) - Waves <- c(waves, waves) - Offset <- c(offset, offset) - Freq <- rep(c(2, 1), each = N) - - ## get initial values - fit0 <- glm.fit(X, Y, offset = Offset, weights = Freq, family = family) - fit1 <- glm.fit(X, Y, offset = Offset, family = family, weights = W, start = fit0$coefficients) - - ## feed geese - ans <- geese.fit(X, Y, ID, Offset, weights = W, waves = Waves, - family = family, control = control, corstr = corstr, - b = fit1$coefficients, scale.fix = TRUE) - ans <- c(ans, list(call=scall, formula=formula)) - class(ans) <- "geese" - ans - -} diff -Nru r-cran-geepack-1.3-1/R/summary.R r-cran-geepack-1.3-2/R/summary.R --- r-cran-geepack-1.3-1/R/summary.R 2017-04-12 14:20:30.000000000 +0000 +++ r-cran-geepack-1.3-2/R/summary.R 2020-12-13 06:56:49.000000000 +0000 @@ -1,3 +1,4 @@ +#' @export summary.geese <- function(object, ...) { mean.sum <- data.frame(estimate = object$beta, # nai.se = sqrt(diag(object$vbeta.naiv)), @@ -43,6 +44,7 @@ ans } +#' @export print.geese <- function(x, digits = NULL, quote = FALSE, prefix = "", ...) { if(is.null(digits)) digits <- options()$digits else options(digits = digits) @@ -77,6 +79,7 @@ invisible(x) } +#' @export print.summary.geese <- function(x, digits = NULL, quote = FALSE, prefix = "", ... ) { if(is.null(digits)) digits <- options()$digits diff -Nru r-cran-geepack-1.3-1/src/inter.cc r-cran-geepack-1.3-2/src/inter.cc --- r-cran-geepack-1.3-1/src/inter.cc 2019-12-11 21:18:05.000000000 +0000 +++ r-cran-geepack-1.3-2/src/inter.cc 2020-12-17 16:51:57.000000000 +0000 @@ -130,12 +130,28 @@ //geestr is a list of maxwave, meanlink, v, scalelink, corrlink, scale.fix; int maxwave = INTEGER(AS_INTEGER(VECTOR_ELT(geestr, 0)))[0]; IVector MeanLink, V, ScaleLink; - MeanLink = asIVector(AS_INTEGER(VECTOR_ELT(geestr, 1))); - V = asIVector(AS_INTEGER(VECTOR_ELT(geestr, 2))); - ScaleLink = asIVector(AS_INTEGER(VECTOR_ELT(geestr, 3))); + + // FIXME: rchk gives warning here ... + //MeanLink = asIVector(AS_INTEGER(VECTOR_ELT(geestr, 1))); + //V = asIVector(AS_INTEGER(VECTOR_ELT(geestr, 2))); + //ScaleLink = asIVector(AS_INTEGER(VECTOR_ELT(geestr, 3))); + // and to here + + // Attempted fix + SEXP ML, VV, SL; + PROTECT(ML = AS_INTEGER(VECTOR_ELT(geestr, 1))); + PROTECT(VV = AS_INTEGER(VECTOR_ELT(geestr, 2))); + PROTECT(SL = AS_INTEGER(VECTOR_ELT(geestr, 3))); + MeanLink = asIVector(ML); + V = asIVector(VV); + ScaleLink = asIVector(SL); + // to here + int corrlink = INTEGER(AS_INTEGER(VECTOR_ELT(geestr, 4)))[0]; int scalefix = INTEGER(AS_INTEGER(VECTOR_ELT(geestr, 5)))[0]; GeeStr G(maxwave, MeanLink, V, ScaleLink, corrlink, scalefix); + UNPROTECT(3); + return G; }