formulaR: Regression coefficients: formulaR

Description Usage Arguments Details Value Examples

View source: R/methods-for-inference.R

Description

Calculate pivotal quantities for the regression coefficients using the method: formulaR form the dissertation.

Usage

1
  formulaR(y, d, h, g, x)

Arguments

y

k-vector of responses.

d

k-vector of heteroscedasticity.

h

scalar of heterogeneity.

g

p-vector of some p-variate Gaussian draw.

x

design k-p-matrix.

Details

Algorithm for calculating a single generalised pivotal quantity for the regression coefficients for given generalised pivotal quantities for the heterogeneity using the multivariate version of the pivotal formula.

Value

A p-vector.

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
bcg   <- bcgVaccineData()
bcg_y <- bcg$logrisk
bcg_d <- bcg$sdiv
bcg_x <- cbind(1,bcg$x)

# When, for example, using the Mandel-Paule estimate:
bcg_h <- pfunc(y=bcg_y, d=bcg_d, x=bcg_x)(dim(bcg_x)[1] -
  dim(bcg_x)[2])

set.seed(51351) # for reproducibility
random_g <- rnorm(dim(bcg_x)[2])
formulaR(y=bcg_y, d=bcg_d, h=bcg_h, g=random_g, x=bcg_x)

# The function can also be used when planing to perform
# a meta regression with no intercept, and only a singel
# covariate (i.e. dim(x) = 1).  In this case,
# the design matrix can simply be provided by a vector.
set.seed(51351) # for reproducibility
random_g <- rnorm(1)
formulaR(y=bcg_y, d=bcg_d, h=bcg_h, g=random_g, x=bcg$x)

# When performing a meta analysis, provide the function
# with a vector of 1s.
formulaR(y=bcg_y, d=bcg_d, h=bcg_h, g=random_g, x=rep(1,
  length(bcg_y)))

metagen documentation built on May 29, 2017, 7:13 p.m.