estimate_site_gradient: Estimate Site Gradient

Description Usage Arguments Value Examples

View source: R/package_contents.R

Description

Estimate Site Gradient

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
estimate_site_gradient(
  model_name,
  synced_folder,
  site_name = "site1",
  data,
  all_site_names = NULL,
  shuffle_rows = TRUE,
  experimental = FALSE
)

estimate_model(
  model_name,
  synced_folder,
  site_name = "site1",
  data,
  all_site_names = NULL,
  shuffle_rows = TRUE,
  wait_time = 1,
  run_compute = FALSE,
  experimental = FALSE
)

Arguments

model_name

name of your model

synced_folder

synced folder to do computation

site_name

name of the site, needs to be one of the all_site_names

data

dataset to get gradient value from

all_site_names

all the site names used to fit this model

shuffle_rows

should the rows of the dataset be permuted, so as to decrease privacy concerns

experimental

using the glm function rather than a custom-written function

wait_time

Time, in seconds, to wait until to try to get new estimate

run_compute

if TRUE, when estimating the model, it will also try to run estimate_new_beta if all other sites have submitted. This allows all sites to be a potential computation site.

Value

A character filename of the gradient file, with the output from gradient_value

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
data = data.frame(y = c(0, 0, 1),
                  pois_y = c(4, 1, 0),
                  x2 = c(-2.19021287072066,
                         -0.344307138450805, 3.47215796952745),
                  x1 = c(-0.263859503846267,
                         -0.985160029707486, 0.227262373184513))
tdir = tempfile()
dir.create(tdir)
model_name = "logistic_example"
form_file = setup_model(model_name = model_name,
                        synced_folder = tdir,
                        formula =  "y ~ x1 + x2", family =  "binomial")
outfile = estimate_site_gradient(
  model_name = model_name, synced_folder = tdir,
  all_site_names = "site1",
  data = data)
clear_model(model_name, tdir)
testthat::expect_error({
outfile = estimate_site_gradient(
  model_name = model_name, synced_folder = tdir,
  all_site_names = "site1",
  data = data)
})

distribglm documentation built on April 15, 2021, 5:06 p.m.