scoring: Normative Scoring

Description Usage Arguments Details Value See Also Examples

View source: R/scoring.R

Description

scoring is a dual purpose function that returns a full dataframe that has either been converted into standard scores based upon overall norms, or by age and gender specific norms (based upon the norm argument). Age and Gender are included as arguments simply to designate the names of the respective variables.

Usage

1
2
scoring(dat, scoring.table = NULL, norm = "overall", Age = NULL,
  Gender = NULL)

Arguments

dat

An R dataframe object containg the scale scores

scoring.table

An R dataframe object that provides means and standard deviations for each normative option. See example section for details.

norm

A character vector of length 1. Use "overall" for overall norms, and "agegender" for age and gender specific norms.

Age

A vector pertaining to the Age variable of length N.

Gender

A vector pertaining to the Gender variable of length N.

Details

This function requires an external R dataframe called 'scoring.table' that has the following structure: columns called SCALE (with scale names that match those in 'dat'), AGE, GENDER, MEAN, and SE. For the rows pertaining to overall norms, the AGE and GENDER values should be the character string "overall". See the example code for more details.

Value

An R dataframe object with N rows and K columns, where K is the number of scales included in dat.

See Also

scoring

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
set.seed(77)
scoring.table <- data.frame(SCALE = rep(LETTERS[1:5], 5),
                            AGE = c(rep("overall", 5),
                                    rep(c("Young", "Old"), each = 5),
                                    rep(c("Young", "Old"), each = 5)),
                            GENDER = c(rep("overall", 5), rep(c("Male", "Female"), each = 10)),
                            MEAN = rnorm(25, mean = 100, sd = 10),
                            SD = rnorm(25, mean = 10, sd = 3),
                            stringsAsFactors = FALSE)
set.seed(78)
n <- 500
dat <- data.frame(AGE = sample(c("Young","Old"), size = n, replace = TRUE),
                  GENDER = sample(c("Male","Female"), size = n, replace = TRUE),
                  A = rnorm(n, mean = 100, sd = 10),
                  B = rnorm(n, mean = 100, sd = 10),
                  C = rnorm(n, mean = 100, sd = 10),
                  D = rnorm(n, mean = 100, sd = 10),
                  E = rnorm(n, mean = 100, sd = 10))

overall <- scoring(dat[,3:7], scoring.table = scoring.table[1:5,], norm = "overall")
agegen <- scoring(dat[,3:7], scoring.table = scoring.table[6:25,], norm = "agegender",
                  Age = dat[,1], Gender = dat[,2])

## End(Not run)

mattsigal/mmisc documentation built on May 21, 2019, 1:26 p.m.