: [pval, t, df] = t_test_regression (y, x, rr, r, alt)

Perform a t test for the null hypothesis rr * b = r in a classical normal regression model y = x * b + e.

Under the null, the test statistic t follows a t distribution with df degrees of freedom.

If r is omitted, a value of 0 is assumed.

With the optional argument string alt, the alternative of interest can be selected. If alt is "!=" or "<>", the null is tested against the two-sided alternative rr * b != r. If alt is ">", the one-sided alternative rr * b > r is used. Similarly for "<", the one-sided alternative rr * b < r is used. The default is the two-sided case.

The p-value of the test is returned in pval.

If no output argument is given, the p-value of the test is displayed.

Package: statistics