View source: R/oss.optSpline.R
oss.optSpline | R Documentation |
This function is a wrapper for the ea_spline function from the ithir package maintained by Brendan Malone and available on bitbucket. The wrapper allows the user to evaluate and plot equal area quadratic splines using multiple values of lambda.
oss.optSpline(
obj,
var.name,
lam = 0.1,
d = t(c(0, 5, 15, 30, 60, 100, 200)),
vlow = 0,
vhigh = 1000,
dir = getwd(),
save.plots = TRUE
)
obj |
Object of class "data.frame" |
var.name |
character; target variable name (must be a numeric variable) |
lam |
numeric; lambda the smoothing parameter |
d |
numeric; standard depths that are used to extract values from fitted spline i.e harmonising depths |
vlow |
numeric; smallest value of the target variable (smaller values will be replaced) |
vhigh |
numeric; highest value of the target variable (larger values will be replaced) |
dir |
character; location to store plots if the option is selected, defaults to current working directory |
save.plots |
logical; TRUE or FALSE, to generate plots or not |
Returns a list with five elements: harmonised data frame; are spline-estimated values of the target variable at standard depths obs.preds data frame; are observed values together with associated spline predictions for each profile at each depth. splineFitError matrix; rmse and rmseiqr between observed and predicted between observed profiles and associated fitted splines. var.1cm matrix; are spline-estimated values of the target variable using the 1 cm increments lamdf data frame; returns the optimal value of lambda for each profile
#Generate splines with various lambdas for soil profiles
data(profiles)
d=t(c(0,5,15,30,60,100))
lam=c(10, 1, 0.1, 0.01, 0.001)
oss.optSpline(obj=profiles,var.name="CEC",lam=lam,d=d,save.plots=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.