Closed irtimmins closed 1 year ago
Brilliant - well spotted, thank you! I shall put this in. Just wondering if the 4 in the code above should be degree+1
to generalise this to different degrees?
Yes that's right, thanks.
One small extra thing is that the sum of all the weights (knot.seq[i+degree+1]-knot.seq[i])
is (degree+1)*(bknots[2]-bknots[1])
since it telescopes with the only the repeated boundary knots remaining. So can write the uniform weights in single step.
Can make a small edit:
p_const <- rep(0,K)
rescale <- (degree+1)*(bknots[2]-bknots[1])
for(i in 1:K){
p_const[i] <- (knot.seq[i+degree+1]-knot.seq[i])/(rescale)
}
p_const
[1] 0.03333 0.06667 0.08333 0.13333 0.11667 0.13333 0.16667 0.11667 0.10000 0.05000
Hi Chris,
with the mspline_uniform_weights() function, just an idea to suggest: given that B-splines have uniform weights by default, we can simply say that the scaling factor that takes M-splines to B-splines will be equivalent to the uniform weights. So uniform weights can be calculated analytically straight from the set of knots - current variance minimising approach may not be needed?
Here's an example attached