fitted.geolm {gear} | R Documentation |
Extract fitted values from a geolm
object
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
## S3 method for class 'geolm'
fitted(object, x, ...)
Arguments
object |
An object produced by the
|
x |
A |
... |
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
Examples
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)))