the test statistic is with -value of by including the block effectswe effectively reduce the uncertainty in the model and are able to more accurately assess the effects of the treatmentsto conclude that the treatment seems to have an effect on the crop yield closer look at the data shows that within each block (rowthe crop yield roughly increases with the treatment level crop py import numpy as np from scipy stats import from numpy linalg import lstsq norm yy np array ([ ]reshape ( , nrow ncol yy shape [ yy shape [ nrow ncol yy reshape ( ,x_ np ones (( , )km np kron(np eye(ncol),np ones (nrow , ))km [, x_ km [, ncolim np eye(nrowc im [, nrowx_ np vstack ((cc)x_ np vstack ((x_ )x_ np vstack ((x_ ) np hstack ((x_ ,x_ ) np hstack (( ,x_ ) shape [ number of parameters in full model betahat lstsq (xyrcond =none)[ estimate under the full model ym betahat x_ np hstack ((x_ x_ )omitting the block effect x_ shape [ number of parameters in reduced model betahat_ lstsq (x_ yrcond =none)[ y_ x_ betahat_ t_ =( - )/( - )*norm( -y_ )** norm( -ym)** )/norm( -ym)** pval_ cdf(t_ , - , -px_ np hstack ((x_ x_ )omitting the treatment effect x_ shape [ number of parameters in reduced model betahat_ lstsq (x_ yrcond =none)[ y_ x_ betahat_ t_ =( - )/( - )*norm( -y_ )** norm( -ym)** )/norm( -ym)** pval_ cdf(t_ , - , -