partialcor.table {petersenlab} | R Documentation |
Partial Correlation Matrix.
Description
Function that creates a partial correlation matrix similar to SPSS output.
Usage
partialcor.table(
x,
y,
z = NULL,
type = "none",
dig = 2,
correlation = "pearson"
)
Arguments
x |
Variable or set of variables in the form of a vector or dataframe
to correlate with |
y |
(optional) Variable or set of variables in the form of a vector or
dataframe to correlate with |
z |
Covariate(s) to partial out from association. |
type |
Type of correlation matrix to print. One of:
|
dig |
Number of decimals to print. |
correlation |
Method for calculating the association. One of:
|
Details
Co-created by Angela Staples (astaples@emich.edu) and Isaac Petersen (isaac-t-petersen@uiowa.edu). Creates a partial correlation matrix, controlling for one or more covariates. For a standard correlation matrix, see cor.table.
Value
A partial correlation matrix.
See Also
Other correlations:
addText()
,
cor.table()
,
crossTimeCorrelation()
,
crossTimeCorrelationDF()
,
vwReg()
Examples
# Prepare Data
data("mtcars")
#Correlation Matrix
partialcor.table(mtcars[,c("mpg","cyl","disp")], z = mtcars$hp)
partialcor.table(mtcars[,c("mpg","cyl","disp")], z = mtcars[,c("hp","wt")])
partialcor.table(mtcars[,c("mpg","cyl","disp")], z = mtcars[,c("hp","wt")],
dig = 3)
partialcor.table(mtcars[,c("mpg","cyl","disp")], z = mtcars[,c("hp","wt")],
dig = 3, correlation = "spearman")
partialcor.table(mtcars[,c("mpg","cyl","disp")], z = mtcars[,c("hp","wt")],
type = "manuscript", dig = 3)
partialcor.table(mtcars[,c("mpg","cyl","disp")], z = mtcars[,c("hp","wt")],
type = "manuscriptBig")
table1 <- partialcor.table(mtcars[,c("mpg","cyl","disp")],
z = mtcars[,c("hp","wt")], type = "latex")
table2 <- partialcor.table(mtcars[,c("mpg","cyl","disp")],
z = mtcars[,c("hp","wt")], type = "latexSPSS")
table3 <- partialcor.table(mtcars[,c("mpg","cyl","disp")],
z = mtcars[,c("hp","wt")], type = "manuscriptLatex")
table4 <- partialcor.table(mtcars[,c("mpg","cyl","disp")],
z = mtcars[,c("hp","wt")], type = "manuscriptBigLatex")
partialcor.table(mtcars[,c("mpg","cyl","disp")], mtcars[,c("drat","qsec")],
mtcars[,c("hp","wt")])
partialcor.table(mtcars[,c("mpg","cyl","disp")], mtcars[,c("drat","qsec")],
mtcars[,c("hp","wt")], type = "manuscript", dig = 3)