Published on :
Statistics CREATION_INTERNE

Analysis of a Diallel Experiment with Multi-Member Random Effects

This code is also available in: Deutsch Español Français
Awaiting validation
The script begins by creating a dataset named 'diallel'. It simulates flowering time data for crosses between 8 different parental lines, distributed in two blocks. A particular feature is the creation of a 'sym' variable to identify reciprocal crosses. Then, the `PROC GLIMMIX` procedure is used to fit a statistical model. The model defines 'block' as a fixed effect and several random effects, notably a multi-member 'line' effect constructed from parents 'p' and 'm' using the `EFFECT` statement. Finally, PROC PRINT is used to display a portion of the random effects design matrix generated by GLIMMIX.
Data Analysis

Type : CREATION_INTERNE


The data is entirely generated in the first DATA step. A `do` loop structures the crosses, and the `INPUT` statement reads flowering time values directly from the `datalines` integrated into the code.

1 Code Block
DATA STEP Data
Explanation :
This DATA STEP block constructs the 'diallel' table. It uses nested loops to generate all combinations of crosses between 8 parents ('p' and 'm'). Data for the 'time' variable is read from internal data lines (datalines) using the ' @@' indicator to read multiple observations on the same line.
Copied!
1DATA diallel;
2 label time = 'Flowering time in days';
3 DO p = 1 to 8;
4 DO m = 1 to 8;
5 IF (m ne p) THEN DO;
6 sym = trim(left(min(m,p))) || ',' || trim(left(max(m,p)));
7 DO block = 1 to 2;
8 INPUT time @code_sas_json/8_SAS_Intro_ReadFile_MultiCol_@@.json;
9 OUTPUT;
10 END;
11 END;
12 END;
13 END;
14 DATALINES;
1514.4 16.2 27.2 30.8 17.2 27.0 18.3 20.2 16.2 16.8 18.6 14.4 16.4 16.0
1615.4 16.5 14.8 14.6 18.6 18.6 15.2 15.3 17.0 15.2 14.4 14.8 10.8 13.2
1731.8 30.4 21.0 23.0 24.6 25.4 19.2 20.0 29.8 28.4 12.8 14.2 13.0 14.4
1816.2 17.8 11.4 13.0 16.8 16.3 12.4 14.2 16.8 14.8 12.6 12.2 9.6 11.2
1914.6 18.8 12.2 13.6 15.2 15.4 15.2 13.8 18.0 16.0 10.4 12.2 13.4 20.0
2020.2 23.4 14.2 14.0 18.6 14.8 22.2 17.0 14.3 17.3 9.0 10.2 11.8 12.8
2114.0 16.6 12.2 9.2 13.6 16.2 13.8 14.4 15.6 15.6 15.6 11.0 13.0 9.8
2215.2 17.2 10.0 11.6 17.0 18.2 20.8 20.8 20.0 17.4 17.0 12.6 13.0 9.8
23;
24RUN;
2 Code Block
PROC GLIMMIX
Explanation :
This block uses the GLIMMIX procedure for statistical analysis. 'class' defines classification variables. The `effect line = mm(p m)` statement creates a multi-member 'line' effect from variables 'p' and 'm'. The model is defined with 'time' as the dependent variable, 'block' as a fixed effect, and 'line', 'sym', 'p', 'm', and their interaction 'p*m' as random effects. The `outdesign(z)=zmat` option saves the random effects design matrix to a 'zmat' table.
Copied!
1PROC GLIMMIX DATA=diallel outdesign(z)=zmat;
2 class block sym p m;
3 effect line = mm(p m);
4 model time = block;
5 random line sym p m p*m;
6RUN;
3 Code Block
PROC PRINT
Explanation :
This block displays the first 10 observations of the 'zmat' table (created by PROC GLIMMIX) where the 'block' variable is equal to 1. It prints the variables 'p', 'm', 'time', and the first 8 columns of the random effects design matrix (_z1 to _z8).
Copied!
1 
2PROC PRINT
3DATA=zmat(where=(block=1) obs=10);
4var p m time _z1-_z8;
5RUN;
6 
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : S A S S A M P L E L I B R A R Y