Learn R Programming

distribglm (version 0.4.1)

gradient_value: Estimate the update gradient value

Description

Estimate the update gradient value

Usage

gradient_value(
  beta = NULL,
  data,
  formula,
  family = binomial(),
  iteration_number = 0,
  shuffle_rows = TRUE,
  link = NULL
)

use_glm_gradient_value( beta = NULL, data, formula, family = binomial(), iteration_number = 0, shuffle_rows = TRUE )

Arguments

beta

current beta value, leave NULL to initialize

data

dataset to get gradient value from

formula

model formula to fit, with tilde syntax

family

generalized linear model family, see family

iteration_number

number of fitting iteration, used for tracking

shuffle_rows

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

link

link function to use with family

Value

A list of estimated values, including the gradient, sample size, iteration number, covariance matrix (A_mat), number of samples with non-zero weights, the sum of the dispersion values (for overdispersion estimates), and a vector of values for combining to create the population gradient (u), with length of the number of beta values

Examples

Run this code
# NOT RUN {
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))
gradient_value(data = data, formula = y ~ x1 + x2,
family = "binomial")
gradient_value(data = data, formula = pois_y ~ x1 + x2,
family = "poisson")
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))
use_glm_gradient_value(data = data, formula = y ~ x1 + x2,
family = binomial(link = "probit"))
# }

Run the code above in your browser using DataLab