Description Usage Arguments Value See Also Examples
This function is used to obtain co-kriging estimations based on a set of local methods.
1 2 |
data |
This argument is used to input data. The data set should be pre-processed into 4 columns. First two columns will represent x and y coordinates of the data points. Third column will represent the values, and the fourth column will represent the treatment index or name. |
run.model |
Can take input: 'AP': local adaptive based on points, 'FP': local fixed points. |
grid.input |
Prediction grids/locations. |
cov.model |
Covariance function for the spatial effects. The available options are "Exp", "Sph" and "Gau". Default option: "Exp". |
neighbourhood.points |
This argument is to input neighbourhood points for the 'FP' algorithm. |
random.seed |
User input of seed number. Default 1234. |
... |
Other optional inputs. |
kriged.output |
A data table with columns related to predictions: (1) tretments (2) differences (3) variances (4) covariances (5) z-values. |
est.parameters |
The cokriging parameters estimated from the localised models. |
est.sample |
Number of samples used for fitting the localised models. |
neighbourhood.points |
The number of neighbourhood points for each treatment. |
grid.coordinates |
A 2 column matrix of prediction grid points. |
model |
Returns the covariance model type. |
grid.size |
Applicable if grid.input=NULL is used. |
shapefile |
Applicable if grid.input is a shapefile. |
type |
Returns the model type as a name. |
comp.time |
Returns the computation time. |
plot.pa.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | ## Not run:
######################################################
##
## Langhorne Creek Data
## ref:
## Bramley, R., Lanyon, D., and Panten, K. (2005). Whole-of-vineyard experimentation -
## An improved basis for knowledge generation and decision making.
## In Proceedings of the 5th European Conference on Precision Agriculture, p.883-890.
##
library(sp); library(fields); library(spTimer); library(ggplot2)
data(LanghorneCreek)
dim(LanghorneCreek)
head(LanghorneCreek)
grid <- data.frame(spT.grid.coords(c(range(LanghorneCreek[,1])),c(range(LanghorneCreek[,2])),by=c(100,100)))
p <- ggplot() +
geom_point(data=grid,aes(x=X1,y=X2),pch="+") +
geom_point(data=LanghorneCreek,aes(x=east,y=north,color=treatment,shape=treatment)) +
labs(x="Easting",y="Northing",color="Treatment",shape="Treatment")
p
##
## fixed neighbourhood algorithm
##
out.lf <- run(data=LanghorneCreek,run.model="FP",grid.input=grid)
names(out.lf)
plot(out.lf, treatment=TRUE)
plot(out.lf, differences=TRUE)
plot(out.lf, zval=TRUE)
plot(out.lf, variances=TRUE)
plot(out.lf, covariances=TRUE)
##
## adaptive points algorithm
##
out.p <- run(data=LanghorneCreek,run.model="AP",grid.input=grid)
plot(out.p, zval=TRUE)
# estimated samples
tr <- c("control","mulch","ripped")
par(mfrow=c(1,3))
for(i in 1:3){
dat <- data.frame(sample=round(out.p$est.sample[,i],2),out.p$grid.coordinates)
dat <- dat[,c(2,3,1)]
head(dat)
library(raster); library(viridis)
r <- rasterFromXYZ(dat)
r.range <- c(floor(min(unlist(c(dat[,3])))),ceiling(max(unlist(c(dat[,3])))))
plot(r,col=rev(viridis(100)),breaks=seq(from=r.range[1],to=r.range[2],length.out = 100),
main=paste0("Estimated sample for ",tr[i]),
axis.args=list(at=seq(r.range[1], r.range[2], length.out=10),
labels=round(seq(r.range[1], r.range[2],length.out=10)),
cex.axis=2))
contour(r, add=TRUE, lty=2)
}
par(mfrow=c(1,1))
dat <- data.frame(sample=round(out.p$neighbourhood.points,2),out.p$grid.coordinates)
dat <- dat[,c(2,3,1)]
head(dat)
library(raster); library(viridis)
r <- rasterFromXYZ(dat)
r.range <- c(floor(min(unlist(c(dat[,3])))),ceiling(max(unlist(c(dat[,3])))))
plot(r,col=rev(viridis(100)),breaks=seq(from=r.range[1],to=r.range[2],length.out = 100),
main=paste0("Neighbourhood sample size"),
axis.args=list(at=seq(r.range[1], r.range[2], length.out=10),
labels=round(seq(r.range[1], r.range[2],length.out=10)),
cex.axis=2))
contour(r, add=TRUE, lty=2)
##
######################################################
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.