ear ALL,

The last part of my thesis analysis is the cross validation. Right now I am 
having difficulty using the cross validation of gstat. Below are my commands 
with the tsport_ace as the variable:

nfold <- 3
part <- sample(1:nfold, 69, replace = TRUE)
sel <- (part != 1)
m.model <- x2[sel, ]
m.valid <- x2[-sel, ]
t<- fit.variogram(v,vgm(0.0437, "Exp", 26, 0))
cv69 <- krige.cv(tsport_ace ~ 1, x2, t, nfold = nrow(x2))

The last line gives an error saying:
Error in SpatialPointsDataFrame(coordinates(data), 
data.frame(matrix(as.numeric(NA),  : 
  row.names of data and coords do not match

I don't know what is wrong. The x2 data is a SpatialPointsdataframe that is why 
i did not specify the location (as it will take it from the data). Here is the 
usage of the function krige.cv:

krige.cv(formula, locations, data, model = NULL, beta = NULL, nmax = Inf, 
        nmin = 0, maxdist = Inf, nfold = nrow(data), verbose = TRUE, ...)
I hope you can help me on this. Thanks a lot.
Best regards,
Pearl



      
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to