Description Usage Arguments Details Value Examples
ANCOVA computation is performed multiple ways with p-value of the variables captured. The covariate corrected data is also captured.
1 2 3 4 5 6 | ANCOVAWithFormattedOutput(
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. |
ANCOVA computation is performed 3 ways:
Using independent variable and all covariates.
Using independent variable and only covariates with p-value <0.05 as determined by method 1.
Using independent variable and/or covariates only if they are selected by AIC.
A list with two objects.
The first object is a matrix with two rows. The first row specifies what the values are in the second row. The second row: The first element is the formula used to evaluate ANCOVA with all covariates. The elements that are between this formula and the next formula are the p-values for each variable. The element that comes next is the formula that only includes significant covariates along with the independent variable. The elements that are between this formula and the next formula are the p-values for each variable after doing ANCOVA with only variables with coefficient that have p-value <0.05. The element that comes next is the formula that only includes significant covariates (determined by AIC), and independent variable is only included if it's determined to be significant by AIC. The following elements are the p-values for the variables after doing ANCOVA with only the variables determined to be significant by AIC.
The second object is a vector containing the dependent variable values corrected for covariates determined to be significant by AIC. Example: For a sample with a specified gender and age, if you want to get the predicted value from the observed value after adjusting for gender and age, then thus this formula: PredictedVal = ObservedVal - GlobalMean - (GenderCoefficient * gender) - (AgeCoefficient * age)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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 <- ANCOVAWithFormattedOutput(inputted.data, "dependent.col",
"independent.col",
c("covariate.one.col", "covariate.two.col"))
table <- results[[1]]
ancova.corrected.values <- results[[2]]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.