Skip to main content
edited body
Source Link
DWin
  • 7.8k
  • 23
  • 35

It only requires minimal manual computations to perform one-sided hypothesis testes concerning the regression coefficients $\beta_{i}$.

Two possible one-sided hypotheses are:

\begin{align} \mathrm{H}_{0}&:\beta_i \geq 0 \\ \tag{1} \mathrm{H}_{1}&: \beta_i < 0 \end{align}

or

\begin{align} \mathrm{H}_{0}&:\beta_i \leq 0 \\ \tag{2} \mathrm{H}_{1}&: \beta_i > 0 \end{align}

The $p$-values provided by R are for the two-sided hypotheses and are calculated as $2P(T_{d}\leq -|t|)$ where $T$ is the test statistic (i.e. the regression coefficient divided by its standard error) and $d$ are the residual degrees of freedom.

The corresponding one-sided $p$-values are $P(T_d\leq t)$ and $P(T_d\geq t)$, for the first $(1)$ and second $(2)$ one-sided hypotheses, respectively.

Here is how to calculate the one-sided $p$-values in R:

mod <- lm(Infant.Mortality~., data = swiss)
res <- summary(mod)

# For the two-sided hypotheses

2*pt(-abs(coef(res)[, 3]), mod$df)

(Intercept)   Fertility Agriculture Examination   Education    Catholic 
0.118504431 0.007335715 0.678267621 0.702498865 0.476305225 0.996338704 

# For H1: beta < 0

pt(coef(res)[, 3], mod$df, lower = TRUE)

(Intercept)   Fertility Agriculture Examination   Education    Catholic 
  0.9407478   0.9963321   0.3391338   0.6487506   0.7618474   0.5018306

# For H1: beta > 0

pt(coef(res)[, 3], mod$df, lower = FALSE)

(Intercept)   Fertility Agriculture Examination   Education    Catholic 
0.059252216 0.003667858 0.660866190 0.351249433 0.238152613 0.498169352

mod.dfmod$df extracts the residual degrees of freedom and coef(res)[, 3] extracts the test statistics.

It only requires minimal manual computations to perform one-sided hypothesis testes concerning the regression coefficients $\beta_{i}$.

Two possible one-sided hypotheses are:

\begin{align} \mathrm{H}_{0}&:\beta_i \geq 0 \\ \tag{1} \mathrm{H}_{1}&: \beta_i < 0 \end{align}

or

\begin{align} \mathrm{H}_{0}&:\beta_i \leq 0 \\ \tag{2} \mathrm{H}_{1}&: \beta_i > 0 \end{align}

The $p$-values provided by R are for the two-sided hypotheses and are calculated as $2P(T_{d}\leq -|t|)$ where $T$ is the test statistic (i.e. the regression coefficient divided by its standard error) and $d$ are the residual degrees of freedom.

The corresponding one-sided $p$-values are $P(T_d\leq t)$ and $P(T_d\geq t)$, for the first $(1)$ and second $(2)$ one-sided hypotheses, respectively.

Here is how to calculate the one-sided $p$-values in R:

mod <- lm(Infant.Mortality~., data = swiss)
res <- summary(mod)

# For the two-sided hypotheses

2*pt(-abs(coef(res)[, 3]), mod$df)

(Intercept)   Fertility Agriculture Examination   Education    Catholic 
0.118504431 0.007335715 0.678267621 0.702498865 0.476305225 0.996338704 

# For H1: beta < 0

pt(coef(res)[, 3], mod$df, lower = TRUE)

(Intercept)   Fertility Agriculture Examination   Education    Catholic 
  0.9407478   0.9963321   0.3391338   0.6487506   0.7618474   0.5018306

# For H1: beta > 0

pt(coef(res)[, 3], mod$df, lower = FALSE)

(Intercept)   Fertility Agriculture Examination   Education    Catholic 
0.059252216 0.003667858 0.660866190 0.351249433 0.238152613 0.498169352

mod.df extracts the residual degrees of freedom and coef(res)[, 3] extracts the test statistics.

It only requires minimal manual computations to perform one-sided hypothesis testes concerning the regression coefficients $\beta_{i}$.

Two possible one-sided hypotheses are:

\begin{align} \mathrm{H}_{0}&:\beta_i \geq 0 \\ \tag{1} \mathrm{H}_{1}&: \beta_i < 0 \end{align}

or

\begin{align} \mathrm{H}_{0}&:\beta_i \leq 0 \\ \tag{2} \mathrm{H}_{1}&: \beta_i > 0 \end{align}

The $p$-values provided by R are for the two-sided hypotheses and are calculated as $2P(T_{d}\leq -|t|)$ where $T$ is the test statistic (i.e. the regression coefficient divided by its standard error) and $d$ are the residual degrees of freedom.

The corresponding one-sided $p$-values are $P(T_d\leq t)$ and $P(T_d\geq t)$, for the first $(1)$ and second $(2)$ one-sided hypotheses, respectively.

Here is how to calculate the one-sided $p$-values in R:

mod <- lm(Infant.Mortality~., data = swiss)
res <- summary(mod)

# For the two-sided hypotheses

2*pt(-abs(coef(res)[, 3]), mod$df)

(Intercept)   Fertility Agriculture Examination   Education    Catholic 
0.118504431 0.007335715 0.678267621 0.702498865 0.476305225 0.996338704 

# For H1: beta < 0

pt(coef(res)[, 3], mod$df, lower = TRUE)

(Intercept)   Fertility Agriculture Examination   Education    Catholic 
  0.9407478   0.9963321   0.3391338   0.6487506   0.7618474   0.5018306

# For H1: beta > 0

pt(coef(res)[, 3], mod$df, lower = FALSE)

(Intercept)   Fertility Agriculture Examination   Education    Catholic 
0.059252216 0.003667858 0.660866190 0.351249433 0.238152613 0.498169352

mod$df extracts the residual degrees of freedom and coef(res)[, 3] extracts the test statistics.

Source Link
COOLSerdash
  • 31.2k
  • 10
  • 104
  • 157

It only requires minimal manual computations to perform one-sided hypothesis testes concerning the regression coefficients $\beta_{i}$.

Two possible one-sided hypotheses are:

\begin{align} \mathrm{H}_{0}&:\beta_i \geq 0 \\ \tag{1} \mathrm{H}_{1}&: \beta_i < 0 \end{align}

or

\begin{align} \mathrm{H}_{0}&:\beta_i \leq 0 \\ \tag{2} \mathrm{H}_{1}&: \beta_i > 0 \end{align}

The $p$-values provided by R are for the two-sided hypotheses and are calculated as $2P(T_{d}\leq -|t|)$ where $T$ is the test statistic (i.e. the regression coefficient divided by its standard error) and $d$ are the residual degrees of freedom.

The corresponding one-sided $p$-values are $P(T_d\leq t)$ and $P(T_d\geq t)$, for the first $(1)$ and second $(2)$ one-sided hypotheses, respectively.

Here is how to calculate the one-sided $p$-values in R:

mod <- lm(Infant.Mortality~., data = swiss)
res <- summary(mod)

# For the two-sided hypotheses

2*pt(-abs(coef(res)[, 3]), mod$df)

(Intercept)   Fertility Agriculture Examination   Education    Catholic 
0.118504431 0.007335715 0.678267621 0.702498865 0.476305225 0.996338704 

# For H1: beta < 0

pt(coef(res)[, 3], mod$df, lower = TRUE)

(Intercept)   Fertility Agriculture Examination   Education    Catholic 
  0.9407478   0.9963321   0.3391338   0.6487506   0.7618474   0.5018306

# For H1: beta > 0

pt(coef(res)[, 3], mod$df, lower = FALSE)

(Intercept)   Fertility Agriculture Examination   Education    Catholic 
0.059252216 0.003667858 0.660866190 0.351249433 0.238152613 0.498169352

mod.df extracts the residual degrees of freedom and coef(res)[, 3] extracts the test statistics.