[R] Change the argument function inside R function in GPfit package
C W
tmrsg11 at gmail.com
Tue Mar 10 02:20:23 CET 2015
I guess I should re-frame my question with real data.
> xx
[,1]
[1,] 0.0
[2,] 0.2
[3,] 0.4
[4,] 0.6
[5,] 0.8
> yy
[,1]
[1,] 0.0000000
[2,] 0.1652000
[3,] 0.4343223
[4,] 0.5996505
[5,] 0.7195857
> cor.mat
[,1] [,2] [,3] [,4] [,5]
[1,] 1.000000000 0.64822376 0.1873066 0.02489388 0.001546431
[2,] 0.648223760 1.00000000 0.6482238 0.18730656 0.024893894
[3,] 0.187306626 0.64822376 1.0000000 0.64822364 0.187306626
[4,] 0.024893881 0.18730656 0.6482236 1.00000000 0.648223880
[5,] 0.001546431 0.02489389 0.1873066 0.64822388 1.000000000
or
xx <- structure(c(0, 0.199999994947575, 0.39999998989515,
0.600000028498471,
0.7999999797903), .Dim = c(5L, 1L))
yy <- structure(c(0, 0.165199951246566, 0.434322340944441,
0.599650488376824,
0.719585664934966), .Dim = c(5L, 1L))
cor.mat <- structure(c(1, 0.648223760165366, 0.187306626057348,
0.0248938807581023,
0.00154643121052443, 0.648223760165366, 1, 0.648223760165366,
0.187306559286623, 0.0248938938021518, 0.187306626057348,
0.648223760165366,
1, 0.648223640552069, 0.187306626057348, 0.0248938807581023,
0.187306559286623, 0.648223640552069, 1, 0.64822387977866,
0.00154643121052443,
0.0248938938021518, 0.187306626057348, 0.64822387977866, 1), .Dim = c(5L,
5L))
Now if I do,
> GP_fit(xx, yy, corr=cor.mat)
Error in corr$type : $ operator is invalid for atomic vectors
How could I fix it?
Thanks!
-M
On Mon, Mar 9, 2015 at 2:14 PM, C W <tmrsg11 at gmail.com> wrote:
> Hi R list,
>
> I am using the GPfit package to fit Gaussian Process model.
>
> The kernel in the package is,
> K(x, x') = sigma^2 * exp(x-x')^2
>
> My kernel have an extra term,
> K((x, z), (x', z')) = sigma^2 * exp(x-x')^2 * exp(z-z')^2
>
> The function corr_matrix() is,
> corr_matrix(X, beta, corr=list(type="exponential",power=1.95))
> github source: https://github.com/cran/GPfit/blob/master/R/corr_matrix.R
>
> I am changing the corr argument, so it looks like mine. How should I do
> it?
>
> Also, what package do you guys recommend for GP modeling? I know GPstuff
> or GPML but that's Matlab.
>
> Thanks very much.
>
> Mike
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list