Type: | Package |
Title: | Improved Score Tests for Generalized Linear Models |
Version: | 0.1-3 |
Date: | 2017-02-16 |
Depends: | R (≥ 3.3.2), MASS, stats |
Suggests: | Sleuth3 |
Author: | Antonio Hermes M. da Silva-Junior [aut, cre], Damiao N. da Silva [aut], Silvia L. P. Ferrari [ctb] |
Maintainer: | Antonio Hermes M. da Silva-Junior <hermes@ccet.ufrn.br> |
Description: | A set of functions to obtain modified score test for generalized linear models. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
LazyLoad: | yes |
LazyData: | yes |
Packaged: | 2017-02-16 14:14:14 UTC; mlfd58 |
NeedsCompilation: | no |
Repository: | CRAN |
Date/Publication: | 2017-02-16 17:27:45 |
Likelihood ratio test for generalized linear models
Description
Computes the likelihood ratio test for the coefficients of a generalized linear model.
Usage
lr.test(fit1, fit2)
Arguments
fit1 |
an object that stores the results of |
fit2 |
an object that stores the results of |
Details
The objects fit1
and fit2
are obtained using the usual options passed to the glm
function.
Value
The function lrt.test()
returns the following list of values:
LR |
the value of the likelihood ratio statistic. |
pvalue |
the p value of test under null hypothesis chi-square distribution. |
Note
Both fit1
and fit2
must have the same family
and link function.
Author(s)
Damiao N. da Silva damiao@ccet.ufrn.br
Antonio Hermes M. da Silva-Junior hermes@ccet.ufrn.br
References
McCullagh P, Nelder J (1989). Generalized Linear Models. Chapman & Hall/CRC, London.
Da Silva DN, Cordeiro GM (2009). "A Computer Program to Improve LR Tests for Generalized Linear Models." Communications in Statistics – Simulation and Computation, 38(10), 2184–2197.
See Also
Examples
data(strength)
fitf <- glm(y ~ cut * lot, data = strength,family = inverse.gaussian("inverse"))
fit0 <- glm(y ~ cut + lot, data = strength, family = inverse.gaussian("inverse"))
lr.test(fit0,fitf)
Modified score test for generalized linear models
Description
Computes the modified score test based for the coefficients of a generalized linear model.
Usage
mdscore(model = model, X1 = X1, phi = NULL)
Arguments
model |
an object that stores the results of |
X1 |
the matrix with the columns of the model matrix X that correspond to the coefficients being specified in the null hypothesis. |
phi |
the precision parameter. |
Details
The object fit.model
is obtained using the usual options passed to the glm
function.
Value
The function mdscore()
returns the following list of values:
Sr |
the value of the score statistic. |
Srcor |
the value of the modified score statistic. |
coef |
a vector with the coefficients A1 , A2 and A3. |
n |
the total sample size. |
df |
the number of degrees of freedom of the chi–squared approximations for the tests. |
phi |
the precision parameter used in the computations |
Author(s)
Antonio Hermes M. da Silva-Junior hermes@ccet.ufrn.br
Damiao N. da Silva damiao@ccet.ufrn.br
References
Cordeiro GM, Ferrari SLP (1991). A Modified Score Test Statistic Having chi-squared Distribution to Order n–1 . Biometrika, 78(3), 573–582.
Cordeiro GM, Ferrari SLP, Paula GA (1993). Improved Score Tests for Generalized Linear Models. Journal of the Royal Statistical Society B, 55(3), 661–674.
Cribari-Neto F, Ferrari SLP (1995). Second Order Asymptotics for Score Tests in Generalised Linear Models. Biometrika, 82(2), 426–432.
da Silva-Junior AHM, da Silva DN, Ferrari SLP (2014). mdscore: An R Package to Compute Improved Score Tests in Generalized Linear Models. Journal of Statistical Software, 61(2), 1-16., http://www.jstatsoft.org/v61/c02/
See Also
Examples
data(strength)
fitf <- glm(y ~ cut * lot, data = strength,family = inverse.gaussian("inverse"))
summary(fitf)
X <- model.matrix(fitf, data = strength)
fit0 <- glm(y ~ cut + lot, data = strength, family = inverse.gaussian("inverse"))
mdscore(fit0, X1=X[, 7:10])
Impact Strength an Insulating Material
Description
The dataset is a subsample of the 5 x 2 factorial experiment given by Ostle and Mensing (1963).
Usage
data(strength)
Format
A data frame with 30 observations on the following 3 variables.
cut
type of specimen cut.
lot
lof of the material –
I
,II
,III
,IV
andV
.y
observations of the impact strength.
Source
Ostle B, Mensing RW (1963). Statistics in Research: Basic Concepts and Techniques for Research Workers. Iowa State University.
Examples
data(strength)
fitf <- glm(y ~ cut * lot, data = strength,family = inverse.gaussian("inverse"))
summary(fitf)
X <- model.matrix(fitf, data = strength)
fit0 <- glm(y ~ cut + lot, data = strength, family = inverse.gaussian("inverse"))
test <- mdscore(fit0, X1=X[, 7:10])
summary(test)
Summary methods for mdscore objects
Description
summary
methods for the mdscore
objects
Usage
## S3 method for class 'mdscore'
summary(object, ...)
Arguments
object |
object resulting from a run of the |
... |
not currently used |
Author(s)
Damiao N. da Silva damiao@ccet.ufrn.br
References
da Silva-Junior AHM, da Silva DN, Ferrari SLP (2014). mdscore: An R Package to Compute Improved Score Tests in Generalized Linear Models. Journal of Statistical Software, 61(2), 1-16., http://www.jstatsoft.org/v61/c02/
See Also
Examples
library(Sleuth3)
d <- transform(case1102, TLrat = Brain/Liver, Ltime = log(Time),
Lwrat = log((Weight + Loss)/Weight),
Treat = factor(Treatment == "BD",
labels=c("NS", "BD"))
)
fitf <- glm(TLrat ~ Ltime * Treat + Days + Sex + Lwrat
+ Tumor + Treat*Lwrat, data = d,
family = Gamma("log")
)
X <- model.matrix(fitf)
fit0 <- glm(TLrat ~ Ltime * Treat + Sex + Lwrat + Tumor + Days,
data=d, family=Gamma("log"))
test <- mdscore(fit0, X1=X[,9], phi=NULL)
summary(test)
Wald test for generalized linear models
Description
Computes the Wald score test for the coefficients of a generalized linear model.
Usage
wald.test(model = model, terms)
Arguments
model |
an object that stores the results of |
terms |
number of coefficients to be tested under null hypothesis |
Details
The object model
is obtained using the usual options passed to the glm
function.
Value
The function wald.test()
returns the following list of values:
W |
the value of the Wald statistic. |
pvalue |
the p value of test under null hypothesis chi-square distribution. |
Author(s)
Damiao N. da Silva damiao@ccet.ufrn.br
Antonio Hermes M. da Silva-Junior hermes@ccet.ufrn.br
References
McCullagh P, Nelder J (1989). Generalized Linear Models. Chapman & Hall/CRC, London.
See Also
Examples
data(strength)
fitf <- glm(y ~ cut * lot, data = strength,family = inverse.gaussian("inverse"))
wald.test(fitf,term=9)