mfasiolo / mgcViz

An R package for interactive visualization of GAM models
https://mfasiolo.github.io/mgcViz/
76 stars 9 forks source link

Creat I_diff() layer for fs and by-variable smooths #31

Open mfasiolo opened 7 years ago

mfasiolo commented 7 years ago

This might be a quite useful layer, see

http://www.fromthebottomoftheheap.net/2017/10/10/difference-splines-i/

To calculate the standard error for the differences in smooth we need:

cov(X1b1, X2b2) = X1 %*% Sig11 %*% t(X1) + X2 %*% Sig22 %*% t(X2) - X1 %*% Sig12 %*% t(X2) - X2 %*% Sig12 %*% t(X1)

where Sig11, Sig22 and Sig12 = Sig21 are blocks of cov(b1, b2).

mfasiolo commented 6 years ago

Partially done here 2336af0a6f88464d1cfb33840f4947db2fcb8336, but by creating a new plotDiff generic for "by" smooths. For 'fs' smooths it might actually make sense creating a layer instead.