data("rimov")
res <- graph.flm(nsim=19, # Increase the number of simulations for serious analysis!
formula.full = Y~Year,
formula.reduced = Y~1,
curve_sets = list(Y=rimov), factors = data.frame(Year = 1979:2014))
plot(res)
# Test if there is a change in the slope in 1994,
# i.e. the full model is T = a + b*year + c*year:Interv,
# where Interv is a dummy variable indicating the pre-intervention
# period (coded 0) or the post-intervention period (coded 1)
Year <- 1979:2014
res <- graph.flm(nsim = 19, # Increase the number of simulations for serious analysis!
formula.full = Y ~ Year + Year:Interv,
formula.reduced = Y ~ Year,
curve_sets = list(Y=rimov),
factors = data.frame(Year = Year,
Interv = factor(c(rep(0,times=1994-1979+1), rep(1,times=2014-1994)),
levels=0:1)),
contrasts = NULL)
plot(res)
# An example of testing the joint effect of a discrete and a continuous variable
nsim <- 999
nsim <- 19
data("GDPtax")
factors.df <- data.frame(Group = GDPtax$Group, Tax = GDPtax$Profittax)
res.tax_within_group <- graph.flm(nsim = nsim,
formula.full = Y~Group+Tax+Group:Tax,
formula.reduced = Y~Group+Tax,
curve_sets = list(Y=GDPtax$GDP),
factors = factors.df)
plot(res.tax_within_group)
# Image data examples
data("abide_9002_23")
iset <- abide_9002_23$curve_set
# \dontshow{
# Cut the data to reduce time
iset$r <- iset$r[1:29,]
iset$funcs <- iset$funcs[1:29, ]
# }
# Testing the discrete factor 'group' with contrasts
# (Use contrasts = FALSE for 'means'; and for continuous factors)
res <- graph.flm(nsim = 19, # Increase nsim for serious analysis!
formula.full = Y ~ Group + Sex + Age,
formula.reduced = Y ~ Sex + Age,
curve_sets = list(Y = iset),
factors = abide_9002_23[['factors']],
contrasts = TRUE,
GET.args = list(type = "area"))
plot(res)
# Examples of modifying 2d plots
plot(res, sign.col="white") + ggplot2::scale_fill_viridis_c(option="magma")
plot(res, sign.col="white") + ggplot2::scale_fill_viridis_c(option="magma") +
ggplot2::scale_radius(range = 2*c(1, 6))
plot(res, what=c("obs", "lo", "hi", "lo.sign", "hi.sign"))
plot(res, what=c("obs", "lo", "hi", "lo.sign", "hi.sign"), sign.type="col")
Run the code above in your browser using DataLab