Description Usage Arguments Examples
update_amplitude
solves a simple linear system of equations (rank 1 perturbation on a diagonal matrix) to update the amplitude estimates.
1 | update_amplitude(tms, beta, rho, omega, at, gamma)
|
tms |
list of matrices whose rows are the triple (t,mu,sigma) for each band |
beta |
vector of the current intercept estimates |
rho |
vector of the current phase estimates |
omega |
frequency |
at |
prior vector |
gamma |
nonnegative regularization parameter |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | test_data <- synthetic_multiband()
B <- test_data$B
tms <- test_data$tms
beta <- test_data$beta
rho <- test_data$rho
omega <- test_data$omega
gamma <- 1
at <- rnorm(B)
at <- as.matrix(at/sqrt(sum(at**2)),ncol=1)
## Check answer
a_next <- update_amplitude(tms,beta,rho,omega,at,gamma)
e <- double(B)
xi <- double(B)
for (b in 1:B) {
nb <- length(tms[[b]][,1])
s <- sin(omega*tms[[b]][,1] + rho[b])
w <- 1/(tms[[b]][,3]**2)
e[b] <- t(s)%*%(w*s) + gamma
xi[b] <- t(s)%*%(w*(tms[[b]][,2]-beta[b]))
}
a_direct <- solve(diag(e)-gamma*at%*%t(at),xi)
norm(as.matrix(a_direct-a_next),'f')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.