Skip to content

Commit

Permalink
Merge branch 'WA-variance'
Browse files Browse the repository at this point in the history
  • Loading branch information
jarioksa committed Nov 5, 2024
2 parents 0efd48f + 586d681 commit 1f8629c
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions R/wascores.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,26 @@
`print.wascores` <-
function(x, ...)
{
cat("\nWeighted Averages\n")
cat("Call:", deparse(attr(x, "call")), "\n\n")
cat(nrow(x$wa), "weighted averages and their standard deviations for",
ncol(x$wa), "variables \n\n")
invisible(x)
if (!is.null(x$stdev)) { # should be always TRUE with class "wascores"
if (ncol(x$wa) == 1) {
out <- do.call("cbind", x)
colnames(out) <- c("WA", "SD", "N2")
print(out)
} else { # more than one x-variate
print(x$wa)
cat("\nUse scores() to see stdev (or derived statistics) and N2\n\n")
}
}
}

`scores.wascores` <-
function(x, display = c("wa", "stdev", "var", "se", "n2", "raw"), ...)
{
display <- tolower(display)
display <- match.arg(display)
## Calculation of CI via t-value is currently disabled (although
## there is an entry in switch). If it is ever enabled in similar
## way, p-value should be lifted to function arguments.
## way, p-value should be lifted to function arguments and "ci" in display.
p <- 0.95
if(display == "ci")
tval <- qt((1 - p)/2, x$N2, lower.tail = FALSE)
Expand Down

0 comments on commit 1f8629c

Please sign in to comment.