myllym / get Goto Github PK
View Code? Open in Web Editor NEWDevelopment version of the R package GET (global envelopes)
Development version of the R package GET (global envelopes)
When using 'rank_envelope' where the data curve has rank 1, I would expect to get a liberal p-value of 0 (according to expression (10) in 'Global envelope tests for spatial processes' (2017)). However, the p-interval returned from 'rank_envelope' gives a liberal p-value of 1/nsim instead.
https://github.com/myllym/GET/blob/master/R/fboxplot.r
I had error tracked down to line 85 of fBoxplot
outliers <- funcs[,outliers_id]
Error in colnames<-
(*tmp*
, value = 15L) :
attempt to set 'colnames' on an object with less than two dimensions
if length(outliers_id) == 1, then outliers becomes a vector in recent R versions. Line 87 tries to set colnames:
colnames(outliers) <- outliers_id
solution would be
outliers <- funcs[,outliers_id, drop = FALSE]
See for instance
https://stackoverflow.com/questions/47754509/how-to-use-drop-f-correctly-in-r-to-preserve-matrix-structure-when-subsetting
There may be other issues like this? Brian
Hi,
I am evaluating some data that contains two-level factors, and ran a graph.flm()
test with contrasts=TRUE
. The result is roughly what I expect, having previously analyzed this data with the fda
package (but switching to GET in order to do tests that control for covariates), however the curve is upside down.
My factor has a natural treatment/no-treatment interpretation (labeled 1 and 0 in my dataframe, respectively) so I expected the "baseline" to be subtracted from the treatment when looking at the contrast, but the opposite is being done. Is there any way to force the ordering of the contrast? I have tried relabeling my factor in case it was alphabetical, but without success.
I have resorted to modifying the result object by multiplying obs
, central
, lo
and hi
by -1 and then swapping lo
and hi
, which seems to give me what I would expect, and I think should be correct. Do you have another recommendation?
Also, this was made slightly more confusing by the fact that with only a single variable omitted in the reduced model, the resulting graph is not titled, so it's not possible to determine which way around the contrast was done without running a second test with more categorical factors omitted, in which case the subplots are labeled and I was able to confirm my suspicion. Is there a way to force a plot label when there is only one plot, or otherwise determine which direction the contrast was done?
Thank you in advance and thank you for making this software available!
When I set the central
argument of central_region
equal to "median"
, it still uses mean
as central function. I believe this is because the argument central
of get_T_0
is not specified when it is called inside individual_central_region
.
Line 125 in dfd7b01
More details : my actual call looks like central_region(my_curve_set, type="erl", coverage=.8, central = "median")
.
When testing the significance of a variable that participates in interactions on its own, R seems to canonicalize the name of interaction terms differently, causing nestedness checks done by GET to fail:
library('GET')
library('fda.usc')
Y <- fdata(matrix(rnorm(96 * 120), 120, 96))
R <- fdata(matrix(rnorm(96 * 120), 120, 96))
S <- fdata(matrix(rnorm(96 * 120), 120, 96))
T <- fdata(matrix(rnorm(96 * 120), 120, 96))
data <- data.frame(V=as.factor(runif(120) > 0.5))
result <- graph.flm(50,
Y ~ V + R + S + T + V:S + V:T,
Y ~ R + S + T + V:S + V:T,
factors=data,
contrasts=TRUE,
curve_sets=list(Y=Y, Z=Z))
results in
Error in check_isnested(formula.full, formula.reduced): The reduced model includes some extra variables, not in the full model.
Traceback:
1. graph.flm(50, Y ~ V + R + S + T + V:S + V:T, Y ~ R + S + T +
. V:S + V:T, factors = data, contrasts = TRUE, savefuns = TRUE,
. curve_sets = list(Y = Y, Z = Z))
2. flm.checks(nsim = nsim, formula.full = formula.full, formula.reduced = formula.reduced,
. curve_sets = curve_sets, factors = factors, fast = fast)
3. check_isnested(formula.full, formula.reduced)
4. stop("The reduced model includes some extra variables, not in the full model.")
This appears to be happening because the labels for the terms in the formula are V:S
and V:T
in the first formula but are computed as S:V
and T:V
in the reduced formula. A workaround for this is to add V
to the full formula last.
I get an
Error in spatstat::im(x$obs < x$lo, xcol = x$rx, yrow = x$ry) :
Length of xcol does not match ncol(mat)
This is due to the used spatstat::im
and spatstat::as.im
treating input x- and y-arguments differently. Plot using the latter are produced first and show up, but the code halts when the former is called.
Code to reproduce:
obs <- matrix(runif(110), 10, 11)
sims <- array(runif(110*12), c(12,10,11))
cr <- global_envelope_test_2d(obs, sims, 1:10, 1:11)
plot(cr)
Line 254 in 136c08c
Hi again,
I get a strange error message from the following example:
library('GET')
library('fda.usc')
Y <- fdata(matrix(rnorm(96 * 120), 120, 96))
Z <- fdata(matrix(rnorm(96 * 120), 120, 96))
data <- data.frame(V=as.factor(runif(120) > 0.5))
result <- graph.flm(50,
Y ~ V + Z,
Y ~ Z,
factors=data,
contrasts=TRUE,
curve_sets=list(Y=Y, Z=Z))
The error I get (with GET 0.1-8) is
Error in (function (Y, dfs, formula.full, nameinteresting, ...) :
The option 'contrasts' only valid for discrete factors with at least two levels.
...
but as you can see from the formula, the variable of interest is a discrete factor with 2 levels ๐
I think this might be a bug? I wasn't able to find anything in the documentation that suggests that this is disallowed.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.