Rglimclim model objects {Rglimclim} | R Documentation |
Many of the objects produced by the Rglimclim
package are lengthy lists of class GLC.modeldef
, needed for interfacing with the underlying Fortran
code. The list structures are not intended to be manipulated by the user; in general, the objects should be visualised and accessed using the functions documented here. To find out more about the individual components of a GLC.modeldef
object, use the names
command.
## S3 method for class 'GLC.modeldef' print(x, scr.width=NULL, global.warn=TRUE, mean.only=FALSE, which.se="robust",...) ## S3 method for class 'GLC.modeldef' plot(x, which.plots = 1:2, sd.plots = TRUE, site.options = list(add.to.map = FALSE, scale = NULL, axis.labels = NULL, coord.cols = 1:2, site.labels="all"), titles=TRUE,distance.units,plot.cols=gray(c(0.8,0)), ...) ## S3 method for class 'GLC.modeldef' anova(object, ..., include.constraints = FALSE, nonlin.warning = TRUE) ## S3 method for class 'GLC.modeldef' logLik(object, ...) ## S3 method for class 'GLC.modeldef' summary(object, tables=c("month","site","year"), ...)
x, object |
An object of (or inheriting from) class |
scr.width |
Desired width of screen output. Labels are truncated so that the width of each line of output is |
global.warn |
Controls whether or not warnings are issued if the user fails to define 'global' quantities that might be expected to be present for different choices of model - such as ‘trace’ thresholds for logistic regression models (because these models might relate to daily rainfall for which such thresholds are usually defined. |
mean.only |
For the |
tables |
Controls whether tables of Pearson residual summaries are produced by the summary method. The default is to produce summary tables broken down separately by month, site and year (in that order). |
which.se |
For the Note: the calculation of robust covariance matrices currently does not take account of differences in dispersion parameter estimates, for models that have them. This is on my "to-do" list, and may remain there for some time. |
which.plots |
A numeric vector controlling which residual plots are produced in the |
sd.plots |
A logical scalar controlling whether the |
site.options |
A list controlling the behaviour of the
Note: the |
titles |
For the |
distance.units |
For the |
plot.cols |
A vector of two colour definitions, used to plot respectively the points and lines representing observations and modelled values if plots 4 or 5 are selected using |
include.constraints |
For the |
nonlin.warning |
For the |
... |
further arguments to be passed to or from other methods. They are ignored by the |
The print
method for objects of class GLC.modeldef
produces a table showing the model structure and coefficient / parameter values, along with standard errors, test statistics and p-values where relevant if these are available (typically, they will be available if model
is the result of a call to GLCfit
). Standard errors are derived from a robust estimate of the parameter covariance matrix (a sandwich estimate accounting for inter-site dependence), unless the model definition uses a spatial “independence” structure (which is the default).
The summary
method extracts relevant diagnostic information and prints it. It returns a NULL
value, invisibly.
The plot
method produces plots of mean Pearson residuals for different subsets of the observations. Note that at present this command is useful for model-building and checking, but it may not be suitable for the generation of publication quality graphics where finer control may be needed.
The anova
method produces an analyis of variance / deviance table for comparing nested models, analogous to that from anova.lm
. Any number of objects may be passed to the method; the code will sort them into order according to their degrees of freedom. Comparisons are based on chi-squared distributions for the log-likelihood ratio statistic, with dispersion parameters handled via their maximum likelihood estimates under an assumption of independence between sites. The ANOVA table reports both a "naive" test which assumes that the log-likelihoods are correctly specified; and a "robust" test which corrects for mis-specification due to inter-site dependence and other failures of model assumptions. The correction is based on the "vertical" adjustment proposed in Chandler and Bate (2007). See notes below for more information.
The print
method returns the value of model
, invisibly.
The logLik
method returns the ‘independence’ log-likelihood (i.e. the log-likelihood calculated under the assumption that data from different sites are independent), with attributes representing the numbers of observations and parameters estimated (including dispersion parameters - where these have been estimated, maximum likelihood estimates are used for the log-likelihood calculations).
See comment above regarding the accuracy / fitness for purpose of this routine.
The degrees of freedom reported by the summary
and anova
methods differ slightly from the usual degrees of freedom associated with linear models: they count all parameters estimated, including constant terms and dispersion
parameters. The reason is that the technique used to adjust likelihood ratio tests for inter-site dependence (and other aspects of model mis-specification) cannot be used to adjust F-tests, and the software therefore reports tests
based on the chi-squared distribution with all parameters set at their
maximum likelihood values. The degrees of freedom therefore must correspond
to the number of parameters estimated via maximum likelihood. This is unlikely to have a major impact on results, because the datasets arising in this kind of application are typically so large that the chi-squared and F-tests will be almost exactly equivalent in any case.
In the anova
method, the robust likelihood ratio calculations currently do not take account of differences in dispersion parameter estimates, for models that have them. This is on my "to-do" list, and may remain there for some time.
In the anova
method, when comparing more than two models the adjustments required to obtain the "robust" likelihood ratio tests are all based on the robust covariance matrix from the largest model: the results when comparing models M2 with M3 (say) may be slightly different, therefore, depending on whether or not a larger model M1 is included simultaneously in the anova
command. However, if the difference is very large then this in itself is a sign that M1 produces very different results from either M2 or M3. The implication is that neither M2 nor M3 captures all of the structure in the data, and hence that M1 should be preferred in such settings.
Chiara Ambrosino (c.ambrosino@ucl.ac.uk) and Richard Chandler (richard@stats.ucl.ac.uk)
Chandler, R.E. and S. Bate (2007). Inference for clustered data using the independence loglikelihood. Biometrika, 94, 167-183.
require(Rglimclim) ## ## Define site information (see make.siteinfo for details) ## data(GLCdemo) ## ## Use the "SimpleModel" object supplied with the demo ## print(names(SimpleModel)) # Shows names of underlying list old.warn <- options()$warn options(warn=1) # Show warnings as they occur print(SimpleModel) # Show model in interpretable format print(SimpleModel,global.warn=FALSE) # Suppress warning message options(warn=old.warn) # Reset handling of warnings ## ## Diagnostics for a fitted model object ## summary(DemoModel,tables=NULL) opar <- par(no.readonly=TRUE) par(mfrow=c(2,2)) plot(DemoModel,which.plots=1:2) par(mfrow=c(1,1)) plot(DemoModel,which.plots=3,site.options=list(site.labels="none"), titles=FALSE) title("My own plot title")