Learn R Programming

spectralGP (version 1.3.3)

change.param.gp: Changes correlation function parameter values of a spectral GP object

Description

Changes the correlation parameter values or the (optional) variance parameter and recalculates the prior variances of the coefficients using calc.variances.gp.

Usage

"change.param"(object,new.specdens.param=NULL, new.variance.param=NULL,...)

Arguments

object
A GP object, created by gp.
new.specdens.param
A vector of new parameter values, matching the length of the original parameter vector.
new.variance.param
The new variance parameter value.
...
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 allows the user to change the parameter values of the spectral GP object and recalculate the prior variances for the coefficients. This is particularly useful for implementing MCMC with the spectral GP.

References

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

See Also

gp, calc.variances.gp, logdensity.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),0.5)
propose.coeff(gp1)
propose.coeff(gp2)
print(logdensity(gp1))
print(logdensity(gp2))
rho=2
sigma=2.5
change.param(gp1,c(rho,4)) # change parameter values of correlation function
change.param(gp2,c(rho,4),sigma)
print(logdensity(gp1))
print(logdensity(gp2))

Run the code above in your browser using DataLab