-
Notifications
You must be signed in to change notification settings - Fork 48
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
Comments
Hi Sue, this seems to be a problem with fitting vgmST to your specific
data. Often this happens because there is a "trend" component you have not
removed. I see your formula is p ~ 1, try putting in some covariates and
see if things improve. Also, look closely at the "empirical" spatial and
temporal variograms so you have an idea what you are fitting the
theoretical variogram too. Hope this helps.
Andrew
…On Mon, Jul 6, 2020 at 7:00 PM sue-shine ***@***.***> wrote:
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
<#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
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABEU3NKQOZPIPPTXZCE5SDR2GHEHANCNFSM4ORMR4KQ>
.
|
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
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
The text was updated successfully, but these errors were encountered: