dbglm {dbstats} | R Documentation |

## Distance-based generalized linear models

### Description

`dbglm`

is a variety of generalized linear model where explanatory
information is coded as distances between individuals. These distances
can either be computed from observed explanatory variables or directly
input as a squared distances matrix.

Response and link function as in the `glm`

function for ordinary
generalized linear models.

Notation convention: in distance-based methods we must distinguish
*observed explanatory variables* which we denote by Z or z, from
*Euclidean coordinates* which we denote by X or x. For explanation
on the meaning of both terms see the bibliography references below.

### Usage

```
## S3 method for class 'formula'
dbglm(formula, data, family=gaussian, method ="GCV", full.search=TRUE,...,
metric="euclidean", weights, maxiter=100, eps1=1e-10,
eps2=1e-10, rel.gvar=0.95, eff.rank=NULL, offset, mustart=NULL, range.eff.rank)
## S3 method for class 'dist'
dbglm(distance,y,family=gaussian, method ="GCV", full.search=TRUE, weights,
maxiter=100,eps1=1e-10,eps2=1e-10,rel.gvar=0.95,eff.rank=NULL,
offset,mustart=NULL, range.eff.rank,...)
## S3 method for class 'D2'
dbglm(D2,y,...,family=gaussian, method ="GCV", full.search=TRUE, weights,maxiter=100,
eps1=1e-10,eps2=1e-10,rel.gvar=0.95,eff.rank=NULL,offset,
mustart=NULL, range.eff.rank)
## S3 method for class 'Gram'
dbglm(G,y,...,family=gaussian, method ="GCV", full.search=TRUE, weights,maxiter=100,
eps1=1e-10,eps2=1e-10,rel.gvar=0.95,eff.rank=NULL,
offset,mustart=NULL, range.eff.rank)
```

### Arguments

`formula` |
an object of class |

`data` |
an optional data frame containing the variables in the model (both response and explanatory variables, either the observed ones, Z, or a Euclidean configuration X). |

`y` |
(required if no formula is given as the principal argument). Response (dependent variable) must be numeric, factor, matrix or data.frame. |

`distance` |
a |

`D2` |
a |

`G` |
a |

`family` |
a description of the error distribution and link function to be used
in the model.
This can be a character string naming a family function, a family
function or the result of a call to a family function.
(See |

`metric` |
metric function to be used when computing distances from observed
explanatory variables.
One of |

`weights` |
an optional numeric vector of prior weights to be used in the fitting process. By default all individuals have the same weight. |

`method` |
sets the method to be used in deciding the |

`full.search` |
sets which optimization procedure will be used to
minimize the modelling criterion specified in |

`maxiter` |
maximum number of iterations in the iterated |

`eps1` |
stopping criterion 1, |

`eps2` |
stopping criterion 2, |

`rel.gvar` |
relative geometric variability (a real number between 0 and 1).
In each |

`eff.rank` |
integer between 1 and the number of observations minus one.
Number of Euclidean coordinates used for model fitting in
each |

`offset` |
this can be used to specify an a priori known component to be included in the linear predictor during fitting. This should be NULL or a numeric vector of length equal to the number of cases. |

`mustart` |
starting values for the vector of means. |

`range.eff.rank` |
vector of size two defining the range of values for the effective rank with which the dblm iterations
will be evaluated (must be specified when |

`...` |
arguments passed to or from other methods to the low level. |

### Details

The various possible ways for inputting the model explanatory
information through distances, or their squares, etc., are the
same as in `dblm`

.

For gamma distributions, the domain of the canonical link function
is not the same as the permitted range of the mean. In particular,
the linear predictor might be negative, obtaining an impossible
negative mean. Should that event occur, `dbglm`

stops with
an error message. Proposed alternative is to use a non-canonical link
function.

### Value

A list of class `dbglm`

containing the following components:

`residuals` |
the |

`fitted.values` |
the fitted mean values, results of final |

`family` |
the |

`deviance` |
measure of discrepancy or badness of fit. Proportional to twice the difference between the maximum achievable log-likelihood and that achieved by the current model. |

`aic.model` |
a version of Akaike's Information Criterion. Equal to minus twice the maximized log-likelihood plus twice the number of parameters. Computed by the aic component of the family. For binomial and Poison families the dispersion is fixed at one and the number of parameters is the number of coefficients. For gaussian, Gamma and inverse gaussian families the dispersion is estimated from the residual deviance, and the number of parameters is the number of coefficients plus one. For a gaussian family the MLE of the dispersion is used so this is a valid value of AIC, but for Gamma and inverse gaussian families it is not. For families fitted by quasi-likelihood the value is NA. |

`bic.model` |
a version of the Bayessian Information Criterion. Equal to minus twice the maximized log-likelihood plus the logarithm of the number of observations by the number of parameters (see, e.g., Wood 2006). |

`gcv.model` |
a version of the Generalized Cross-Validation Criterion. We refer to Wood (2006) pp. 177-178 for details. |

`null.deviance` |
the deviance for the null model. The null model will include the offset, and an intercept if there is one in the model. Note that this will be incorrect if the link function depends on the data other than through the fitted mean: specify a zero offset to force a correct calculation. |

`iter` |
number of Fisher scoring ( |

`prior.weights` |
the original weights. |

`weights` |
the |

`df.residual` |
the residual degrees of freedom. |

`df.null` |
the residual degrees of freedom for the null model. |

`y` |
the response vector used. |

`convcrit` |
convergence criterion. One of: |

`H` |
hat matrix projector of the last |

`rel.gvar` |
the relative geometric variabiliy in the last |

`eff.rank` |
the |

`varmu` |
vector of estimated variance of each observation. |

`dev.resids` |
deviance residuals |

`call` |
the matched call. |

Objects of class `"dbglm"`

are actually of class
`c("dbglm", "dblm")`

, inheriting the `plot.dblm`

method
from class `"dblm"`

.

### Note

When the Euclidean distance is used the `dbglm`

model reduces
to the generalized linear model (`glm`

).

### Author(s)

Boj, Eva <evaboj@ub.edu>, Caballe, Adria <adria.caballe@upc.edu>, Delicado, Pedro <pedro.delicado@upc.edu> and Fortiana, Josep <fortiana@ub.edu>

### References

Boj E, Caballe, A., Delicado P, Esteve, A., Fortiana J (2016). *Global and local distance-based generalized linear models*.
TEST 25, 170-195.

Boj E, Delicado P, Fortiana J (2010). *Distance-based local linear regression for functional predictors*.
Computational Statistics and Data Analysis 54, 429-437.

Boj E, Grane A, Fortiana J, Claramunt MM (2007). *Selection of predictors in distance-based regression*.
Communications in Statistics B - Simulation and Computation 36, 87-98.

Cuadras CM, Arenas C, Fortiana J (1996). *Some computational aspects of a distance-based model
for prediction*. Communications in Statistics B - Simulation and Computation 25, 593-609.

Cuadras C, Arenas C (1990). *A distance-based regression model for prediction with mixed data*.
Communications in Statistics A - Theory and Methods 19, 2261-2279.

Cuadras CM (1989). *Distance analysis in discrimination and classification using both
continuous and categorical variables*. In: Y. Dodge (ed.), *Statistical Data Analysis and Inference*.
Amsterdam, The Netherlands: North-Holland Publishing Co., pp. 459-473.

Wood SN (2006). *Generalized Additive Models: An Introduction with R*. Chapman & Hall,
Boca Raton.

### See Also

`summary.dbglm`

for summary.

`plot.dbglm`

for plots.

`predict.dbglm`

for predictions.

`dblm`

for distance-based linear models.

### Examples

```
## CASE POISSON
z <- rnorm(100)
y <- rpois(100, exp(1+z))
glm1 <- glm(y ~z, family = poisson(link = "log"))
D2 <- as.matrix(dist(z))^2
class(D2) <- "D2"
dbglm1 <- dbglm(D2,y,family = poisson(link = "log"), method="rel.gvar")
plot(z,y)
points(z,glm1$fitted.values,col=2)
points(z,dbglm1$fitted.values,col=3)
sum((glm1$fitted.values-y)^2)
sum((dbglm1$fitted.values-y)^2)
## CASE BINOMIAL
y <- rbinom(100, 1, plogis(z))
# needs to set a starting value for the next fit
glm2 <- glm(y ~z, family = binomial(link = "logit"))
D2 <- as.matrix(dist(z))^2
class(D2) <- "D2"
dbglm2 <- dbglm(D2,y,family = binomial(link = "logit"), method="rel.gvar")
plot(z,y)
points(z,glm2$fitted.values,col=2)
points(z,dbglm2$fitted.values,col=3)
sum((glm2$fitted.values-y)^2)
sum((dbglm2$fitted.values-y)^2)
```

*dbstats*version 2.0.2 Index]