Compute all the single terms in the scope argument that can be dropped from the GWRM model, fit those models and compute a table of the changes in fit.
Usage
## S3 method for class 'gw'
drop1(object, scope, test = c("none", "Chisq"), k = 2,
trace = FALSE, ...)
Arguments
object
a fitted object of class inheriting from "gw".
scope
a formula giving the terms to be considered for dropping.
test
"none", which considers the AIC criterion, or Chisq, which is the likelihood-ratio test.
k
the penalty constant in AIC / Cp.
trace
if TRUE, print out progress reports.
...
further arguments passed to or from other methods.
Value
An object of class "anova" summarizing the differences in fit between the models.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(GWRM)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GWRM/drop1.gw.Rd_%03d_medium.png", width=480, height=480)
> ### Name: drop1.gw
> ### Title: Drop All Possible Single Terms to a GWRM Model
> ### Aliases: drop1.gw
>
> ### ** Examples
>
> data(goals)
>
> fit0 <- gw(goals ~ offset(log(played)), data = goals)
> summary(fit0)
Call: gw(formula = goals ~ offset(log(played)), data = goals)
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -2.25269 0.04279 -52.63944 0.00000
Fit:
log-likelihood AIC BIC df
-2051 4108 4123 1221
betaII:
par Estimate Std. Error
k 12.951182 6.653273
ro 6.604384 2.131549
Degrees of Freedom: Total (i.e. Null); 1221 Residual
Code of convergence: 0
Method: L-BFGS-B
>
> fit1 <- step(fit0, ~ position)
Start: AIC=4107.71
goals ~ offset(log(played))
trying +position
Df AIC
+ position 2 3820.0
<none> 4107.7
Step: AIC=3819.98
goals ~ position + offset(log(played))
trying -position
Df AIC
<none> 3820.0
- position 2 4107.7
> summary(fit1)
Call: gw(formula = goals ~ position + offset(log(played)), data = goals)
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -3.092e+00 7.876e-02 -3.926e+01 0.000e+00
positionForward 1.568e+00 8.996e-02 1.743e+01 5.236e-68
positionMidfielder 6.835e-01 8.798e-02 7.768e+00 7.967e-15
Fit:
log-likelihood AIC BIC df
-1905 3820 3846 1219
betaII:
par Estimate Std. Error
k 13.79084 7.597486
ro 12.89112 4.229415
Degrees of Freedom: Total (i.e. Null); 1219 Residual
Code of convergence: 0
Method: L-BFGS-B
>
>
>
>
>
> dev.off()
null device
1
>