Learn R Programming

spectralGP (version 1.3.3)

propose.coeff.gp: Proposes new coeffients in a spectral GP object.

Description

Proposes new coefficients in a spectral GP object as normal deviates centered around the current values, with the proposal standard deviation the product of the supplied standard deviation(s) and the square root of the prior variances. The proposal can be done for all coefficients at once (block=0) or for individual blocks.

Usage

"propose.coeff"(object, block = 0, proposal.sd = 1,...)

Arguments

object
A GP object, created by gp.
block
The block of coefficients to be proposed, or 0 if all coefficients are to be proposed.
proposal.sd
Proposal standard deviation. This is multiplied by the square root of the prior variance for each coefficient to produce the final proposal standard deviation.
...
Other arguments.

Value

The function modifies the GP object, which is essentially a pointer (an R environment in this case), so NULL is returned.

Details

This function can be used to simulate a GP by using proposal.sd=1 to sample coefficients, coeff, from the prior or in a MCMC context to propose new coefficient values via the Metropolis algorithm. The function automatically updates the process values in the process component of the gp list based on the new coefficient values.

References

Type 'citation("spectralGP")' for references.

See Also

gp, calc.variances.gp, simulate.gp, updateprocess.gp, zero.coeff.gp

Examples

Run this code
library(spectralGP)
rho=1
gp1=gp(128,matern.specdens,c(rho,4))
gp2=gp(c(64,64),matern.specdens,c(rho,4))
propose.coeff(gp1)
propose.coeff(gp2)
plot(gp1)
plot(gp2)
prior1=logdensity(gp1)
prior2=logdensity(gp2)
add.blocks(gp1)
add.blocks(gp2)
propose.coeff(gp1,block=2,proposal.sd=0.1)
propose.coeff(gp2,block=3,proposal.sd=0.1)
priorstar1=logdensity(gp1)
priorstar2=logdensity(gp2)
plot(gp1)
plot(gp2)

Run the code above in your browser using DataLab