glslr: Generalized least squares using precomputed eigen...

Description Usage Arguments Value Examples

Description

Generalized least squares using precomputed eigen decomposition of covariance matrix

Usage

1
2
3
glslr(formula, data, U, lambda = rep(1, ncol(U)), subset, na.action,
  rank = ncol(U), quantileTransform = FALSE, method = "qr",
  model = FALSE, x = FALSE, y = FALSE, contrasts = NULL, ...)

Arguments

formula

a formula expression as for regression models, of the form response ~ predictors. See the documentation of formula for other details.

data

an optional data frame in which to interpret the variables occurring in formula.

U

eigen vectors of covariance matrix

lambda

eigen values of covariance matrix. If not specified, set all values to 1

subset

expression saying which subset of the rows of the data should be used in the fit. All observations are included by default.

na.action

a function to filter missing data.

rank

number of eigen vectors of U to use

quantileTransform

Use a non-parametric test that only uses the ranks of the transformed test statistics.

method

method to be used by lm.fit.

model

should the model frame be returned?

x

should the design matrix be returned?

y

should the response be returned?

contrasts

a list of contrasts to be used for some or all of

...

additional arguments to lm.fit.

Value

lm.gls object for use with summary()

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
library(mvtnorm)
library(clusterGeneration)

# number of samples
N = 100

# Generate positive definite covariance matrix 
C = genPositiveDefMat(N)$Sigma

# simulate response from covariance matrix C
y = t(rmvnorm(1, rep(0, N), C))

# eigen decomposition of matrix C
dcmp = eigen(C)
U = dcmp$vectors
lambda = dcmp$values

# simulate random covariate 
X_cov = rnorm(N)

# fit GLS from eigen decomposition
fit = glslr( y~ X_cov, U=U, lambda=lambda)

# get results
summary(fit)

GabrielHoffman/pinnacle documentation built on May 3, 2019, 3:02 p.m.