Last data update: 2014.03.03

R: Simulated draws from a bivariate density function on a grid
simcontourR Documentation

Simulated draws from a bivariate density function on a grid

Description

For a general two parameter density defined on a grid, simulates a random sample.

Usage

simcontour(logf,limits,data,m)

Arguments

logf

function that defines the logarithm of the density

limits

limits (xlo, xhi, ylo, yhi) that cover the joint probability density

data

vector or list of parameters associated with the function logpost

m

size of simulated sample

Value

x

vector of simulated draws of the first parameter

y

vector of simulated draws of the second parameter

Author(s)

Jim Albert

Examples

m=array(c(0,0),c(2,1))
v=array(c(1,.6,.6,1),c(2,2))
normpar=list(m=m,v=v)
s=simcontour(lbinorm,c(-4,4,-4,4),normpar,1000)
plot(s$x,s$y)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(LearnBayes)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LearnBayes/simcontour.Rd_%03d_medium.png", width=480, height=480)
> ### Name: simcontour
> ### Title: Simulated draws from a bivariate density function on a grid
> ### Aliases: simcontour
> ### Keywords: models
> 
> ### ** Examples
> 
> m=array(c(0,0),c(2,1))
> v=array(c(1,.6,.6,1),c(2,2))
> normpar=list(m=m,v=v)
> s=simcontour(lbinorm,c(-4,4,-4,4),normpar,1000)
> plot(s$x,s$y)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>