# Hyper Fit

Site Paper Reference: Robotham & Obreschkow (2015)

### Methods

Below are the available methods for Algorithm types
**optim,**
**LA**
and
**LD.**

#### Optim :

#### LaplaceApproximation (LA) :

#### LaplacesDemon (LD) :

### About

Hyper Fit is an R package for fitting multi-dimensional data with a hyperplane available at github.com/asgr/hyper.fit. The hyper.fit package has a top level line fitting function that uses downhill searches (optim/LaplaceApproximation) or MCMC (LaplacesDemon) to search out the best fitting parameters for a hyperplane (minimum a 1D line for 2D data), including the intrinsic scatter as part of the fit. See the
**Hyper Fit Paper**
and
**Hyper Fit Manual**
tabs for more information about Hyper Fit.

### Credit

If you use this website for your work please credit and/or cite Robotham & Obreschkow (2015)

### Usage

Specify data first by using Example Data or Uploaded Data. Change the fitting parameters under Fit Options and click Recalculate to produce a different fit. The appearance of the plot can be changed under Plot Options.

**Example Data**

Example data can be used by clicking an example under
**Example Data.**
Once an example is clicked, the example data will be used in all future calculations.

**Upload Data**

Data may be uploaded under the
**Upload Data**
section.
The file format accepted has a header with quoted column names (which can be any user defined name), and with the values separated by a separator in the set [ , tab space | ; : ].
Once the data is uploaded, it can be used in all future calculations by pressing the
Use
button.

When a file is selected with
Choose File
, the column names may be set by clicking
**Column Names.**
It is recommended that the column names be set for an uploaded file before the file is used.

Uploaded data cannot have more than 2,000 row entries for the web version of Hyper Fit. Please use the standalone hyper.fit package available at github.com/asgr/hyper.fit instead for large datasets. The uploaded data may either be 2D or 3D data, and below are some rules and examples of the 2D and 3D data:

Required, Ignore, Optional.

2D | 3D |
---|---|

x | x |

y | y |

z | z |

sx | sx |

sy | sy |

sz | sz |

corxy | corxy |

corxz | corxz |

coryz | coryz |

weights | weights |

Example of 2D data (space-separated)

"x" "y" "sx" "sy" "corxy" "weights" 0.2695 0.0724 0.065 0.03 0.85 1.0 0.1615 0.0147 0.065 0.03 0.85 1.0 -0.0865 -0.151 0.065 0.03 0.85 1.0 0.8808 0.5284 0.065 0.03 0.85 1.5 -0.8177 -0.9546 0.065 0.03 0.85 1.5 0.4069 0.0901 0.065 0.03 0.85 1.0 0.4118 0.242 0.065 0.03 0.85 1.0 0.4425 -0.0621 0.065 0.03 0.85 1.0

Example of 3D data (CSV)

"x","y","z","sx","sy","sz","corxy","corxz","coryz" 0.2695,0.0724,0.0394,0.065,0.03,0.02,0.85,0,0 0.1615,0.0147,0.0529,0.065,0.03,0.02,0.85,0,0 -0.0865,-0.151,0.0224,0.065,0.03,0.02,0.85,0,0 0.8808,0.5284,0.1042,0.065,0.03,0.02,0.85,0,0 -0.8177,-0.9546,0,0.065,0.03,0.02,0.85,0,0 0.4069,0.0901,0.0191,0.065,0.03,0.02,0.85,0,0 0.4118,0.242,0.0292,0.065,0.03,0.02,0.85,0,0 0.4425,-0.0621,0.1424,0.065,0.03,0.02,0.85,0,0

**Fit Options**

Under
**Fit Options,**
the following parameters can be specified for the fit calculation. The names in
(grey)
represent the parameter names for the hyper.fit function.

**Coordinate Type**

(coord.type)

This specifies whether the fit should be done in terms of the normal vector to the hyperplane (coord.type="normvec") gradients defined to produce values along the vert.axis dimension (coord.type="alpha") or by the values of the angles that form the gradients (coord.type="theta"). "theta" is the default since it will tend to produce a more numerically stable fit since changes in one angle will not impact the others as much as a change in the unit vector components.

**Scatter Type**

(scat.type)

This specifies whether the intrinsic scatter should be defined orthogonal to the plane (orth) or along the vert.axis of interest (vert.axis).

**Error Scale**

(doerrorscale)

If FALSE then the provided covariance are treated as it. If TRUE then the likelihood function is also allowed to rescale all errors by a uniform multiplicative value.

**Max Iterations**

(itermax)

The maximum iterations to use for either the LaplaceApproximation function or LaplacesDemon function (LA and LD only). This is limited to a maximum of 20,000 iterations for the web version of Hyper Fit. Please use the standalone hyper.fit package available at github.com/asgr/hyper.fit instead for analysis requiring more iterations (this should be apparent from the diagnostic Coda trace plots when using LD methods).

**Algorithm**

(algo.func)

If algo.func="optim" (default) hyper.fit will optimise using the R base optim function. If algo.func="LA" will optimise using the LaplaceApproximation function. If algo.func="LD" will optimise using the LaplacesDemon function. For both algo.func="LA" and algo.func="LD" the LaplacesDemon package will be used (see http://www.bayesian-inference.com/software).

**Method**

(algo.method)

Specifies the "method" argument of optim function when using algo.func="optim" (if not specified hyper.fit will use "Nelder-Mead" for optim). Specifies "Method" argument of LaplaceApproximation function when using algo.func="LA" (if not specified hyper.fit will use "NM" for LaplaceApproximation). Specifies "Algorithm" argument of LaplacesDemon function when using algo.func="LD" (if not specified hyper.fit will use "CHARM" for LaplacesDemon). When using algo.func="LD" the user can also specify further options via the Specs argument below.

**Specs**

(Specs)

Inputs to pass to the LaplacesDemon function. Default Specs=list(alpha.star = 0.44) option is for the default CHARM algorithm (see algo.method above). Specs can be set to NULL, but not all methods will accept this. (LD only)

**Plot Options**

Under
**Plot Options,**
the following parameters can change the appearance of the plot. The names in
(grey)
represent the parameter names for the plot.hyper.fit function.

**Sigma Scale**

(sigscale)

Changes the colour range of the points.

**Transparency**

(trans)

Sets the alpha of the points.

**Ellipses**

(doellipse)

If set to TRUE, points will be displayed as ellipses. If FALSE, points are displayed as dots. Using ellipses may reduce the performance of the program.

**Sig Figs**

The number of significant figures to show in the main output.

**Use Bar**

(dobar)

If set to TRUE, a bar depicting the SigScale will appear on the plot. (2D only)

**Bar Position**

(position)

Sets the position of the SigScale bar on the plot. Use Bar must be set to TRUE to enable this option. (2D only)

#### Acknowledgements

This website was written in the programming language
**R**
by
**Aaron Robotham**
and
**Joseph Dunne**
with help from
**Mark Boulton.**
It uses the library
**Shiny**
to provide the interface.