HomogeneityOfRegressionSlopes.RdReturns information that can be used to determine if the homogeneity of regression slopes, an assumption for ANCOVA, is met.
HomogeneityOfRegressionSlopes( inputted.data, dependent.variable, independent.variable, covariates )
| inputted.data | A dataframe |
|---|---|
| dependent.variable | A string that specifies the column name of the column to use as the dependent variable. Column must be numeric. |
| independent.variable | A string that specifies the column name of the column to use as the independent variable. Column can be numeric or factor. If it's a factor, then it can only have two levels. |
| covariates | A vector of strings that specifies the columns names of the columns to be used as covariates. Columns can be numeric or factor. If it's a factor, then it can only have two levels. |
A matrix with two rows. The first row specify what the values are in the second row. The second row: The first element is the formula used to evaluate p-value of interaction terms. The remaining elements are the p-values for each interaction term.
To test homogeneity of regression slopes, interaction terms need to be added and the p-value should be assessed. If the p-value is significant for any interaction term, then this means the assumption of homogeneity of regression slopes is not met.
dependent.col <- c(10.1, 11.3, 12.1, 13.7, 14.2, 1.6, 2.3, 3.2, 4.1, 5.3) independent.col <- as.factor(c(1, 1, 1, 1, 1, 0, 0, 0, 0, 0)) covariate.one.col <- c(1, 2, 3, 4, 5, 1, 2, 3, 4, 5) covariate.two.col <- as.factor(c(1, 0, 1, 0, 1, 0, 1, 0, 1, 0)) inputted.data <- data.frame(dependent.col, independent.col, covariate.one.col, covariate.two.col) results <- HomogeneityOfRegressionSlopes(inputted.data, "dependent.col", "independent.col", c("covariate.one.col", "covariate.two.col")) results#> [,1] #> row1 "Interaction terms Formula (test for homogeneity of slopes)" #> row2 "dependent.col~independent.col + covariate.one.col + covariate.one.col*independent.col + covariate.two.col + covariate.two.col*independent.col" #> [,2] #> row1 "P-value independent.col:covariate.one.col" #> row2 "0.109766283989074" #> [,3] #> row1 "P-value independent.col:covariate.two.col" #> row2 "0.367854055970476"