Ref:https://onlinecourses.science.psu.edu/stat464/print/book/export/html/11
Additive model
Value = typical value + row effect + column effect + residual
predicate value = Typical value + row effect + column effect
Where value is the value of our attention, typical value is overall median,row effect is the block Effect,column effect is treatment effect
Here are the use case questions to show:
Question: For the content of niacin (vitamin B3) in bread, three laboratory (ABC) methods may be different. The niacin content is divided into three gears:
No niacin, 2mg/100gm, 4mg/100gm. We send some samples to three labs to do the testing, want to know: When dividing grade, whether
Based on the actual content of nicotinic acid.
Input: niacin_r.txt (see Web page)
Step One:
Plots the mean (or other summary) of the response for two-way combinations of factors, thereby illustrating possible inter Actions.
data = read.table ("Niacin_r.txt", Header=f, sep= ",") data = as.data.frame (data) names ("=c", "Lab", "level") Attach (data) Interaction.plot (lab, level, niacin, Fun=median) detach (data)
Results
Since three lines are basically parallel (no apparent crossover), we can continue to do so. (Additive model does not consider the situation of interaction)
Now we need to tidy up the data: First gather the data in lab and level
A=aggregate (Niacin~lab+level, Data=data, median)
The result is this:
> A Lab level niacin1 a 0 362 b 0 383 C 0 394 a 2 535 b 2 566 C 2 557 a 4 688 b 4 769 C 4 73
It then turns it into a matrix, each line represents a block (level horizontal, 0,2,4), and each column represents treat (this is LAB,ABC)
> M=matrix (a[,3], nrow=3, ncol=3, byrow=t) > M [, 1] [, 2] [, 3][1,] 39[2, ] 55[3,] 73
Step Two: Median polish
> Medpolish (M) 1:7final:7median Polish Results (Dataset: "M") Overall:55row effects:[1] -17 0 18Column Effe CTS:[1]-2 1 0Residuals: [, 1] [, 2] [, 3][1,] 0 -1 1[2,] 0 0 0[3,] -3 2 0
So we've got the complete additive model, where typical value is overall, which is 55.
Note: Medpolish actually makes a split of the previous results, such as
m[1,1] = overall + column_effect[1] + row_effect[1] + residuals[1, 1] = 55 + (-17) + (-2) + 0
in order to determine the quality of the model, we calculate the statistic r*. As in the above example, TV is 55 and the r* is calculated to be about 0.9346, which means that the lab and level are considered
Additive model, can explain 93% of the level of nicotinic acid assessment results.
(The additive model of the labs and levels of niacin explain about 93% of the variation in the measured niacin levels.)
If the three lines have crosses, consider each block (each row) separately, using Kruskal test. If overall error rate is 0.09, 3 blocks,
Then each alpha value is 0.03 (the P-value is less than it rejects the original hypothesis).
The interaction statistic can be judged by the residuals matrix above, using the Q statistic, and using the chi-square distribution of degrees of freedom (b-1) x (k-1) to determine the P-value
Dichotomous Data (Cochran ' s Tests)
b block,k a treatment, the actual value only two, namely 0 and 1
The premise: blocks is randomly selected; The result variable is two-valued.
Assume:
H0:treatments is equally effective
H1:difference in effectiveness among treatments.
Applied Nonparametric Statistics-lec8