help scores
-------------------------------------------------------------------------------

Title

scores - create scores of variables (depending on user specified number of > missings)

Syntax

scores newvar = fcn(varlist) [if] [in] [, options]

where the syntax of fcn is

fcn description ------------------------------------------------------------------------- min minima of varlist max maxima of varlist total total (sum) scores of varlist sd standard deviations of varlist mean mean scores of varlist

options Description ------------------------------------------------------------------------- Main minvalid(#) minimum number of variables with valid values; default is (1) score(argument) transformation of mean scores according to argument minval(#) theoretically lowest value of scale items; default is (0) maxval(#) theoretically highest value of scale items; default is (0) auto determine range of values of scale items automatically replace replace existing variable by newvar

Sub (arguments of score()) z z-score transformation of mean scores centered centering of mean scores at the overall mean pomp transformation of mean scores to POMP scores -------------------------------------------------------------------------

Description

Using row functions of [D] egen, -scores- calculates scores according to fcn using variables listed in (varlist) and assigns them to the new variable newvar. If the number of valid values of (varlist) is less than minvalid(#) the resulting score will be set to missing.

If fcn is mean the score(argument) can be used to request a transformation of the scores to z-scores, to scores centered at the overall mean, or to POMP (= percent of maximum possible) scores with 0 and 100 as minimum and maximum possible values (see: Cohen, P., Cohen, J., Aiken, L.S. & West, S.G. (1999). The problem of units and the circumstance for POMP. Multivariate Behavioral Research, 34, 315-346). The latter requires to specify the minimum and maximum possible values of the items listed in varlist by using the options minval(#) and maxval(#). Alternatively, if all items listed in varlist have value labels defining the same range of values, the minimum and maximum possible values can be determined automatically by using the option auto.

If newvar exists already you can use the option replace to replace it by the new variable generated.

Options

+------+ ----+ Main +-------------------------------------------------------------

minvalid(#) specifies how many values must be valid for calculating a score. If the number of valid values is less than # the resulting score will be set to missing.

score(argument) requests a transformation of the scores. This will only work if mean scores have been requested by mean(varlist). Three transformations are possible according to (argument) (see below).

minval(#) specifies the theoretical minimum value of the items (# = lowest value possible) (only useful if POMP scores have been requested by score(pomp)).

maxval(#) specifies the theoretical maximum value of the items (# = highest value possible) (only useful if POMP scores have been requested by score(pomp)).

auto requests to determine the range of values of the items (lowest and highest possible values) automatically. auto requires that all items listed in varlist have values labels defining the same range of values. This option overrides values specified using minval(#) and maxval(#) (only useful if POMP scores have been requested by score(pomp)).

replace requests that newvar will replace an already existing variable (if it exists).

+--------------------+ ----+ Sub (option score) +-----------------------------------------------

score(z) requests a transformation of the mean scores to z-scores (resulting mean = 0, sd = 1)

score(centered) requests to center the mean scores at the overall mean (resulting mean = 0)

score(pomp) requests to transform the scores to POMP (percent of maximum possible) scores with 0 and 100 as minimum and maximum possible values. Note that score(pomp) requires to specify the minimum and maximum possible values of the items listed in (varlist) by using the options minval(#) and maxval(#), as well.

Examples

The following data set allows to show how -scores- creates scores depending on the number of missing values defined by the user:

. clear all . input v1-v5

v1 v2 v3 v4 v5 1. 1 2 3 4 5 2. 1 2 3 4 . 3. 1 2 3 . . 4. 1 . 3 4 . 5. 1 2 . . . 6. 1 . . . . 7. . . . . . 8. end

Generate variable test containing the minima of the four variables v1, v3, v4, and v5 (per default the value of test is valid if at least one variable of varlist has a valid value):

. scores test=min(v1 v3-v5) (1 missing value generated) (0 real changes made)

. list

+-------------------------------+ | v1 v2 v3 v4 v5 test | |-------------------------------| 1. | 1 2 3 4 5 1 | 2. | 1 2 3 4 . 1 | 3. | 1 2 3 . . 1 | 4. | 1 . 3 4 . 1 | 5. | 1 2 . . . 1 | |-------------------------------| 6. | 1 . . . . 1 | 7. | . . . . . . | +-------------------------------+

Replace variable test by test containing the minima of variables v1, v3, v4, and v5. Specify minvalid(3) so that test has valid values only if least three values of the four variables of varlist are valid (or equivalently: at most 4-3=1 value may be missing):

. scores test=min(v1 v3-v5), nv(3) replace (1 missing value generated) (3 real changes made, 3 to missing)

. list

+-------------------------------+ | v1 v2 v3 v4 v5 test | |-------------------------------| 1. | 1 2 3 4 5 1 | 2. | 1 2 3 4 . 1 | 3. | 1 2 3 . . . | 4. | 1 . 3 4 . 1 | 5. | 1 2 . . . . | |-------------------------------| 6. | 1 . . . . . | 7. | . . . . . . | +-------------------------------+

Same as above but using the maxima instead of the minima:

. scores test=max(v1 v3-v5), nv(3) replace (1 missing value generated) (3 real changes made, 3 to missing)

. list

+-------------------------------+ | v1 v2 v3 v4 v5 test | |-------------------------------| 1. | 1 2 3 4 5 5 | 2. | 1 2 3 4 . 4 | 3. | 1 2 3 . . . | 4. | 1 . 3 4 . 4 | 5. | 1 2 . . . . | |-------------------------------| 6. | 1 . . . . . | 7. | . . . . . . | +-------------------------------+

Same as above but creating the total (sum) scores instead of the maxima:

. scores test=total(v1 v3-v5), nv(3) replace (4 real changes made, 4 to missing)

. list

+-------------------------------+ | v1 v2 v3 v4 v5 test | |-------------------------------| 1. | 1 2 3 4 5 13 | 2. | 1 2 3 4 . 8 | 3. | 1 2 3 . . . | 4. | 1 . 3 4 . 8 | 5. | 1 2 . . . . | |-------------------------------| 6. | 1 . . . . . | 7. | . . . . . . | +-------------------------------+

Same as above but creating the standard deviations (sd) instead of total scores:

. scores test=sd(v1 v3-v5), nv(3) replace (3 missing values generated) (1 real change made, 1 to missing)

. list

+------------------------------------+ | v1 v2 v3 v4 v5 test | |------------------------------------| 1. | 1 2 3 4 5 1.7078251 | 2. | 1 2 3 4 . 1.5275252 | 3. | 1 2 3 . . . | 4. | 1 . 3 4 . 1.5275252 | 5. | 1 2 . . . . | |------------------------------------| 6. | 1 . . . . . | 7. | . . . . . . | +------------------------------------+

Same as above but creating mean scores instead of the standard deviations:

. scores test=mean(v1 v3-v5), nv(3) replace (1 missing value generated) (3 real changes made, 3 to missing)

. list

+------------------------------------+ | v1 v2 v3 v4 v5 test | |------------------------------------| 1. | 1 2 3 4 5 3.25 | 2. | 1 2 3 4 . 2.6666667 | 3. | 1 2 3 . . . | 4. | 1 . 3 4 . 2.6666667 | 5. | 1 2 . . . . | |------------------------------------| 6. | 1 . . . . . | 7. | . . . . . . | +------------------------------------+

Same as above but creating mean scores centered around the overall mean:

. scores test=mean(v1 v3-v5), nv(3) sc(c) replace (1 missing value generated) (3 real changes made, 3 to missing)

. list

+-------------------------------------+ | v1 v2 v3 v4 v5 test | |-------------------------------------| 1. | 1 2 3 4 5 .38888889 | 2. | 1 2 3 4 . -.19444444 | 3. | 1 2 3 . . . | 4. | 1 . 3 4 . -.19444444 | 5. | 1 2 . . . . | |-------------------------------------| 6. | 1 . . . . . | 7. | . . . . . . | +-------------------------------------+

Same as above but creating z-scores instead of centered mean scores:

. scores test=mean(v1 v3-v5), nv(3) sc(z) replace (1 missing value generated) (3 real changes made, 3 to missing)

. list

+-------------------------------------+ | v1 v2 v3 v4 v5 test | |-------------------------------------| 1. | 1 2 3 4 5 1.1547005 | 2. | 1 2 3 4 . -.57735027 | 3. | 1 2 3 . . . | 4. | 1 . 3 4 . -.57735027 | 5. | 1 2 . . . . | |-------------------------------------| 6. | 1 . . . . . | 7. | . . . . . . | +-------------------------------------+

Same as above but instead of z-scores transforming the mean scores to POMP scores assuming Likert scale items with anchors ranging from 1 (minimum possible value) to 5 (maximum possible value):

. scores test=mean(v1 v3-v5), nv(3) sc(p) min(1) max(5) replace (1 missing value generated) (3 real changes made, 3 to missing)

. list

+------------------------------------+ | v1 v2 v3 v4 v5 test | |------------------------------------| 1. | 1 2 3 4 5 56.25 | 2. | 1 2 3 4 . 41.666667 | 3. | 1 2 3 . . . | 4. | 1 . 3 4 . 41.666667 | 5. | 1 2 . . . . | |------------------------------------| 6. | 1 . . . . . | 7. | . . . . . . | +------------------------------------+

Acknowledgements

Thanks to Kit Baum for helpful advice!

Author

Dirk Enzmann http://www2.jura.uni-hamburg.de/instkrim/kriminologie/Mitarbeiter/Enzmann/E > nzmann.html dirk.enzmann@uni-hamburg.de