fitted.geolm: Extract fitted values from a 'geolm' object

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/fitted.R

Description

Extract the fitted values, i.e., the estimated mean values, for an object produced by the geolm function for a specified set of covariates, x. If x is NULL, then then x is taken from object.

Usage

1
2
## S3 method for class 'geolm'
fitted(object, x, ...)

Arguments

object

An object produced by the geolm function.

x

A m \times p matrix of covariates for the locations where fitted values are desired. If NULL, object$x is used.

...

Not currently implemented.

Details

If the object has a known mean, i.e., object$mu is not NULL, then the function returns the vector rep(object$mu, m). If object has estimated coefficients, then x %*% object$coeff is returned.

If x is missing, then object$x is used for x. Naturally, ncol(x) must equal length(object$coeff). If x is NULL and object$mu is not NULL, then m is taken to be 1.

Value

The vector of fitted values.

Author(s)

Joshua French

See Also

fitted

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data = data.frame(y = rnorm(10), x1 = runif(10),
                 x2 = runif(10))
d = as.matrix(dist(data[,c("x1", "x2")]))
mod = cmod_man(v = exp(-d), evar = 1)
gearmod = geolm(y ~ x1, data = data,
                coordnames = ~ x1 + x2, mod = mod)
# fitted values for original observations
fitted(gearmod)
# fitted values for new observations
fitted(gearmod, x = cbind(1, rnorm(20)))

gear documentation built on April 14, 2020, 5:12 p.m.

Related to fitted.geolm in gear...