pgee.fit: Penalized Generalized Estimating Equations

Description Usage Arguments Details Value Examples

View source: R/estimation_functions.R

Description

Estimate regression coefficients using Penalized Generalized Estimating Equations (PGEEs). Linear and binary logistic models are currently supported. In particular, can handle the case of bivariate correlated mixed outcomes, in which each cluster consists of one continuous outcome and one binary outcome.

Usage

1
2
3
4
5
pgee.fit(N, m, X, Z = NULL, y = NULL, yc = NULL, yb = NULL,
  wctype = "Ind", family = "Gaussian", lambda = 0, eps = 1e-06,
  maxiter = 1000, tol.coef = 0.001, tol.score = 0.001, init = NULL,
  standardize = TRUE, penalty = "SCAD", weights = rep(1, N),
  FDR = FALSE, fdr.corr = NULL, fdr.type = "all")

Arguments

N

Number of clusters.

m

Cluster size. Assumed equal across all clusters. Should be set to 2 for family=="Mixed".

X

Design matrix. If family=="Mixed", then design matrix for continuous responses. For family!="Mixed", should have N*m rows. For family=="Mixed", should have N rows. For standardize=TRUE, the first column should be a column vector of ones, corresponding to the intercept.

Z

Design matrix for binary responses for family=="Mixed". Should not be provided for other family types. If not provided for family=="Mixed", is set equal to X. For family!="Mixed", should have N*m rows. For family=="Mixed", should have N rows. For standardize=TRUE, the first column should be a column vector of ones, corresponding to the intercept.

y

Response vector. Don't use this argument for family == "Mixed". Instead, use arguments yc and yb. Since the cluster size is assumed equal across clusters, the vector is assumed to have the form c(y_1, y_2,...,y_N), with y_i = c(y_i1,...,y_im).

yc

Continuous response vector. Use only for family=="Mixed".

yb

Binary (0/1) response vector. Use only for family=="Mixed".

wctype

Working correlation type; one of "Ind", "CS", or "AR1". For family=="Mixed", "CS" and "AR1" are equivalent.

family

"Gaussian", "Binomial", or "Mixed" (use the last for bivariate mixed outcomes). Note that for "Binomial", currently only binary outcomes are supported.

lambda

Tuning parameter(s). A vector of two tuning parameters should be provided for family=="Mixed" (one for the continuous outcome coefficients, and one of the binary outcome coefficients). Otherwise, a single tuning parameter should be provided.

eps

Disturbance in the Linear Quadratic Approximation algorithm.

maxiter

The maximum number of iterations the Newton algorithm tries before declaring failure to converge.

tol.coef

Converge of the Newton algorithm is declared if two conditions are met: The L1-norm of the difference of successive iterates should be less than tol.coef AND the L1-norm of the penalized score should be less than tol.score.

tol.score

See tol.coef.

init

Vector of initial values for regression coefficients. For family=="Mixed", should be c(init_c, init_b). Defaults to glm values.

standardize

Standardize the design matrices prior to estimation?

penalty

"SCAD", "MCP", or "LASSO".

weights

Vector of cluster weights. All observations in a cluster are assumed to have the same weight.

FDR

Should the false discovery rate be estimated for family=="Mixed"? Currently, FDR cannot be estimated for other family types.

fdr.corr

Association parameter to use in FDR estimation. The default is to use the association parameter estimated from the PGEEs.

fdr.type

Estimate the FDR for only the coefficients corresponding to the continuous outcomes ("continuous"), for only the coefficients corresponding to the binary outcomes ("binary"), or for all coefficients ("all", the default).

Details

pgee.fit estimates the regression coefficients for a single value of the tuning paramter (or a single pair of tuning parameters in the mixed outcomes case). To select optimal tuning parameter(s) via k-fold cross validation, see cv.pgee.

For bivariate mixed outcomes, the false discovery rate can be estimated.

Value

A list

coefficients

Vector of estimated regression coefficients. For family=="Mixed", this takes the form c(coef_c, coef_b).

vcov

Sandwich formula based covariance matrix of estimated regression coefficients (other than the intercept(s)). The row/column names correspond to elements of coefficients.

phi

Estimated dispersion parameter.

alpha

Estimated association parameter.

num_iterations

Number of iterations the Newton algorithm ran.

converge

0=converged, 1=did not converge.

PenScore

Vector of penalized score functions at the estimated regression coefficients. If the algorithm converges, then these should be close to zero.

FDR

Estimated FDR for family=="Mixed", if requested.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
set.seed(100)
# Gaussian
N <- 100
m <- 10
p <- 10
y <- rnorm(N * m)
# If you want standardize = TRUE, you must provide an intercept.
X <- cbind(1, matrix(rnorm(N * m * (p - 1)), N * m, p - 1))
fit <- pgee.fit(X = X, y = y, N = N, m = m, lambda = 0.5, wctype = "CS",
            family = "Gaussian")
str(fit)
fit$coefficients
fit$vcov

# Binary
y <- sample(0:1, N*m, replace = TRUE)
fit <- pgee.fit(X = X, y = y, N = N, m = m, lambda = 0.1, wctype = "CS",
            family = "Binomial")
str(fit)
fit$coefficients
fit$vcov

# Bivariate mixed outcomes
# Generate some data
Bc <- c(2.0, 3.0, 1.5, 2.0, rep(0, times = p - 4))
Bb <- c(0.7, -0.7, -0.4, rep(0, times = p - 3))
dat <- gen_mixed_data(Bc, Bc, N, 0.5)
# Estimate regression coefficients and false discovery rate
fit <- pgee.fit(X = dat$X, yc = dat$yc, yb = dat$yb, N = N, m = 2,
            wctype = "CS", family = "Mixed", lambda = c(0.1, 0.05),
            FDR = TRUE)
str(fit)
fit$coefficients
fit$vcov

Example output

List of 8
 $ coefficients  : num [1:10] 1.65e-02 3.83e-07 -2.66e-04 -8.06e-06 -3.09e-06 ...
 $ vcov          : num [1:9, 1:9] 8.61e-13 -1.44e-11 -1.36e-13 -9.17e-14 4.32e-14 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:9] "2" "3" "4" "5" ...
  .. ..$ : chr [1:9] "2" "3" "4" "5" ...
 $ phi           : num 1.06
 $ alpha         : num -0.0112
 $ num_iterations: num 13
 $ converge      : num 0
 $ PenScore      : num [1:10] -5.03e-16 -4.32e-04 1.24e-01 1.88e-01 1.64e-01 ...
 $ FDR           : logi NA
 [1]  1.647210e-02  3.833171e-07 -2.660433e-04 -8.056127e-06 -3.087420e-06
 [6]  8.031320e-07 -6.295737e-04 -6.726526e-03 -4.295715e-07  5.060864e-03
               2             3             4             5             6
2   8.613359e-13 -1.443383e-11 -1.359931e-13 -9.165927e-14  4.317532e-14
3  -1.443383e-11  2.523863e-08  4.194025e-12  1.463658e-11 -2.834944e-11
4  -1.359931e-13  4.194025e-12  3.191533e-11 -2.170933e-12 -1.976114e-12
5  -9.165927e-14  1.463658e-11 -2.170933e-12  7.307825e-12  2.608954e-13
6   4.317532e-14 -2.834944e-11 -1.976114e-12  2.608954e-13  1.375238e-12
7   6.422694e-13  6.851341e-10  1.802262e-10 -2.399149e-10  3.363041e-11
8   9.411808e-11 -2.776368e-08 -2.546778e-09  8.121936e-10  3.822077e-10
9  -1.115545e-13 -8.915957e-13  6.852764e-13  4.606714e-13  8.435045e-14
10  3.529888e-10  7.157877e-08 -3.177134e-09  4.235949e-11  7.232707e-11
               7             8             9            10
2   6.422694e-13  9.411808e-11 -1.115545e-13  3.529888e-10
3   6.851341e-10 -2.776368e-08 -8.915957e-13  7.157877e-08
4   1.802262e-10 -2.546778e-09  6.852764e-13 -3.177134e-09
5  -2.399149e-10  8.121936e-10  4.606714e-13  4.235949e-11
6   3.363041e-11  3.822077e-10  8.435045e-14  7.232707e-11
7   1.552830e-07 -1.729901e-07 -8.205465e-12 -3.954180e-08
8  -1.729901e-07  1.507694e-05  2.580865e-10 -9.704816e-07
9  -8.205465e-12  2.580865e-10  8.125506e-13 -8.012537e-11
10 -3.954180e-08 -9.704816e-07 -8.012537e-11  1.036791e-05
List of 8
 $ coefficients  : num [1:10] -9.78e-02 -5.87e-02 -7.56e-02 -2.58e-08 -5.10e-03 ...
 $ vcov          : num [1:9, 1:9] 1.39e-03 -2.39e-04 4.08e-09 2.34e-05 -2.31e-06 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:9] "2" "3" "4" "5" ...
  .. ..$ : chr [1:9] "2" "3" "4" "5" ...
 $ phi           : num 1
 $ alpha         : num 0.00668
 $ num_iterations: num 11
 $ converge      : num 0
 $ PenScore      : num [1:10] -3.58e-07 -4.17e-05 -4.92e-05 1.23e-06 6.24e-03 ...
 $ FDR           : logi NA
 [1] -9.775728e-02 -5.872854e-02 -7.561909e-02 -2.579482e-08 -5.098200e-03
 [6]  6.709633e-04  4.849940e-03  2.215454e-02  6.060735e-07  4.823028e-02
               2             3             4             5             6
2   1.390546e-03 -2.386341e-04  4.079203e-09  2.339723e-05 -2.313984e-06
3  -2.386341e-04  1.655552e-03 -1.258208e-09 -1.162351e-05  6.927630e-06
4   4.079203e-09 -1.258208e-09  3.193028e-12  9.306620e-10  2.058728e-11
5   2.339723e-05 -1.162351e-05  9.306620e-10  5.886218e-05 -6.298594e-07
6  -2.313984e-06  6.927630e-06  2.058728e-11 -6.298594e-07  1.114552e-06
7  -3.565046e-05  2.382287e-05  1.041267e-09  6.913538e-06  3.362207e-08
8  -6.986897e-05 -2.900527e-05 -2.355404e-09  1.336237e-05  4.538517e-08
9  -3.991919e-09  1.204502e-08 -5.790573e-15  2.937704e-09 -3.516431e-11
10 -1.053045e-04 -7.764264e-05  2.495350e-09  1.598950e-05 -3.252945e-06
               7             8             9            10
2  -3.565046e-05 -6.986897e-05 -3.991919e-09 -1.053045e-04
3   2.382287e-05 -2.900527e-05  1.204502e-08 -7.764264e-05
4   1.041267e-09 -2.355404e-09 -5.790573e-15  2.495350e-09
5   6.913538e-06  1.336237e-05  2.937704e-09  1.598950e-05
6   3.362207e-08  4.538517e-08 -3.516431e-11 -3.252945e-06
7   4.297730e-05  4.124194e-06  5.968554e-10 -2.018825e-05
8   4.124194e-06  5.058943e-04  1.856554e-09  1.235802e-04
9   5.968554e-10  1.856554e-09  5.868542e-12 -6.242236e-09
10 -2.018825e-05  1.235802e-04 -6.242236e-09  1.222288e-03
List of 8
 $ coefficients  : num [1:20] 2.05 3.04 1.50 2.02 -2.93e-05 ...
 $ vcov          : num [1:18, 1:18] 6.07e-03 -1.99e-03 9.18e-04 1.12e-07 1.10e-08 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:18] "2" "3" "4" "5" ...
  .. ..$ : chr [1:18] "2" "3" "4" "5" ...
 $ phi           : num 0.903
 $ alpha         : num 0.183
 $ num_iterations: num 10
 $ converge      : num 0
 $ PenScore      : num [1:20] -5.58e-07 9.31e-08 -2.85e-07 -8.79e-07 4.77e-02 ...
 $ FDR           : num 0.594
 [1]  2.047051e+00  3.040296e+00  1.502942e+00  2.015991e+00 -2.925349e-05
 [6] -2.367132e-06 -6.632613e-02 -9.152748e-07 -1.697829e-05  2.473875e-04
[11]  3.373039e+00  3.725877e+00  5.823727e-01  3.954125e+00 -4.312767e-06
[16] -5.340395e-01 -2.219041e-01  1.227100e-08 -5.939249e-01  8.185394e-01
               2             3             4             5             6
2   6.067430e-03 -1.994187e-03  9.183373e-04  1.120478e-07  1.095106e-08
3  -1.994187e-03  8.499964e-03 -1.092966e-03 -1.012126e-07 -7.233250e-09
4   9.183373e-04 -1.092966e-03  1.260350e-02  1.008510e-07 -9.366246e-08
5   1.120478e-07 -1.012126e-07  1.008510e-07  6.906804e-10  2.524796e-11
6   1.095106e-08 -7.233250e-09 -9.366246e-08  2.524796e-11  1.415766e-11
7   5.278163e-04 -2.129094e-04  1.719097e-04 -1.105871e-08 -1.030054e-08
8   1.228719e-08 -3.525293e-08 -1.433152e-08 -6.163627e-12 -1.898112e-12
9   8.632915e-08 -1.129494e-07 -5.777191e-08 -4.938664e-11 -1.740980e-11
10 -4.324671e-06  3.419060e-06 -3.843469e-06 -2.464315e-09 -2.041790e-10
12  1.999765e-03 -1.229370e-03  6.040512e-03  7.458440e-07 -5.045008e-08
13  4.639094e-04  9.793754e-03 -1.706723e-03 -1.505214e-07  2.438135e-07
14 -2.183079e-04 -4.902097e-03  1.509391e-02  2.114872e-06 -1.581195e-07
15  5.563223e-09 -9.130134e-09 -1.674314e-09 -4.524822e-13 -4.428578e-13
16  1.469873e-04  8.580838e-03  3.479823e-04  1.819400e-07  5.758183e-07
17 -8.998121e-04 -2.775425e-03 -5.546974e-04  1.804347e-07 -2.432032e-07
18 -2.113816e-09  1.115609e-09  9.205544e-10  2.456952e-13 -6.624567e-14
19 -3.400299e-03 -3.688318e-04  3.636519e-03 -4.749089e-07 -1.252001e-07
20  7.295800e-04 -1.086563e-03  1.550250e-03 -3.656149e-07 -3.219096e-08
               7             8             9            10            12
2   5.278163e-04  1.228719e-08  8.632915e-08 -4.324671e-06  1.999765e-03
3  -2.129094e-04 -3.525293e-08 -1.129494e-07  3.419060e-06 -1.229370e-03
4   1.719097e-04 -1.433152e-08 -5.777191e-08 -3.843469e-06  6.040512e-03
5  -1.105871e-08 -6.163627e-12 -4.938664e-11 -2.464315e-09  7.458440e-07
6  -1.030054e-08 -1.898112e-12 -1.740980e-11 -2.041790e-10 -5.045008e-08
7   1.161352e-03  1.142078e-08  9.199996e-08 -1.123398e-07  3.982237e-04
8   1.142078e-08  5.249917e-12  7.388985e-12  1.069282e-10 -1.086270e-08
9   9.199996e-08  7.388985e-12  2.731616e-10  7.432086e-10  2.378787e-07
10 -1.123398e-07  1.069282e-10  7.432086e-10  5.508336e-08  1.121240e-05
12  3.982237e-04 -1.086270e-08  2.378787e-07  1.121240e-05  4.357038e-01
13 -2.099369e-04  8.122335e-09 -2.650940e-07 -6.196575e-06 -9.242782e-03
14  9.231346e-04  3.339292e-08  2.429992e-06  1.681701e-05  5.602406e-01
15  4.405135e-09 -9.965784e-15 -8.227181e-15 -4.624539e-12  1.156936e-07
16 -1.648790e-03 -7.788926e-08 -1.562993e-06 -1.947880e-05 -1.313660e-01
17  2.327306e-03  3.131309e-09  7.656904e-07  3.154618e-06 -5.515750e-02
18 -6.864954e-10 -6.942618e-14  7.173760e-13  2.993692e-13  4.849884e-08
19  4.613168e-04  9.107466e-08  7.453231e-07 -8.924857e-07 -1.491422e-01
20 -9.581017e-05 -2.416204e-08 -2.228102e-07  5.021345e-06  1.243623e-01
              13            14            15            16            17
2   4.639094e-04 -2.183079e-04  5.563223e-09  1.469873e-04 -8.998121e-04
3   9.793754e-03 -4.902097e-03 -9.130134e-09  8.580838e-03 -2.775425e-03
4  -1.706723e-03  1.509391e-02 -1.674314e-09  3.479823e-04 -5.546974e-04
5  -1.505214e-07  2.114872e-06 -4.524822e-13  1.819400e-07  1.804347e-07
6   2.438135e-07 -1.581195e-07 -4.428578e-13  5.758183e-07 -2.432032e-07
7  -2.099369e-04  9.231346e-04  4.405135e-09 -1.648790e-03  2.327306e-03
8   8.122335e-09  3.339292e-08 -9.965784e-15 -7.788926e-08  3.131309e-09
9  -2.650940e-07  2.429992e-06 -8.227181e-15 -1.562993e-06  7.656904e-07
10 -6.196575e-06  1.681701e-05 -4.624539e-12 -1.947880e-05  3.154618e-06
12 -9.242782e-03  5.602406e-01  1.156936e-07 -1.313660e-01 -5.515750e-02
13  2.024047e-01 -6.651392e-02  2.646102e-07  5.317334e-03 -4.446412e-02
14 -6.651392e-02  1.000502e+00 -1.459658e-07 -3.418954e-01  9.393061e-04
15  2.646102e-07 -1.459658e-07  2.993054e-12 -1.033343e-07 -1.192904e-07
16  5.317334e-03 -3.418954e-01 -1.033343e-07  4.571472e-01 -7.272123e-02
17 -4.446412e-02  9.393061e-04 -1.192904e-07 -7.272123e-02  1.550194e-01
18 -2.684176e-08  1.114626e-07 -9.608794e-14 -4.538110e-08  3.130715e-08
19 -6.188868e-02 -2.134241e-01 -9.419478e-08  1.009501e-01  6.735619e-02
20 -2.166507e-02  1.750626e-01  1.896163e-08 -1.903459e-02 -2.118618e-02
              18            19            20
2  -2.113816e-09 -3.400299e-03  7.295800e-04
3   1.115609e-09 -3.688318e-04 -1.086563e-03
4   9.205544e-10  3.636519e-03  1.550250e-03
5   2.456952e-13 -4.749089e-07 -3.656149e-07
6  -6.624567e-14 -1.252001e-07 -3.219096e-08
7  -6.864954e-10  4.613168e-04 -9.581017e-05
8  -6.942618e-14  9.107466e-08 -2.416204e-08
9   7.173760e-13  7.453231e-07 -2.228102e-07
10  2.993692e-13 -8.924857e-07  5.021345e-06
12  4.849884e-08 -1.491422e-01  1.243623e-01
13 -2.684176e-08 -6.188868e-02 -2.166507e-02
14  1.114626e-07 -2.134241e-01  1.750626e-01
15 -9.608794e-14 -9.419478e-08  1.896163e-08
16 -4.538110e-08  1.009501e-01 -1.903459e-02
17  3.130715e-08  6.735619e-02 -2.118618e-02
18  6.498689e-14  5.871319e-09  1.206831e-08
19  5.871319e-09  2.745129e-01 -7.139645e-02
20  1.206831e-08 -7.139645e-02  8.965196e-02

pgee.mixed documentation built on May 2, 2019, 8:35 a.m.