strip_split_plot
Analyzes data from strip-split-plot experiments. Function strip_split_plot also analyzes strip-split-plot experiments replicated at several locations.
Synopsis
#include <imsls.h>
float *imsls_f_strip_split_plot (int n, int n_locations, int n_strip_a, int n_strip_b, int n_split, int block[], int strip_a[], int strip_b[], int split[], float y[], …, 0)
The type double function is imsls_d_strip_split_plot.
Required Arguments
int n (Input)
Number of missing and non-missing experimental observations. imsls_f_strip_split_plot verifies that:
int n_locations (Input)
Number of locations. n_locations must be one or greater. If n_locations>1 then the optional array locations[] must be included as input to imsls_f_strip_split_plot.
int n_strip_a (Input)
Number of levels associated with the strip-plot A factor. n_strip_a must be greater than one.
int n_strip_b (Input)
Number of levels associated with the strip-plots B factor. n_strip_b must be greater than one.
int n_split (Input)
Number of levels associated with the split factor. n_split must be greater than one.
int block[] (Input)
An array of length n containing the block identifiers for each observation in y. Locations can have different numbers of blocks. Each block at a single location must be assigned a different identifier, but different locations can have the same assignments.
int strip_a[] (Input)
An array of length n containing the strip-plot A level identifiers for each observation in y. Each level of this factor must be assigned a different integer. imsls_f_strip_split_plot verifies that the number of unique strip-plot identifiers is equal to n_strip_a.
int strip_b[] (Input)
An array of length n containing the strip-plot B identifiers for each observation in y. Each level of this factor must be assigned a different integer. imsls_f_strip_split_plot verifies that the number of unique strip-plot identifiers is equal to n_strip_b.
int split[] (Input)
An array of length n containing the split-plot level identifiers for each observation in y. Each level of this factor must be assigned a different integer. imsls_f_strip_split_plot verifies that the number of unique split-plot identifiers is equal to n_split.
float y[] (Input)
An array of length n containing the experimental observations and any missing values. Missing values cannot be omitted. They are indicated by placing a NaN (not a number) in y. The NaN value can be set using either the function imsls_f_machine(6) or imsls_d_machine(6), depending upon whether single or double precision is being used, respectively. The location, strip-plot A, strip-plot B and split-plot for each observation in y are identified by the corresponding values in the argument’s locations, strip_a, strip_b, and split.
Return Value
Address of a pointer to the memory location of a two dimensional, 22 by 6 array containing the ANOVA table. Each row in this array contains values for one of the effects in the ANOVA table. The first value in each row, anova_tablei,0 = anova_table[i×6], identifies the source for the effect associated with values in that row. The remaining values in a row contain the ANOVA table values using the following convention:
j |
anova_tablei,j = anova_table[i*6+j] |
0 |
Source Identifier (values described below) |
1 |
Degrees of freedom |
2 |
Sum of squares |
3 |
Mean squares |
4 |
F-statistic |
5 |
p-value for this F-statistic |
The Source Identifiers in the first column of anova_tablei,j are the only negative values in anova_table[]. Note that the p-value for the F-statistic is returned as 0.0 when the value is so small that all significant digits have been lost. Assignments of identifiers to ANOVA sources use the following coding:
Source Identifier |
ANOVA Source |
-1 |
LOCATION† |
-2 |
BLOCKs WITHIN LOCATION |
-3 |
STRIP-PLOT A |
-4 |
LOCATION × STRIP-PLOT A † |
-5 |
STRIP-PLOT A ERROR |
-6 |
SPLIT-PLOT |
-7 |
SPLIT-PLOT × STRIP-PLOT A |
-8 |
LOCATION × SPLIT-PLOT † |
-9 |
SPLIT-PLOT ERROR |
-10 |
LOCATION × SPLIT-PLOT × STRIP-PLOT A † |
-11 |
STRIP-PLOT B |
-12 |
LOCATION × STRIP-PLOT B † |
-13 |
STRIP_PLOT B ERROR |
-14 |
STRIP-PLOT A × STRIP-PLOT B |
-15 |
LOCATION × STRIP-PLOT A × STRIP-PLOT B |
-16 |
STRIP-PLOT A × STRIP-PLOT B ERROR |
-17 |
SPLIT-PLOT × STRIP-PLOT B |
-18 |
STRIP-PLOT A × STRIP-PLOT B × SPLIT-PLOT |
-19 |
LOCATION × SPLIT-PLOT × STRIP-PLOT B † |
-20 |
LOCATION × STRIP-PLOT A × STRIP-PLOT B × SPLIT-PLOT † |
-21 |
STRIP-PLOT A × STRIP-PLOT B × SPLIT-PLOT ERROR |
-22 |
CORRECTED TOTAL |
Notes: † If n_locations=1 sources involving location are set to missing (NaN).
Synopsis with Optional Arguments
#include <imsl.h>
float *imsls_f_strip_split_plot (int n, int n_locations,int n_strip_a, int n_strip_b, int n_split, int block[], int strip_a[], int strip_b[], int split[], float y[],
IMSLS_RETURN_USER, float anova_table[],
IMSLS_LOCATIONS, int locations[],
IMSLS_N_MISSING, int *n_missing,
IMSLS_CV, float **cv,
IMSLS_CV_USER, float cv[],
IMSLS_GRAND_MEAN, float *grand_mean,
IMSLS_STRIP_PLOT_A_MEANS, float **strip_plot_a_means,
IMSLS_STRIP_PLOT_A_MEANS_USER, float strip_plot_a_means[],
IMSLS_STRIP_PLOT_B_MEANS, float **strip_plot_b_means,
IMSLS_STRIP_PLOT_B_MEANS_USER, float strip_plot_b_means[],
IMSLS_SPLIT_PLOT_MEANS, float **split_plot_means,
IMSLS_SPLIT_PLOT_MEANS_USER, float split_plot_means[],
IMSLS_STRIP_PLOT_AB_MEANS, float **strip_plot_ab_means,
IMSLS_STRIP_PLOT_AB_MEANS_USER, float strip_plot_ab_means[],
IMSLS_STRIP_PLOT_A_SPLIT_PLOT_MEANS, float **strip_plot_a_split_plot_means,
IMSLS_STRIP_PLOT_A_SPLIT_PLOT_MEANS_USER, float strip_plot_a_split_plot_means[],
IMSLS_STRIP_PLOT_B_SPLIT_PLOT_MEANS, float **strip_plot_b_split_plot_means,
IMSLS_STRIP_PLOT_B_SPLIT_PLOT_MEANS_USER, float strip_plot_b_split_plot_means[],
IMSLS_TREATMENT_MEANS, float **treatment_means,
IMSLS_TREATMENT_MEANS_USER, float treatment_means[],
IMSLS_STD_ERRORS, float **std_err,
IMSLS_STD_ERRORS_USER, float std_err[],
IMSLS_N_BLOCKS, int **n_blocks,
IMSLS_N_BLOCKS_USER, int n_blocks[],
IMSLS_LOCATION_ANOVA_TABLE, float **location_anova_table,
IMSLS_LOCATION_ANOVA_TABLE_USER, float location_anova_table[],
IMSLS_ANOVA_ROW_LABELS, char ***anova_row_labels,
IMSLS_ANOVA_ROW_LABELS_USER, char *anova_row_labels[],
0)
Optional Arguments
IMSLS_RETURN_USER, float anova_table[] (Output)
User defined array of length 132 for storage of the 22 by 6 anova table described as the return argument for imsls_f_strip_split_plot. For a detailed description of the format for this table, see the previous description of the return arguments for imsls_f_strip_split_plot.
IMSLS_LOCATIONS, int locations[] (Input)
An array of length n containing the location identifiers for each observation in y. Unique integers must be assigned to each location in the study. This argument is required when n_locations>1.
IMSLS_N_MISSING, int *n_missing (Output)
Number of missing values, if any, found in y. Missing values are denoted with a NaN (Not a Number) value.
IMSLS_CV, float **cv (Output)
Address of a pointer to an internally allocated array of length 3 containing the strip-plots and split-plot coefficients of variation. cv[0] contains the strip-plot A C.V., cv[1] contains the strip-plot B C.V., and cv[2] contains the split-plot C.V.
IMSLS_CV_USER, float cv[] (Output)
Storage for the array cv, provided by the user.
IMSLS_GRAND_MEAN, float *grand_mean (Output)
Mean of all the data across every location.
IMSLS_STRIP_PLOT_A_MEANS, float **strip_plot_a_means (Output)
Address of a pointer to an internally allocated array of length n_strip_a containing the factor A strip-plot means.
IMSLS_STRIP_PLOT_A_MEANS_USER, float strip_plot_a_means[] (Output)
Storage for the array strip_plot_a_means, provided by the user.
IMSLS_STRIP_PLOT_B_MEANS, float **strip_plot_b_means (Output)
Address of a pointer to an internally allocated array of length n_strip_b containing the strip-plot B means.
IMSLS_STRIP_PLOT_B_MEANS_USER, float strip_plot_b_means[] (Output)
Storage for the array strip_plot_b_means, provided by the user.
IMSLS_SPLIT_PLOT_MEANS, float **split_plot_means (Output)
Address of a pointer to an internally allocated array of length n_split containing the strip-plot B means.
IMSLS_SPLIT_PLOT_MEANS_USER, float split_plot_means[] (Output)
Storage for the array split_plot_means, provided by the user.
IMSLS_STRIP_PLOT_A_SPLIT_PLOT_MEANS, float **strip_plot_a_split_plot_means (Output)
Address of a pointer to an internally allocated 2-dimensional array of size n_strip_a by n_split containing the means for all combinations of the factor A strip-plot and split-plots.
IMSLS_STRIP_PLOT_A_SPLIT_PLOT_MEANS_USER, float strip_plot_a_split_plot_means[] (Output)
Storage for the array strip_a_split_plot_means, provided by the user.
IMSLS_STRIP_PLOT_B_SPLIT_PLOT_MEANS, float **strip_plot_b_split_plot_means (Output)
Address of a pointer to an internally allocated 2-dimensional array of size n_strip_b by n_split containing the means for all combinations of strip-plot B and split-plots.
IMSLS_STRIP_B_PLOT_SPLIT_PLOT_MEANS_USER, float strip_plot_b_split_plot_means[] (Output)
Storage for the array strip_b_split_plot_means, provided by the user.
IMSLS_STRIP_PLOT_AB_MEANS, float **strip_plot_ab_means (Output)
Address of a pointer to an internally allocated 2-dimensional array of size n_strip_a by n_strip_b containing the means for all combinations of strip-plots.
IMSLS_STRIP_PLOT_AB_MEANS_USER, float strip_plot_ab_means[] (Output)
Storage for the array strip_plot_ab_means, provided by the user.
IMSLS_TREATMENT_MEANS, float **treatment_means (Output)
Address of a pointer to an internally allocated array of size (n_strip_a*n_strip_b*n_split) containing the treatment means. For i >0, j >0, and k >0, treatment_meansi,j,k = treatment_means (i‑1)*n_strip_b × n_split + (j‑1) × n_split + (k‑1)] contains the mean of the observations, averaged over all locations, blocks and replicates, for the i-th level of the factor A strip-plot, the j‑th level of the factor B strip-plot, and the k‑th level of the split-plot.
IMSLS_TREATMENT_MEANS_USER, float treatment_means[] (Output)
Storage for the array treatment_means, provided by the user.
IMSLS_STD_ERRORS, float **std_err (Output)
Address of a pointer to an internally allocated array of length 20 containing ten standard errors and their associated degrees of freedom. The standard errors are in the first 10 elements and their associated degrees of freedom are reported in std_err[10] through std_err[19].
Element |
Standard Error for Comparisons Between Two |
Degrees of Freedom |
std_err[0] |
Strip-Plot A Means |
std_err[10] |
std_err[1] |
Strip-Plot B Means |
std_err[11] |
std_err[2] |
Split-Plot Means |
std_err[12] |
std_err[3] |
Strip-Plot A Means at the same level of split-plots |
std_err[13] |
std_err[4] |
Strip-Plot A Means at the same level of strip-plot B |
std_err[14] |
std_err[5] |
Strip-Plot B Means at the same level of split-plots |
std_err[15] |
std_err[6] |
Strip-Plot B Means at the same level of strip-plot A |
std_err[16] |
std_err[7] |
Split-Plot Means at the same level of strip-plot A |
std_err[17] |
std_err[8] |
Split-Plot Means at the same level of strip-plot B |
std_err[18] |
std_err[9] |
Treatment Means (same strip-plot A, strip-plot B and split-plot) |
std_err[19] |
IMSLS_STD_ERRORS_USER, float std_err[] (Output)
Storage for the array std_err, provided by the user.
IMSLS_N_BLOCKS, int **n_blocks (Output)
Address of a pointer to an internally allocated array of length n_locations containing the number of blocks, or replicates, at each location. This value must be greater than one, n_blocks > 1.
IMSLS_N_BLOCKS_USER, int n_blocks[] (Output)
User provided storage for the array n_blocks.
IMSLS_LOCATION_ANOVA_TABLE, float **location_anova_table (Output)
Address of a pointer to an internally allocated 3-dimensional array of size n_locations by 22 by 6 containing the anova tables associated with each location. For each location, the 22 by 6 dimensional array corresponds to the anova table for that location. For example, location_anova_table[(i‑1)×132+(j-1)×6+(k-1)] contains the value in the k‑th column and j‑th row of the returned anova table for the i‑th location.
IMSLS_LOCATION_ANOVA_TABLE_USER, float anova_table[] (Output)
User provided storage for the array location_anova_table.
IMSLS_ANOVA_ROW_LABELS, char ***anova_row_labels (Output)
Address of a pointer to a pointer to an internally allocated array containing the labels for each of the n_anova rows of the returned ANOVA table. The label for the i‑th row of the ANOVA table can be printed with printf("%s", anova_row_labels[i]);
The memory associated with anova_row_labels can be freed with a single call to imsls_free(anova_row_labels).
IMSLS_ANOVA_ROW_LABELS_USER, char *anova_row_labels[] (Output)
Storage for the array anova_row_labels, provided by the user. The amount of space required will vary depending upon the number of factors and n_anova. An upperbound on the required memory is char *anova_row_labels[800].
Description
Function imsls_f_strip_split_plot is capable of analyzing a wide variety of strip-split plot experiments, also referred to as strip-strip plot experiments. By default, imsls_f_strip_split_plot assumes that both strip-plot factors, and split-plots are fixed effects, and the location effects, if any, are random effects. The nature of randomization used in an experiment determines analysis of the data. Two popular forms of randomization in strip-plot and split-plot experiments are illustrated in the following two figures. In both experiments, the strip-plot factor, factor A, has 4 levels that are randomly assigned to a block or field in four strips.
|
Factor A Strip-Plots |
||||
A2 |
A1 |
A4 |
A3 |
||
Strip Plots |
B3 |
A2B3 |
A1B3 |
A4B3 |
A3B3 |
B1 |
A2B1 |
A1B1 |
A4B1 |
A3B1 |
|
B2 |
A2B2 |
A1B2 |
A4B2 |
A3B2 |
In the strip-plot experiment, factor B, has 3 levels that are randomly assigned as strips across each of the four levels of factor A. In this case, factors A and B are completely crossed. The randomization applied to factor B is independent of the application of the strip-plots, factor A.
Contrast this to the randomization depicted in Table 2. In this split-plot experiment, the levels of factor B are nested within each level of factor A whole-plots. Factor B is randomized independently within each level of factor A. Unlike the strip-plot experiment, in the split-plot experiment different levels of factor B appear in the same row.
Whole-Plot Factor |
|||
A2 |
A1 |
A4 |
A3 |
A2B1 |
A1B3 |
A4B1 |
A3B2 |
A2B3 |
A1B1 |
A4B3 |
A3B1 |
A2B2 |
A1B2 |
A4B2 |
A3B2 |
A strip-split plot experiment is a strip-plot experiment with a third factor randomized within each level of strip-plot factor A, see Table 3. The third factor, referred to as the split-plot factor, is randomly assigned to experimental units within each level of strip-plot factor A. imsls_f_strip_split_plot analyzes strip-split plot experiments consisting of two strip-plot factors and one split-plot factor nested within strip-plot factors A and B.
Strip-split plot experiments are closely related to split-split plot experiments, see Table 4. The main difference between the two is that in strip-split plot experiments, the order of the levels for factor B are not applied randomly across factor A. Each level of factor B is constant across any row. In this example, the entire first row is assigned to the third level of factor B. In the equivalent split-split plot experiment, the levels of factor B are not constant across any row. The levels are randomized within each level of factor A.
In some studies, a strip-split-plot experiment is replicated at several locations. Function imsls_f_strip_split_plot can analyze strip-split plot experiments replicated at multiple locations, even when the number of blocks or replicates at each location might be different. If only a single replicate or block is used at each location, then location should be treated as a blocking factor, with n_locations=1. If n_locations=1, it is assumed that either the experiment was conducted at multiple locations, each with a single block, or at a single location with more than one block or replicate at that location. When n_locations=1, all entries associated with location in the anova table will contain missing values.
However, if n_locations>1, it is assumed the experiment was repeated at multiple locations, with blocking occurring at each location. Although the number of blocks at each location can be different, the number of levels for the strip-plot and split-plot factors strip-plots must be the same at each location. The locations associated with each of the observations in y are specified in the argument locations[], which is a required input argument when n_locations>1.
By default, locations are assumed to be random effects. Tests involving strip-plots use the interaction between strip-plots and locations as the error term for testing whether there are statistically significant differences among strip-plots. However, this assumes that the interaction of strip-plots and locations is not statistically significant. A test of this assumption is included in the anova table. If any interactions between locations and strip-plot or split-plot factors are statistically significant, then the nature of these interactions should be explored since this impacts the interpretation of the significance of the treatment factors.
Similarly, when locations are assumed to be random effects, tests involving split-plots do not use the split-plot errors pooled across locations. Instead, the error term for split-plots is the interaction between locations and split-plots.
Suppose, for example, that a researcher wanted to conduct an agricultural experiment comparing the effectiveness of 4 fertilizers with 3 seed lots and 3 rates of application. One replicate of the experiment is conducted at each of the 3 farms. That is, only a single field at each location is assigned to this experiment.
Each field is divided into 4 vertical strips and 3 horizontal strips. The vertical strips are randomly assigned to fertilizers and the rows are randomly assigned to application rates. Fertilizers and application rates represent strip-plot factors A and B respectively. Seed lots are randomly assigned to three sub-divisions within each combination of strip-plots.
|
Fertilizer Strip Plots |
||||
F2 |
F1 |
F4 |
F3 |
||
Strip Plot |
R3 |
F2R3S1 |
F1R3S3 |
F4R3S3 |
F3R3S2 |
R2 |
F2R1S3 |
F1R1S2 |
F4R1S3 |
F3R1S1 |
|
R1 |
F2R2S1 |
F1R2S1 |
F4R2S2 |
F3R2S3 |
In this case, each farm is a blocking factor, fertilizers are factor A strip-plots, fertilizer application rates are factor B strip-plots, and seed lots are split-plots. The input array rep would contain integers from 1 to the number of farms.
Example
The experiment was conducted using a 2 x 2 strip_split plot arrangement with each of the four plots divided into 2 sub-divisions that were randomly assigned one of two split-plot levels. This was replicated 3 times producing an experiment with n = 2x2x2x3 = 24 observations.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <imsls.h>
void l_printLSD(int n1, int *equalMeans, float *means);
void l_printLSD2Table(int n1, int n2, int* equalMeans, float *means);
void l_printLSD3Table(int n1, int n2, int n3, int* equalMeans,
float *means);
int main()
{
char **anova_row_labels;
char *col_labels[] = {" ", "\nID", "\nDF", "\nSSQ",
"Mean\nsquares", "\nF", "\np-value"};
int i, j, k, l, page_width = 132;
int n = 24; /* Total number of observations */
int n_locations = 1; /* Number of locations */
int n_strip_a = 2; /* Number of Factor A strip-plots within a
location */
int n_strip_b = 2; /* Number of Factor B strip-plots within a
location */
int n_split = 2; /* Number of split-plots within each Factor
A strip-plot */
int block[]={
1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 3, 3, 3
};
int strip_a[]={
1, 1, 1, 1, 2, 2, 2, 2,
1, 1, 1, 1, 2, 2, 2, 2,
1, 1, 1, 1, 2, 2, 2, 2
};
int strip_b[]={
1, 1, 2, 2, 1, 1, 2, 2,
1, 1, 2, 2, 1, 1, 2, 2,
1, 1, 2, 2, 1, 1, 2, 2
};
int split[]={
1, 2, 1, 2, 1, 2, 1, 2,
1, 2, 1, 2, 1, 2, 1, 2,
1, 2, 1, 2, 1, 2, 1, 2
};
float y[] ={
30.0, 40.0, 38.9, 38.2,
41.8, 52.2, 54.8, 58.2,
20.5, 26.9, 21.4, 25.1,
26.4, 36.7, 28.9, 35.9,
21.0, 25.4, 24.0, 23.3,
34.4, 41.0, 33.0, 34.9
};
float alpha = 0.05;
float grand_mean = 0;
float *cv;
float *aov;
float *treatment_means;
float *strip_plot_a_means;
float *strip_plot_b_means;
float *split_plot_means;
float *strip_a_split_plot_means;
float *strip_b_split_plot_means;
float *strip_plot_ab_means;
float *std_err;
int *equal_means;
aov = imsls_f_strip_split_plot(n, n_locations, n_strip_a,
n_strip_b, n_split, block, strip_a, strip_b, split, y,
IMSLS_GRAND_MEAN, &grand_mean,
IMSLS_CV, &cv,
IMSLS_TREATMENT_MEANS, &treatment_means,
IMSLS_STRIP_PLOT_A_MEANS, &strip_plot_a_means,
IMSLS_STRIP_PLOT_B_MEANS, &strip_plot_b_means,
IMSLS_SPLIT_PLOT_MEANS, &split_plot_means,
IMSLS_STRIP_PLOT_A_SPLIT_PLOT_MEANS, &strip_a_split_plot_means,
IMSLS_STRIP_PLOT_B_SPLIT_PLOT_MEANS, &strip_b_split_plot_means,
IMSLS_STRIP_PLOT_AB_MEANS, &strip_plot_ab_means,
IMSLS_STD_ERRORS, &std_err,
IMSLS_ANOVA_ROW_LABELS, &anova_row_labels,
0);
/* Output results. */
imsls_page(IMSLS_SET_PAGE_WIDTH, &page_width);
/* Print ANOVA table, without first column. */
imsls_f_write_matrix(" *** ANALYSIS OF VARIANCE TABLE ***",
22, 6, aov,
IMSLS_WRITE_FORMAT, "%3.0f%3.0f%8.2f%7.2f%7.2f%7.3f",
IMSLS_ROW_LABELS, anova_row_labels,
IMSLS_COL_LABELS, col_labels,
0);
/*
* Print the various means.
*/
printf("\nGrand mean: %f\n\n", grand_mean);
printf("Coefficient of Variation\n");
printf(" Strip-Plot A: %9.4f\n", cv[0]);
printf(" Strip-Plot B: %9.4f\n", cv[1]);
printf(" Split-Plot: %9.4f\n\n", cv[2]);
l = 0;
/*
* Print the Treatment Means.
*/
printf("\n\n**********************************************");
printf("***************");
printf("\nTreatment Means\n");
for (i=0; i < n_strip_a; i++){
for(j=0; j < n_strip_b; j++){
for(k=0; k < n_split; k++){
printf("treatment[%d][%d][%d] %9.4f \n",
i+1, j+1, k+1, treatment_means[l++]);
}
}
}
printf("\nStandard Error for Comparing Two Treatment Means: ");
printf("%f \n(df=%f)\n", std_err[9], std_err[19]);
equal_means = imsls_f_multiple_comparisons(
n_strip_a*n_strip_b*n_split,
treatment_means, (int) std_err[19],
std_err[9]/sqrt(2.0),
IMSLS_LSD,
IMSLS_ALPHA, alpha,
0);
l_printLSD3Table(n_strip_a, n_strip_b, n_split, equal_means,
treatment_means);
/*
* Print the Strip-plot A Means.
*/
printf("\n\n*****************************************************");
printf("********");
imsls_f_write_matrix("Strip-plot A Means", n_strip_a, 1,
strip_plot_a_means, 0);
printf("\nStandard Error for Comparing Two Strip-Plot A Means: ");
printf("%f \n(df=%f)\n",
std_err[0], std_err[10]);
equal_means = imsls_f_multiple_comparisons(n_strip_a,
strip_plot_a_means, (int) std_err[10], std_err[0]/sqrt(2.0),
IMSLS_LSD,
IMSLS_ALPHA, alpha,
0);
l_printLSD(n_strip_a, equal_means, strip_plot_a_means);
/*
* Print Strip-plot B Means.
*/
printf("\n\n****************************************************");
printf("*********");
imsls_f_write_matrix("Strip-plot B Means", n_strip_b, 1,
strip_plot_b_means, 0);
printf("\nStandard Error for Comparing Two Strip-Plot B Means: ");
printf("%f \n(df=%f)\n", std_err[1], std_err[11]);
equal_means = imsls_f_multiple_comparisons(n_strip_b,
strip_plot_b_means,
(int) std_err[11], std_err[1]/sqrt(2.0),
IMSLS_LSD,
IMSLS_ALPHA, alpha,
0);
l_printLSD(n_strip_b, equal_means, strip_plot_b_means);
/*
* Print the Split-plot Means.
*/
printf("\n\n****************************************************");
printf("*********");
imsls_f_write_matrix("Split-plot Means", n_split, 1,
split_plot_means, 0);
printf("\nStandard Error for Comparing Two Split-Plot Means: ");
printf("%f \n(df=%f)\n", std_err[2], std_err[12]);
equal_means = imsls_f_multiple_comparisons(n_split,
split_plot_means,
(int) std_err[12], std_err[2]/sqrt(2.0),
IMSLS_LSD,
IMSLS_ALPHA, alpha,
0);
l_printLSD(n_split, equal_means, split_plot_means);
/*
* Print the Strip-plot A by Split-plot Means.
*/
printf("\n\n***************************************************");
printf("**********");
imsls_f_write_matrix("Strip-plot A by Split-plot Means",
n_strip_a, n_split, strip_a_split_plot_means, 0);
printf("\nStandard Error for Comparing Two Means: %f \n(df=%f)\n",
std_err[3], std_err[13]);
equal_means = imsls_f_multiple_comparisons(n_strip_a*n_split,
strip_a_split_plot_means,
(int) std_err[13],
std_err[3]/sqrt(2.0),
IMSLS_LSD,
IMSLS_ALPHA, alpha,
0);
l_printLSD2Table(n_strip_a, n_split, equal_means,
strip_a_split_plot_means);
/*
* Print the Strip-plot A by Strip-plot B Means.
*/
printf("\n\n****************************************************");
printf("*********");
imsls_f_write_matrix("Strip-plot A by Strip-plot B Means",
n_strip_a, n_strip_b, strip_plot_ab_means, 0);
printf("\nStandard Error for Comparing Two Means: %f \n(df=%f)\n",
std_err[4], std_err[14]);
equal_means = imsls_f_multiple_comparisons(n_strip_a*n_strip_b,
strip_plot_ab_means, (int) std_err[14],
std_err[4]/sqrt(2.0),
IMSLS_LSD,
IMSLS_ALPHA, alpha,
0);
l_printLSD2Table(n_strip_a, n_strip_b, equal_means,
strip_plot_ab_means);
/*
* Print the Strip-Plot B by Split-Plot Means.
*/
printf("\n\n****************************************************");
printf("*********");
imsls_f_write_matrix("Strip-Plot B by Split-Plot Means", n_strip_b,
n_split, strip_b_split_plot_means, 0);
printf("\nStandard Error for Comparing Two Means: %f \n(df=%f)\n",
std_err[5], std_err[15]);
equal_means = imsls_f_multiple_comparisons(n_strip_b*n_split,
strip_b_split_plot_means,
(int) std_err[15], std_err[5]/sqrt(2.0),
IMSLS_LSD,
IMSLS_ALPHA, alpha,
0);
l_printLSD2Table(n_strip_b, n_split, equal_means,
strip_b_split_plot_means);
}
/*
* Local functions to output results of means comparisons.
*/
void l_printLSD(int n, int *equalMeans, float *means){
float x=0.0;
int i, j, k;
int iSwitch;
int *idx;
idx = (int *) malloc(n * sizeof (int));
for (k=0; k < n; k++) {
idx[k] =k+1;
}
/* Sort means in ascending order*/
iSwitch=1;
while (iSwitch != 0){
iSwitch = 0;
for (i = 0; i < n-1; i++){
if (means[i] > means[i+1]){
iSwitch = 1;
x = means[i];
means[i] = means[i+1];
means[i+1] = x;
j = idx[i];
idx[i] = idx[i+1];
idx[i+1] = j;
}
}
}
printf("[group] \t Mean \t\tLSD Grouping \n");
for (i=0; i < n; i++){
printf(" [%d] \t\t%f", idx[i], means[i]);
for (j=1; j < i+1; j++){
if(equalMeans[j-1] >= i+2-j){
printf("\t *");
}else{
if(equalMeans[j-1]>=0) printf("\t");
}
}
if (i < n-1 && equalMeans[i]>0) printf("\t *");
printf("\n");
}
free(idx);
return;
}
void l_printLSD2Table(int n1, int n2, int *equalMeans, float *means){
float x=0.0;
int i, j, k, n;
int iSwitch;
int *idx;
n = n1*n2;
idx = (int *) malloc(2*n * sizeof (int));
i = 1;
j = 1;
for (k=0; k < n; k++) {
idx[2*k] = i;
idx[2*k+1] = j++;
if (j > n2){
j = 1;
i++;
}
}
/* sort means in ascending order*/
iSwitch=1;
while (iSwitch != 0){
iSwitch = 0;
for (i = 0; i < n-1; i++){
if (means[i] > means[i+1]){
iSwitch = 1;
x = means[i];
means[i] = means[i+1];
means[i+1] = x;
j = idx[2*i];
idx[2*i] = idx[2*(i+1)];
idx[2*(i+1)] = j;
j = idx[2*i+1];
idx[2*i+1] = idx[2*(i+1)+1];
idx[2*(i+1)+1] = j;
}
}
}
printf("[A][B] \tMean \t\tLSD Grouping \n");
for (i=0; i < n; i++){
printf("[%d][%d] \t%f", idx[2*i], idx[2*i+1],means[i]);
for (j=1; j < i+1; j++){
if(equalMeans[j-1] >= i+2-j){
printf("\t*");
}else{
if(equalMeans[j-1]>0) printf("\t");
}
}
if (i < n-1 && equalMeans[i]>0) printf("\t*");
printf("\n");
}
free(idx);
idx = NULL;
return;
}
void l_printLSD3Table(int n1, int n2, int n3, int *equalMeans,
float *means)
{
float x=0.0;
int i, j, k, m, n;
int iSwitch;
int *idx;
n = n1*n2*n3;
idx = (int *) malloc(3*n * sizeof (int));
i = 1;
j = 1;
k = 1;
for (m=0; m < n; m++) {
idx[3*m] = i;
idx[3*m+1] = j;
idx[3*m+2] = k++;
if (k > n3){
k = 1;
j++;
if (j > n2){
j = 1;
i++;
}
}
}
/* sort means in ascending order*/
iSwitch=1;
while (iSwitch != 0){
iSwitch = 0;
for (i = 0; i < n-1; i++){
if (means[i] > means[i+1]){
iSwitch = 1;
x = means[i];
means[i] = means[i+1];
means[i+1] = x;
j = idx[3*i];
idx[3*i] = idx[3*(i+1)];
idx[3*(i+1)] = j;
j = idx[3*i+1];
idx[3*i+1] = idx[3*(i+1)+1];
idx[3*(i+1)+1] = j;
j = idx[3*i+2];
idx[3*i+2] = idx[3*(i+1)+2];
idx[3*(i+1)+2] = j;
}
}
}
printf("[A][B][Split] \t Mean \t\t LSD Grouping \n");
for (i=0; i < n; i++){
printf("[%d][%d] [%d] \t%f", idx[3*i], idx[3*i+1], idx[3*i+2],
means[i]);
for (j=1; j < i+1; j++){
if(equalMeans[j-1] >= i+2-j){
printf("\t*");
}else{
if(equalMeans[j-1]>0) printf("\t");
}
}
if (i < n-1 && equalMeans[i]>0) printf("\t*");
printf("\n");
}
free(idx);
return;
}
Output
*** ANALYSIS OF VARIANCE TABLE ***
Mean
ID DF SSQ squares F p-value
Location .................... -1 ... ........ ....... ....... .......
Blocks ...................... -2 2 1310.28 655.14 14.53 0.061
Strip-Plot A ................ -3 1 858.01 858.01 40.37 0.024
Location x A ................ -4 ... ........ ....... ....... .......
Strip-Plot A Error .......... -5 2 42.51 21.26 1.48 0.385
Split-Plot .................. -6 1 163.80 163.80 41.22 0.003
Split-Plot x A .............. -7 1 11.34 11.34 2.85 0.166
Location x Split-Plot ....... -8 ... ........ ....... ....... .......
Split-Plot Error ............ -9 4 15.90 3.97 1.56 0.338
Location x Split-Plot x A ... -10 ... ........ ....... ....... .......
Strip-Plot B ................ -11 1 17.17 17.17 0.47 0.565
Location x B ................ -12 ... ........ ....... ....... .......
Strip-Plot B Error .......... -13 2 73.51 36.75 2.85 0.260
A x B ....................... -14 1 1.55 1.55 0.12 0.762
Location x A x B ............ -15 ... ........ ....... ....... .......
A x B Error ................. -16 2 25.82 12.91 5.08 0.080
Split-Plot x B .............. -17 1 46.76 46.76 18.39 0.013
Split-Plot x A x B .......... -18 1 0.51 0.51 0.20 0.677
Location x Split-Plot x B ... -19 ... ........ ....... ....... .......
Location x Split-Plot x A x B -20 ... ........ ....... ....... .......
Split-Plot x A x B Error .... -21 4 10.17 2.54 ....... .......
Corrected Total ............. -22 23 2577.33 ....... ....... .......
Grand mean: 33.870834
Coefficient of Variation
Strip-Plot A: 13.6116
Strip-Plot B: 17.8986
Split-Plot: 5.8854
*************************************************************
Treatment Means
treatment[1][1][1] 23.8333
treatment[1][1][2] 30.7667
treatment[1][2][1] 28.1000
treatment[1][2][2] 28.8667
treatment[2][1][1] 34.2000
treatment[2][1][2] 43.3000
treatment[2][2][1] 38.9000
treatment[2][2][2] 43.0000
Standard Error for Comparing Two Treatment Means: 1.302029
(df=4.000000)
[A][B][Split] Mean LSD Grouping
[1][1] [1] 23.833334
[1][2] [1] 28.100000 *
[1][2] [2] 28.866669 *
[1][1] [2] 30.766668 * *
[2][1] [1] 34.200001 *
[2][2] [1] 38.899998
[2][2] [2] 43.000000 *
[2][1] [2] 43.299999 *
*************************************************************
Strip-plot A Means
1 27.89
2 39.85
Standard Error for Comparing Two Strip-Plot A Means: 1.882171
(df=2.000000)
[group] Mean LSD Grouping
[1] 27.891665
[2] 39.849998
*************************************************************
Strip-plot B Means
1 33.03
2 34.72
Standard Error for Comparing Two Strip-Plot B Means: 2.474972
(df=2.000000)
[group] Mean LSD Grouping
[1] 33.025002 *
[2] 34.716667 *
*************************************************************
Split-plot Means
1 31.26
2 36.48
Standard Error for Comparing Two Split-Plot Means: 0.813813
(df=4.000000)
[group] Mean LSD Grouping
[1] 31.258331
[2] 36.483334
*************************************************************
Strip-plot A by Split-plot Means
1 2
1 25.97 29.82
2 36.55 43.15
Standard Error for Comparing Two Means: 1.150906
(df=4.000000)
[A][B] Mean LSD Grouping
[1][1] 25.966667
[1][2] 29.816668
[2][1] 36.549999
[2][2] 43.149998
*************************************************************
Strip-plot A by Strip-plot B Means
1 2
1 27.30 28.48
2 38.75 40.95
Standard Error for Comparing Two Means: 2.074280
(df=2.000000)
[A][B] Mean LSD Grouping
[1][1] 27.299997 *
[1][2] 28.483335 *
[2][1] 38.750000 *
[2][2] 40.949997 *
*************************************************************
Strip-Plot B by Split-Plot Means
1 2
1 29.02 37.03
2 33.50 35.93
Standard Error for Comparing Two Means: 0.920673
(df=4.000000)
[A][B] Mean LSD Grouping
[1][1] 29.016668
[2][1] 33.500000 *
[2][2] 35.933334 * *
[1][2] 37.033333 *