Learn R Programming

IsingSampler (version 0.5.0)

BlumeCapelSampler: Sample states from the Blume-Capel model

Description

Samples states from the Blume-Capel model, an Ising model with an additional on-site quadratic ("single-ion anisotropy" or "crystal-field") term. This is a thin wrapper around IsingSampler that sets ordered (spin-1) response options by default and requires the quadratic parameter delta.

Usage

BlumeCapelSampler(n, graph, thresholds, delta, beta = 1, nIter = 100,
    responses = c(-1L, 0L, 1L), method = c("MH", "direct"),
    CFTPretry = 10, constrain)

Value

A matrix containing samples of states.

Arguments

n

Number of states to draw.

graph

Square matrix indicating the weights of the network. Must be symmetrical with 0 as diagonal.

thresholds

Vector indicating the thresholds (external field). A single value is recycled over all nodes.

delta

The quadratic (Blume-Capel) parameter, entering the Hamiltonian as delta_i * s_i^2. Either a single value (recycled over all nodes) or one value per node. Must be supplied. A positive delta favours the middle category; a negative delta favours the extreme categories.

beta

Scalar indicating the inverse temperature.

nIter

Number of iterations in the Metropolis sampler.

responses

Ordered response options, defaulting to the spin-1 values c(-1L, 0L, 1L). Other (numeric) response options may be supplied, but the delta term only has an identifiable effect with more than two options.

method

The sampling method, either "MH" (Metropolis-Hastings, default) or "direct". Exact sampling ("CFTP") is implemented for two response options only and is therefore not available here; delta has no identifiable effect on binary responses in any case.

CFTPretry

Passed to IsingSampler; unused for the methods offered here.

constrain

A (number of samples) by (number of nodes) matrix with samples that need be constrained; NA indicates that the sample is unconstrained.

Author

Sacha Epskamp (mail@sachaepskamp.com)

Details

The Blume-Capel Hamiltonian implemented here is $$H(s) = -\sum_i \tau_i s_i - \sum_{i<j} \omega_{ij} s_i s_j + \sum_i \delta_i s_i^2,$$ with thresholds \(\tau\), network weights \(\omega\) (graph) and quadratic terms \(\delta\) (delta); states are drawn with probability proportional to \(\exp(-\beta H(s))\). Setting delta = 0 recovers the ordinary (multi-level) Ising model, so BlumeCapelSampler(..., delta = 0) is equivalent to IsingSampler.

See Also

IsingSampler, IsingLikelihood

Examples

Run this code
if (FALSE) {
# A small ferromagnetic network:
P <- 5
W <- matrix(0.5, P, P); diag(W) <- 0

# Low crystal field: ordered (mostly +1 / -1):
X0 <- BlumeCapelSampler(1000, W, thresholds = 0, delta = 0, beta = 1)

# High crystal field: disordered "0" phase (mostly the middle category):
X3 <- BlumeCapelSampler(1000, W, thresholds = 0, delta = 3, beta = 1)

mean(X0 == 0)  # low
mean(X3 == 0)  # high
}

Run the code above in your browser using DataLab