composite: Composite

Description Usage Arguments Details Value Author(s) Examples

Description

Returns a mean composite for each observation (row) in the set

Usage

1
composite(set, R = NULL, Zitems = FALSE, maxScore = NULL, rel=FALSE, nomiss = 0.8, tr = 0)

Arguments

set

A matrix or data.frame of the scores in the columns to be averaged

R

A numeric vector specifying the columns in set that should be reverse scored prior to averaging.

Zitems

A logical indicating whether the items should be standardized (Z-scored) before creating a composite. This is probably most useful when items have been measured on different scales.

maxScore

A numeric element indicating the maximum possible score on each scale. If R = NULL then this is not needed. If not provided, composite will try to find the maximum possible score on its own.

rel

A logical indicating whether the reliability information (alpha, avg r, etc.) for the composite should be printed (not returned however).

nomiss

A numeric vector specifying the proporiton of valid cases in set (i.e. data that must not be NA) for the mean to be returned

tr

Amount of trimming to be done before calculating the mean

Details

This function is used to create a unit-weighted composite of the variables listed in the columns of the matrix or data.frame "set" for each row. The nomiss option lets one specify the proportion of valid cases required for the composite mean to be computed. By default, the mean is computed if at least 80 precent of the data in the the row are valid, the mean results otherwise NA results.

Value

Returns a list of composite scores corresponding to each row of 'set'

Author(s)

Ryne A. Sherman

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
data(RSPdata)
names(RSPdata)
# Forming a composite:
  # We will form a composite extraversion variable using BFI scores.
    # First put the variables into one data.frame
ext.vars <- data.frame(RSPdata$sBFI1, RSPdata$sBFI6, RSPdata$sBFI11,
	RSPdata$sBFI16, RSPdata$sBFI21, RSPdata$sBFI26, RSPdata$sBFI31, RSPdata$sBFI36)
head(ext.vars) # Looks good
    # Three items need to be reverse scored
ext.comp <- composite(ext.vars, R = c(2,5,7), rel = TRUE)
ext.comp
    # Let's say we want to include the CAQ item "04 - Is a talkative Individual" in our
    # extraversion composite. But is is measured on a 1 to 9 scale while the BFI variables
    # are measured on a 1 to 5 scale. We should set Zitems=TRUE to Z-score all of the
    # items before compositing.
ext.comp2 <- composite(data.frame(ext.vars, RSPdata$sCAQ004), 
	R = c(2,5,7), rel= TRUE, Zitems = TRUE)
describe(ext.comp2) # mean is zero
  

Example output

Loading required package: psych
Loading required package: abind
Loading required package: foreach
  [1] "SID"        "ssex"       "sBFI1"      "sBFI2"      "sBFI3"     
  [6] "sBFI4"      "sBFI5"      "sBFI6"      "sBFI7"      "sBFI8"     
 [11] "sBFI9"      "sBFI10"     "sBFI11"     "sBFI12"     "sBFI13"    
 [16] "sBFI14"     "sBFI15"     "sBFI16"     "sBFI17"     "sBFI18"    
 [21] "sBFI19"     "sBFI20"     "sBFI21"     "sBFI22"     "sBFI23"    
 [26] "sBFI24"     "sBFI25"     "sBFI26"     "sBFI27"     "sBFI28"    
 [31] "sBFI29"     "sBFI30"     "sBFI31"     "sBFI32"     "sBFI33"    
 [36] "sBFI34"     "sBFI35"     "sBFI36"     "sBFI37"     "sBFI38"    
 [41] "sBFI39"     "sBFI40"     "sBFI41"     "sBFI42"     "sBFI43"    
 [46] "sBFI44"     "sEXT"       "sAGR"       "sCON"       "sNEUR"     
 [51] "sOPEN"      "sCAQ001"    "sCAQ002"    "sCAQ003"    "sCAQ004"   
 [56] "sCAQ005"    "sCAQ006"    "sCAQ007"    "sCAQ008"    "sCAQ009"   
 [61] "sCAQ010"    "sCAQ011"    "sCAQ012"    "sCAQ013"    "sCAQ014"   
 [66] "sCAQ015"    "sCAQ016"    "sCAQ017"    "sCAQ018"    "sCAQ019"   
 [71] "sCAQ020"    "sCAQ021"    "sCAQ022"    "sCAQ023"    "sCAQ024"   
 [76] "sCAQ025"    "sCAQ026"    "sCAQ027"    "sCAQ028"    "sCAQ029"   
 [81] "sCAQ030"    "sCAQ031"    "sCAQ032"    "sCAQ033"    "sCAQ034"   
 [86] "sCAQ035"    "sCAQ036"    "sCAQ037"    "sCAQ038"    "sCAQ039"   
 [91] "sCAQ040"    "sCAQ041"    "sCAQ042"    "sCAQ043"    "sCAQ044"   
 [96] "sCAQ045"    "sCAQ046"    "sCAQ047"    "sCAQ048"    "sCAQ049"   
[101] "sCAQ050"    "sCAQ051"    "sCAQ052"    "sCAQ053"    "sCAQ054"   
[106] "sCAQ055"    "sCAQ056"    "sCAQ057"    "sCAQ058"    "sCAQ059"   
[111] "sCAQ060"    "sCAQ061"    "sCAQ062"    "sCAQ063"    "sCAQ064"   
[116] "sCAQ065"    "sCAQ066"    "sCAQ067"    "sCAQ068"    "sCAQ069"   
[121] "sCAQ070"    "sCAQ071"    "sCAQ072"    "sCAQ073"    "sCAQ074"   
[126] "sCAQ075"    "sCAQ076"    "sCAQ077"    "sCAQ078"    "sCAQ079"   
[131] "sCAQ080"    "sCAQ081"    "sCAQ082"    "sCAQ083"    "sCAQ084"   
[136] "sCAQ085"    "sCAQ086"    "sCAQ087"    "sCAQ088"    "sCAQ089"   
[141] "sCAQ090"    "sCAQ091"    "sCAQ092"    "sCAQ093"    "sCAQ094"   
[146] "sCAQ095"    "sCAQ096"    "sCAQ097"    "sCAQ098"    "sCAQ099"   
[151] "sCAQ100"    "v2rbq001"   "v2rbq002"   "v2rbq003"   "v2rbq004"  
[156] "v2rbq005"   "v2rbq006"   "v2rbq007"   "v2rbq008"   "v2rbq009"  
[161] "v2rbq010"   "v2rbq011"   "v2rbq012"   "v2rbq013"   "v2rbq014"  
[166] "v2rbq015"   "v2rbq016"   "v2rbq017"   "v2rbq018"   "v2rbq019"  
[171] "v2rbq020"   "v2rbq021"   "v2rbq022"   "v2rbq023"   "v2rbq024"  
[176] "v2rbq025"   "v2rbq026"   "v2rbq027"   "v2rbq028"   "v2rbq029"  
[181] "v2rbq030"   "v2rbq031"   "v2rbq032"   "v2rbq033"   "v2rbq034"  
[186] "v2rbq035"   "v2rbq036"   "v2rbq037"   "v2rbq038"   "v2rbq039"  
[191] "v2rbq040"   "v2rbq041"   "v2rbq042"   "v2rbq043"   "v2rbq044"  
[196] "v2rbq045"   "v2rbq046"   "v2rbq047"   "v2rbq048"   "v2rbq049"  
[201] "v2rbq050"   "v2rbq051"   "v2rbq052"   "v2rbq053"   "v2rbq054"  
[206] "v2rbq055"   "v2rbq056"   "v2rbq057"   "v2rbq058"   "v2rbq059"  
[211] "v2rbq060"   "v2rbq061"   "v2rbq062"   "v2rbq063"   "v2rbq064"  
[216] "v2rbq065"   "v2rbq066"   "v2rbq067"   "v3rbq001"   "v3rbq002"  
[221] "v3rbq003"   "v3rbq004"   "v3rbq005"   "v3rbq006"   "v3rbq007"  
[226] "v3rbq008"   "v3rbq009"   "v3rbq010"   "v3rbq011"   "v3rbq012"  
[231] "v3rbq013"   "v3rbq014"   "v3rbq015"   "v3rbq016"   "v3rbq017"  
[236] "v3rbq018"   "v3rbq019"   "v3rbq020"   "v3rbq021"   "v3rbq022"  
[241] "v3rbq023"   "v3rbq024"   "v3rbq025"   "v3rbq026"   "v3rbq027"  
[246] "v3rbq028"   "v3rbq029"   "v3rbq030"   "v3rbq031"   "v3rbq032"  
[251] "v3rbq033"   "v3rbq034"   "v3rbq035"   "v3rbq036"   "v3rbq037"  
[256] "v3rbq038"   "v3rbq039"   "v3rbq040"   "v3rbq041"   "v3rbq042"  
[261] "v3rbq043"   "v3rbq044"   "v3rbq045"   "v3rbq046"   "v3rbq047"  
[266] "v3rbq048"   "v3rbq049"   "v3rbq050"   "v3rbq051"   "v3rbq052"  
[271] "v3rbq053"   "v3rbq054"   "v3rbq055"   "v3rbq056"   "v3rbq057"  
[276] "v3rbq058"   "v3rbq059"   "v3rbq060"   "v3rbq061"   "v3rbq062"  
[281] "v3rbq063"   "v3rbq064"   "v3rbq065"   "v3rbq066"   "v3rbq067"  
[286] "v4rbq001"   "v4rbq002"   "v4rbq003"   "v4rbq004"   "v4rbq005"  
[291] "v4rbq006"   "v4rbq007"   "v4rbq008"   "v4rbq009"   "v4rbq010"  
[296] "v4rbq011"   "v4rbq012"   "v4rbq013"   "v4rbq014"   "v4rbq015"  
[301] "v4rbq016"   "v4rbq017"   "v4rbq018"   "v4rbq019"   "v4rbq020"  
[306] "v4rbq021"   "v4rbq022"   "v4rbq023"   "v4rbq024"   "v4rbq025"  
[311] "v4rbq026"   "v4rbq027"   "v4rbq028"   "v4rbq029"   "v4rbq030"  
[316] "v4rbq031"   "v4rbq032"   "v4rbq033"   "v4rbq034"   "v4rbq035"  
[321] "v4rbq036"   "v4rbq037"   "v4rbq038"   "v4rbq039"   "v4rbq040"  
[326] "v4rbq041"   "v4rbq042"   "v4rbq043"   "v4rbq044"   "v4rbq045"  
[331] "v4rbq046"   "v4rbq047"   "v4rbq048"   "v4rbq049"   "v4rbq050"  
[336] "v4rbq051"   "v4rbq052"   "v4rbq053"   "v4rbq054"   "v4rbq055"  
[341] "v4rbq056"   "v4rbq057"   "v4rbq058"   "v4rbq059"   "v4rbq060"  
[346] "v4rbq061"   "v4rbq062"   "v4rbq063"   "v4rbq064"   "v4rbq065"  
[351] "v4rbq066"   "v4rbq067"   "v5rbq001"   "v5rbq002"   "v5rbq003"  
[356] "v5rbq004"   "v5rbq005"   "v5rbq006"   "v5rbq007"   "v5rbq008"  
[361] "v5rbq009"   "v5rbq010"   "v5rbq011"   "v5rbq012"   "v5rbq013"  
[366] "v5rbq014"   "v5rbq015"   "v5rbq016"   "v5rbq017"   "v5rbq018"  
[371] "v5rbq019"   "v5rbq020"   "v5rbq021"   "v5rbq022"   "v5rbq023"  
[376] "v5rbq024"   "v5rbq025"   "v5rbq026"   "v5rbq027"   "v5rbq028"  
[381] "v5rbq029"   "v5rbq030"   "v5rbq031"   "v5rbq032"   "v5rbq033"  
[386] "v5rbq034"   "v5rbq035"   "v5rbq036"   "v5rbq037"   "v5rbq038"  
[391] "v5rbq039"   "v5rbq040"   "v5rbq041"   "v5rbq042"   "v5rbq043"  
[396] "v5rbq044"   "v5rbq045"   "v5rbq046"   "v5rbq047"   "v5rbq048"  
[401] "v5rbq049"   "v5rbq050"   "v5rbq051"   "v5rbq052"   "v5rbq053"  
[406] "v5rbq054"   "v5rbq055"   "v5rbq056"   "v5rbq057"   "v5rbq058"  
[411] "v5rbq059"   "v5rbq060"   "v5rbq061"   "v5rbq062"   "v5rbq063"  
[416] "v5rbq064"   "v5rbq065"   "v5rbq066"   "v5rbq067"   "acq1CAQ001"
[421] "acq1CAQ002" "acq1CAQ003" "acq1CAQ004" "acq1CAQ005" "acq1CAQ006"
[426] "acq1CAQ007" "acq1CAQ008" "acq1CAQ009" "acq1CAQ010" "acq1CAQ011"
[431] "acq1CAQ012" "acq1CAQ013" "acq1CAQ014" "acq1CAQ015" "acq1CAQ016"
[436] "acq1CAQ017" "acq1CAQ018" "acq1CAQ019" "acq1CAQ020" "acq1CAQ021"
[441] "acq1CAQ022" "acq1CAQ023" "acq1CAQ024" "acq1CAQ025" "acq1CAQ026"
[446] "acq1CAQ027" "acq1CAQ028" "acq1CAQ029" "acq1CAQ030" "acq1CAQ031"
[451] "acq1CAQ032" "acq1CAQ033" "acq1CAQ034" "acq1CAQ035" "acq1CAQ036"
[456] "acq1CAQ037" "acq1CAQ038" "acq1CAQ039" "acq1CAQ040" "acq1CAQ041"
[461] "acq1CAQ042" "acq1CAQ043" "acq1CAQ044" "acq1CAQ045" "acq1CAQ046"
[466] "acq1CAQ047" "acq1CAQ048" "acq1CAQ049" "acq1CAQ050" "acq1CAQ051"
[471] "acq1CAQ052" "acq1CAQ053" "acq1CAQ054" "acq1CAQ055" "acq1CAQ056"
[476] "acq1CAQ057" "acq1CAQ058" "acq1CAQ059" "acq1CAQ060" "acq1CAQ061"
[481] "acq1CAQ062" "acq1CAQ063" "acq1CAQ064" "acq1CAQ065" "acq1CAQ066"
[486] "acq1CAQ067" "acq1CAQ068" "acq1CAQ069" "acq1CAQ070" "acq1CAQ071"
[491] "acq1CAQ072" "acq1CAQ073" "acq1CAQ074" "acq1CAQ075" "acq1CAQ076"
[496] "acq1CAQ077" "acq1CAQ078" "acq1CAQ079" "acq1CAQ080" "acq1CAQ081"
[501] "acq1CAQ082" "acq1CAQ083" "acq1CAQ084" "acq1CAQ085" "acq1CAQ086"
[506] "acq1CAQ087" "acq1CAQ088" "acq1CAQ089" "acq1CAQ090" "acq1CAQ091"
[511] "acq1CAQ092" "acq1CAQ093" "acq1CAQ094" "acq1CAQ095" "acq1CAQ096"
[516] "acq1CAQ097" "acq1CAQ098" "acq1CAQ099" "acq1CAQ100" "acq2CAQ001"
[521] "acq2CAQ002" "acq2CAQ003" "acq2CAQ004" "acq2CAQ005" "acq2CAQ006"
[526] "acq2CAQ007" "acq2CAQ008" "acq2CAQ009" "acq2CAQ010" "acq2CAQ011"
[531] "acq2CAQ012" "acq2CAQ013" "acq2CAQ014" "acq2CAQ015" "acq2CAQ016"
[536] "acq2CAQ017" "acq2CAQ018" "acq2CAQ019" "acq2CAQ020" "acq2CAQ021"
[541] "acq2CAQ022" "acq2CAQ023" "acq2CAQ024" "acq2CAQ025" "acq2CAQ026"
[546] "acq2CAQ027" "acq2CAQ028" "acq2CAQ029" "acq2CAQ030" "acq2CAQ031"
[551] "acq2CAQ032" "acq2CAQ033" "acq2CAQ034" "acq2CAQ035" "acq2CAQ036"
[556] "acq2CAQ037" "acq2CAQ038" "acq2CAQ039" "acq2CAQ040" "acq2CAQ041"
[561] "acq2CAQ042" "acq2CAQ043" "acq2CAQ044" "acq2CAQ045" "acq2CAQ046"
[566] "acq2CAQ047" "acq2CAQ048" "acq2CAQ049" "acq2CAQ050" "acq2CAQ051"
[571] "acq2CAQ052" "acq2CAQ053" "acq2CAQ054" "acq2CAQ055" "acq2CAQ056"
[576] "acq2CAQ057" "acq2CAQ058" "acq2CAQ059" "acq2CAQ060" "acq2CAQ061"
[581] "acq2CAQ062" "acq2CAQ063" "acq2CAQ064" "acq2CAQ065" "acq2CAQ066"
[586] "acq2CAQ067" "acq2CAQ068" "acq2CAQ069" "acq2CAQ070" "acq2CAQ071"
[591] "acq2CAQ072" "acq2CAQ073" "acq2CAQ074" "acq2CAQ075" "acq2CAQ076"
[596] "acq2CAQ077" "acq2CAQ078" "acq2CAQ079" "acq2CAQ080" "acq2CAQ081"
[601] "acq2CAQ082" "acq2CAQ083" "acq2CAQ084" "acq2CAQ085" "acq2CAQ086"
[606] "acq2CAQ087" "acq2CAQ088" "acq2CAQ089" "acq2CAQ090" "acq2CAQ091"
[611] "acq2CAQ092" "acq2CAQ093" "acq2CAQ094" "acq2CAQ095" "acq2CAQ096"
[616] "acq2CAQ097" "acq2CAQ098" "acq2CAQ099" "acq2CAQ100"
  RSPdata.sBFI1 RSPdata.sBFI6 RSPdata.sBFI11 RSPdata.sBFI16 RSPdata.sBFI21
1             5             1              4              4              1
2             4             3              5              5              4
3             3             4              2              3              4
4             4             3              4              4              3
5             3             2              4              4              3
6             5             3              4              4              2
  RSPdata.sBFI26 RSPdata.sBFI31 RSPdata.sBFI36
1              4              1              5
2              3              5              4
3              3              4              2
4              3              4              3
5              4              4              4
6              4              2              5
 raw_alpha std.alpha   G6(smc) average_r      S/N        ase     mean        sd
 0.8522702 0.8519561 0.8596228 0.4183829 5.754753 0.01539347 3.392073 0.6979583
  median_r
 0.4063875
   X1    X2    X3    X4    X5    X6    X7    X8    X9   X10   X11   X12   X13 
4.625 3.375 2.375 3.250 3.500 4.125 3.000 4.375 1.875 1.875 3.500 2.375 4.125 
  X14   X15   X16   X17   X18   X19   X20   X21   X22   X23   X24   X25   X26 
3.375 2.500 3.375 2.750 2.375 3.500 2.500 2.875 2.375 1.750 3.500 3.250 3.375 
  X27   X28   X29   X30   X31   X32   X33   X34   X35   X36   X37   X38   X39 
2.750 4.500 2.500 3.375 3.625 2.750 2.000 2.750 2.500 2.250 2.750 3.125 3.750 
  X40   X41   X42   X43   X44   X45   X46   X47   X48   X49   X50   X51   X52 
3.000 4.125 3.500 3.875 2.375 3.125 4.000 2.875 2.375 3.500 3.500 2.750 3.875 
  X53   X54   X55   X56   X57   X58   X59   X60   X61   X62   X63   X64   X65 
4.625 3.500 3.125 3.875 4.375 2.625 2.875 4.125 3.125 3.500 3.375 3.375 4.250 
  X66   X67   X68   X69   X70   X71   X72   X73   X74   X75   X76   X77   X78 
3.375 4.000 3.500 3.875 4.250 3.375 3.750 3.000 3.625 4.500 3.875 2.500 2.500 
  X79   X80   X81   X82   X83   X84   X85   X86   X87   X88   X89   X90   X91 
3.500 4.875 3.875 3.375 2.750 2.625 3.625 3.500 2.750 3.500 4.000 3.250 3.125 
  X92   X93   X94   X95   X96   X97   X98   X99  X100  X101  X102  X103  X104 
2.875 1.875 3.125 3.125 4.125 3.375 4.875 3.750 4.000 3.375 4.375 3.625 3.375 
 X105  X106  X107  X108  X109  X110  X111  X112  X113  X114  X115  X116  X117 
3.875 3.375 3.500 4.000 3.000 4.250 3.625 2.875 4.500 4.125 4.875 3.375 2.750 
 X118  X119  X120  X121  X122  X123  X124  X125  X126  X127  X128  X129  X130 
1.750 2.500 3.625 3.750 4.500 3.000 2.625 3.625 2.875 3.750 2.875 3.625 3.625 
 X131  X132  X133  X134  X135  X136  X137  X138  X139  X140  X141  X142  X143 
3.500 2.875 4.000 3.750 3.500 3.500 3.250 2.375 3.250 3.750 3.125 2.750 4.875 
 X144  X145  X146  X147  X148  X149  X150  X151  X152  X153  X154  X155  X156 
2.875 4.125 3.125 3.000 3.125 3.750 3.750 3.000 3.250 3.375 3.250 2.625 3.750 
 X157  X158  X159  X160  X161  X162  X163  X164  X165  X166  X167  X168  X169 
2.500 3.000 3.625 4.250 4.125 4.125 2.375 2.000 4.125 2.375 3.500 3.875 3.750 
 X170  X171  X172  X173  X174  X175  X176  X177  X178  X179  X180  X181  X182 
4.000 2.875 4.250 3.750 3.750 4.625 3.875 3.125 3.000 3.125 4.125 3.750 4.000 
 X183  X184  X185  X186  X187  X188  X189  X190  X191  X192  X193  X194  X195 
4.875 3.000 1.375 3.125 3.125 3.875 4.250 3.750 2.500 4.250 3.375 4.375 2.750 
 X196  X197  X198  X199  X200  X201  X202  X203  X204  X205 
4.000 2.500 4.750 3.625 4.375 3.375 4.125 4.000 2.750 2.750 
 raw_alpha std.alpha   G6(smc) average_r      S/N        ase         mean
 0.8746749 0.8746749 0.8867729 0.4367695 6.979247 0.01319109 2.289676e-17
        sd  median_r
 0.7066475 0.4160115
   vars   n mean   sd median trimmed  mad   min  max range  skew kurtosis   se
X1    1 205    0 0.71   0.06    0.02 0.76 -2.11 1.45  3.56 -0.27    -0.35 0.05

multicon documentation built on May 2, 2019, 3:18 a.m.