tylermorganwall / skpr

Generates and evaluates D, I, A, Alias, E, T, G, and custom optimal designs. Supports generation and evaluation of mixture and split/split-split/N-split plot designs. Includes parametric and Monte Carlo power evaluation functions. Provides a framework to evaluate power using functions provided in other packages or written by the user.
https://tylermorganwall.github.io/skpr/
GNU General Public License v3.0
115 stars 15 forks source link

get_optimality fails to retrieve $D (d efficiency( by eval_design() #58

Closed kdevkdev closed 9 months ago

kdevkdev commented 4 years ago

Thx for great package!

eval_design() seemingly stores d efficiency in attribute "D" (lines 415 - 430) , but get_optimality() only considers attribute "D-Efficiency"

I suggest to coherently store it in "D-Efficiency"?

GeorgeMKhoury commented 3 years ago

Sorry for the delay. @tylermorganwall At first I thought this was just a style suggestion, but now I see that we have a serious problem here.

From the get_optimality() help:

> factorialcoffee = expand.grid(cost = c(1, 2),
                                type = as.factor(c("Kona", "Colombian", "Ethiopian", "Sumatra")),
                                size = as.factor(c("Short", "Grande", "Venti")))
> 
> designcoffee = gen_design(factorialcoffee, ~cost + size + type, trials = 29,
                            optimality = "D", repeats = 100)
> power_output = eval_design(designcoffee, model = ~cost + size + type,
                             alpha = 0.05, detailedoutput = TRUE)
> get_optimality(designcoffee)
         D         I        A            G   T        E    Alias
1 99.09996 0.2224214 98.21557 Not Computed 203 22.79472 18.29479
> get_optimality(power_output)
   D         I  A  G  T  E    Alias
1 NA 0.2224214 NA NA NA NA 18.25657

get_optimality should return the same values when fed a gen_design or eval_design output.

tylermorganwall commented 9 months ago

I believe this has been fixed since this issue was opened.