Commit d7085292 authored by agebhard's avatar agebhard

new tests, start from scratch with leman example

parent 661f90c0
......@@ -11,7 +11,7 @@
ret$formula<-formula
ft<-terms(formula)
ret$variables<-attr(ft,"variables")
ret$ntr<-dim(model.matrix.default(formula=formula,data=x))[2]
ret$ntr<-dim(model.matrix(object=formula,data=x))[2]
if(length(ret$variables)!=4 & length(ret$variables)!=2) stop("need 1 or 3 variables (\"z ~ f(x, y)\" or \"z ~ 1\") in formula!")
if(length(ret$variables)==4){
......
......@@ -10,7 +10,7 @@ print.bk.prior<-function(x){
cat("prior ",i,"\n")
cat(" type is ", x$type[i],"\n")
if(x$type[i]=="empirical"){
cat(" based on a additional dataset of size", x$info,"\n\n")
cat(" based on an additional dataset of size", x$info[i],"\n\n")
}
cat("prior guess for regression parameter:\n")
print(x$mu[[i]])
......
.First.lib <- function(lib, pkg) {
require(rgeostat)
if(version$major==0 && version$minor < 62)
stop("This version for R 0.62 or later")
library.dynam("baykrig", pkg, lib)
require(sgeostat)
require(tripack)
}
if(version$minor < "62") {
library.dynam("baykrig")
require(sgeostat)
require(tripack)
}
str(leman.bk.ord)
q()
library(rgeostat);library(baykrig);
library(rgeostat);library(baykrig);
......@@ -8,11 +7,9 @@ leman.bk.ord <- bk.grid(point = leman.pt, at = "cadpbm", prior=leman.prior.ord,v
library(rgeostat);library(baykrig);
leman.bk.ord <- bk.grid(point = leman.pt, at = "cadpbm", prior=leman.prior.ord,var.mod.obj = leman.sph, xsw=min(leman.bank$x),ysw=min(leman.bank$y), xne=max(leman.bank$x), yne=max(leman.bank$y), nx=20, ny=20, trend=0, rsearch = 10, extrap = F,border=leman.bank, duplicate="mean");
ls(ans)
ls()
library(rgeostat);library(baykrig);
library(rgeostat);library(baykrig);
library(rgeostat);library(baykrig);
ls()
library(rgeostat);library(baykrig);
library(rgeostat);library(baykrig);
dyn.load("getpid.so")
......@@ -30,3 +27,5 @@ dyn.load("getpid.so")
.C("R_getpid",integer(1))
library(rgeostat);library(baykrig);
leman.bk.ord <- bk.grid(point = leman.pt, at = "cadpbm", prior=leman.prior.ord,var.mod.obj = leman.sph, xsw=min(leman.bank$x),ysw=min(leman.bank$y), xne=max(leman.bank$x), yne=max(leman.bank$y), nx=5, ny=5, trend=0, rsearch = 10, extrap = T,border=leman.bank, duplicate="mean");
ls()
q()
library(sgeostat)
library(rgeostat)
library(baykrig)
data(leman)
# loads "leman.78" "leman.83" "leman.88"
data(leman.bank)
leman.78.pt<-point(leman.78)
leman.83.pt<-point(leman.83)
leman.88.pt<-point(leman.88)
plot(leman.78.pt,v="cadpbm")
lines(leman.bank)
plot(leman.83.pt,v="cadpbm")
lines(leman.bank)
plot(leman.88.pt,v="cadpbm")
lines(leman.bank)
leman.88.pr.30<-pair(leman.88.pt,maxdist=30)
spacebox(leman.88.pt,leman.88.pr.30,"cadpbm")
leman.88.ev30<-est.variogram(leman.88.pt,leman.88.pr.30,"cadpbm")
plot(leman.88.ev30)
leman.88.vmsph<-fit.variogram("spherical",leman.88.ev30,0.1,0.2,25,plot.it=T)
plot(leman.88.ev30,var.mod.obj=leman.88.vmsph)
# crash:
# leman.krg<-krige.grid(min(leman.bank$x),min(leman.bank$y), max(leman.bank$x), max(leman.bank$y), nx=100, ny=100, point = leman.88.pt, at = "cadpbm", var.mod.obj = leman.88.vmsph, rsearch = 7.5, extrap = F,border=leman.bank)
leman.krg<-krige.grid.c(min(leman.bank$x),min(leman.bank$y), max(leman.bank$x), max(leman.bank$y), nx=100, ny=100, point = leman.88.pt, at = "cadpbm", var.mod.obj = leman.88.vmsph, rsearch = 7.5, extrap = F,border=leman.bank)
leman.prior<-empirical.prior(leman.83,cadpbm~x+y,leman.88.vmsph,duplicate="mean")
leman.prior<-empirical.prior(leman.78,cadpbm~x+y,leman.88.vmsph,prior=leman.prior,duplicate="mean")
leman.bk <- bk.grid(point = leman.88.pt , at = "cadpbm", prior=leman.prior,var.mod.obj = leman.88.vmsph, xsw=min(leman.bank$x),ysw=min(leman.bank$y), xne=max(leman.bank$x), yne=max(leman.bank$y), nx=50, ny=50, trend=0, rsearch = 10, extrap = T,border=leman.bank, duplicate="mean")
library(sgeostat)
library(rgeostat)
library(baykrig)
data(leman)
# loads "leman.78" "leman.83" "leman.88"
data(leman.bank)
leman.78.pt<-point(leman.78)
leman.83.pt<-point(leman.83)
leman.88.pt<-point(leman.88)
plot(leman.78.pt,v="cadpbm")
lines(leman.bank)
plot(leman.83.pt,v="cadpbm")
lines(leman.bank)
plot(leman.88.pt,v="cadpbm")
lines(leman.bank)
leman.88.pr.30<-pair(leman.88.pt,maxdist=30)
spacebox(leman.88.pt,leman.88.pr.30,"cadpbm")
leman.88.ev30<-est.variogram(leman.88.pt,leman.88.pr.30,"cadpbm")
plot(leman.88.ev30)
leman.88.vmsph<-fit.variogram("spherical",leman.88.ev30,0.1,0.2,25,plot.it=T)
plot(leman.88.ev30,var.mod.obj=leman.88.vmsph)
# crash:
# leman.krg<-krige.grid(min(leman.bank$x),min(leman.bank$y), max(leman.bank$x), max(leman.bank$y), nx=100, ny=100, point = leman.88.pt, at = "cadpbm", var.mod.obj = leman.88.vmsph, rsearch = 7.5, extrap = F,border=leman.bank)
leman.krg<-krige.grid.c(min(leman.bank$x),min(leman.bank$y), max(leman.bank$x), max(leman.bank$y), nx=100, ny=100, point = leman.88.pt, at = "cadpbm", var.mod.obj = leman.88.vmsph, rsearch = 7.5, extrap = F,border=leman.bank)
R : Copyright 2001, The R Development Core Team
Version 1.4.0 (2001-12-19)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type `license()' or `licence()' for distribution details.
R is a collaborative project with many contributors.
Type `contributors()' for more information.
Type `demo()' for some demos, `help()' for on-line help, or
`help.start()' for a HTML browser interface to help.
Type `q()' to quit R.
[Previously saved workspace restored]
> library(sgeostat)
Loading required package: mva
> library(rgeostat)
> leman.krg<-krige.grid(min(leman.bank$x),min(leman.bank$y), max(leman.bank$x), max(leman.bank$y), nx=100, ny=100, point = leman.88.pt, at = "cadpbm", var.mod.obj = leman.88.vmsph, rsearch = 7.5, extrap = F,border=leman.bank)
Process R segmentation fault at Fri Jan 4 09:44:36 2002
R : Copyright 2001, The R Development Core Team
Version 1.4.0 (2001-12-19)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type `license()' or `licence()' for distribution details.
R is a collaborative project with many contributors.
Type `contributors()' for more information.
Type `demo()' for some demos, `help()' for on-line help, or
`help.start()' for a HTML browser interface to help.
Type `q()' to quit R.
[Previously saved workspace restored]
> library(sgeostat)
Loading required package: mva
> library(rgeostat)
> leman.krg<-krige.grid(min(leman.bank$x),min(leman.bank$y), max(leman.bank$x), max(leman.bank$y), nx=100, ny=100, point = leman.88.pt, at = "cadpbm", var.mod.obj = leman.88.vmsph, rsearch = 7.5, extrap = F,border=leman.bank)
Process R segmentation fault at Fri Jan 4 09:45:14 2002
R : Copyright 2001, The R Development Core Team
Version 1.4.0 (2001-12-19)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type `license()' or `licence()' for distribution details.
R is a collaborative project with many contributors.
Type `contributors()' for more information.
Type `demo()' for some demos, `help()' for on-line help, or
`help.start()' for a HTML browser interface to help.
Type `q()' to quit R.
[Previously saved workspace restored]
> library(sgeostat)
Loading required package: mva
> library(rgeostat)
> leman.krg<-krige.grid(min(leman.bank$x),min(leman.bank$y), max(leman.bank$x), max(leman.bank$y), nx=100, ny=100, point = leman.88.pt, at = "cadpbm", var.mod.obj = leman.88.vmsph, rsearch = 7.5, extrap = F,border=leman.bank)
Process R segmentation fault at Fri Jan 4 09:47:32 2002
R : Copyright 2001, The R Development Core Team
Version 1.4.0 (2001-12-19)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type `license()' or `licence()' for distribution details.
R is a collaborative project with many contributors.
Type `contributors()' for more information.
Type `demo()' for some demos, `help()' for on-line help, or
`help.start()' for a HTML browser interface to help.
Type `q()' to quit R.
[Previously saved workspace restored]
> library(sgeostat)
Loading required package: mva
> library(rgeostat)
> leman.krg<-krige.grid(min(leman.bank$x),min(leman.bank$y), max(leman.bank$x), max(leman.bank$y), nx=100, ny=100, point = leman.88.pt, at = "cadpbm", var.mod.obj = leman.88.vmsph, rsearch = 7.5, extrap = F,border=leman.bank)
Process R segmentation fault at Fri Jan 4 09:52:43 2002
R : Copyright 2001, The R Development Core Team
Version 1.4.0 (2001-12-19)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type `license()' or `licence()' for distribution details.
R is a collaborative project with many contributors.
Type `contributors()' for more information.
Type `demo()' for some demos, `help()' for on-line help, or
`help.start()' for a HTML browser interface to help.
Type `q()' to quit R.
[Previously saved workspace restored]
> library(sgeostat)
Loading required package: mva
> library(rgeostat)
> leman.krg<-krige.grid(min(leman.bank$x),min(leman.bank$y), max(leman.bank$x), max(leman.bank$y), nx=100, ny=100, point = leman.88.pt, at = "cadpbm", var.mod.obj = leman.88.vmsph, rsearch = 7.5, extrap = F,border=leman.bank)
Process R segmentation fault at Fri Jan 4 10:05:48 2002
R : Copyright 2001, The R Development Core Team
Version 1.4.0 (2001-12-19)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type `license()' or `licence()' for distribution details.
R is a collaborative project with many contributors.
Type `contributors()' for more information.
Type `demo()' for some demos, `help()' for on-line help, or
`help.start()' for a HTML browser interface to help.
Type `q()' to quit R.
[Previously saved workspace restored]
> library(sgeostat)
Loading required package: mva
> library(rgeostat)
> leman.krg<-krige.grid.c(min(leman.bank$x),min(leman.bank$y), max(leman.bank$x), max(leman.bank$y), nx=100, ny=100, point = leman.88.pt, at = "cadpbm", var.mod.obj = leman.88.vmsph, rsearch = 7.5, extrap = F,border=leman.bank)
>
> str(leman.krg)
List of 8
$ x : num [1:100] 500 501 502 502 503 ...
$ y : num [1:100] 118 119 119 119 120 ...
$ z : num [1:100, 1:100] NA NA NA NA NA NA NA NA NA NA ...
$ var : num [1:100, 1:100] NA NA NA NA NA NA NA NA NA NA ...
$ done: int [1:100, 1:100] 0 0 0 0 0 0 0 0 0 0 ...
$ snb : int [1:200, 1:10000] 0 0 0 0 0 0 0 0 0 0 ...
$ data:Classes point and `data.frame': 200 obs. of 3 variables:
..$ x : num [1:200] 501 502 501 503 502 501 504 503 502 504 ...
..$ y : num [1:200] 119 120 121 121 122 123 122 123 124 124 ...
..$ cadpbm: num [1:200] 0.73 0.74 0.45 1.09 1.32 0.29 0.17 0.51 0.93 0.59 ...
$ at : chr "cadpbm"
- attr(*, "class")= chr "krige.map"
> plot(leman.krg)
> plot(leman.krg,show.snb=T)
select points to place search neighbourhoods ...
> leman.krg30<-krige.grid.c(min(leman.bank$x),min(leman.bank$y), max(leman.bank$x), max(leman.bank$y), nx=100, ny=100, point = leman.88.pt, at = "cadpbm", var.mod.obj = leman.88.vmsph, rsearch = 30, extrap = F,border=leman.bank)
> plot(leman.krg30,show.snb=T)
select points to place search neighbourhoods ...
> plot(leman.krg,show.snb=T)
select points to place search neighbourhoods ...
> leman.krg10<-krige.grid.c(min(leman.bank$x),min(leman.bank$y), max(leman.bank$x), max(leman.bank$y), nx=100, ny=100, point = leman.88.pt, at = "cadpbm", var.mod.obj = leman.88.vmsph, rsearch = 10, extrap = F,border=leman.bank)
> plot(leman.krg10,show.snb=T)
select points to place search neighbourhoods ...
> plot(leman.krg10,show.snb=T)
select points to place search neighbourhoods ...
> plot(leman.krg10,show.snb=T)
select points to place search neighbourhoods ...
> plot(leman.krg10,show.snb=T)
select points to place search neighbourhoods ...
> plot(leman.krg10,show.snb=T)
select points to place search neighbourhoods ...
> plot(leman.krg10,show.snb=T)
select points to place search neighbourhoods ...
> plot(leman.krg10,show.snb=T)
select points to place search neighbourhoods ...
> plot(leman.krg10,show.snb=T)
select points to place search neighbourhoods ...
> plot(leman.krg10,show.snb=T)
select points to place search neighbourhoods ...
> plot(leman.krg10,show.point=F,show.snb=T)
Error in plot.krige.map(leman.krg10, show.point = F, show.snb = T) :
unused argument(s) (show.point ...)
> plot(leman.krg10,show.data=F,show.snb=T)
select points to place search neighbourhoods ...
> plot(leman.krg,show.point=F,show.snb=T)
Error in plot.krige.map(leman.krg, show.point = F, show.snb = T) :
unused argument(s) (show.point ...)
> plot(leman.krg,show.data=F,show.snb=T)
select points to place search neighbourhoods ...
> plot(leman.krg,show.data=F,show.snb=T)
select points to place search neighbourhoods ...
> leman.krg10.2<-krige.grid.c(min(leman.bank$x),min(leman.bank$y), max(leman.bank$x), max(leman.bank$y), nx=200, ny=200, point = leman.88.pt, at = "cadpbm", var.mod.obj = leman.88.vmsph, rsearch = 10, extrap = F,border=leman.bank)
> plot(leman.krg10,show.data=F,show.snb=T)
select points to place search neighbourhoods ...
> x11()
> plot(leman.krg10.2,show.data=F,show.snb=T)
select points to place search neighbourhoods ...
> save.image()
> q()
Save workspace image? [y/n/c]: y
Process R finished at Sat Jan 5 00:30:32 2002
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment