--- title: "Filtering by Kriging" author: "RGeostats Team" date: "September 2019" output: beamer_presentation: colortheme: beaver fig_height: 6 theme: Boadilla fontsize: 8pt theme: Boadilla colortheme: beaver --- \frametitle{Loading Data} ```{r Loading_Library, include=FALSE} library(knitr) library(RGeostats) constant.define("asp",1) rm(list=ls()) ``` The Grid containing the information is downloaded from the distribution ```{r Loading_Data} rg.load("Exdemo_Filter","grid") ``` The loaded file (called **grid **) contains 3 variables: - **P** (phosphorus) which is the *variable of interest* - **Cr** (chromium) is an auxiliary variable - **Ni** (nickel) another auxiliary variable --- \frametitle{Statistics on main variable} ```{r Statistics_P} print(grid,flag.resume=FALSE,flag.stats=TRUE,names="P") ``` Note that some pixels are not informed for variable **P**. --- \frametitle{Statistics on auxiliary variables} ```{r Statistics_Cr} print(grid,flag.resume=FALSE,flag.stats=TRUE,names="Cr") ``` --- \frametitle{Statistics on auxiliary variables} ```{r Statistics_Ni} print(grid,flag.resume=FALSE,flag.stats=TRUE,names="Ni") ``` --- \frametitle{Correlation between Cr and P} ```{r Correlation_Cr_P,results="hide"} correlation(grid,"Cr","P",title="") ``` --- \frametitle{Correlation between Ni and P} ```{r Correlation_Ni_P,results="hide"} correlation(grid,"Ni","P",title="") ``` --- \frametitle{Correlation between Ni and CR} ```{r Correlation_Ni_Cr,results="hide"} correlation(grid,"Ni","Cr",title="") ``` --- \frametitle{Completing the variable **P**} Using inverse square distance ```{r Completing_P} grid = db.locate(grid,"P","z") grid = db.grid.fill(grid,radix="Fill") ``` We concentrate on the variable of interest **P** (completed) in the next operations ```{r Locate_P} grid = db.locate(grid,"Fill.P","z") ``` --- \frametitle{Display P} ```{r Visualize_P} plot(grid,pos.legend=1,title="P after completion") ``` --- \frametitle{Variogram Calculation} ```{r Variogram_calculation} varioP = vario.grid(grid,nlag=50) modelP = model.auto(varioP,struct=c(1,2,12),auth.aniso = FALSE,flag.noreduce=TRUE) ``` --- \frametitle{Variogram Model} ```{r Variogram_Model} modelP ``` --- \frametitle{Monovariate Factorial Kriging Analysis} We must define the **Neighborhood** ```{r Neighborhood_Definition} neigh = neigh.create(ndim=2,type=3,radimg=c(10,10)) ``` The **image** neighborhood is based on $(2*10+1)^2=441$ pixels (centered on the target pixel). During the estimation, only the contribution of second and third basic structures are kept (Nugget Effect is filtered out): ** Factorial Kriging Analysis**. ```{r Performing_monovariate_FKA} means = db.stat(grid,flag.mono=TRUE,names="Fill.P") mono = krimage(grid,modelP,neigh,cov.extract = c(2,3), uc="",mean=means) ``` --- \frametitle{Monovariate Factorial Kriging Analysis} ```{r Visualize_P_after_FKA_monovariate} plot(mono,pos.legend=1,title="P denoised (monovariate)",zlim=c(0,150)) ``` --- \frametitle{Correlation between Initial and Filtered images} Correlation for **P** variable between Initial image and its Filtered version (monovariate FKA) ```{r Correlation_P_denoised_monovariate} correlation(mono,"Fill.P","Kimage.Fill.P.estim", title="",xlab="P Filled",ylab="P Filtered") ``` --- \frametitle{Multivariate Approach} ```{r Locate_Multivariate, fig.align='center', fig.height=5} grid = db.locate(grid,c("Fill.P","Cr","Ni"),"z") varioM = vario.grid(grid,nlag=50) modelM = model.auto(varioM,struct=c(1,2,12),auth.aniso = FALSE,flag.noreduce=TRUE) ``` --- \frametitle{Multivariate Model} ```{r Multivariate_Model} modelM ``` --- \frametitle{Multivariable Factorial Kriging Analysis} ```{r Performing_Multivariate_FKA} means = db.stat(grid,flag.mono=TRUE,names=c("Fill.P","Cr","Ni")) multi = krimage(grid,modelM,neigh,cov.extract = c(2,3), uc="",mean=means) ``` Note that, using the same **neigh** as in monovariate, the dimension of the Kriging System is now $3 * 441 = 1323$ --- \frametitle{Multivariable Factorial Kriging Analysis} ```{r Visualize_P_after_FKA_multivariate} plot(multi,pos.legend=1,title="P denoised (multivariate)",zlim=c(0,150)) ``` --- \frametitle{Correlation between Initial and Filtered images} Correlation for **P** variable between Initial image and its Filtered version (multivariate FKA) ```{r Correlation_P_denoised_multivariate} correlation(multi,"Fill.P","Kimage.Fill.P.estim") ```