Skip to content

Universal kriging with geoR

2 messages · GEMA FERNANDEZ-AVILES CALDERON, Paulo Justiniano Ribeiro Jr

#
Dear list,

I have a computational error and I can not found the solution...

I would like to perform an Universal Kriging with geoR. I have a geodata object: log(price), long, lat and pollution, but 'krige.conv' and 'ksline' functions give me the same error: system is computationally singular.

Any ideas will be appreciated.

Thanks in advance,
Gema

PS: I can send you the data to run the code


############################################################################

# read the data and create a geodata object
attach(Datos)
bordes.munimadrid=read.table("MuniMadrid.txt")
coord=cbind(long,lat)
uk.vivi<-cbind(coord , log(Datos$precio.house.x), Mal_olor )
obj.uk.vivi<-as.geodata(obj=uk.vivi, coords.col = 1:2, data.col = 3,
              covar.col = 4 ,covar.names = "Pollution" )
summary(obj.uk.vivi)

#Number of data points: 300
#
#Coordinates summary
#      long     lat
#min 433426 4466197
#max 451184 4484681
#
#Distance summary
#     min      max
#   19.18 20836.71
#
#Data summary
#   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
#   6.91    7.94    8.19    8.16    8.43    9.28
#
#Covariates summary
#    Mal_olor
# Min.   :0.080
# 1st Qu.:0.210
# Median :0.260
# Mean   :0.281
# 3rd Qu.:0.330
# Max.   :0.720


## I woulk like to use this spatial trend but UK doesn't run
sp.tren.rp=trend.spatial("1st", obj.uk.vivi, add=~Mal_olor)

# Universal kriging with geoR() first option
loci <- expand.grid(seq(424854, 456141, l = 101), seq(4462788, 4499622, l = 101))
UK.krig.viviendas <- krige.conv(obj.uk.vivi, loc = loci, borders = bordes.munimadrid,
              krige = krige.control(type.krige = "ok", cov.model = "gau",
              cov.pars = c(0.06, 3000), nug = 0.05, trend.l = "1st", trend.d ="1st") )

krige.conv: results will be returned only for prediction locations inside the borders
krige.conv: model with mean given by a 1st order polynomial on the coordinates
Error in solve.default(ttivtt, crossprod(ivtt, as.vector(data))) :
  sistema es computacionalmente singular: n?mero de condici?n rec?proco = 6.8379e-20


# Universal kriging with geoR() second option
uk.2= ksline(obj.uk.vivi, coords = obj.uk.vivi$coords, data = obj.uk.vivi$data,
       loc = loci, borders = bordes.munimadrid,
       cov.model = "gau",  cov.pars=c(0.06, 3000), nug = 0.05,
       lambda = 1, m0 = "kt", nwin = "full",
       trend = 1, d = 2 )

ksline: results will be returned only for prediction locations inside the borders
Error in solve.default(crossprod(xmat, iv) %*% xmat) :
sistema es computacionalmente singular: n?mero de condici?n rec?proco = 6.8379e-20

############################################################################
1 day later
#
try dividind the coordinates by 1000
and let me know

apparently they are given in UTM, therefore meters, this will change to 
kilometers

If this does not run please send me the data



Paulo Justiniano Ribeiro Jr
LEG (Laboratorio de Estatistica e Geoinformacao)
Universidade Federal do Parana
Caixa Postal 19.081
CEP 81.531-990
Curitiba, PR  -  Brasil
Tel: (+55) 41 3361 3573
VOIP: (+55) (41) (3361 3600) 1053 1066
Fax: (+55) 41 3361 3141
e-mail: paulojus AT  ufpr  br
http://www.leg.ufpr.br/~paulojus
On Sat, 3 Oct 2015, GEMA FERNANDEZ-AVILES CALDERON wrote: