Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: glm
See also: glmopt glmcore glmest glmlrtest glmll glmlink glmdiagh

Quantlet: glmstat
Description: glmstat provides some statistics for a fitted GLM.

Link:
Usage: stat = glmstat(code,x,y,b,bv{,opt})
Input:
code text string, the short code for the model (e.g. "bilo" for logit or "noid" for ordinary PLM).
x n x p matrix, the predictor variables.
y n x 1 vector, the response variables. (In the case of replicated data, the number of replications should be given in opt.wx and y should contain the sums of all responses for a replication.)
b p x 1 vector, estimated coefficients.
bv p x p matrix, inverse Hessian of optimization procedure. This is the estimated covariance of b, as it comes out of "glmcore", i.e. not yet corrected for dispersion!
opt optional, a list with optional input. "glmopt" can be used to set up this parameter. The order of the list elements is not important.
opt.weights string, type of weights. Can be "frequency" for replication counts, or "prior" (default) for prior weights in weighted regression.
opt.wx scalar or n x 1 vector, frequency or prior weights. If not given, set to 1.
opt.off scalar or n x 1 vector, offset in linear predictor. If not given, set to 0.
opt.pow scalar, power for power link. If not given, set to 0 (logarithm).
opt.nbk scalar, extra parameter k for negative binomial distribution. If not given, set to 1 (geometric distribution).
Output:
stat list with the following statistics:
stat.serror standard errors of parameter estimates.
stat.tvalue t-values for parameter estimates.
stat.pvalue p-values for significance of parameter estimates.
stat.df degrees of freedom.
stat.deviance deviance.
stat.pearson generalized pearson's chi^2.
stat.loglik log-likelihood.
stat.dispersion dispersion parameter estimate =pearson/df.
stat.r2 (pseudo) R^2.
stat.adr2 adjusted (pseudo) R^2.
stat.aic AIC criterion.
stat.bic BIC criterion.

Example:
library("glm")
;==========================
;  simulate data
;==========================
n=100
b=1|2
p=rows(b)
bv=0.*matrix(p,p)
x=2.*uniform(n,p)-1
y=( 1./(1+exp(-x*b)).>uniform(n) )
;==========================
;  compute statistics
;==========================
glmstat("bilo",x,y,b,bv)

Result:
The statistics of this perfect fit.



Author: M. Mueller, 20010228
(C) MD*TECH Method and Data Technologies, 05.02.2006