Gapfill_ann | R Documentation |
This function automatically gap-fills the missing data points (marked as "NA") in the flux dataset using artificial neural networks (ANN) that take up to three variables as inputs. The ANN algorithms are based on the package 'neuralnet'.
Gapfill_ann( data, Flux = "Flux", var1, var2 = NULL, var3 = NULL, win = 5, interval = 10, threshold = 1, hidden = 2, fail = "ave", ... )
data |
a data frame that includes the flux (with NA indicating the missing data) and independent variables |
Flux |
a string indicates the column name for the flux variable to be gap-filled |
var1 |
a string indicates the column name for the first variable |
var2 |
a string indicates the column name for the second variable, default: NULL |
var3 |
a string indicates the column name for the third variable, default: NULL |
win |
a number indicates the required sampling window length around each gap (total number in two sides), unit: days (default: 5) |
interval |
a number indicates the temporal resolution of the measurements in the dataset, unit: minutes (default: 10) |
threshold |
a number specifies the threshold for the partial derivatives of the error function as stopping criteria for the ANN model (default: 1) |
hidden |
a vector of integers specifies the number of hidden neurons (vertices) in each layer in the ANN model (default: c(2), i.e. one layer with 2 neurons) |
fail |
a string or a number indicates what to do when model fails to converge: 1. use the mean value in the sampling window to fill the gap ("ave", default), or 2. use any value assigned here to fill the gap (e.g., 9999, NA, etc.) |
... |
other arguments pass to 'neuralnet' |
A data frame that includes the original data, gap-filled data ("filled") and a "mark" column that indicates the value in each row of the "filled" is either: 0. original, 1. gap-filled, or 2. failed to converge
# read example data df <- read.csv(file = system.file("extdata", "Soil_resp_example.csv", package = "FluxGapsR"),header = T) df_filled <- Gapfill_ann(data = df,var1 = "Ts",var2 = "Ta",var3 = "Moist") # visualize the gapfilled results plot(df_filled$filled,col="red") points(df_filled$Flux)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.