Skip to content

Variable transformation give weird variance results when using kriging? #137

Open
@Cidree

Description

@Cidree

Hello,

I am analysing the interpolation techniques, and I encountered something that appears to be weird for me (I might be wrong).

I am using here 100 random points in Spain where the precipitation has been measured. The precipitation does not follow a normal distribution, so I did a log-transformation and then it follows a normal distribution.

Here, I did two analysis, one with the non-transformed variable and another with the transformed variable. When using ordinary kriging, the predictions of the precipitation are consistent in both cases. However, the variance it's significantly different between both methods.

  • Transformed option: the variance oscillates 1 and 1.20 after transforming with exp()
    transformation

  • Non-transformed option: the variance oscillates between 2.5 and 364
    non_transformed

I tried this with other examples, including meuse data, and the range of the variance are always weird when I use a transformation. Here I paste the code that I am using for transforming the variable, and invert the transformation. If you need the full code for a reproducible example, please let me know.

## Transform precipitation
precipitacion_sf <- precipitacion_sf %>%
  mutate(
    prec_trans = log(prec)
  )

## Fit variogram
prec_var <- variogram(
  object    = prec_trans ~ 1,
  locations = precipitacion_sf
)

prec_opt_vgm <- fit.variogram(
  object = prec_var,
  model  = vgm(c("Sph", "Gau", "Exp"))
)

## Ordinary kriging
prec_ko_sf <- krige(
  formula   = prec_trans ~ 1,
  locations = precipitacion_sf,
  newdata   = grid_sfc,
  model     = prec_opt_vgm
)

## Invert transformation
prec_ko_sf <- prec_ko_sf %>%
  mutate(
    var1.pred = exp(var1.pred),
    var1.var  = exp(var1.var),
  )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions