Generates a full experimental design for an experiment.

fullfact(xprmt, ...)

Arguments

xprmt

An object of class experiment.

...

Vectors used to overwrite columns of xprmt. These arguments should be named and their names should match the names of xprmt.

Value

An object of class experiment with a full factorial design of the inputed experiment.

Details

This function is basically a wrapper around the expand.grid function applied to all the column of the inputed experiment object. Any of these columns can be replaced by user-defined vectors of values, see examples.

Examples

sir1 <- load_experiment("sir", system.file("models", "sir.gaml", package = "gamar"))
#> Loading experiment "sir" from file "sir.gaml"...
#>
#> Periods of observation ("obsrates") are converted into integers.
#>
#> Final time step ("tmax") is converted into integer.
#>
#> Seed is converted into numeric.
#>
#> Parameters' types are cast according to model definition
#>
# 1. First type of use: tranforming an experiment into one with a full # factorial design: (use the function `repl`, if you want more details `?repl`) sir2 <- repl(sir1, 3) sir2$p_S0 <- 1:3 sir2
#> Experiment with 3 simulations of 5 parameters and 3 observed variables #> experiment name: sir #> input gaml file: /Users/mac/Desktop/gamar/inst/models/sir.gaml #> model parameters: p_S0, p_I0, p_R0, p_beta, p_gamma #> observed variables: r_S, r_I, r_R #> Experiment overview: #> p_S0 p_I0 p_R0 p_beta p_gamma r_S r_I r_R tmax seed output #> 1 1 1 0 1.5 0.15 1 1 1 1000 1 NA #> 2 2 1 0 1.5 0.15 1 1 1 1000 1 NA #> 3 3 1 0 1.5 0.15 1 1 1 1000 1 NA
sir2[1, 2] <- 2 # "sir2" is not full factorial: sir2
#> Experiment with 3 simulations of 5 parameters and 3 observed variables #> experiment name: sir #> input gaml file: /Users/mac/Desktop/gamar/inst/models/sir.gaml #> model parameters: p_S0, p_I0, p_R0, p_beta, p_gamma #> observed variables: r_S, r_I, r_R #> Experiment overview: #> p_S0 p_I0 p_R0 p_beta p_gamma r_S r_I r_R tmax seed output #> 1 1 2 0 1.5 0.15 1 1 1 1000 1 NA #> 2 2 1 0 1.5 0.15 1 1 1 1000 1 NA #> 3 3 1 0 1.5 0.15 1 1 1 1000 1 NA
# this is: fullfact(sir2)
#> p_S0 p_I0 p_R0 p_beta p_gamma r_S r_I r_R tmax seed output #> 1 1 2 0 1.5 0.15 1 1 1 1000 1 NA #> 2 2 2 0 1.5 0.15 1 1 1 1000 1 NA #> 3 3 2 0 1.5 0.15 1 1 1 1000 1 NA #> 4 1 1 0 1.5 0.15 1 1 1 1000 1 NA #> 5 2 1 0 1.5 0.15 1 1 1 1000 1 NA #> 6 3 1 0 1.5 0.15 1 1 1 1000 1 NA
# 2. Second type of use: by providing vectors of values to overwrite elements # of the "experiment" object and then expand it into full factorial design: fullfact(sir2, p_S0 = 1:3, p_I0 = 4:5)
#> p_S0 p_I0 p_R0 p_beta p_gamma r_S r_I r_R tmax seed output #> 1 1 4 0 1.5 0.15 1 1 1 1000 1 NA #> 2 2 4 0 1.5 0.15 1 1 1 1000 1 NA #> 3 3 4 0 1.5 0.15 1 1 1 1000 1 NA #> 4 1 5 0 1.5 0.15 1 1 1 1000 1 NA #> 5 2 5 0 1.5 0.15 1 1 1 1000 1 NA #> 6 3 5 0 1.5 0.15 1 1 1 1000 1 NA