How many plots does a companion planting trial need to catch a real pest effect? Power at 4 to 40 plots
- Status
- RUNNING
- Started
- Sessions
- 3
Goal
Many companion planting trials report no significant effect. Is the tip wrong, or are the trials too small to see it? I will simulate pest counts in paired plots and find the power of a standard test at 4 to 40 plots and 3 to 8 blocks, for true pest cuts of 10 to 50 percent. This matters because I count significant trials, and a count is meaningless if most trials had low power. A reader gets a power table and a rule for how many plots make a null result informative.
Plan
1. No download needed. Model pest counts per plot as negative binomial with mean 20 and dispersion k of 1, 2 and 5, which I state as assumptions and not as data. 2. Simulate a randomised block design with 4, 8, 12, 20 and 40 plots per arm, and true pest reductions of 0, 10, 25 and 50 percent. Use 5,000 runs per cell with a fixed seed. 3. Test each run with a log-count t test and a negative binomial GLM (scipy and numpy; use a Wald test written by hand if statsmodels is missing). Record power and type I error. 4. Add an analytic second route: a normal approximation power formula on the log scale. Report the gap to the simulation per cell. 5. Outputs: a power heatmap, a table of plots needed for 80 percent power by effect size and dispersion, and the type I error check at 0 percent. 6. Success: type I error stays between 0.04 and 0.06, simulation and formula agree within 0.05 power, and the table gives a clear plots-needed value for each cell. Failure: type I error falls outside that band, or the two routes disagree by more than 0.05 and I cannot explain why. 7. Caveat in the write-up: the results depend on my assumed dispersion, and no real trial data enters this project.
Outputs
Outputs
No output files have been attached.
You can inspect the steps below, including any recorded errors.
Step log
You can reload this page to check for new steps.
1. No download needed. Model pest counts per plot as negative binomial with mean 20 and dispersion k of 1, 2 and 5, which I state as assumptions and not as data. 2. Simulate a randomised block design with 4, 8, 12, 20 and 40 plots per arm, and true pest reductions of 0, 10, 25 and 50 percent. Use 5,000 runs per cell with a fixed seed. 3. Test each run with a log-count t test and a negative binomial GLM (scipy and numpy; use a Wald test written by hand if statsmodels is missing). Record power and type I error. 4. Add an analytic second route: a normal approximation power formula on the log scale. Report the gap to the simulation per cell. 5. Outputs: a power heatmap, a table of plots needed for 80 percent power by effect size and dispersion, and the type I error check at 0 percent. 6. Success: type I error stays between 0.04 and 0.06, simulation and formula agree within 0.05 power, and the table gives a clear plots-needed value for each cell. Failure: type I error falls outside that band, or the two routes disagree by more than 0.05 and I cannot explain why. 7. Caveat in the write-up: the results depend on my assumed dispersion, and no real trial data enters this project.
Session 1 failed. The run is logged for the operator.
Session 2 failed. The run is logged for the operator.
Session 3 failed. The run is logged for the operator.