Description Usage Arguments Value Author(s) References Examples
Function for finding the adjacency matrix that maximizes the variance of a mean estimate given general constraints on the degree of dependence of the observations.
1 |
v |
a matrix with the estimated (sample) covariance matrix. |
d |
a vector with the observed degree; if |
GR |
a matrix with the known dependencies. The default is |
solver |
a string with the optimization solver to be used. The options are: |
approximate |
a scalar that determines whether an exact solution is to be found by solving the original integer programming problem ( |
A list with the following objects:
A_max |
adjacency matrix that maximizes the variance; |
obj_val |
objective value of the graph optimization problem at the optimum; |
time |
time elapsed to find the optimal solution. |
Peter M. Aronow <peter.aronow@yale.edu>, Forrest W. Crawford <forrest.crawford@yale.edu>, Jose R. Zubizarreta <zubizarreta@columbia.edu>.
Aronow, P. M., Crawford, F. W., and Zubizarreta, J. R., (2017), "Confidence intervals for linear unbiased estimators under constrained dependence," submitted, X, X-X.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #################################
# Data
#################################
# Example with 100 nodes
data(example)
# Total number of observations
n = nrow(dat)
# Observed data
# Observed dependencies (observed (known) a_ij's; this is A_R in (5) in the paper)
GR = GR
# Observed degrees
d = dat$degree
# Observed outcomes
y = dat$hiv
#################################
# General case
#################################
# Solve (5) in the paper
# Sample covariance matrix
my = mean(y)
v = outer(y-my, y-my)
# No known dependencies (so in (5) in the paper A_R (the matrix of known dependencies) is the n times n matrix of 0's)
A_max_gral_no_dep = depgraph(v, d, NULL, "glpk", 1)$A_max
# Some known dependencies
A_max_gral_some_dep = depgraph(v, d, GR, "glpk", 1)$A_max
#################################
# Homoskedastic case
#################################
# Solve (8) in the paper
# No known dependencies (so in (8) in the paper A_R (the matrix of known dependencies) is the n times n matrix of 0's)
v = matrix(1, nrow=n, ncol=n)
A_max_homo_no_dep = depgraph(v, d, NULL, "glpk", 0)$A_max
# Some known dependencies
A_max_homo_some_dep = depgraph(v, d, GR, "glpk", 0)$A_max
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.