1 Completely Randomised Design with VST (Dowthyaksai Lagadapati, Vineeth Kolthuri Vijay, Rahul Vithalani)

Usage :

The Completely Randomized Design is a statistical experimental design used when the treatments or factors are assigned to the experimental units randomly. This design is particularly useful when you want to investigate the effects of various treatments or factors without any specific structure. VST (Variance-Stabilizing Transformation) is sometimes used when the variances don’t appear to be constant.

1.1 Assumptions :

  • Homogeneity of Variance: The variance of the response variable is consistent across treatment groups, ensuring valid statistical comparisons.

  • Random assignment: Assign subjects or units to treatment groups randomly to reduce bias and ensure equal chances for each unit.

  • Independence: Ensure that each subject or unit’s outcome is independent of others by random assignment.

  • Normality: A roughly normal distribution of the response variable within each treatment group, with options for handling non-normal data if needed.

  • Equal Sample Sizes: While it’s often assumed that sample sizes are equal in a Completely Randomized Design, statistical methods can accommodate unequal sizes also.

1.2 Process:

1.2.1 Sample Size Determination:

Determining the sample size for a Completely Randomized Design (CRD) with Variance-Stabilizing Transformation (VST) involves several essential steps. First, clarify your research objectives and decide on the significance level, expected variability desired statistical power, and effect size. Choose the appropriate statistical test for your CRD with VST and calculate the sample size using the relevant formulae or software. Account for potential attrition, round up to the nearest whole number and ensure ethical and practical feasibility. Conduct pilot studies, if possible, to refine estimates, and seek expert validation. A well-considered sample size is crucial for reliable and meaningful study results, avoiding both underpowered and excessively large samples. Careful planning is key to achieving an appropriate sample size for your study.

we can also determine the sample size by in R using the parameters if variances are known.

power.anova.test(groups = NULL, n = NULL,between.var = NULL, within.var = NULL, sig.level = 0.05, power = NULL)

If the variances are not known we use pwr.anova.test to find the sample size.

pwr.anova.test(k = NULL, n = NULL, f = NULL, sig.level = 0.05, power = NULL)

1.2.2 Design Layout:

Designing a Completely Randomized Design (CRD) layout with Variance-Stabilizing Transformation (VST) involves several key steps. Initially, identify your experimental units and define treatment groups. Randomly assign subjects to treatments to minimize bias, ensuring equal opportunities for each unit. Replicate treatments for robust results and plan data collection, specifying measurements and timing. Incorporate VST if needed and establish a systematic data recording process associated with treatment groups and units. Control randomization, address order effects, manage logistics, and account for confounding variables. Consider pilot testing to refine the layout, maintain thorough documentation for transparency, and ensure compliance with ethical and regulatory standards, particularly when dealing with human or animal subjects.

#Layout for CRD with VST
library(agricolae)
output<-function(levels,replication){
  out<-design.crd(levels,replication)$book
  out<-out[order(out$levels), ]
  write.csv(out,"layout.csv")}
Input<-function(path){
  ind<-read.csv(path)
  ind<-ind[,4:5]
  colnames(ind)<-c("levels","response")
  ind}
##


## Design layout 
levels<-c("P1","P2")
replication<-5
output(levels,replication) #open layout.csv, add column with response, and save file

we can manipulate the data or create an aditional solumn to the file and save it.

1.2.3 Collect Data:

Conduct the experiments and record the responses for each treatment group. 

Add the response data to a CSV file using the InDesign function. This function ensures the data is properly formatted for analysis. 

we can also manually enter the data by typing or reading a csv file.

1.2.4 Preliminary Plots:

Plots for data with 2 populations and stable variance:

Plots for data with 3 populations and unstable variance:

1.2.5 Statistical Tests:

Perform a suitable statistical test to analyze the data. For a Completely Randomized Design, you can use analysis of variance (ANOVA) to assess the treatment effects and determine if there are significant differences among the treatment groups.

Fixed Effects:

The factors or treatments that are of particular importance to the study are modeled using fixed effects. These elements are regarded as constant and not subject to change. They stand for degrees of a categorical variable, such as various treatment modalities or interventions.

When to Apply:

  • Use fixed effects when your primary interest is in a small number of distinct treatment levels or groups.

  • Fixed effects are ideal when you want to assess the effects of these levels exactly and you want to compare these levels in a specified way.

Hypothesis :

Null Hypothesis : \(H_{0} = \tau_{i}\) = 0 \(\forall\) i

Alternate Hypothesis : \(H_{a} = \tau_{i} \neq \exists\) i

In a CRD with fixed effects, the general linear model can be represented as : \(Y_{ij} = \mu + \tau_{i} + \epsilon_{ij}\)

where

  • \(Y_{ij}\) represents the observed response for the j th observation in the i th treatment group.

  • \(\mu\) is the overall population mean.

  • \(\tau_i\) represents the effect of the i th treatment group.

  • \(\epsilon_{ij}\) is the random error term.

Random Effects:

When modeling elements or groups that are not the focus of the study but are thought to have been randomly picked from a wider population, random effects are used. These elements serve as a source of random variability that is unrelated to the study’s main objective.

When to Apply:

  • When you have many levels or categories within a factor and you want to simulate the variability associated with these levels, use random effects.

  • When you want to account for the intrinsic variability within these levels and think these levels are a random sampling from a broader population, random effects are appropriate.

In a CRD with random effects, the general linear model can be represented as:

\(Y_{ij} = \mu + \tau_{i} + \epsilon_{ij}\)

Hypothesis:

\(H_{0} : \sigma_{\tau i} = 0\) , \(\forall\) i

\(H_{a}: \sigma_{\tau i} \neq 0\) , \(\exists\) i

A Completely Randomized Design (CRD) is a common experimental design used in statistical analysis, and Variance Stabilizing Transformations (VST) can be applied to address issues related to non-constant variance and non-normality. Below, I’ll outline the main formulas typically used when applying VST to CRD:

ANOVA table:

Source Sum of Square  Degree of freedom  Mean Square  F-distribution 
Treatment \(SSTr = n\sum(\overline{y_{i.}} - \overline{y_{..}})^2\) k-1 MSTr=SSTr/I-1 F= MSTr/MSE
Error \(SSE = \sum\sum(y_{ij} - \overline{y_{i.}})^2\) n -I MSE=SSE/I(J-I)
Total \(SST = \sum\sum(y_{ij} - \overline{y_{..}})^2\) N-1 or nk-1

SST represents the total variability in the data.

SSTR represents the variability between treatment groups.

SSE represents the unexplained variability or residual variation within treatment groups. 

The Grand Mean : \(\overline y_{..}\) = \(\sum\sum \frac{y_{ij}}{N}\)

where

  • \(\overline y_{..}\) is the grand mean of all observations. 

  • N is the total number of observations. 

  • \(y_{ij}\)  is the j th observation in the i th treatment group. 

The Sum of Squares Total (SST): SST= \(\sum_{i=1}^{k}\sum_{j=1}^{n}(y_{ij} - \overline{y}..)^2\)

where

  • k is the number of treatment groups.

  • n is the number of observations in each group.

The Sum of Squares Treatment (SSTR): \(SSTr = n\sum(\overline{y_{i.}} - \overline{y_{..}})^2\)

The Sum of Squares Error (SSE): SSE = SST − SSTr 

Mean squares = Sum of Squares /degrees of freedom.

  • The F-statistic : F= MSTr / MSE

  • P-value : The p-value is determined from the F-distribution with degrees of freedom for Treatment and degrees of freedom for Error , using the F-statistic. 

After performing the analysis of variance (ANOVA) on the transformed data, you may obtain an F-statistic and a corresponding p-value. These values will help you determine whether there are significant differences between the treatment groups in the CRD. If significant differences are detected, you can make inferences about the impact of the treatments on the response variable. 

If the variances are not stable or the data is not normal, specific VST applied to the data will depend on the nature of the data and the transformation needed to meet the assumptions of ANOVA. The formulas listed above are fundamental for conducting the analysis in a CRD with VST, but the choice of transformation and related equations may vary depending on the specific transformation used (e.g., square root, logarithmic, or Box-Cox). 

Transformations:

Logarithmic Transformation:

When to Use: When data shows exponential or multiplicative growth, logarithmic transformations are frequently utilized. For instance, a log transformation can assist in linearizing the relationship and stabilizing variance when researching the effects of financial variables or the proliferation of microorganisms.

Box-Cox Transformation:

When to Use: Because of normality or constant variance assumptions its adaptability, the Box-Cox transformation can be applied to data that doesn’t adhere to the assumptions of normality or constant variance. The best power transformation for your data can be found by calculating the lambda () value.

Transformation by the square root:

When to Use: When the variance of the data rises with the mean, a square root transformation can be applied. This is frequently seen in count statistics, such as the quantity of flaws in production processes

1.2.6 Residuals:

In a Completely Randomized Design (CRD) with Variance-Stabilizing Transformation (VST), VST or non-parametric methods are often necessary in the presence of data characteristics like unequal variances, non-normality, outliers, small sample sizes, non-continuous data, or the need for robustness. VST helps address unequal variances and non-normality, while non-parametric methods are suitable for non-continuous or small sample data. These approaches ensure valid and reliable statistical analysis, even when traditional parametric assumptions are not met. The choice between VST and non-parametric methods depends on the data nature and study goals.

1.2.7 Inference:

Inference in a Completely Randomized Design (CRD) with Variance-Stabilizing Transformation (VST) involves a structured process for drawing conclusions from experimental data. It begins with data analysis, typically using ANOVA, while considering the application of VST to stabilize variance. Hypotheses are formulated, and a significance level is chosen to determine the probability of Type I errors. The appropriate statistical test provides a p-value, aiding in assessing statistical significance. Post-hoc tests may identify specific group differences, and effect size measures quantify the magnitude of these differences. Confidence intervals can offer parameter estimates. Residual analysis ensures model fit and assumption adherence. Interpretation is based on p-values, followed by assessing practical significance. Findings are clearly communicated in research reports or presentations. The process concludes with discussions on limitations and future research directions, emphasizing the importance of meaningful interpretation and communication in the scientific process.

1.2.8 Multiple Comparisons:

In a Completely Randomized Design (CRD) with Variance-Stabilizing Transformation (VST) involving more than two treatment groups, you can conduct multiple comparisons to pinpoint significant differences. Start with an initial ANOVA to confirm group distinctions. If ANOVA shows significance, select an appropriate multiple comparison test such as Tukey’s HSD, Bonferroni, Duncan’s Multiple Range Test, or Scheffé’s Method. Execute the chosen test to identify which specific treatment groups differ significantly. Interpret results based on p-values or confidence intervals and report these findings clearly, but be mindful of the increased risk of Type I errors and select your method and significance level with care, considering your study’s goals and data characteristics.

1.3 Example:

The source of the example is “Design and Analysis of Experiments textbook by D.C. Montgomery (8th ed.) Problem 3.29 (pg-135).

Q) A semiconductor manufacturer has developed three different methods for reducing particle counts on wafers. All three methods are tested on five different wafers and the after treatment particle count obtained. The data are shown below:

  • Do all methods have the same effect on mean particle count?

  • Plot the residuals versus the predicted response. Construct a normal probability plot of the residuals. Are there potential concerns about the validity of the assumptions?

  • Based on your answer to part (b) conduct another analysis of the particle count data and draw appropriate conclusions.

Answer :

a)

Reading the data:

count <- c(31, 10, 21, 4, 1, 62, 40, 24, 30, 35, 53, 27, 120, 97, 68)
method <- c(rep(1,5), rep(2,5), rep(3,5))
method <- as.factor(method)
dat <- data.frame(count,method)
str(dat)
## 'data.frame':    15 obs. of  2 variables:
##  $ count : num  31 10 21 4 1 62 40 24 30 35 ...
##  $ method: Factor w/ 3 levels "1","2","3": 1 1 1 1 1 2 2 2 2 2 ...

Hypothesis we are testing:

Null Hypothesis:

\[ H_{0} : \mu_{1} = \mu_{2} = \mu_{3} = \mu \]

Alternate Hypothesis:

\[ H_{a} : \mu{i} \neq \mu , \exists i=1,2,3 \]

Performing analysis of Variance:

model1<-aov(count~method,data=dat)
summary(model1)
##             Df Sum Sq Mean Sq F value  Pr(>F)   
## method       2   8964    4482   7.914 0.00643 **
## Residuals   12   6796     566                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

As our p-value is 0.00643 < 0.05(\(\alpha\)), we reject null hypothesis that all the means are equal and conclude that atleast one mean differ and all the methods doesn’t have same effect on mean particle count.

b)

Residual Plots:

library(ggfortify)
autoplot(model1)

From the Normal probability plot(NQQ) we can observe that the data appear to be fairly normal. But, if we observe residuals vs fitted plot, we can see that the variance doesn’t appear to be constant. i.e, the spread of the three populations isn’t constant.

Now, we need to transform the data to obtain approximate results.

C)

library(MASS)
boxplot(count~method,xlab="Method Type",ylab="Particle Count",main="Boxplot of Observations")

This boxplot confirms the unstable variances across the 3 given populations. We will use BoxCox transformation to stabilise the variances.

boxcox(count~method)

Here we can see that \(\lambda\) = 1 is outside the confidence interval(span between the left and right lines among the three) and the likelihood function(middle line) is around 0.4(lambda). So, we perform the transformation on count at \(\lambda\) = 0.4 and see the changes.

lambda <-  0.4
trans.count <- count^(lambda)
boxcox(trans.count~method)

boxplot(trans.count~method, xlab="Method Type",ylab="Particle Count",main="Boxplot of Observations")

From the boxplot we can see that the variance spread across all the populations is fairly constant than that of before the transfrmation (observe the values in y-axis). From the BoxCox we can see that \(\lambda\) = 1 lies within the confidence interval. So, the ANOVA test will now be valid after the transformation.

Performing ANOVA on Transformed data:

trans.dat <- data.frame(trans.count,method)
trans.dat$method <- as.factor(trans.dat$method)
str(trans.dat)
## 'data.frame':    15 obs. of  2 variables:
##  $ trans.count: num  3.95 2.51 3.38 1.74 1 ...
##  $ method     : Factor w/ 3 levels "1","2","3": 1 1 1 1 1 2 2 2 2 2 ...
#anova
model2<-aov(trans.count~method,data=trans.dat)
summary(model2)
##             Df Sum Sq Mean Sq F value  Pr(>F)   
## method       2  21.21  10.605   9.881 0.00291 **
## Residuals   12  12.88   1.073                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
autoplot(model2)

After the transformation the assumptions of ANOVA (normality and constant variance) are satisfied. From the summary we find that the p-value for the transformed data is 0.00291 < 0.05(\(\alpha\)). So, we reject null hypothesis ans conclude that all methods doesn’t have same effect on mean particle count. Atleast one method has different effect.

1.4 Code:

#a)
count <- c(31, 10, 21, 4, 1, 62, 40, 24, 30, 35, 53, 27, 120, 97, 68)
method <- c(rep(1,5), rep(2,5), rep(3,5))
method <- as.factor(method)
dat <- data.frame(count,method)
str(dat)

model1<-aov(count~method,data=dat)
summary(model1)

#b)
library(ggfortify)
autoplot(model1)

#c)
library(MASS)
boxplot(count~method,xlab="Method Type",ylab="Particle Count",main="Boxplot of Observations")

boxcox(count~method)

lambda <-  0.4
trans.count <- count^(lambda)
boxcox(trans.count~method)
boxplot(trans.count~method, xlab="Method Type",ylab="Particle Count",main="Boxplot of Observations")

trans.dat <- data.frame(trans.count,method)
trans.dat$method <- as.factor(trans.dat$method)
str(trans.dat)
#anova
model2<-aov(trans.count~method,data=trans.dat)
summary(model2)
autoplot(model2)