Skip to contents

Two methods are available: method = "pathB" and method = "simlandr". See Details section.

Usage

fit_3d_vfld(
  vf,
  method = c("simlandr", "pathB"),
  .pathB_options = pathB_options(vf),
  .sim_vf_options = sim_vf_options(vf),
  .simlandr_options = simlandr_options(vf),
  linear_interp = FALSE
)

Arguments

vf

A vectorfield object estimated by fit_2d_vf().

method

The method used for landscape construction. Can be pathB or simlandr.

.pathB_options

Only for method = "pathB". Options controlling the path-integral algorithm. Should be generated by sim_vf_options().

.sim_vf_options

Only for method = "simlandr". Options controlling the vector field simulation. Should be generated by sim_vf_options().

.simlandr_options

Only for method = "simlandr". Options controlling the landscape construction. Should be generated by simlandr_options().

linear_interp

Use linear interpolation method to estimate the drift vector (and the diffusion matrix). This can speed up the calculation. If TRUE, be sure that a linear grid was calculated for the vector field using <vf> <- add_interp_grid(<vf>).

Value

A landscape object as described in simlandr::make_3d_static(), or a 3d_static_landscape_B object, which inherits from the landscape class and contains the following elements: dist, the distribution estimation for landscapes; plot, a 3D plot using plotly; plot_2, a 2D plot using ggplot2; x, y, from vf.

Details

For method = "simlandr", the landscape is constructed based on the generalized potential landscape by Wang et al. (2008), implemented by the simlandr package. This function is a wrapper of sim_vf() and simlandr::make_3d_static(). Use those two functions separately for more customization.

For method = "pathB", the landscape is constructed based on the deterministic path-integral quasi-potential defined by Bhattacharya et al. (2011).

We recommend the simlandr method for psychological data because it is more stable.

Parallel computing based on future is supported for both methods. Use future::plan("multisession") to enable this and speed up computation.

Examples

if (FALSE) { # interactive()
# generate data
single_output_grad <- simlandr::sim_fun_grad(length = 200, seed = 1614)
# fit the vector field
v2 <- fit_2d_vf(single_output_grad, x = "x", y = "y", method = "MVKE")
plot(v2)
# fit the landscape
future::plan("multisession")
set.seed(1614)
l2 <- fit_3d_vfld(v2,
.sim_vf_options = sim_vf_options(chains = 16, stepsize = 1, forbid_overflow = TRUE),
.simlandr_options = simlandr_options(adjust = 5, Umax = 4))
plot(l2, 2)
future::plan("sequential")
}