# fit_transformation_df: Fitting Bidimensional or Tridimensional Regression /... In TriDimRegression: Bayesian Statistics for 2D/3D Transformations

 fit_transformation_df R Documentation

## Fitting Bidimensional or Tridimensional Regression / Geometric Transformation Models via Two Tables.

### Description

Fits Bidimensional or Tridimensional regression / geometric transformation models using Stan engine. Two sets of coordinates are supplied via `iv` (for an independent variable) and `dv` (for the dependent one). The two tables must have the same dimensions (both N×2 or N×3).

For the 2D data, you can fit `"translation"` (2 for translation only), `"euclidean"` (4 parameters: 2 for translation, 1 for scaling, and 1 for rotation), `"affine"` (6 parameters: 2 for translation and 4 that jointly describe scaling, rotation and sheer), or `"projective"` (8 parameters: affine plus 2 additional parameters to account for projection).

For 3D data, you can fit `"translation"` (3 for translation only), `"euclidean_x"`, `"euclidean_y"`, `"euclidean_z"` (5 parameters: 3 for translation scale, 1 for rotation, and 1 for scaling), `"affine"` (12 parameters: 3 for translation and 9 to account for scaling, rotation, and sheer), and `"projective"` (15 parameters: affine plus 3 additional parameters to account for projection). transformations.

For details on transformation matrices and computation of scale and rotation parameters please see `vignette("transformation_matrices", package = "TriDimRegression")`

### Usage

``````fit_transformation_df(
iv,
dv,
transformation,
priors = NULL,
chains = 1,
cores = NULL,
...
)
``````

### Arguments

 `iv` a data frame containing independent variable, must by numeric only, N×2 or N×3. `dv` a data frame containing dependent variable, must by numeric only, N×2 or N×3. `transformation` the transformation to be used: `"translation"` (both 2D and 3D), `"euclidean"` (2D), `"euclidean_x"`, `"euclidean_y"`, `"euclidean_z"` (3D, rotation about, respectively, x, y, and z axis), `"affine"` (2D and 3D), or `"projective"` (2D and 3D). `priors` named list of parameters for prior distributions of parameters `a` (translation, normal distribution), `b` (all other parameters, normal distribution), and `sigma` (residual variance, exponential). E.g., `list("a" = c(0, 10), "b"= c(0, 1), "sigma"=1)`. Default priors are `"a" = c(0, max_absolute_difference_in_means(d, iv)) / 2)`, `"b" = c(0, max_absolute_difference_in_means(d, iv)) / 2)`, `"sigma" = 1 * sd(dv)`. `chains` Number of chains for sampling. `cores` Number of CPU cores to use for sampling. If omitted, all available cores are used. `...` Additional arguments passed to `sampling` function.

### Value

A tridim_transformation object

`fit_transformation`
``````# Geometric transformations of 2D data