# Discriminant analysis (/docs/analyses/discriminant-analysis)



## When to use it [#when-to-use-it]

Use discriminant analysis when the outcome is a group and the predictors are numeric. For example: can recall and confidence tell lecture students from workshop students? Logistic regression answers a similar question for two groups. Discriminant analysis reports a function, group centroids, and a classification table.

## Assumptions [#assumptions]

Predictors are numeric. The groups have similar covariance. Tensr does not test that. With two groups there is one discriminant function.

## Running it in Tensr [#running-it-in-tensr]

<Steps>
  <Step>
    Analyze → Classify → Discriminant. In chat: “Discriminant analysis of method from recall and confidence.”
  </Step>

  <Step>
    Group column is the category. Columns are the numeric predictors. At least one predictor is required.
  </Step>
</Steps>

## Options [#options]

<TypeTable
  type="{
  group_column: {
    type: 'string',
    description: 'Grouping variable.',
  },
  columns: {
    type: 'string[]',
    description: 'Numeric predictors. At least one. The dispatcher also accepts feature_columns as an alias of this list.',
  },
  decimal_places: {
    type: '0–6',
    description: 'Report output. Decimal places.',
    default: '3',
  },
  apa_format: {
    type: 'boolean',
    description: 'Report output. APA-style p-values.',
    default: 'true',
  },
  include_charts: {
    type: 'boolean',
    description: 'Report output. Shared chart switch.',
    default: 'true',
  },
}"
/>

## Reading the output [#reading-the-output]

Teaching method predicted from exam score and study hours. The groups overlap, so classification should be better than chance and well short of perfect.

| Group    |    LD1 |    LD2 |
| -------- | -----: | -----: |
| Lecture  | -0.438 |  0.082 |
| Online   |  0.008 | -0.168 |
| Workshop |  0.429 |  0.087 |

| Functions   | Wilks' λ |    χ² | df | p-value |
| ----------- | -------: | ----: | -: | ------: |
| 1 through 2 |    0.876 | 12.44 |  4 |    .014 |
| 2           |    0.986 | 1.323 |  1 |    .250 |

Linear discriminant analysis of `method` using 2 predictor(s). Linear discriminant analysis of `method` using 2 predictor(s). Metrics: Classification accuracy = 44.8%; Groups = 3; Cases = 96; Chance accuracy = 33.3%.

## Reporting (APA 7) [#reporting-apa-7]

Linear discriminant analysis of `method` using 2 predictor(s). Report the estimate in the table. This procedure is not summarised by one p-value.

## Coming from SPSS [#coming-from-spss]

Analyze → Classify → Discriminant.

SPSS prints eigenvalues, Wilks’ lambda, standardized coefficients, and a classification table. Tensr prints centroids, Wilks’ lambda, the classification counts, and the coefficients.

## Related [#related]

A yes-or-no outcome with odds ratios is [logistic regression](/docs/analyses/logistic-regression). Several outcomes at once, rather than a group, is [MANOVA](/docs/analyses/manova).
