Josh B
2011-Sep-30 22:10 UTC
[R] Data simulation for ANOVA decomposition into sums of squares
Dear listserv,
Please consider the following dataset:
x <- matrix(nrow = 8, ncol = 2)
colnames(matrix) <- c("classification", "soluble_fiber")
x[1:4,1] <- "bagel"
x[5:8,1] <- "donut"
How would I simulate a dataset for a one-way fixed-effect ANOVA (where
"classification" is the treatment variable and
"soluble_fiber" is the response variable) such that the total sums of
squares are equal to 1, and the treatment sums of squares are equal to 0.1? In
other words, I simply want to make up "soluble_fiber" values for each
observation (rows) such that an ANOVA of "soluable_fiber" ~
"classification" yields total sums of squares = 1 and treatment sums
of squares = 0.1.
More generally, I'd like to develop some code that will let me simulate
datasets with different treatment sums of squares (ranging from 0.1 - 0.9) while
holding the total sums of squares constant (equal to 1).
Many thanks in advance for your suggestions. I recognize that this is as much a
statistical/mathematical question as an R programing question.
Sincerely,
-----------------------------------
Josh Banta, Ph.D
Assistant Professor
Department of Biology
The University of Texas at Tyler
Tyler, TX 75799
Tel: (903) 565-5655
http://plantevolutionaryecology.org
[[alternative HTML version deleted]]
Seemingly Similar Threads
- Splitting a data frame into several completely separate data frames
- Extracting P-values from the lrm function in the rms library
- Pointing to a specific place on the x-axis with an arrow
- Find and replace all the elements in a data frame
- Plotting a quadratic line on top of an xy scatterplot
