predict.gv: Predict method for 'gen.variogram' object with model.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/predict.gv.R

Description

Predicts values based on a fitted gen.variogram model.

Usage

1
2
## S3 method for class 'gv'
predict(object, newdata, ...)

Arguments

object

'gv' fitted model (see 'gen.variogram').

newdata

Real distances matrix to predict genetic distance by the fitted model.

...

Further arguments to be passed.

Value

Returns the matrix of predicted genetic distances.

Author(s)

Pedro Tarroso <ptarroso@cibio.up.pt>

See Also

gen.variogram plot.gv krig

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data(vipers)
data(d.gen)

# create a grid of the sampled area for interpolation
grid <- expand.grid(x=seq(-10,10,0.5), y=seq(30, 50, 0.5))

# create a distance matrix between samples
r.dist <- dist(vipers[,1:2])

# fit a variogram with defaults (spherical model) and estimation of range
gv <- gen.variogram(r.dist, d.gen)
gv <- gv.model(gv)

all.dist <- as.matrix(dist(grid))

result <- predict(gv, all.dist)

phylin documentation built on Dec. 12, 2019, 5:07 p.m.