Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 include new sampled data example #4

Merged
merged 7 commits into from Jun 9, 2022

Conversation

jakobdambon
Copy link
Owner

Using the spam::rmvnorm suite to sample SVC data, therefore replacing the old functions depending on package RandomFields.

Main changes:

  • package contains a new sample data set called SVCdata, that has been sample from the RandomFields package. In the help file, I cite the RandomFields JSS article to give them the appropriate credit.
  • package contains one sample function called sample_SVCdata.

@jakobdambon jakobdambon added the enhancement New feature or request label Jun 7, 2022
@jakobdambon jakobdambon linked an issue Jun 7, 2022 that may be closed by this pull request
@reinhardfurrer
Copy link
Collaborator

reinhardfurrer commented Jun 8, 2022 via email

@reinhardfurrer
Copy link
Collaborator

reinhardfurrer commented Jun 9, 2022

Good to go. 2 cents:

For sample_SVCdata() should there be an X=NULL argument?
I tried to construct a nice figure (one-dim domain) to illustrate the additiveness of the SVC but with a rnorm() noise, one hardly sees anything.

Would it make sense to include the wrapper functions cov.mat32 and cov.mat52() in spam?
With these wrappers, you could simply construct a do.call() with any covariance function based on 3 parameters. Mainly aesthetics...

@reinhardfurrer reinhardfurrer merged commit 5f3f33f into master Jun 9, 2022
@jakobdambon jakobdambon deleted the 2-include-new-sampled-data-example branch June 9, 2022 19:47
@jakobdambon
Copy link
Owner Author

jakobdambon commented Jun 9, 2022

I've added the X=NULL argument and pushed into master.

I don't understand your comment on the example / figure / additiveness of the SVCs. For a nice example, I use a code like this:

set.seed(123)
# SVC parameters
(df.pars <- data.frame(
   var = c(2, 1),
   scale = c(3, 1),
   mean = c(1, 2)))
# nugget standard deviation
tau <- 0.5

# sample locations
s <- sort(runif(500, min = 0, max = 10))
SVCdata <- sample_SVCdata(
  df.pars = df.pars, nugget.sd = tau, locs = s, cov.name = "mat32"
)

matplot(x = SVCdata$locs, y = SVCdata$beta, type = "l")

Could you provide an example?

For your final comment, I will put it in a backlog #5.

@reinhardfurrer
Copy link
Collaborator

reinhardfurrer commented Jun 12, 2022

I was thinking of:

set.seed(123)
# SVC parameters
(df.pars <- data.frame(
   var = c(2, 1),
   scale = c(3, 1),
   mean = c(1, 2)))
# nugget standard deviation
tau <- 0.5

# sample locations
s <- sort(runif(100, min = 0, max = 10))
X <- cbind(1, rep(c(0, 1, .5, 0, 1), times=c(24, 35, 5, 12, 24)))
SVCdata <- sample_SVCdata(
  df.pars = df.pars, nugget.sd = tau, locs = s, cov.name = "mat32", X = X
)
with(data = SVCdata, {
  plot( s, y, ylim = c(-1,6))
  lines(s, rowSums(X * beta), col = 2)
  lines(s, beta[,1], col = 3)
  lines(s, beta[,2], col = 4)
  lines(s, X[,2], col = 5)
})
legend("topright", legend = c('smooth fit', "first SVC", "second SVC", 
  "covariate second SVC"), col=c(2:5), bty = 'n', lty = 1)

It was helpful to understand the role of the covariate. I struggle with random covariates. Just a tiny detail, nothing to worry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include new sampled data example
2 participants