/* G2.sas for Generalizability Theory analyses This file contains program syntax and illustrative data for conducting Generalizability Theory analyses using the SAS VARCOMP procedure. The VARCOMP procedure has a number of useful options for computing variance components, but it also has three shortcomings: (1) it runs slowly for even modest-sized data sets; (2) the set-up of the data that is entered into the VARCOMP procedure is quite different from the set-up that many users will have for their data; and (3) it provides only variance components and no additional Generalizability Theory statistics. Nothing can be done about the slow speed, but the other two shortcomings are addressed by the syntax in this file. The VARCOMP procedure requires that each row of a data matrix consist of a single observation (e.g., a single score or rating) and the condition values (e.g., as is the levels of independent variables) for the observation/score/rating. This is probably not the arrangement that many people will have in their data files. More commonly, all of the data for one case (person) appears on one line/record, and the observations (scores or ratings) have variable names but with no explicit levels. For example, if the data were based on 10 items that were administered to each person on two occasions, then the common data set-up would be to have 20 variables for each person. To enter this data into VARCOMP, the data set would have to be rearranged. Every score for each person would have to appear on a separate line, accompanied by correct values for new variables indicating the item level (1-to-10) and the occasion (1 and 2). The SAS DATA, SET, OUTPUT, & KEEP commands can be used to rearrange data sets in the correct, necessary ways. The online documention for the commands is very good, and there is no need to repeat the instructions here. Instead, the procedure is illustrated below for the data sets used by Brennan (2001) and Shavelson & Webb (1991) in their texts on Generalizability Theory. For each example, the illustrative data are presented along with commands for reading the data into SAS, with commands for transforming the data set-ups for entry into VARCOMP, and by commands for running VARCOMP on the data. The VARCOMP procedure has an option for saving the variance components results to an SAS data file. This file can then be read and Generalizability Theory computations can be performed on the saved data. At the end of the illustrative data examples in this file is a set of SAS PROC IML commands that read the saved variance components and perform the remaining Generalizability Theory analyses. Here are the options for the METHOD statement on the VARCOMP procedure: ML, REML, MINQUE (0), MINQUE (1), SSTYPE (1), and SSTYPE (3). */ /* one-facet crossed design, as in p x i Type 1, based on Brennan, 2001, page 431, Table A.1 data from Brennan, 2001, p. 28, Table 2.2, & p. 36, Table 2.4 10 persons, 12 items */ data type1b; input v1 - v12; cards; 1 0 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 0 1 1 0 0 1 0 0 0 0 1 1 1 1 1 0 1 0 0 0 0 0 1 1 1 0 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 ;run; data type1blong; set type1b; items=1; depend=v1; person=_n_; output; items=2; depend=v2; person=_n_; output; items=3; depend=v3; person=_n_; output; items=4; depend=v4; person=_n_; output; items=5; depend=v5; person=_n_; output; items=6; depend=v6; person=_n_; output; items=7; depend=v7; person=_n_; output; items=8; depend=v8; person=_n_; output; items=9; depend=v9; person=_n_; output; items=10; depend=v10; person=_n_; output; items=11; depend=v11; person=_n_; output; items=12; depend=v12; person=_n_; output; keep items depend person; run; proc means data = type1blong;run; proc varcomp data = type1blong method = reml; class person items; model depend = person items ; run; /* one-facet crossed design, as in p x i Type 1, based on Brennan, 2001, page 431, Table A.1 data from Shavelson & Webb, 1991, p. 5, Table 1.1, & p. 29, Table 3.2 20 persons, 8 items. */ data type1s; input v1 - v8; cards; 0 1 0 0 0 1 0 1 1 0 1 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 0 0 1 0 0 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 0 1 0 0 1 1 0 1 0 1 0 0 0 1 1 1 0 0 0 0 1 1 1 0 1 0 0 1 1 0 0 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 0 0 1 0 0 0 0 1 1 1 1 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 ;run; data type1slong; set type1s; items=1; depend=v1; person=_n_; output; items=2; depend=v2; person=_n_; output; items=3; depend=v3; person=_n_; output; items=4; depend=v4; person=_n_; output; items=5; depend=v5; person=_n_; output; items=6; depend=v6; person=_n_; output; items=7; depend=v7; person=_n_; output; items=8; depend=v8; person=_n_; output; keep items depend person; run; proc means data = type1slong;run; proc varcomp data = type1slong method = reml; class person items; model depend = person items ; run; /* one-facet nested design, as in i : p Type 2, based on Brennan, 2001, page 431, Table A.2 data from Brennan, 2001, p. 43, Table 2.8, & p. 44 10 persons, 8 items per person, but none of the items are the same, so there are 80 items. */ data type2; input v1 - v8; cards; 2 6 7 5 2 5 5 5 4 5 6 7 6 7 5 7 5 5 4 6 5 4 5 5 5 9 8 6 5 7 7 6 4 3 5 6 4 5 6 4 4 4 4 7 6 4 7 8 2 6 6 5 2 7 7 5 3 4 4 5 6 6 6 4 0 5 4 5 5 5 5 3 6 8 7 6 6 8 8 6 ;run; data type2long; set type2; items=1 +_n_*100; depend=v1; person=_n_; output; items=2 +_n_*100; depend=v2; person=_n_; output; items=3 +_n_*100; depend=v3; person=_n_; output; items=4 +_n_*100; depend=v4; person=_n_; output; items=5 +_n_*100; depend=v5; person=_n_; output; items=6 +_n_*100; depend=v6; person=_n_; output; items=7 +_n_*100; depend=v7; person=_n_; output; items=8 +_n_*100; depend=v8; person=_n_; output; keep items depend person; run; proc means data = type2long;run; proc varcomp data = type2long method = reml; class person ; model depend = person ; run; /* two-facet crossed design, as in p x i x o Type 3, based on Brennan, 2001, page 432, Table A.3 data from Brennan, 2001, p. 72, Table 3.1, & p. 111 10 persons, 4 items, 2 occasions. */ data type3b; input v1 - v8; cards; 2 6 7 5 2 5 5 5 4 5 6 7 6 7 5 7 5 5 4 6 5 4 5 5 5 9 8 6 5 7 7 6 4 3 5 6 4 5 6 4 4 4 4 7 6 4 7 8 2 6 6 5 2 7 7 5 3 4 4 5 6 6 6 4 0 5 4 5 5 5 5 3 6 8 7 6 6 8 8 6 ;run; data type3blong; set type3b; items=1; occs=1; depend=v1; person=_n_; output; items=2; occs=1; depend=v2; person=_n_; output; items=3; occs=1; depend=v3; person=_n_; output; items=4; occs=1; depend=v4; person=_n_; output; items=1; occs=2; depend=v5; person=_n_; output; items=2; occs=2; depend=v6; person=_n_; output; items=3; occs=2; depend=v7; person=_n_; output; items=4; occs=2; depend=v8; person=_n_; output; keep items depend occs person; run; proc means data = type3blong;run; proc varcomp data = type3blong method = reml; class person items occs; model depend = person items occs items*person occs*person items*occs ; run; /* two-facet crossed design, as in p x r x s Type 3, based on Brennan, 2001, page 432, Table A.3 data from Shavelson & Webb, 1991, p. 69, Table 5.1 8 persons, 3 raters, 2 subject matters. */ data type3s; input v1 - v6; cards; 4 4 4 5 5 6 6 7 6 7 9 5 8 7 7 4 3 2 6 8 7 9 11 7 2 1 1 5 5 3 5 4 4 7 6 5 4 5 6 6 8 9 7 7 6 5 9 9 ;run; data type3slong; set type3s; raters=1; subjmat=1; depend=v1; teacher=_n_; output; raters=2; subjmat=1; depend=v2; teacher=_n_; output; raters=3; subjmat=1; depend=v3; teacher=_n_; output; raters=1; subjmat=2; depend=v4; teacher=_n_; output; raters=2; subjmat=2; depend=v5; teacher=_n_; output; raters=3; subjmat=2; depend=v6; teacher=_n_; output; keep raters depend subjmat teacher; run; proc means data = type3slong;run; proc varcomp data = type3slong method = reml; class teacher raters subjmat; model depend = teacher raters subjmat raters*teacher subjmat*teacher raters*subjmat ; run; /* two-facet nested design, as in p x (r : t) Type 4, based on Brennan, 2001, page 432, Table A.4 data from Brennan, 2001, p. 73, Table 3.2, & p. 116 10 persons, 12 raters, 3 tasks. */ data type4; input v1 - v12; cards; 5 6 5 5 5 3 4 5 6 7 3 3 9 3 7 7 7 5 5 5 7 7 5 2 3 4 3 3 5 3 3 5 6 5 1 6 7 5 5 3 3 1 4 3 5 3 3 5 9 2 9 7 7 7 3 7 2 7 5 3 3 4 3 5 3 3 6 3 4 5 1 2 7 3 7 7 7 5 5 7 5 5 5 4 5 8 5 7 7 5 5 4 3 2 1 1 9 9 8 8 6 6 6 5 5 8 1 1 4 4 4 3 3 5 6 5 5 7 1 1 ;run; data type4long; set type4; raters=1; task=1; depend=v1; person=_n_; output; raters=2; task=1; depend=v2; person=_n_; output; raters=3; task=1; depend=v3; person=_n_; output; raters=4; task=1; depend=v4; person=_n_; output; raters=1; task=2; depend=v5; person=_n_; output; raters=2; task=2; depend=v6; person=_n_; output; raters=3; task=2; depend=v7; person=_n_; output; raters=4; task=2; depend=v8; person=_n_; output; raters=1; task=3; depend=v9; person=_n_; output; raters=2; task=3; depend=v10; person=_n_; output; raters=3; task=3; depend=v11; person=_n_; output; raters=4; task=3; depend=v12; person=_n_; output; keep raters depend task person; run; proc means data = type4long;run; proc varcomp data = type4long method = reml; class person raters task; model depend = person task raters(task) task*person ; run; /* two-facet nested design, as in (F1 : P) * F2; Type 5, based on Brennan, 2001, page 433, Table A.5 Brennan (2001) and Shavelson & Webb (1991) did not provide illustrative data for this design. The data from Brennan (2001, p. 73, Table 3.2) are therefore used below. facet1 is assumed to be nested within persons 10 persons, 4 levels of Facet 1, 3 levels of Facet 2. */ data type5; input v1 - v12; cards; 5 6 5 5 5 3 4 5 6 7 3 3 9 3 7 7 7 5 5 5 7 7 5 2 3 4 3 3 5 3 3 5 6 5 1 6 7 5 5 3 3 1 4 3 5 3 3 5 9 2 9 7 7 7 3 7 2 7 5 3 3 4 3 5 3 3 6 3 4 5 1 2 7 3 7 7 7 5 5 7 5 5 5 4 5 8 5 7 7 5 5 4 3 2 1 1 9 9 8 8 6 6 6 5 5 8 1 1 4 4 4 3 3 5 6 5 5 7 1 1 ;run; data type5long; set type5; facet1=1 + _n_*100; facet2=1; depend=v1; person=_n_; output; facet1=2 + _n_*100; facet2=1; depend=v2; person=_n_; output; facet1=3 + _n_*100; facet2=1; depend=v3; person=_n_; output; facet1=4 + _n_*100; facet2=1; depend=v4; person=_n_; output; facet1=1 + _n_*100; facet2=2; depend=v5; person=_n_; output; facet1=2 + _n_*100; facet2=2; depend=v6; person=_n_; output; facet1=3 + _n_*100; facet2=2; depend=v7; person=_n_; output; facet1=4 + _n_*100; facet2=2; depend=v8; person=_n_; output; facet1=1 + _n_*100; facet2=3; depend=v9; person=_n_; output; facet1=2 + _n_*100; facet2=3; depend=v10; person=_n_; output; facet1=3 + _n_*100; facet2=3; depend=v11; person=_n_; output; facet1=4 + _n_*100; facet2=3; depend=v12; person=_n_; output; keep facet1 depend facet2 person; run; proc means data = type5long;run; proc varcomp data = type5long method = reml; class person facet1 facet2; model depend = person facet2 facet1(person) person*facet2 ; run; /* two-facet nested design, as in F1 : (P * F2) Type 6, based on Brennan, 2001, page 433, Table A.6 Brennan (2001) and Shavelson & Webb (1991) did not provide illustrative data for this design. The data from Brennan (2001, p. 73, Table 3.2) are therefore used below. facet1 is assumed to be nested within person*facet2 10 persons, 4 levels of Facet 1, 3 levels of Facet 2. */ data type6; input v1 - v12; cards; 5 6 5 5 5 3 4 5 6 7 3 3 9 3 7 7 7 5 5 5 7 7 5 2 3 4 3 3 5 3 3 5 6 5 1 6 7 5 5 3 3 1 4 3 5 3 3 5 9 2 9 7 7 7 3 7 2 7 5 3 3 4 3 5 3 3 6 3 4 5 1 2 7 3 7 7 7 5 5 7 5 5 5 4 5 8 5 7 7 5 5 4 3 2 1 1 9 9 8 8 6 6 6 5 5 8 1 1 4 4 4 3 3 5 6 5 5 7 1 1 ;run; data type6long; set type6; facet1=1; facet2=1; depend=v1; person=_n_; output; facet1=2; facet2=1; depend=v2; person=_n_; output; facet1=3; facet2=1; depend=v3; person=_n_; output; facet1=4; facet2=1; depend=v4; person=_n_; output; facet1=5; facet2=2; depend=v5; person=_n_; output; facet1=6; facet2=2; depend=v6; person=_n_; output; facet1=7; facet2=2; depend=v7; person=_n_; output; facet1=8; facet2=2; depend=v8; person=_n_; output; facet1=9; facet2=3; depend=v9; person=_n_; output; facet1=10; facet2=3; depend=v10; person=_n_; output; facet1=11; facet2=3; depend=v11; person=_n_; output; facet1=12; facet2=3; depend=v12; person=_n_; output; keep facet1 facet2 person depend ; run; proc means data = type6long;run; proc varcomp data = type6long method = reml; class person facet1 facet2; model depend = person facet2 person*facet2 ; run; /* two-facet nested design, as in (F1 * F2) : P Type 7, based on Brennan, 2001, page 433, Table A.7 Brennan (2001) and Shavelson & Webb (1991) did not provide illustrative data for this design. The data from Brennan (2001, p. 73, Table 3.2) are therefore used below. facet1*facet2 is assumed to be nested within persons 10 persons, 4 levels of Facet 1, 3 levels of Facet 2. */ data type7; input v1 - v12; cards; 5 6 5 5 5 3 4 5 6 7 3 3 9 3 7 7 7 5 5 5 7 7 5 2 3 4 3 3 5 3 3 5 6 5 1 6 7 5 5 3 3 1 4 3 5 3 3 5 9 2 9 7 7 7 3 7 2 7 5 3 3 4 3 5 3 3 6 3 4 5 1 2 7 3 7 7 7 5 5 7 5 5 5 4 5 8 5 7 7 5 5 4 3 2 1 1 9 9 8 8 6 6 6 5 5 8 1 1 4 4 4 3 3 5 6 5 5 7 1 1 ;run; data type7long; set type7; facet1=1 + _n_*100; facet2=1 + _n_*100; depend=v1; person=_n_; output; facet1=2 + _n_*100; facet2=1 + _n_*100; depend=v2; person=_n_; output; facet1=3 + _n_*100; facet2=1 + _n_*100; depend=v3; person=_n_; output; facet1=4 + _n_*100; facet2=1 + _n_*100; depend=v4; person=_n_; output; facet1=1 + _n_*100; facet2=2 + _n_*100; depend=v5; person=_n_; output; facet1=2 + _n_*100; facet2=2 + _n_*100; depend=v6; person=_n_; output; facet1=3 + _n_*100; facet2=2 + _n_*100; depend=v7; person=_n_; output; facet1=4 + _n_*100; facet2=2 + _n_*100; depend=v8; person=_n_; output; facet1=1 + _n_*100; facet2=3 + _n_*100; depend=v9; person=_n_; output; facet1=2 + _n_*100; facet2=3 + _n_*100; depend=v10; person=_n_; output; facet1=3 + _n_*100; facet2=3 + _n_*100; depend=v11; person=_n_; output; facet1=4 + _n_*100; facet2=3 + _n_*100; depend=v12; person=_n_; output; keep facet1 depend facet2 person; run; proc means data = type7long;run; proc varcomp data = type7long method = reml; class person facet1 facet2; model depend = person facet1(person) facet2(person) ; run; /* two-facet nested design, as in F1 : F2 : P Type 8, based on Brennan, 2001, page 433, Table A.8 Brennan (2001) and Shavelson & Webb (1991) did not provide illustrative data for this design. The data from Brennan (2001, p. 73, Table 3.2) are therefore used below. facet1is assumed to be nested within facet2, which is assumed to be nested within persons 10 persons, 4 levels of Facet 1, 3 levels of Facet 2. */ data type8; input v1 - v12; cards; 5 6 5 5 5 3 4 5 6 7 3 3 9 3 7 7 7 5 5 5 7 7 5 2 3 4 3 3 5 3 3 5 6 5 1 6 7 5 5 3 3 1 4 3 5 3 3 5 9 2 9 7 7 7 3 7 2 7 5 3 3 4 3 5 3 3 6 3 4 5 1 2 7 3 7 7 7 5 5 7 5 5 5 4 5 8 5 7 7 5 5 4 3 2 1 1 9 9 8 8 6 6 6 5 5 8 1 1 4 4 4 3 3 5 6 5 5 7 1 1 ;run; data type8long; set type8; facet1=1; facet2=1; depend=v1; person=_n_; output; facet1=2; facet2=1; depend=v2; person=_n_; output; facet1=3; facet2=1; depend=v3; person=_n_; output; facet1=4; facet2=1; depend=v4; person=_n_; output; facet1=5; facet2=2; depend=v5; person=_n_; output; facet1=6; facet2=2; depend=v6; person=_n_; output; facet1=7; facet2=2; depend=v7; person=_n_; output; facet1=8; facet2=2; depend=v8; person=_n_; output; facet1=9; facet2=3; depend=v9; person=_n_; output; facet1=10; facet2=3; depend=v10; person=_n_; output; facet1=11; facet2=3; depend=v11; person=_n_; output; facet1=12; facet2=3; depend=v12; person=_n_; output; keep facet1 facet2 person depend ; run; proc means data = type8long;run; proc varcomp data = type8long method = reml; class person facet1 facet2; model depend = person facet2(person) ; run; /* 3-facet crossed design, as in p x i x o x b using data from Brennan, 2001, p. 72, Table 3.1, & p. 111 10 persons, 4 items, 2 occasions, changing to 2 items, 2 occasions, & 2 levels of facet3 */ data facet3; input v1 - v8; cards; 2 6 7 5 2 5 5 5 4 5 6 7 6 7 5 7 5 5 4 6 5 4 5 5 5 9 8 6 5 7 7 6 4 3 5 6 4 5 6 4 4 4 4 7 6 4 7 8 2 6 6 5 2 7 7 5 3 4 4 5 6 6 6 4 0 5 4 5 5 5 5 3 6 8 7 6 6 8 8 6 ;run; data facet3long; set facet3; items=1; occs=1; facet3=1; depend=v1; person=_n_; output; items=1; occs=1; facet3=2; depend=v2; person=_n_; output; items=2; occs=1; facet3=1; depend=v3; person=_n_; output; items=2; occs=1; facet3=2; depend=v4; person=_n_; output; items=1; occs=2; facet3=1; depend=v5; person=_n_; output; items=1; occs=2; facet3=2; depend=v6; person=_n_; output; items=2; occs=2; facet3=1; depend=v7; person=_n_; output; items=2; occs=2; facet3=2; depend=v8; person=_n_; output; keep items depend occs facet3 person; run; proc means data = facet3long;run; proc varcomp data = facet3long method = reml; class person items occs facet3 ; model depend = person items occs facet3 person*items person*occs person*facet3 items*occs items*facet3 occs*facet3 ; run; /*********** The following program reads a variance components *********** matrix and produces Generalizability Theory statistics. *********** Follow the instructions until you get to "End of user specifications". *********** The program uses the SPSS Matrix--End Matrix procedure. *********** To run the program you must select all of the commands *********** between, and including, "proc iml;" and "quit;", then click on Run. */ options nocenter nodate nonumber linesize=90 formdlim=' '; title; proc iml; /* Enter a one-row data matrix of variance components; Enter the data matrix directly, within the PROC IML environment, as in the trial-run data below. The data matrix must be named "vcs"; the data must appear inside curly brackets; place a space between the data values. */ /* Brennan, 2001, Data Set 3, p 72 & p 111 */ vcs = { .5528 .442 .007 .575 .101 .156 .935 }; /* Now look at the terms in the SPSS Variance Components results and then create the "facets" curly brackets matrix below (see the "facets =" statement), as follows: separate the values within each row by a space, and place a semi-colon at the end of every row (except the last row) 1st row: the first row should contain the sequence of digits from 1 to the total number of variance components; e.g., enter "1 2 3 4;" if there are four variance components 2nd row: indicate whether persons were involved in the computations for each variance component; Enter "1" if persons were involved, and enter "0" if persons were not involved; e.g., if there were 7 variance components for p i o p*i p*o i*o p*i*o, then enter 1 0 0 1 1 0 1; 3rd row: indicate whether your Facet 1 was involved in the computations for each variance component; Enter the number of levels of Facet 1 if Facet 1 was involved, and enter "0" if Facet 1 was not involved in the computations for each term; e.g., if there were 7 variance components, and Facet 1 ("i") had 4 levels p i o p*i p*o i*o p*i*o, then enter 0 4 0 4 0 4 4; 4rth row: indicate whether Facet 2 was involved in the computations for each variance component; Enter the number of levels of Facet 2 if Facet 2 was involved, and enter "0" if Facet 2 was not involved in the computations for each term; e.g., if there were 7 variance components, and Facet 2 ("o") had 2 levels p i o p*i p*o i*o p*i*o, then enter 0 0 2 0 2 2 2; You can ignore this step/row for single-facet designs If there are more than 2 facets in your design, then continue adding rows following the above instructions. the right-most column for row 2 onwards is for the residual variance component (the highest order interaction). It should not have "0" values. the model "facets" matrix below is for the variance components from the data from Brennan, 2001, Data Set 3, p 72 & p 111. Re-design this matrix for your own variance components data. */ facets = { 1 2 3 4 5 6 7 , 1 0 0 1 1 0 1 , 0 4 0 4 0 4 4 , 0 0 2 0 2 2 2 }; /* The remaining commands are for producing D study statistics and graphs. Although your design may have more than 3 facets for the above G-study analyses, the D study analyses provided by this program are conducted only 3 facets (the D study output for more than 3 facets would be overwhelming and difficult to interpret). */ /* Enter D-study values for Facet 1; enter the values inside curly brackets, and place a space between the values */ dfacet1 = {4 8 16}; /* Enter D-study values for Facet 2; enter the values inside curly brackets, and place a space between the values. You can ignore this step for single-facet designs */ dfacet2 = {2 4}; /* Enter D-study values for Facet 3; enter the values inside curly brackets, and place a space between the values. You can ignore this step for single-facet or two-facet designs */ dfacet3 = {2 4}; /* Enter labels for the codes (5 characters maximum), if desired, here; */ labels=("Term 1" || "Term 2" || "Term 3" || "Term 4" || "Term 5" ||"Term 6" || "Term 7" || "Term 8" || "Term 9" || "Term 10" || "Term 11" || "Term 12" || "Term 13" || "Term 14" || "Term 15" || "Term 16" || "Term 17" || "Term 18" || "Term 19" || "Term 20" || "Term 21"); /* At the very bottom of this file, after the QUIT statement, is a PLOT command that can be used to plot the results for the D-study values that you specified above. Specify the data that you would like to plot by entering the appropriate number on the GRAPHDAT statement: enter "1" for relative error variances; enter "2" for absolute error variances; enter "3" for G-coefficients; enter "4" for phi coefficients */ graphdat = 4; /* End of user specifications */ /***************************************************************************/ print,,,, "G-Theory Analyses:"; /* row sums module */ start rsum(matname); rsums =j(nrow(matname),1); do rows = 1 to nrow(matname); dumr = matname[rows,]; rsums[rows,1]=sum(dumr); end; return(rsums); finish; if ncol(vcs) ^= ncol(facets) then do; print,,, "The number of columns in your variance components matrix is not"; print "the same as the number of columns in your facets matrix."; end; labels2 = labels[1,1:ncol(vcs)]; facets = facets[2:nrow(facets),]; nfacets = nrow(facets) - 1; /* absolute & relative error variances */ absv = 0; relv = 0; dummat = facets[2:nrow(facets),]; /* setting all 0 values to 1 */ do luper = 1 to nrow(dummat); do lupec = 1 to ncol(dummat); if dummat[luper,lupec] = 0 then; dummat[luper,lupec] = 1; end;end; denom = dummat[1,]; do lupec = 2 to ncol(vcs); do luper = 1 to nrow(dummat); if luper < nrow(dummat) then; denom[1,lupec] = denom[1,lupec] * dummat[luper+1,lupec]; end; absv = absv + ( vcs[1,lupec] / denom[1,lupec] ); if facets[1,lupec] ^= 0 then; relv = relv + ( vcs[1,lupec] / denom[1,lupec] ); end; relG = vcs[1,1] / ( vcs[1,1] + relv ); absG = vcs[1,1] / ( vcs[1,1] + absv ); percents = vcs / rsum(vcs); print,,"Entered Specifications, Variance Components and"; print "their Proportions of the Total Variance:"; if nfacets=1 then; clabs=("Persons"||"Facet1"||"VarComp"||"Proport"); if nfacets=2 then; clabs=("Persons" || "Facet1" || "Facet2" || "VarComp" || "Proport"); if nfacets=3 then; clabs=("Persons"||"Facet1"||"Facet2"||"Facet3"||"VarComp"||"Proport"); print ( t(facets) || t(vcs) || t(percents) ) [colname=clabs rowname=labels format=10.3]; print,"Error Variances:" ( relv || absv ) [colname={"Relative","Absolute"} format=10.3]; print,"G-coefficients:" ( relG || absG ) [colname={"G", "Phi"} format=10.3]; /* D study */ if nfacets <= 3 then do; print,,,, 'D-Study:'; print,'Entered D-Study values for Facet 1:' dfacet1; if nfacets=2 | nfacets=3 then; print,'Entered D-Study values for Facet 2:' dfacet2; if nfacets=3 then; print,'Entered D-Study values for Facet 3:' dfacet3; persons = facets[1,]; vfacet1 = facets[2,]; if nfacets = 1 then do; dfacet2 = 1; vfacet2 = j(1,ncol(vcs),1); dfacet3 = 1; vfacet3 = j(1,ncol(vcs),1); end; if nfacets = 2 then do; vfacet2 = facets[3,]; dfacet3 = 1; vfacet3 = j(1,ncol(vcs),1); end; if nfacets = 3 then do; vfacet2 = facets[3,]; vfacet3 = facets[4,]; end; do f3 = 1 to ncol(dfacet3); dabsv = t(dfacet1); drelv = dabsv; drelG = dabsv; dabsG = dabsv; dabsv2 = { -9999 -9999 -9999 }; drelv2 = dabsv2; drelG2 = dabsv2; dabsG2 = dabsv2; do f2 = 1 to ncol(dfacet2); resdum = j(ncol(dfacet1),4,-9999); counter = 1; do f1 = 1 to ncol(dfacet1); absvdum = 0; relvdum = 0; do lupe = 2 to ncol(vcs); f3dum = 1; f2dum = 1; f1dum = 1; if vfacet1[1,lupe] > 1 then; f1dum = dfacet1[1,f1]; if vfacet2[1,lupe] > 1 then; f2dum = dfacet2[1,f2]; if vfacet3[1,lupe] > 1 then; f3dum = dfacet3[1,f3]; absvdum = absvdum + ( vcs[1,lupe] / (f1dum * f2dum * f3dum ) ); if persons[1,lupe] ^= 0 then; relvdum = relvdum + ( vcs[1,lupe] / (f1dum * f2dum * f3dum ) ); end; gdum = vcs[1,1] / ( vcs[1,1] + relvdum ); pdum = vcs[1,1] / ( vcs[1,1] + absvdum ); resdum[counter,] = ( absvdum || relvdum || gdum || pdum ); dabsv2 = ( dabsv2 // ( dfacet2[1,f2] || dfacet1[1,f1] || absvdum) ); drelv2 = ( drelv2 // ( dfacet2[1,f2] || dfacet1[1,f1] || relvdum) ); drelG2 = ( drelG2 // ( dfacet2[1,f2] || dfacet1[1,f1] || gdum) ); dabsG2 = ( dabsG2 // ( dfacet2[1,f2] || dfacet1[1,f1] || pdum) ); counter = counter + 1; end; dabsv = ( dabsv || resdum[,1] ); drelv = ( drelv || resdum[,2] ); drelG = ( drelG || resdum[,3] ); dabsG = ( dabsG || resdum[,4] ); end; dfac3 = dfacet3[1,f3]; if nfacets=3 then; print,'Entered D-Study values for Facet 3:' dfac3; print,,, "In the D-study results below, the levels of Facet 1 appear in"; print "the first column, and the levels of Facet 2 appear in the first row."; print,,"D-Study Absolute Error Variances", ((0 || dfacet2) // dabsv) [format=10.3]; print,"D-Study Relative Error Variances", ((0 || dfacet2) // drelv) [format=10.3]; print,"D-Study G Coefficients", ((0 || dfacet2) // drelG) [format=10.3]; print,"D-Study Phi Coefficients", ((0 || dfacet2) // dabsG) [format=10.3]; dabsv2 = dabsv2[2:nrow(dabsv2),]; drelv2 = drelv2[2:nrow(drelv2),]; drelG2 = drelG2[2:nrow(drelG2),]; dabsG2 = dabsG2[2:nrow(dabsG2),]; end; /* saving data for plots */ if nfacets <= 2 then do; if graphdat = 1 then do; create plotdata from drelv2[colname={"Facet2" "Facet1" "Gstat"}]; append from drelv2;end; if graphdat = 2 then do; create plotdata from dabsv2[colname={"Facet2" "Facet1" "Gstat"}]; append from dabsv2;end; if graphdat = 3 then do; create plotdata from drelG2[colname={"Facet2" "Facet1" "Gstat"}]; append from drelG2;end; if graphdat = 4 then do; create plotdata from dabsG2[colname={"Facet2" "Facet1" "Gstat"}]; append from dabsG2;end; end; end; quit; proc plot data = plotdata vpct=55 hpct = 55; title 'Gstat is the coefficient you specified on the GRAPHDAT= statement'; plot gstat*facet1=facet2 / vaxis=0 to 1 by .1 ;run;