m2LG: compute a gaussian log likelihood criterion for a GEE fit

Description Usage Arguments Details Value Author(s) Examples

Description

compute a gaussian log likelihood criterion for a GEE fit

Usage

1
m2LG(gmod, response, x, id, tim, invlink = function(x) x, hetfac = function(m) rep(1, length(m)))

Arguments

gmod

a gee or yagsResult instance

response

the response data vector for the instance

x

the design matrix (will typically need an intercept column) for the instance

id

the cluster discriminator

tim

the time coordinates when relevant for time series models

invlink

transformation of Xbeta to generate mean response

hetfac

function of estimated mean to multiply variance function for heteroskedasticity

Details

Note that yags now computes the m2LG value as a matter of course for several working structures. This code is simply called after yags has converged before returning the yagsResult instance.

Value

a scalar

Author(s)

VJ Carey

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
26
27
28
29
set.seed(2340)
y = rnorm(200,10)
x = runif(200)
id = as.numeric(rep(1:50, each=4))
require(gee)
require(yags)
f1 = gee(y~x, id=id, corstr="exchangeable")
f2 = yags(y~x, id=id, corstr="exchangeable", alphainit=.2)
require(nlme)
f3 = gls(y~x, cor=corCompSymm(.2, form=~1|id), method="ML")
m2LG(f1, y, cbind(1,x), id, id ) # tim variable irrelevant
m2LG(f2, y, cbind(1,x), id, id ) # tim variable irrelevant
-2*f3$logLik # for ML estimate of correlation
f4 = gls(y~x, cor=corCompSymm(f2@alpha, form=~1|id,fixed=TRUE), method="ML")
-2*f4$logLik
# relate m2LG to deviance in simple case
f5 = yags(y~x, id=id, corstr="independence")
summary(f5)
f5@m2LG
f5@phi*(f5@m2LG-200*log(2*pi*f5@phi))
f6 = glm(y~x)
f6
# generate heteroskedastic data and check
y2 = rnorm(200,25,(1+2*x)^2)
f7 = yags(y2~x, id=id, corstr="independence", family=quasi(var="mu^2"), betainit=c(25,.03))
f7@m2LG
f7@phi*(f7@m2LG-200*log(2*pi*f7@phi))
f8 = glm(y2~x, family=quasi(var="mu^2"))
summary(f8)

yags documentation built on May 2, 2019, 5:46 p.m.

Related to m2LG in yags...