|
3 | 3 | # |
4 | 4 | # convert ppm object into format palatable to rmh.default |
5 | 5 | # |
6 | | -# $Revision: 2.67 $ $Date: 2025/09/19 04:44:21 $ |
| 6 | +# $Revision: 2.68 $ $Date: 2025/09/28 04:01:23 $ |
7 | 7 | # |
8 | 8 | # .Spatstat.rmhinfo |
9 | 9 | # rmhmodel.ppm() |
@@ -382,23 +382,25 @@ rmhmodel.ppm <- function(model, w, ..., |
382 | 382 | else |
383 | 383 | predict(model, window=wsim, type="trend", |
384 | 384 | covariates=newcovariates) |
385 | | - ## check for substantial fraction of NA's |
386 | | - if(!Y$marked) { |
387 | | - Atrend <- area(as.owin(Z$trend)) |
388 | | - } else { |
389 | | - Atrend <- mean(sapply(lapply(Z$trend, as.owin), area)) |
390 | | - } |
391 | | - okfrac <- Atrend/area(wsim) |
392 | | - if(okfrac < 0.95) { |
393 | | - gripe <- paste("The model trend is undefined (NA) at", |
394 | | - percentage(1 - okfrac), |
395 | | - "of locations in the simulation window") |
396 | | - if(okfrac < 0.5) |
397 | | - stop(gripe, call.=FALSE) |
398 | | - warning(paste(paste0(gripe, ";"), |
399 | | - "simulations will be generated in a sub-window", |
400 | | - "covering only", percentage(okfrac), "of the area"), |
401 | | - call.=FALSE) |
| 385 | + if(newdata.given) { |
| 386 | + ## check for substantial fraction of NA's |
| 387 | + if(!Y$marked) { |
| 388 | + Atrend <- area(as.owin(Z$trend)) |
| 389 | + } else { |
| 390 | + Atrend <- mean(sapply(lapply(Z$trend, as.owin), area)) |
| 391 | + } |
| 392 | + okfrac <- Atrend/area(wsim) |
| 393 | + if(okfrac < 0.95) { |
| 394 | + gripe <- paste("The model trend is undefined (NA) at", |
| 395 | + percentage(1 - okfrac), |
| 396 | + "of locations in the simulation window") |
| 397 | + if(okfrac < 0.5) |
| 398 | + stop(gripe, call.=FALSE) |
| 399 | + warning(paste(paste0(gripe, ";"), |
| 400 | + "simulations will be generated in a sub-window", |
| 401 | + "covering only", percentage(okfrac), "of the area"), |
| 402 | + call.=FALSE) |
| 403 | + } |
402 | 404 | } |
403 | 405 | } |
404 | 406 |
|
|
0 commit comments