> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-fix-nav-issues.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Aplica o teste t de Student a amostras de duas populações.

# studentTTest

<div id="studentTTest">
  ## studentTTest
</div>

Introduzido em: v21.1.0

Aplica o teste t de Student a amostras de duas populações.

Os valores de ambas as amostras estão na coluna `sample_data`. Se `sample_index` for igual a 0, o valor nessa linha pertence à amostra da primeira população. Caso contrário, pertence à amostra da segunda população.
A hipótese nula é que as médias das populações são iguais. Assume-se uma distribuição normal com variâncias iguais.

**Veja também**

* [teste t de Student](https://en.wikipedia.org/wiki/Student%27s_t-test)
* [função welchTTest](/pt-BR/reference/functions/aggregate-functions/welchTTest)

**Sintaxe**

```sql theme={null}
studentTTest([confidence_level])(sample_data, sample_index)
```

**Parâmetros**

* `confidence_level` — Opcional. Nível de confiança para calcular os intervalos de confiança. [`Float`](/pt-BR/reference/data-types/float)

**Argumentos**

* `sample_data` — Dados da amostra. [`Integer`](/pt-BR/reference/data-types/int-uint) ou [`Float`](/pt-BR/reference/data-types/float) ou [`Decimal`](/pt-BR/reference/data-types/decimal)
* `sample_index` — Índice da amostra. [`Integer`](/pt-BR/reference/data-types/int-uint)

**Valor retornado**

Retorna uma tupla com dois ou quatro elementos (se o `confidence_level` opcional for especificado): estatística t calculada, valor p calculado, \[limite inferior do intervalo de confiança calculado], \[limite superior do intervalo de confiança calculado]. [`Tuple(Float64, Float64)`](/pt-BR/reference/data-types/tuple) ou [`Tuple(Float64, Float64, Float64, Float64)`](/pt-BR/reference/data-types/tuple)

**Exemplos**

**Uso básico**

```sql title=Query theme={null}
SELECT studentTTest(sample_data, sample_index) FROM student_ttest;
```

```response title=Response theme={null}
┌─studentTTest(sample_data, sample_index)───┐
│ (-0.21739130434783777,0.8385421208415731) │
└───────────────────────────────────────────┘
```

**Veja também**

* [teste t de Student](https://en.wikipedia.org/wiki/Student%27s_t-test)
* [função welchTTest](/pt-BR/reference/functions/aggregate-functions/welchTTest)
