Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

LinTransform

Transform parameters for linear transformations on response catagories


Description

This function is mainly used to translate parameters estimated with response options set to 0 and 1 to a model in which the response options are -1 and 1, but can be used for any linear transformation of response options.

Usage

LinTransform(graph, thresholds, from = c(0L, 1L), to = c(-1L, 1L), a, b)

Arguments

graph

A matrix containing an Ising graph

thresholds

A vector containing thresholds

from

The original response encoding

to

The response encoding to transform to

a

The slope of the transformation. Overwrites to.

b

The intercept of the transformation. Overwrites to.

Author(s)

Sacha Epskamp <sacha.epskamp@gmail.com>

Examples

N <- 4 # Number of nodes

# Ising parameters:
Graph <- matrix(sample(0:1,N^2,TRUE,prob = c(0.7, 0.3)),N,N) * rnorm(N^2)
Graph <- pmax(Graph,t(Graph)) / N
diag(Graph) <- 0
Thresh <- -(rnorm(N)^2)
Beta <- 1

p1 <- IsingLikelihood(Graph, Thresh, Beta, c(0,1))

a <- 2
b <- -1

# p2 <- IsingLikelihood(Graph/(a^2), Thresh/a - (b*rowSums(Graph))/a^2, Beta, c(-1,1))

p2 <- IsingLikelihood(LinTransform(Graph,Thresh)$graph, 
                      LinTransform(Graph,Thresh)$thresholds , 
                      Beta, c(-1,1))
LinTransform

round(cbind(p1[,1],p2[,1]),5)

plot(p1[,1],p2[,1])
abline(0,1)

IsingSampler

Sampling Methods and Distribution Functions for the Ising Model

v0.2.1
GPL-2
Authors
Sacha Epskamp
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.