Title: | Geostatistics Methods and Klovan Data |
---|---|
Description: | A comprehensive set of geostatistical, visual, and analytical methods, in conjunction with the expanded version of the acclaimed J.E. Klovan's mining dataset, are included in 'klovan'. This makes the package an excellent learning resource for Principal Component Analysis (PCA), Factor Analysis (FA), kriging, and other geostatistical techniques. Originally published in the 1976 book 'Geological Factor Analysis', the included mining dataset was assembled by Professor J. E. Klovan of the University of Calgary. Being one of the first applications of FA in the geosciences, this dataset has significant historical importance. As a well-regarded and published dataset, it is an excellent resource for demonstrating the capabilities of PCA, FA, kriging, and other geostatistical techniques in geosciences. For those interested in these methods, the 'klovan' datasets provide a valuable and illustrative resource. Note that some methods require the 'RGeostats' package. Please refer to the README or Additional_repositories for installation instructions. This material is based upon research in the Materials Data Science for Stockpile Stewardship Center of Excellence (MDS3-COE), and supported by the Department of Energy's National Nuclear Security Administration under Award Number DE-NA0004104. |
Authors: | Jonathan E Gordon [aut]
|
Maintainer: | Roger H French <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2025-02-12 04:42:37 UTC |
Source: | https://github.com/cran/klovan |
This function calculates the eigenvalues of a given covariance matrix or a klovan dataset. In case of a klovan dataset, it is first converted into a covariance matrix. For further details on klovan datasets, refer to the README.
calc_eigenvalues(data)
calc_eigenvalues(data)
data |
A covariance matrix made with |
A data frame with two columns: "Evalues_COV" and "pc.names1". "Evalues_COV" represents the eigenvalues for each principal component listed in "pc.names1".
data("Klovan_Row80") calc_eigenvalues(covar_mtrx(Klovan_Row80)) # view eigenvalues
data("Klovan_Row80") calc_eigenvalues(covar_mtrx(Klovan_Row80)) # view eigenvalues
This function calculates the Eigenvectors of a given covariance matrix or a klovan dataset. In case of a klovan dataset, it is first converted into a covariance matrix. For further details on klovan datasets, refer to the README.
calc_eigenvectors(data)
calc_eigenvectors(data)
data |
A covariance matrix made with |
A data frame with two columns: "Evalues_COV" and "pc.names1". "Evalues_COV" represents the eigenvectors for each principal component listed in "pc.names1".
data("Klovan_Row80") calc_eigenvectors(covar_mtrx(Klovan_Row80)) # view eigenvectors
data("Klovan_Row80") calc_eigenvectors(covar_mtrx(Klovan_Row80)) # view eigenvectors
Calculate the cardinal sine model based on the given parameters.
cardinal_sine_model(h, sill)
cardinal_sine_model(h, sill)
h |
Distance. |
sill |
Sill value. |
Computed value based on the cardinal sine model.
Calculate the Cauchy model based on the given parameters.
cauchy_model(h, nugget, sill, range, a)
cauchy_model(h, nugget, sill, range, a)
h |
Distance. |
nugget |
Nugget effect. |
sill |
Sill value. |
range |
Range value. |
a |
Additional parameter. |
Computed value based on the Cauchy model.
correlation matrix
cor_mtrx(data)
cor_mtrx(data)
data |
A dataset of class data.frame. The data should contain 'C_X' and 'C_Y' columns representing the x and y coordinates of the data points and excludes any rank, ID, or column not for analysis. |
a correlation matrix as matrix object
data("Klovan_Row80") cor_mtrx(range_transform(Klovan_Row80)) # view correlation matrix corMtrx <- cor_mtrx(Klovan_Row80) # save correlation matrix as object
data("Klovan_Row80") cor_mtrx(range_transform(Klovan_Row80)) # view correlation matrix corMtrx <- cor_mtrx(Klovan_Row80) # save correlation matrix as object
The correlation plot is a summary showing the relationship among variables.The plot below is a 10 x 10 table where each variable is plotted against every other variable.In the top half of the table, the correlation coefficients are displayed. In the bottom half, the scatter plots are shown along with a regression line. Down the diagonal axis, the variable histograms are show.
correlation_plot(data)
correlation_plot(data)
data |
A dataset of class data.frame. The data should contain 'C_X' and 'C_Y' columns representing the x and y coordinates of the data points and excludes any rank, ID, or column not for analysis, see README for details |
a correlation plot displaying correlation coefficients, the scatter plots with a regression line and, the variable histograms in a 10 x 10 table.
data("Klovan_Row80") correlation_plot(Klovan_Row80)
data("Klovan_Row80") correlation_plot(Klovan_Row80)
Calculate the cosinus model based on the given parameters.
cosinus_model(h, sill, a)
cosinus_model(h, sill, a)
h |
Distance. |
sill |
Sill value. |
a |
Additional parameter. |
Computed value based on the cosinus model.
This function creates a non-normalized co-variance matrix from the given klovan dataset. For further details on klovan datasets, refer to the README.
covar_mtrx(data)
covar_mtrx(data)
data |
A dataset of class data.frame. The data should contain 'C_X' and 'C_Y' columns representing the x and y coordinates of the data points and excludes any rank, ID, or column not for analysis. |
A non-normalized co-variance matrix of the klovan data.
data("Klovan_Row80") covar_mtrx(Klovan_Row80) # view co-variance matrix
data("Klovan_Row80") covar_mtrx(Klovan_Row80) # view co-variance matrix
This function calculates the sum of all the eigenvalues from a provided covariance matrix or klovan dataset. Each eigenvalue is divided by the sum of the eigenvalues to determine its proportional contribution. This yields the percent contribution of each eigenvalue and provides an understanding of the proportion of total variance explained by each eigenvalue.
eigen_contribution(Cov_Mtrx)
eigen_contribution(Cov_Mtrx)
Cov_Mtrx |
A covariance matrix used to compute the eigenvalues or A dataset of class data.frame. The data should contain 'C_X' and 'C_Y' columns representing the x and y coordinates of the data points and excludes any rank, ID, or column not for analysis, see README for details |
A data frame with columns: "EigenValues", "CumSum", "CumSumPct", "pc.names". Where: - "EigenValues": The eigenvalues - "CumSum": The cumulative sum of the eigenvalues - "CumSumPct": The proportional contribution of each eigenvalue - "pc.names": The principal component names
data("Klovan_Row80") your_cov_Mtrx <- covar_mtrx(Klovan_Row80) # example covariance matrix eigen_contribution(Klovan_Row80) # view the data frame eigen_contribution(your_cov_Mtrx) # view the data frame eigen_contribution(covar_mtrx(Klovan_Row80)) # view the data frame
data("Klovan_Row80") your_cov_Mtrx <- covar_mtrx(Klovan_Row80) # example covariance matrix eigen_contribution(Klovan_Row80) # view the data frame eigen_contribution(your_cov_Mtrx) # view the data frame eigen_contribution(covar_mtrx(Klovan_Row80)) # view the data frame
Calculate the exponential model based on the given parameters.
exponential_model(h, nugget, sill, range)
exponential_model(h, nugget, sill, range)
h |
Distance. |
nugget |
Nugget effect. |
sill |
Sill value. |
range |
Range value. |
Computed value based on the exponential model.
This function performs a Factor Analysis on a provided dataset using the "Varimax" orthogonal rotation method. It also calculates the factor scores for each factor.
factor_analysis(data, num_fac = 3)
factor_analysis(data, num_fac = 3)
data |
A dataset of class data.frame. The data should contain 'C_X' and 'C_Y' columns representing the x and y coordinates of the data points and excludes any rank, ID, or column not for analysis, see README for details |
num_fac |
A numeric value indicating the number of factors to analyze. It's recommended to use 3, which is also the default value. |
A data frame containing the calculated factors.
data("Klovan_Row80") factor_analysis(Klovan_Row80) factor_analysis(Klovan_Row80, 3)
data("Klovan_Row80") factor_analysis(Klovan_Row80) factor_analysis(Klovan_Row80, 3)
factor correlation plot
factor_cor_plot( data, FAC_1, FAC_2, num_fac = 3, text_col = "red", line_col = "lightblue" )
factor_cor_plot( data, FAC_1, FAC_2, num_fac = 3, text_col = "red", line_col = "lightblue" )
data |
A dataset of class data.frame. The data should contain 'C_X' and 'C_Y' columns
representing the x and y coordinates of the data points and excludes any rank,
ID, or column not for analysis, see README for details. It will be that will be converted into
a plottable dataframe, see README for details or
a plottable data frame created from the |
FAC_1 |
the first factor to be compared. A string that can be chosen from FA1:FA3 or FA1:FAnum_fac e.g. "FA1" |
FAC_2 |
the first factor to be compared. A string that can be chosen from FA1:FA3 or FA1:FAnum_fac e.g. "FA2" |
num_fac |
a numeric value for how many factors to analyze. Recommended to use 3 and default to 3. |
text_col |
an R color, the color of the text lables, defaults to "red" |
line_col |
an R color, the color of the lines, defaults to "lightblue" |
a ggplot object of the correlation plot
data("Klovan_Row80") fa_plot1 <- factor_cor_plot(Klovan_Row80, "FAC1", "FAC2", 2) fa_plot1 factor_cor_plot(Klovan_Row80, "FAC1", "FAC3") fa_plot2 <-factor_cor_plot(factor_analysis(Klovan_Row80), "FAC1", "FAC3", 4) fa_plot2
data("Klovan_Row80") fa_plot1 <- factor_cor_plot(Klovan_Row80, "FAC1", "FAC2", 2) fa_plot1 factor_cor_plot(Klovan_Row80, "FAC1", "FAC3") fa_plot2 <-factor_cor_plot(factor_analysis(Klovan_Row80), "FAC1", "FAC3", 4) fa_plot2
This function creates a faceted plot of each rotated factor score, which could be interpreted as the elements of a "phantom" variable. This function aids in defining the relationship between the phantom variables and the known ore body by producing a contoured map for each variable.
factor_score_plot( Interp_Data, overlay, data, FA_colors = c(FA1 = "black", FA2 = "blue", FA3 = "darkred", FA4 = "green", FA5 = "purple", FA6 = "orange", FA7 = "yellow", FA8 = "pink", FA9 = "cyan", FA10 = "magenta") )
factor_score_plot( Interp_Data, overlay, data, FA_colors = c(FA1 = "black", FA2 = "blue", FA3 = "darkred", FA4 = "green", FA5 = "purple", FA6 = "orange", FA7 = "yellow", FA8 = "pink", FA9 = "cyan", FA10 = "magenta") )
Interp_Data |
A plottable data frame produced by the |
overlay |
A Boolean input. If TRUE, the plot will overlay isolines; if FALSE, it will not. |
data |
a klovan dataset (transformed, untransformed, outlier, etc), see README for details. |
FA_colors |
A named vector of colors for different factors. Defaults to a set color palette. |
A ggplot object representing the Factor Scores plot.
data("Klovan_Row80") factor_plot1 <- factor_score_plot(inv_dis_wt(Klovan_Row80), TRUE, data = Klovan_Row80) factor_plot1 your_interp_data_IDW <- inv_dis_wt(Klovan_Row80, 3) factor_score_plot(your_interp_data_IDW, FALSE, data = Klovan_Row80)
data("Klovan_Row80") factor_plot1 <- factor_score_plot(inv_dis_wt(Klovan_Row80), TRUE, data = Klovan_Row80) factor_plot1 your_interp_data_IDW <- inv_dis_wt(Klovan_Row80, 3) factor_score_plot(your_interp_data_IDW, FALSE, data = Klovan_Row80)
Calculate the gamma model based on the given parameters.
gamma_model(h, nugget, sill, range, a)
gamma_model(h, nugget, sill, range, a)
h |
Distance. |
nugget |
Nugget effect. |
sill |
Sill value. |
range |
Range value. |
a |
Additional parameter. |
Computed value based on the gamma model.
Calculate the Gaussian model based on the given parameters.
gaussian_model(h, nugget, sill, range)
gaussian_model(h, nugget, sill, range)
h |
Distance. |
nugget |
Nugget effect. |
sill |
Sill value. |
range |
Range value. |
Computed value based on the Gaussian model.
This function applies the Inverse Distance Weighting interpolation algorithm
inv_dis_wt(data, num_fac = 3)
inv_dis_wt(data, num_fac = 3)
data |
A dataset of class data.frame. The data should contain 'C_X' and 'C_Y' columns representing the x and y coordinates of the data points and excludes any rank, ID, or column not for analysis, see README for details |
num_fac |
a numeric value for how many factors to analyze. Recommended to use 3 and default to 3. |
a data frame with interpolated data for the whole graph. Data frame has collumns: "C_X" "C_Y" "value" "FA": C_X, C_Y are coordinates and "value" is the value for the "FA" the relevant factor.
data("Klovan_Row80") inv_dis_wt(Klovan_Row80, 4) inv_dis_wt(Klovan_Row80, 3)
data("Klovan_Row80") inv_dis_wt(Klovan_Row80, 4) inv_dis_wt(Klovan_Row80, 3)
The klovan
outlier dataset provides exploration data for geostatistics and analytical methods with an erroneous data point. The region has undergone extensive geological investigation, revealing the position of a known ore body.
The erroneous allows for investigation into how outliers effect the packages analytical methods.
Klovan_2D_all_outlier
Klovan_2D_all_outlier
A data frame with observations of various geological variables @item rank: Rank of the observation @item C_X: X-coordinate of the observation @item C_Y: Y-coordinate of the observation @item P_Elong: Elongation of the geological feature @item P_Fe: Iron content in the geological feature @item P_Fold: Folding factor of the geological feature @item P_Fract: Fracturing level of the geological feature @item P_Mg: Magnesium content in the geological feature @item P_Na: Sodium content in the geological feature @item P_Space: Spatial arrangement factor of the geological feature @item P_Sulfide: Sulfide content in the geological feature @item P_Veins: Veining factor of the geological feature @item P_XLSize: Size of the geological feature
The klovan
dataset provides exploration data for geostatistics and analytical methods. The region has undergone extensive geological investigation, revealing the position of a known ore body.
Klovan_Row80
Klovan_Row80
A data frame with observations of various geological variables @item rank: Rank of the observation @item C_X: X-coordinate of the observation @item C_Y: Y-coordinate of the observation @item P_Elong: Elongation of the geological feature @item P_Fe: Iron content in the geological feature @item P_Fold: Folding factor of the geological feature @item P_Fract: Fracturing level of the geological feature @item P_Mg: Magnesium content in the geological feature @item P_Na: Sodium content in the geological feature @item P_Space: Spatial arrangement factor of the geological feature @item P_Sulfide: Sulfide content in the geological feature @item P_Veins: Veining factor of the geological feature @item P_XLSize: Size of the geological feature
This function performs kriging interpolation on spatial data using ridge regression to calculate the kriging weights. It uses either regular inverse or generalized inverse with ridge regression based on the availability of regular inverse for the given covariance matrix.
kriging( data, factor, grid_cell_size = NA, nugget, sill, range_val, a, model_name )
kriging( data, factor, grid_cell_size = NA, nugget, sill, range_val, a, model_name )
data |
A dataset of class data.frame. The data should contain 'C_X' and 'C_Y' columns representing the x and y coordinates of the data points and excludes any rank, ID, or column not for analysis, see README for details |
factor |
The target factor (FAC) to be interpolated using kriging. |
grid_cell_size |
The desired cell size for the grid. Default is NA, which will calculate the cell size based on the average distance between data points. |
nugget |
The nugget effect parameter for the variogram model. |
sill |
The sill parameter for the variogram model. |
range_val |
The range parameter for the variogram model. |
a |
Additional parameter (depends on the variogram model) use NA if not needed. |
model_name |
The name of the model to use for variogram fitting and kriging. Options include
"Sph1", "Exp1", "Gau1", "Mat1", "Pow1", "Quad1", "Card1", "Gam1", "Cau1", "Sta1", "Ord1", "Tri1", and "Cos1".
use function |
A data frame containing the interpolated values for the target factor (FAC).
data(Klovan_Row80) # Perform kriging interpolation for FAC1 kriging_results <- kriging(Klovan_Row80, factor = 1, grid_cell_size = NA, nugget=.0001, sill=2.5, range_val=1000, a=NA, model_name="Sph1")
data(Klovan_Row80) # Perform kriging interpolation for FAC1 kriging_results <- kriging(Klovan_Row80, factor = 1, grid_cell_size = NA, nugget=.0001, sill=2.5, range_val=1000, a=NA, model_name="Sph1")
This function performs automatic kriging interpolation with factor analysis preprocessing on input data. The optimization may not work as intended use higher num_init_test and num_fin_test values or run the function multiples times to ensure an accurate result.
kriging.auto( data, num_fac = 3, grid_cell_size = NA, num_init_test = 8, num_fin_test = 200, nugget_bounds = c(0, 0.2), sill_bounds = c(0, 20000), range_bounds = c(0, 25000) )
kriging.auto( data, num_fac = 3, grid_cell_size = NA, num_init_test = 8, num_fin_test = 200, nugget_bounds = c(0, 0.2), sill_bounds = c(0, 20000), range_bounds = c(0, 25000) )
data |
A dataset of class data.frame. The data should contain 'C_X' and 'C_Y' columns representing the x and y coordinates of the data points and excludes any rank, ID, or column not for analysis. |
num_fac |
A numeric value indicating the number of factors to analyze. Default is 3. |
grid_cell_size |
The desired cell size for the grid. Default is NA, which will calculate the cell size based on the average distance between data points. |
num_init_test |
The number of random starts for initial model optimization. Default is 8 |
num_fin_test |
The number of random starts for final model optimization. Default is 200 |
nugget_bounds |
A numeric vector specifying the lower and upper bounds for the nugget parameter during optimization. Default is c(0, .2). |
sill_bounds |
A numeric vector specifying the lower and upper bounds for the sill parameter during optimization. Default is c(0, 20000). |
range_bounds |
A numeric vector specifying the lower and upper bounds for the range parameter during optimization. Default is c(0, 25000). |
A data frame with interpolated data for the whole grid. Data frame has columns: "C_X", "C_Y", "value", "FA". "C_X" and "C_Y" are the coordinates, "value" is the interpolated value, and "FA" indicates the relevant factor the value corresponds to.
data("Klovan_Row80") kriging.auto(Klovan_Row80)
data("Klovan_Row80") kriging.auto(Klovan_Row80)
This function appends a new column to the input data, marking potential outliers. Once identified, these outliers can either be removed or imputed.
manage_outliers(data, property)
manage_outliers(data, property)
data |
A dataset of class data.frame. |
property |
A string representing the property on which the range transformation is based. |
The input dataset, supplemented with a new Boolean column. TRUE signifies a high likelihood of an outlier, while FALSE signifies a low likelihood.
data("Klovan_2D_all_outlier") manage_outliers(Klovan_2D_all_outlier, "P_Mg")
data("Klovan_2D_all_outlier") manage_outliers(Klovan_2D_all_outlier, "P_Mg")
Calculate the Matern model based on the given parameters.
matern_model(h, nugget, sill, range, a)
matern_model(h, nugget, sill, range, a)
h |
Distance. |
nugget |
Nugget effect. |
sill |
Sill value. |
range |
Range value. |
a |
Shape parameter. |
Computed value based on the Matern model.
Calculate the order-1 G.C. model based on the given parameters.
order_1_gc_model(h, nugget, sill, range)
order_1_gc_model(h, nugget, sill, range)
h |
Distance. |
nugget |
Nugget effect. |
sill |
Sill value. |
range |
Range value. |
Computed value based on the order-1 G.C. model.
This function generates a correlation plot, also known as a "circle" plot, which compares the loadings from one principal component (PC) against another. It visualizes the similarity among original variables and their correlation with each PC, revealing potential clusters. The function also adds annotations for understanding positive and negative values in different quadrants.
pc_cor_plot(data, PC_1, PC_2, text_col = "red")
pc_cor_plot(data, PC_1, PC_2, text_col = "red")
data |
A dataset of class data.frame. The data should contain 'C_X' and 'C_Y' columns representing the x and y coordinates of the data points and excludes any rank, ID, or column not for analysis, see README for details |
PC_1 |
A string specifying the first PC for comparison, can be chosen from "PC1" to "PC10". For example, "PC1". |
PC_2 |
A string specifying the second PC for comparison, can be chosen from "PC1" to "PC10". For example, "PC2". |
text_col |
An R color for the text labels. Defaults to "red". |
A ggplot object representing the correlation plot.
data("Klovan_Row80") pc_cor_plot(Klovan_Row80, "PC1", "PC2")
data("Klovan_Row80") pc_cor_plot(Klovan_Row80, "PC1", "PC2")
Calculate the power model based on the given parameters.
power_model(h, nugget, sill, a)
power_model(h, nugget, sill, a)
h |
Distance. |
nugget |
Nugget effect. |
sill |
Sill value. |
a |
Power parameter. |
Computed value based on the power model.
This function prints the names of the predefined model functions.
print_model_names()
print_model_names()
NULL (This function is used for printing the model names only.)
print_model_names()
print_model_names()
Calculate the quadratic exponential model based on the given parameters.
quadratic_exponential_model(h, nugget, sill, range, a)
quadratic_exponential_model(h, nugget, sill, range, a)
h |
Distance. |
nugget |
Nugget effect. |
sill |
Sill value. |
range |
Range value. |
a |
Additional parameter. |
Computed value based on the quadratic exponential model.
Normalize the data using a 'Range' transform . In the returned data table, note that in each column of the normalized Data Table, the variables will range from 0 to 1.
range_transform(data)
range_transform(data)
data |
A dataset of class data.frame. The data should contain 'C_X' and 'C_Y' columns representing the x and y coordinates of the data points and excludes any rank, ID, or column not for analysis, see README for details |
a range transformed version of a klovan dataset.
data("Klovan_Row80") T_Klovan <- range_transform(Klovan_Row80)
data("Klovan_Row80") T_Klovan <- range_transform(Klovan_Row80)
Constructs a database from a provided dataset using specified factors. For more details on the dataset format, see the package README.
Rgeo_database(data, num_fac = 3, property)
Rgeo_database(data, num_fac = 3, property)
data |
A dataset of class data.frame. The data should contain 'C_X' and 'C_Y' columns representing the x and y coordinates of the data points and excludes any rank, ID, or column not for analysis, see README for details |
num_fac |
A numeric value indicating the number of factors to analyze. Default is 3. |
property |
A string indicating which factor to build variogram from e.g. "RC1" or "RC2" |
The Rgeo_database
function constructs a db-class object from the provided
dataset using the number of factors specified by num_fac
and made for use with property
.
A db-class object containing the factors selected with num_fac
and made for use with property
.
if(requireNamespace("RGeostats", quietly = TRUE)){ library(RGeostats) data("Klovan_Row80", package = "klovan") Rgeo_database(Klovan_Row80, 3, "RC3") }
if(requireNamespace("RGeostats", quietly = TRUE)){ library(RGeostats) data("Klovan_Row80", package = "klovan") Rgeo_database(Klovan_Row80, 3, "RC3") }
Performs kriging interpolation on a provided database using 'RGeostats' methods. The data is interpolated over a grid covering the entire area of interest.
Rgeo_kriging(db, model, dx = NA, dy = NA)
Rgeo_kriging(db, model, dx = NA, dy = NA)
db |
A db-class object. Should be created using the |
model |
An S4 plottable Rgeostats omnidirectional variogram model.
Should be created using the |
dx |
Optional. The grid cell size in the x-direction. If not provided, it is calculated as the average of the ranges in x and y directions divided by 50. |
dy |
Optional. The grid cell size in the y-direction. If not provided, it is calculated as the average of the ranges in x and y directions divided by 50. |
The Rgeo_kriging()
function performs kriging interpolation based on the provided
database (db) and variogram model (model). The grid cell sizes dx
and dy
can be optionally specified or will be automatically determined based on the data.
Results can be visualized with the Rgeo_kriging_plot()
function and summary statistics
can be printed by simply calling the returned kriged object.
A S4 plottable Rgeostats kriged database. Can be plotted using the
Rgeo_kriging_plot
function. Summary statistics for the kriging process
can be printed by simply calling the returned dbgrid3 object.
if(requireNamespace("RGeostats", quietly = TRUE)){ library(RGeostats) data("Klovan_Row80", package = "klovan") db <- Rgeo_database(Klovan_Row80, 3, "RC3") model <- Rgeo_vario_model(db, 3, "RC3", lag = 500, model = 13) krig <- Rgeo_kriging(db, model) krig # prints summary statistics for kriging }
if(requireNamespace("RGeostats", quietly = TRUE)){ library(RGeostats) data("Klovan_Row80", package = "klovan") db <- Rgeo_database(Klovan_Row80, 3, "RC3") model <- Rgeo_vario_model(db, 3, "RC3", lag = 500, model = 13) krig <- Rgeo_kriging(db, model) krig # prints summary statistics for kriging }
This function creates a plot of the kriged database. The function is designed specifically for visualizing geostatistical data.
Rgeo_kriging_plot(krig_db, db, property)
Rgeo_kriging_plot(krig_db, db, property)
krig_db |
A kriged database object, resulting from the |
db |
The original database object that was used to generate the kriged database. |
property |
A character string representing the property (or column name) from the database that you want to visualize e.g. "RC1" or "RC2". |
The function takes a kriged database and the original database, then generates a comparative plot for a specific property. This helps in understanding the effect of kriging on the selected property.
A plot comparing the specified property
in the original and kriged databases.
if(requireNamespace("RGeostats", quietly = TRUE)){ library(RGeostats) data("Klovan_Row80", package = "klovan") db <- Rgeo_database(Klovan_Row80, 3, "RC3") model <- Rgeo_vario_model(db, 3, "RC3", lag = 500, model = 13) krig_db <- Rgeo_kriging(db, model) Rgeo_kriging_plot(krig_db, db, "RC3") }
if(requireNamespace("RGeostats", quietly = TRUE)){ library(RGeostats) data("Klovan_Row80", package = "klovan") db <- Rgeo_database(Klovan_Row80, 3, "RC3") model <- Rgeo_vario_model(db, 3, "RC3", lag = 500, model = 13) krig_db <- Rgeo_kriging(db, model) Rgeo_kriging_plot(krig_db, db, "RC3") }
This function constructs an Experimental Ominidirectional Variogram using 'Rgeostats'.
Rgeo_vario_construct_plot(db, num_fac, property, lag, nlag = 10)
Rgeo_vario_construct_plot(db, num_fac, property, lag, nlag = 10)
db |
The db-class containing the data information used to calculate the experimental variogram. The variograms are calculated for the set of "z*" variables present in the db. |
num_fac |
A numeric value indicating how many factors to analyze. Default is 3. |
property |
A string indicating which factor to build variogram from e.g. "RC1" or "RC2" |
lag |
Array containing the distance lags for each calculation direction. If the lag is not defined, set as NA. A default lag is calculated so that the maximum distance is equal to half of the field diagonal |
nlag |
Array containing the number of lags for each calculation direction If nlag not defined, set as NA. If the number of lags is not defined, it defaults to 10. |
a plottable Rgeostats Experimental Ominidirectional Variogram model
if(requireNamespace("RGeostats")){ library(RGeostats) data("Klovan_Row80", package = "klovan") db <- Rgeo_database(Klovan_Row80, 3, "RC3") Rgeo_vario_construct_plot(db, 3, "RC3", lag = 500) }
if(requireNamespace("RGeostats")){ library(RGeostats) data("Klovan_Row80", package = "klovan") db <- Rgeo_database(Klovan_Row80, 3, "RC3") Rgeo_vario_construct_plot(db, 3, "RC3", lag = 500) }
This function calculates an omnidirectional variogram model for a given dataset using 'RGeostats' package. The variogram model can be useful for understanding the spatial dependence structure of the data. The function also allows the user to choose the number of factors to analyze, the property to build the variogram from, and the type of model to use for the variogram.
Rgeo_vario_model(db, num_fac, property, lag, nlag = 10, model)
Rgeo_vario_model(db, num_fac, property, lag, nlag = 10, model)
db |
A db-class object. This is the dataset used to calculate the experimental variogram. The variogram is calculated for the set of "z*" variables present in the db. |
num_fac |
A numeric value indicating how many factors to analyze. This helps to limit the scope of the analysis to a specific number of factors. Default is 3. |
property |
A string indicating which factor (or property) to build the variogram from. For example, it can be "RC1" or "RC2". |
lag |
A numeric value or an array containing the distance lags for each calculation direction. If the lag is not defined, set as NA. A default lag is calculated so that the maximum distance is equal to half of the field diagonal. |
nlag |
A numeric value or an array containing the number of lags for each calculation direction. If nlag is not defined, set it as NA. If the number of lags is not defined, it defaults to 10. |
model |
A numeric value indicating what type of model to use in the variogram. This parameter corresponds to the model types provided by the RGeostats package. Run the line 'melem.name()' in RGeostats to see the number corresponding to each model. |
An object of class 'model'. This is a plottable Rgeostats omnidirectional variogram model. It can be used for further geostatistical analysis or for visualizing the spatial structure of the data.
if(requireNamespace("RGeostats")){ library(RGeostats) data("Klovan_Row80", package = "klovan") db <- Rgeo_database(Klovan_Row80, 3, "RC3") model <- Rgeo_vario_model(db, 3, "RC3", lag = 500, model = 13) }
if(requireNamespace("RGeostats")){ library(RGeostats) data("Klovan_Row80", package = "klovan") db <- Rgeo_database(Klovan_Row80, 3, "RC3") model <- Rgeo_vario_model(db, 3, "RC3", lag = 500, model = 13) }
scree plot
scree_plot( EigenPlot, bar_fill = "lightblue", outline = "darkblue", eigen_line = "red", cum_eigen_line = "blue" )
scree_plot( EigenPlot, bar_fill = "lightblue", outline = "darkblue", eigen_line = "red", cum_eigen_line = "blue" )
EigenPlot |
A dataset of class data.frame. The data should contain 'C_X' and 'C_Y' columns
representing the x and y coordinates of the data points and excludes any rank,
ID, or column not for analysis, see README for details or,
a covariance matrix that will be converted into a plottable data frame or,
a plottable data frame created by the |
bar_fill |
an R color, The fill color for the bars, defaults to "lightblue" |
outline |
an R color, the outline color of the bars, defaults to "darkblue" |
eigen_line |
an R color, the color of the eigenvalues line, defaults to "red" |
cum_eigen_line |
an R color, the color of the cummulative eigenvalues line, defaults to "blue" |
a ggplot object of the scree plot
data("Klovan_Row80") scree_plot(eigen_contribution(covar_mtrx(Klovan_Row80))) Scree1 <- scree_plot(Klovan_Row80) Scree1 your_eigen_data1 <- eigen_contribution(Klovan_Row80) scree_plot(your_eigen_data1)
data("Klovan_Row80") scree_plot(eigen_contribution(covar_mtrx(Klovan_Row80))) Scree1 <- scree_plot(Klovan_Row80) Scree1 your_eigen_data1 <- eigen_contribution(Klovan_Row80) scree_plot(your_eigen_data1)
Calculate the spherical model based on the given parameters.
spherical_model(h, nugget, sill, range)
spherical_model(h, nugget, sill, range)
h |
Distance. |
nugget |
Nugget effect. |
sill |
Sill value. |
range |
Range value. |
Computed value based on the spherical model.
Calculate the stable model based on the given parameters.
stable_model(h, nugget, sill, range, a)
stable_model(h, nugget, sill, range, a)
h |
Distance. |
nugget |
Nugget effect. |
sill |
Sill value. |
range |
Range value. |
a |
Additional parameter. |
Computed value based on the stable model.
Calculate the triangle model based on the given parameters.
triangle_model(h, nugget, sill, range)
triangle_model(h, nugget, sill, range)
h |
Distance. |
nugget |
Nugget effect. |
sill |
Sill value. |
range |
Range value. |
Computed value based on the triangle model.
This function calculates the empirical variogram for a given target factor (FAC) and plots it along with the fitted variogram based on the specified variogram model.
vario_plot( data, factor, nlags = NA, lags = NA, nugget, sill, range_val, a, model_name )
vario_plot( data, factor, nlags = NA, lags = NA, nugget, sill, range_val, a, model_name )
data |
A dataset of class data.frame. The data should contain 'C_X' and 'C_Y' columns representing the x and y coordinates of the data points and excludes any rank, ID, or column not for analysis, see README for details |
factor |
The target factor (FAC) to be used for variogram calculation and fitting. |
nlags |
The number of lag bins for variogram calculation. Default is NA, which will use Sturges' formula to determine the number of lags. |
lags |
The lag width for variogram calculation. Default is NA, which will calculate the lag width based on the range of distances. |
nugget |
The nugget effect parameter for the variogram model. |
sill |
The sill parameter for the variogram model. |
range_val |
The range parameter for the variogram model. |
a |
Additional parameter (depends on the variogram model) use NA if not needed. |
model_name |
The name of the model to use for variogram fitting.
Available options include "Sph1", "Exp1", "Gau1", "Mat1", "Pow1", "Quad1", "Card1", "Gam1", "Cau1",
"Sta1", "Ord1", "Tri1", and "Cos1". Use function |
A plot displaying the empirical variogram and the fitted variogram based on the specified model.
data(Klovan_Row80) # Plot variogram for FAC1 vario_plot(Klovan_Row80, factor = 1, nlags = 10, nugget = 0.01, sill = 2.5, range_val = 1000, a = NA, model_name = "Sph1")
data(Klovan_Row80) # Plot variogram for FAC1 vario_plot(Klovan_Row80, factor = 1, nlags = 10, nugget = 0.01, sill = 2.5, range_val = 1000, a = NA, model_name = "Sph1")