Title: | Keng's Axe and Firewood |
---|---|
Description: | Miscellaneous functions and data used in Qingyao's psychological research and teaching. |
Authors: | Qingyao Zhang [aut, cre] |
Maintainer: | Qingyao Zhang <[email protected]> |
License: | CC BY 4.0 |
Version: | 2024.10.16 |
Built: | 2024-10-18 12:30:47 UTC |
Source: | CRAN |
Cut-off values of r given the sample size n.
cut_r(n)
cut_r(n)
n |
Sample size of the r. |
Given n and p, t and then r could be determined. The formula used could be found in test_r()
's documentation.
A data.frame including the cut-off values of r at the significance levels of p = 0.1, 0.05, 0.01, 0.001. r with the absolute value larger than the cut-off value is significant at the corresponding significance level.
cut_r(193)
cut_r(193)
Compute PRE and test it using the F-test.
test_PRE( fitC = NULL, fitA = NULL, n = NULL, PC = NULL, PA = NULL, SSEC = NULL, SSEA = NULL )
test_PRE( fitC = NULL, fitA = NULL, n = NULL, PC = NULL, PA = NULL, SSEC = NULL, SSEA = NULL )
fitC |
The result of |
fitA |
The result of |
n |
Sample size of the Model C or Model A. Model C and Model A must use the same sample, and hence have the same sample size. |
PC |
The number of parameters in Model C. |
PA |
The number of parameters in Model A. PA must be larger than PC. |
SSEC |
The Sum of Squared Errors of Model C. |
SSEA |
The Sum of Squared Errors of Model A. |
test_PRE()
tests the PRE
(Proportional Reduction in Error) of Model A compared with Model C. There are two ways of using test_PRE()
. The first is giving test_PRE()
fitC and fitA. The second is giving n, PC, PA, SSEC, and SSEA. The first way is more convenient, and it minimizes precision loss by omitting copying and pasting SSEC and SSEA. Please refer to Judd et al. (2017) for more details about PRE.
A data.frame including SSEC, SSEA, PRE, F, df1, df2, and p.
Judd, C. M., McClelland, G. H., & Ryan, C. S. (2017). Data analysis: A model comparison approach to regression, ANOVA, and beyond. Routledge.
x <- rnorm(193) y <- 0.3 + 0.2*x + rnorm(193) dat <- data.frame(y, x) fitC <- lm(y ~ 1, dat) fitA <- lm(y ~ x, dat) test_PRE(fitC, fitA)
x <- rnorm(193) y <- 0.3 + 0.2*x + rnorm(193) dat <- data.frame(y, x) fitC <- lm(y ~ 1, dat) fitA <- lm(y ~ x, dat) test_PRE(fitC, fitA)
Test r using the t-test given r and n.
test_r(r, n)
test_r(r, n)
r |
Pearson correlation. |
n |
Sample size of r. |
To test the significance of the r using one-sample t-test, the SE of the r is determined by the following formula: SE = sqrt((1 - r^2)/(n - 2))
.
A data.frame including r, se of r, t, and p.
test_r(0.2, 193)
test_r(0.2, 193)