Skip to content

Commit

Permalink
Parameter updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jchristopherson committed Feb 22, 2025
1 parent 360f8b0 commit 5148487
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
15 changes: 8 additions & 7 deletions examples/mcmc_regression_example.f90
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,23 @@ program example

! Define an initial covariance matrix for the proposal
sigma = 0.0d0
sigma(1,1) = 1.0d-8
sigma(2,2) = 1.0d-8
sigma(3,3) = 1.0d-8
sigma(4,4) = 1.0d-8
sigma(1,1) = 1.0d-3
sigma(2,2) = 1.0d-3
sigma(3,3) = 1.0d-3
sigma(4,4) = 1.0d-3

! Define an initial guess
xi = [1.0d0, 0.5d0, -1.0d-1, 1.0d0]
! xi = [1.0d0, 0.5d0, -1.0d-1, 1.0d0]
xi = 0.0d0

! Initialize the proposal distribution object as well
call solver%initialize_proposal(xi, sigma)

! Compute the fit
call solver%sample(xi, niter = 100000)
call solver%sample(xi, niter = 250000)

! Get the chain - disregard the initial portion of the chain for burn-in
chain = solver%get_chain(bin = 0.9d0)
chain = solver%get_chain(bin = 0.0d0)

! Extract the model - use the mean values
mdl = [ &
Expand Down
3 changes: 2 additions & 1 deletion src/fstats_mcmc_fitting.f90
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ subroutine mr_on_success(this, iter, alpha, xc, xp, err)
resid = this%m_f0 - this%y

! Update the variance
this%m_modelVariance = variance(resid)
! this%m_modelVariance = variance(resid)
this%m_modelVariance = 1.0d-4
end subroutine

! ------------------------------------------------------------------------------
Expand Down

0 comments on commit 5148487

Please sign in to comment.