Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"sill" must be positive.?? #2

Open
sue-shine opened this issue Jul 6, 2020 · 2 comments
Open

"sill" must be positive.?? #2

sue-shine opened this issue Jul 6, 2020 · 2 comments

Comments

@sue-shine
Copy link

Excuse me, sorry to bother you. I have met a question when coding.as the code follows.
<loc<-read.csv("F:/1Guichi1991-2015/schdata.SU/location.csv")
<date<-read.csv("F:/1Guichi1991-2015/schdata.SU/date.csv")
<data<-read.csv("F:/1Guichi1991-2015/schdata.SU/data.csv")
 
<library("dplyr")
<library("tidyr")
<library("STRbook")
<library("sp")
<library("spacetime")
 
#STFDF
<spat_part <- SpatialPoints(coords = loc[,c("lon", "lat")])
 
<date$time<-as.character(date$time) 
<temp_part<-date$time   
<temp_part <- as.Date(temp_part)
<class(date$time)
 
<data$VillageID<-as.integer(data$VillageID)
<all(unique(data$VillageID) == loc$VillageID)
<STOBJ1<- STFDF(sp = spat_part,
               time = temp_part,
               data = data)
 
<proj4string(STOBJ1) <- CRS("+proj=longlat +ellps=WGS84")
<library(gstat)
<vv<-variogram(object=p~1,  
              data=STOBJ1,
              width=2,  
              cutoff=28,
              tlags=0.01:6.1,tunit="days")
 
<plot(vv)
#separable model
<sepVgm <- vgmST(stModel = "separable",    
                space = vgm(10, "Exp", 400, nugget = 0.1),
                time = vgm(10, "Exp", 1, nugget = 0.1),
                sill = 20)  
<sepVgm <- fit.StVariogram(vv, sepVgm)
 ##Error in vgmST("separable", space = vgm(1 - par[2], as.character(model$space$model[2]), :
"sill" must be positive.
I can find the problem with my exercise data, could you please help me?
<spat_pred_grid<- expand.grid(
< lon = seq(117, 118, length = 20),
< lat = seq(30, 31, length = 20)) %>%
< SpatialPoints(proj4string = CRS(proj4string(STOBJ1)))
<gridded(spat_pred_grid) <- TRUE
 
<temp_pred_grid <- as.Date("1991-06-01") + seq(1, 6, length = 6)
 
 
<DE_pred<- STF(sp = spat_pred_grid,
                time = temp_pred_grid)
 
<STOBJ1 <- as(STOBJ1[,"1991-06-01::1991-06-25"], "STIDF")
 
<STOBJ1 <- subset(STOBJ1, !is.na(STOBJ1$p))
 
<pred_kriged <- krigeST(p ~ #1,
                       data = STOBJ1,
                       newdata = DE_pred, # prediction grid
                       modelList = sepVgm, # semivariogram
                       computeVar = TRUE)
 ##Error in chol.default(A) : the leading minor of order 88 is not positive definite

@andrewzm
Copy link
Owner

andrewzm commented Jul 8, 2020 via email

@sue-shine
Copy link
Author

Hi, I try to put covariates in, but it didn't work, I wonder if it is convenient to check my exercise data for you.really need help.Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants