score.normal.regression: Score Function for Simple Linear Regression Model

Description Usage Arguments Value Examples

View source: R/Other.Regression.R

Description

computes an n by p+1 matrix containing the components of the score function in a linear regression of y on the n x p covariate matrix x. The ith row of the output corresponds to the ith data point.

Usage

1
score.normal.regression(y, x, theta.hat)

Arguments

y

the univariate response

x

the design matrix

theta.hat

MLEs of parameters

Value

Column 1 of the output is the sigma component of the score. Columns 2 to p+1 are the components of the score corresponding to the regression coefficients.

Examples

1
2
3
4
5
6
7
8
m = matrix(rnorm(20),10,2)
X = cbind(rep(1,10),m)
y = rnorm(10)
fit = lm(y~X-1)
sigma = sqrt(mean(fit$residual^2))
theta.hat =  c(sigma,fit$coefficients)
score.normal.regression(y,X,theta.hat=theta.hat)
round(apply(.Last.value,2,sum))

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