lidom / ffscb

R-package ffscb: fast n' fair simultaneous confidence bands for functional parameters. The statistical theory and methodology is described in our paper https://arxiv.org/abs/1910.00131. A description of the functions in our R-package can be found at www.dliebl.com/ffscb/.
http://www.dliebl.com/ffscb/
Other
5 stars 1 forks source link

Creating Bands with "fd" Objects #1

Open creutzml opened 2 years ago

creutzml commented 2 years ago
  1. Length of Tau MUST equal grid.size, else the estimated mean will be of different length than the band created, and an error will be tripped: for example Error in cbind(result, x.v + FFSCB.t, x.v - FFSCB.t) : dims [product 200] do not match the length of object [14400]
  1. If using fd objects to create the band, then an error is tripped by plot.confidence_band: for example Error in seq.default(from = 0, to = 1, len = nrow(band)) : argument 'length.out' must be of length 1
creutzml commented 2 years ago

The first issue is avoided relatively easy, with using eval.fd and specifying the grid points manually to match the length of grid.size. But it may be useful to add a helpful error for this issue.

Haven't fully investigated the plot issue

creutzml commented 2 years ago

In my own iteration, I moved rownames(band) <- seq(from = 0, to = 1, len = nrow(band)) under the first if (type=="vector") block of code.

However, the next issue was that the code produced a plot with only the upper band plotted. This comes from line 58 in the original code. Changing this to be fda::plot.fd(band,col=col[1],lwd=lwd[1],lty=lty[1],add=TRUE) plots everything (removed the [1] indexing on band), but then color schemes don't quite work out well. I will play with this some, but another concern is for when there's just a single sided band plotted.

creutzml commented 2 years ago

In my own iteration, I moved rownames(band) <- seq(from = 0, to = 1, len = nrow(band)) under the first if (type=="vector") block of code.

However, the next issue was that the code produced a plot with only the upper band plotted. This comes from line 58 in the original code. Changing this to be fda::plot.fd(band,col=col[1],lwd=lwd[1],lty=lty[1],add=TRUE) plots everything (removed the [1] indexing on band), but then color schemes don't quite work out well. I will play with this some, but another concern is for when there's just a single sided band plotted.

This issue is compounded... plot.fd from the fda package has an error in its plotting that needs to be corrected. When the fd object has coefficients of dimension 2, ndim==2, plot.fd does not allow the user to change the color at all. I submitted a Pull request for that function. However, the changes to plot.confidence_band cannot really be made until plot.fd is corrected.