propose.coeff.gp {spectralGP} | R Documentation |
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
## S3 method for class 'gp'
propose.coeff(object, block = 0, proposal.sd = 1,...)
Arguments
object |
A GP object, created by |
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. |
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.
Value
The function modifies the GP object, which is essentially a pointer (an R environment in this case), so NULL is returned.
Author(s)
Christopher Paciorek paciorek@alumni.cmu.edu
References
Type 'citation("spectralGP")' for references.
See Also
gp
, calc.variances.gp
, simulate.gp
, updateprocess.gp
,
zero.coeff.gp
Examples
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)