### Function Reference: `regression_ttest`

statistics: h = regression_ttest (y, x)
statistics: [h, pval] = regression_ttest (y, x)
statistics: [h, pval, ci] = regression_ttest (y, x)
statistics: [h, pval, ci, stats] = regression_ttest (y, x)
statistics: […] = regression_ttest (y, x, Name, Value)

Perform a linear regression t-test.

`h = regression_ttest (y, x)` tests the null hypothesis that the slope beta1 of a simple linear regression equals 0. The result is h = 0 if the null hypothesis cannot be rejected at the 5% significance level, or h = 1 if the null hypothesis can be rejected at the 5% level. y and x must be vectors of equal length with finite real numbers.

The p-value of the test is returned in pval. A 100(1-alpha)% confidence interval for beta1 is returned in ci. stats is a structure containing the value of the test statistic (`tstat`), the degrees of freedom (`df`), the slope coefficient (`beta1`), and the intercept (`beta0`). Under the null, the test statistic stats.`tstat` follows a T-distribution with stats.`df` degrees of freedom.

`[…] = regression_ttest (…, name, value)` specifies one or more of the following name/value pairs:

| Name | Value
--- | --- | ---
| `"alpha"` | the significance level. Default is 0.05.
| `"tail"` | a string specifying the alternative hypothesis

| `"both"` | beta1 is not 0 (two-tailed, default)
| `"left"` | beta1 is less than 0 (left-tailed)
| `"right"` | beta1 is greater than 0 (right-tailed)

See also: regression_ftest, regress, regress_gp

Source Code: regression_ttest