NEWS.md
cor() for an ‘spdesign’ object is deprecated. Use cor(design$design) instead. cor() no longer masks stats::cor(): for any other input, it now calls stats::cor(). Previously, cor() on a matrix failed after loading spdesign.sample_with_replacement is deprecated and ignored with a warning. Design candidates are always drawn without replacement, so the same choice task never occurs more than once in a design.generate_design() now gives an informative error when the design has more rows than there are possible choice tasks: in the candidate set after exclusions for the ‘random’ and ‘federov’ algorithms, or in the full factorial of the attribute levels for the ‘rsc’ algorithm.max_swap is now used by the ‘rsc’ algorithm. It relabels for max_relabel iterations and then swaps for max_swap iterations. Previously, it switched between relabeling and swapping every max_relabel iterations and ignored max_swap.max_relabel and max_swap in the control list of generate_design() are now 500 instead of 10000. With the old defaults, the ‘rsc’ algorithm never swapped within the default 10000 iterations. Alternating between relabeling and swapping finds considerably more efficient designs.generate_design() now gives an error when exclusions or level occurrences are used with the ‘rsc’ algorithm. They were silently ignored before, because the ‘rsc’ algorithm does not use a candidate set.max_no_improve iterations without improvement, and each restart searches from its own starting point. Previously, a new base design candidate could only be accepted if it beat the best design found so far, so the search could not move after a restart. The best design across all runs is returned as the design, and the best design of each run is stored in the new list element ‘runs’, as for the ‘federov’ algorithm.max_no_improve in the control list of generate_design() is now 1000 instead of 100000. The ‘rsc’ search usually reaches a local optimum within a few hundred iterations, and with the old default it never restarted.build_candidate_set() builds the candidate set one alternative at a time instead of from the full factorial of all alternatives. Exclusions that refer to a single alternative are applied to its profiles before the alternatives are combined, and choice tasks that only differ in the order of exchangeable alternatives, e.g. two unlabelled alternatives, are only included once. This uses far less memory for large designs. generate_design() now uses it when no candidate set is supplied. Designs with exchangeable alternatives generated with a given seed will differ from earlier versions.allow_reversed_pairs in generate_design() to include the profiles of exchangeable alternatives in every order. A warning is given if this results in a candidate set with more than a million rows.alt1_x10 and alt1_x1, was applied wrongly and could exclude every row of the candidate set.full_factorial() is deprecated. Use build_candidate_set() to build a candidate set from the utility functions, or expand.grid() for a list of attributes.x1 inside x10 or b inside b_sq. The level occurrences could then never be satisfied and the search ran forever.x1[1:3](2:6), could be applied to the number of levels of another attribute whose name starts with the same name, e.g. x10.x1 inside x10.dudx, e.g. b_x1 and b_x12.* and its attribute, e.g. x1 * b_x1 or b_x1 / x1, now give an informative error.generate_design() returns an error otherwise. Previously, a prior without a matching level gave a misleading error about a singular Fisher information matrix. Attribute names ending in _dummy, e.g. x1_dummy, are also an error, because the _dummy extension belongs on the parameter, e.g. b_x1_dummy. Previously, this gave an error about parameters named NA2 and NA3 without a prior. Other levels, e.g. negative, decimal or unsorted levels, could give wrongly named or wrongly ordered dummy-coded attributes. Only the number of levels matters for the design, so recode meaningful levels, e.g. c(1500, 750, 500), as c(1, 2, 3).I(x1 * x2), were left out of the Fisher information matrix. This also caused the warning ‘longer object length is not a multiple of shorter object length’. The variance-covariance matrix can no longer be silently recycled to the wrong size. If a term or parameter in the utility functions cannot be matched to the design, an informative error is returned.b_time * time_car and b_time * time_bus.I(x1^2), interactions written without spaces, e.g. I(x1*x2), and attribute names starting with a capital I now work.dplyr::distinct().generate_design(), block() and the search algorithms. Previously, any error, including errors from argument checks in generate_design(), returned an incomplete design object instead of stopping. Interrupting the search or blocking with Esc or Ctrl + C still returns the best design or blocking found so far.generate_design() now stops with an informative error if no design with a non-singular Fisher information matrix is found.generate_design() now stops with an informative error if this happens for an attribute with level occurrences specified.|> operator.b_ at some point in the string. b_ was the target for a regex looking for priors. The regex is updated to only consider b_ at the beginning of a word.generate_design() function to fail if all priors were specified as Bayesian. The bug was caused by a check returning a NULL object that would then be expanded to match the number of draws.save_designs to the generate_design() function. When set to TRUE, all intermediate designs generated during the search process will be saved as .rds files in the current working directory. The default value is FALSE.level_balance() that produces a list of level occurrences in the design to inspect level balanceprobabilities() will now return the choice probabilities by choice task.@docType issue