; loading :Load-All.lsp
; loading :Sir-Program.lsp
; loading :SIR-I-II-Model.lsp
; loading :PCA-Model.lsp
; loading :Phd-Model.lsp
; finished loading "Load-All.lsp"
; loading :rib-g-ratio.lsp
; finished loading "rib-g-ratio.lsp"
(variables)
(RIB-G-RATIO)
> (length rib-g-ratio)
7

Work on original scale :

> (def out(twoway-model-additive rib-g-ratio))

"=============="
"grand mean ="
1.511641544553083
"row-effects="
(0.2960597711318056 -0.7679738623169539
****too long so I just truncated it *****-0.5229925858633878)
"col-effects"
(-0.5416594256321706 -0.48645086505160373 -0.5949651393341608 -0.3743153449031711 -0.3549714978033722 0.4761239747325312 1.8762382979919363)
"==============="
"Sum of squares :"
"for row "
281.8045028443038
"for column"
940.2420146607504
" for error"
759.6298878687396
"total"
1981.6764053737938
OUT

WOrking on log scale :

> (def out(twoway-model-additive (log rib-g-ratio)))

"=============="
"grand mean ="
0.2197640086353135
"row-effects="
(0.13172608109608233 -0.5858534896907084  ***too long again ***  -0.2362603221534226)
"col-effects"
(-0.2623126803987415 -0.2107633638081253 -0.3222625718226662 -0.11150946265421914 -0.09847331117374275 0.2473455342397374 0.7579758556177539)
"==============="
"Sum of squares :"
"for row "
78.6596990047473
"for column"
167.984806522024
" for error"
170.79409443559922
"total"
417.4385999623705
OUT
>

Apply pca to the residuals
> (length (car (last out)))
7
> (pca-model (car (last out))
)
 

==============================================================

*** Principal Component Analysis ***

Scale type: "Covariances"

Number of observations: 192

Number of variables: 7

the first principal component:
(0.3524200194660413 0.27889531724409183 0.2606494550477866 0.15828097680066247 0.12270490429254599 -0.5543553126336035 -0.6185953602175244)

the second principal component:
(0.22074833800547292 0.17118660140801698 0.06440953454558095 -0.2341388280758533 -0.2754181986176589 -0.6001810750523124 0.6533936277867544)

the third principal component:
(0.1913622043099338 0.5300300675373782 0.026058112819411148 -0.3463390351568518 -0.5953370280601857 0.4041396277376451 -0.2099139491873312)

the companion output variances of PCA:
#(0.7820667857969441 0.053165606947989455 0.02319043348334915 0.017514616106852777 0.009614422208373866 0.008658053967480863 2.128140814429853E-32)

the proportions of all variances:
#(0.874589701598498 0.05945539838846691 0.025933992682574042 0.019586694068454927 0.01075186263241577 0.009682350629590396 2.3799118868794982E-32)

==============================================================
#<Object: 16f4378, prototype = PCA-MODEL-PROTO>

It appears that the first component dominates -- see proportions of variance

But be aware that the scaling in pca plot is not absolute.

Basis curve :

> (plot-lines (iseq 1 7) (list 0.3524200194660413 0.27889531724409183 0.2606494550477866 0.15828097680066247 0.12270490429254599 -0.5543553126336035 -0.6185953602175244))
#<Object: 18a5b78, prototype = SCATTERPLOT-PROTO>

Further ideas

fit a linear model for each row of the residuals against
first pca coefficient

Q : do you need to do this one at a time ?
Hint : connection with singular value decomposition of residual matrix

After obtainin the regression coefficients, plot them against the
row-effect