View source: R/McSweeny_Porter.r
| McSweeny_Porter | R Documentation |
Performs rank-based ANCOVA with and without an interaction term between the covariates and the group.
McSweeny_Porter(data, formula)
data |
A data frame containing the variables specified in the formula. |
formula |
An object of class "formula": a symbolic description of the model to be fitted. The structure should be 'response ~ covariate1 + ... + group'. |
A list containing the following components:
Summary of the model with only covariates.
Summary of the model with covariates and group main effects.
The result of an ANOVA test for group effect.
The result of an ANOVA test for interaction effect between group and covariate variables.
Summary of the model including the interaction term.
The original data frame with added columns for ranks.
McSweeney M, Porter AJOp. Small sample properties of nonparametric index of response and rank analysis of covariance. 1971;16.
Olejnik SF, Algina JJER. A review of nonparametric alternatives to analysis of covariance. 1985;9(1):51-83.
# 1. Create a sample data frame
data <- data.frame(
group = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3),
response = c(16, 60, 82, 126, 137, 44, 67, 87, 100, 142, 17, 28, 105, 149, 160),
covariate1 = c(26, 10, 42, 49, 55, 21, 28, 5, 12, 58, 1, 19, 41, 48, 35),
covariate2 = c(12, 21, 24, 29, 34, 17, 2, 40, 38, 36, 8, 1, 9, 28, 16)
)
# 2. Run the McSweeny and Porter method
results <- McSweeny_Porter(
formula = response ~ covariate1 + covariate2 + group,
data = data
)
# 3. View the results
print(results)
print(results$group_effect)
print(results$interaction_effect)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.