score.gamma.regression: Score Function for Gamma Regression Model

Description Usage Arguments Value Examples

View source: R/Other.Regression.R

Description

Compute a p+1 by n matrix containing the components of the score function in a Gamma regression of y on the n x p covariate matrix x. The ith column of the output corresponds to the ith data point.

Usage

1
score.gamma.regression(y, x, thetahat, link = "log")

Arguments

y

the univariate response

x

the design matrix

theta.hat

MLEs of parameters

Value

Row 1 of the output is the shape component of the score. Rows 2 to p+1 are the components of the score corresponding to the regression coefficients.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
set.seed(5)
n = 200  #(sample size)
p = 3
beta = c(3,4,5)
alpha = 3
x = rnorm(n*(p-1))
x = c(rep(1,n),x)
x = matrix(x,n,p)
scale=exp(x %*% beta) / alpha
y =rgamma(n,shape=alpha,scale=scale)
theta.hat = estimate.gamma.regression(x,y)

LiYao-sfu/EDFtest documentation built on Dec. 18, 2021, 4:35 a.m.