Solar cycles, defined based on the number of sunspots present on the Sun's surface, exhibit nearly periodic 11-year changes. These fluctuations affect the levels of solar radiation, the ejection of solar material, and the number and size of sunspots, solar flares, and coronal loops [1].
Monthly mean total sunspot number | A group of sunspots [2] |
---|---|
![]() |
![]() |
The orbital period of Jupiter around the Sun is 11.862 years. So, does Jupiter have anything to do with the 11-year cycle?
In this project, we use the number of sunspots observed in the last centuries and Bayesian inference
techniques to try to answer this question, by:
- Approximating the time series of sunspot observations as a sum of harmonic waves plus background noise using Fourier analysis;
- Sampling in the model parameter space using emcee [3], a Python-based ensemble sampler for Markov chain Monte Carlo (MCMC).
The code comes with all the dependencies that can be installed from the requirements file. However, we recommend creating a virtual environment using a package manager like Miniconda. To create a virtual environment and install the dependencies, run:
conda create -n bayesian-inference python==3.11
conda activate bayesian-inference
pip install -r requirements.txt
To execute the scripts and reproduce the results, run:
python src/fourier.py
python src/sampling.py
We briefly describe the two phases of the method below. For more information and implementation details, please refer to the code.
Let
To estimate the fourier.py
we iteratively extract the most dominant frequency from the Fourier spectrum and subtract it from the signal for
Original vs reconstructed signal using n=15 Fourier components |
---|
![]() |
Time series of the residuals | Distribution of the residuals |
---|---|
![]() |
![]() |
In the sampling.py
script, we sample in the high dimensional and multi-modal parameter space of emcee
to globally optimize and correct the estimates as well as to quantify the uncertainty in each dimension. By using Bayes' theorem, we compute the posterior distribution according to:
We use these priors on the parameters:
- Uninformative priors on
$\{A_j\}_{j=1}^n$ and$\{T_j\}_{j=1}^n$ ; - Gaussian priors with zero mean and standard deviation set to
$\pi$ for$\{\phi_j\}_{j=1}^n$ ; - Jeffreys prior on
$\sigma > 0$ .
Combining everything, we have that the logarithm of the posterior has the form:
Running a chain of 50k steps, all parameters converge to their respective posterior distributions. We can see the chains for a few selected parameters
Selected amplitude and period chains | Selected phase and noise chains | Log posterior chains |
---|---|---|
![]() |
![]() |
![]() |
We can compute an updated parameter estimate
Initial estimate and new mean estimate into the observed data space |
---|
![]() |
Mean signal and 2-sigma posterior spread into the observed data space |
---|
![]() |
The initial parameters have all been modified by the inference process, converging to a better estimate. In particular,
Fifth period distribution – compatible with Jupiter |
---|
![]() |
Therefore we conclude, according to our inference process, that Jupiter is likely to play a role in shaping the signal.
[1] Wikipedia, "Solar cycle", https://en.wikipedia.org/wiki/Solar_cycle
[2] Wikipedia, "Sunspot", https://en.wikipedia.org/wiki/Sunspot
[3] Foreman-Mackey et al., "emcee: The MCMC Hammer", https://arxiv.org/abs/1202.3665, https://github.com/dfm/emcee
[4] WDC-SILSO, Royal Observatory of Belgium, Brussels, "Monthly mean total sunspot number [1/1749 - 1/2023]", https://www.sidc.be/SILSO/datafiles