characterize_gaussian_fits: Characterize the orientation of fitted 2D Gaussians

Description Usage Arguments Details Value Author(s) References Examples

View source: R/characterize_gaussian_fits.R

Description

The orientation and partial correlations of Gaussian data are analyzed according to Levitt et al. 1994 and Priebe et al. 2003. Features include computation of partial correlations between response variables and independent and diagonally-tuned predictions, along with Z-difference scoring.

Usage

1
2
3
4
5
6
characterize_gaussian_fits(
  fit_objects_list = NULL,
  data = NULL,
  constrain_amplitude = FALSE,
  ...
)

Arguments

fit_objects_list

A list of outputs from fit_gaussian_2D(). See Details for more. This is the preferred input object for this function.

data

A data.frame that contains the raw data (generally rectilinearly gridded data, but this is not a strict requirement). Columns must be named "X_values", "Y_values" and "response". See fit_gaussian_2D() for details.

constrain_amplitude

Default FALSE; should the amplitude of the Gaussian be set to the maximum value of the "response" variable (TRUE), or should the amplitude fitted by stats::nls() (FALSE)? See fit_gaussian_2D() for details.

...

Additional arguments that can be passed to fit_gaussian_2D() if data are supplied.

Details

This function accepts either a list of objects output from fit_gaussian_2D() (preferred) or a data.frame that contains the raw data.

The supplied fit_objects_list must be a list that contains objects returned by fit_gaussian_2D(). This list must contain exactly three models. All three models must have been run using method = "elliptical_log". The models must be: 1) one in which orientation is unconstrained, 2) one in which orientation is constrained to Q = 0 (i.e. a diagonally-oriented Gaussian), and 3) one in which orientation is constrained to Q = -1 (i.e. a horizontally-oriented Gaussian). See this function's Examples for guidance.

Should raw data be provided instead of the fit_objects_list, the characterize_gaussian_fits() runs fit_gaussian_2D() internally. This is generally not recommended, as difficulties in fitting models via stats::nls() are more easily troubleshot by the optional arguments in fit_gaussian_2D(). Nevertheless, supplying raw data instead of a list of fitted models is feasible, though your mileage may vary.

Value

A list with the following:

Author(s)

Vikram B. Baliga

References

Levitt JB, Kiper DC, Movshon JA. Receptive fields and functional architecture of macaque V2. J Neurophysiol. 1994 71:2517–2542.

Priebe NJ, Cassanello CR, Lisberger SG. The neural representation of speed in macaque area MT/V5. J Neurosci. 2003 Jul 2;23(13):5650-61. doi: 10.1523/JNEUROSCI.23-13-05650.2003.

Winship IR, Crowder N, Wylie DRW. Quantitative reassessment of speed tuning in the accessory optic system and pretectum of pigeons. J Neurophysiol. 2006 95(1):546-551. doi: 10.1152/jn.00921.2005

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
if (interactive()) {
  library(gaussplotR)

  ## Load the sample data set
  data(gaussplot_sample_data)

  ## The raw data we'd like to use are in columns 1:3
  samp_dat <-
    gaussplot_sample_data[,1:3]

  ## Fit the three required models
  gauss_fit_uncn <-
    fit_gaussian_2D(
      samp_dat,
      method = "elliptical_log",
      constrain_amplitude = FALSE,
      constrain_orientation = "unconstrained"
    )

  gauss_fit_diag <-
    fit_gaussian_2D(
      samp_dat,
      method = "elliptical_log",
      constrain_amplitude = FALSE,
      constrain_orientation = 0
    )

  gauss_fit_indp <-
    fit_gaussian_2D(
      samp_dat,
      method = "elliptical_log",
      constrain_amplitude = FALSE,
      constrain_orientation = -1
    )

  ## Combine the outputs into a list
  models_list <-
    list(
      gauss_fit_uncn,
      gauss_fit_diag,
      gauss_fit_indp
    )

  ## Now characterize
  out <-
    characterize_gaussian_fits(models_list)
  out

  ## Alternatively, the raw data itself can be supplied.
  ## This is less preferred, as fitting of models may fail
  ## internally.
  out2 <-
    characterize_gaussian_fits(data = samp_dat)

  ## This produces the same output, assuming models are fit without error
  identical(out, out2)
}

gaussplotR documentation built on Jan. 13, 2021, 3:55 p.m.