Skip to content

glmmrOptim

Approximate Optimal Experimental Designs Using Generalised Linear Mixed Models

v0.3.7 · Mar 31, 2026 · GPL (>= 2)

Description

Optimal design analysis algorithms for any study design that can be represented or modelled as a generalised linear mixed model including cluster randomised trials, cohort studies, spatial and temporal epidemiological studies, and split-plot designs. See <https://github.com/samuel-watson/glmmrBase/blob/master/README.md> for a detailed manual on model specification. A detailed discussion of the methods in this package can be found in Watson, Hemming, and Girling (2023) <doi:10.1177/09622802231202379>.

Downloads

326

Last 30 days

11989th

725

Last 90 days

2.7K

Last year

Trend: +41.1% (30d vs prior 30d)

CRAN Check Status

7 ERROR
1 NOTE
6 OK
Show all 14 flavors
Flavor Status
r-devel-linux-x86_64-debian-clang OK
r-devel-linux-x86_64-debian-gcc OK
r-devel-linux-x86_64-fedora-clang OK
r-devel-linux-x86_64-fedora-gcc ERROR
r-devel-macos-arm64 ERROR
r-devel-windows-x86_64 OK
r-oldrel-macos-arm64 NOTE
r-oldrel-macos-x86_64 ERROR
r-oldrel-windows-x86_64 ERROR
r-patched-linux-x86_64 OK
r-release-linux-x86_64 OK
r-release-macos-arm64 ERROR
r-release-macos-x86_64 ERROR
r-release-windows-x86_64 ERROR
Check details (9 non-OK)
ERROR r-devel-linux-x86_64-fedora-gcc

examples

Running examples in ‘glmmrOptim-Ex.R’ failed
The error most likely occurred in:

> ### Name: DesignSpace
> ### Title: A GLMM Design Space
> ### Aliases: DesignSpace
> 
> ### ** Examples
> 
> 
> ## ------------------------------------------------
> ## Method `DesignSpace$new`
> ## ------------------------------------------------
> 
> ## Don't show: 
> glmmrBase::setParallel(FALSE) # for the CRAN check
> setParallelOptim(FALSE)
> ## End(Don't show)
> df <- nelder(~ ((int(2)*t(3)) > cl(3)) > ind(5))
> df$int <- df$int - 1
> des <- Model$new(formula = ~ int + factor(t) - 1+ (1|gr(cl)) + (1|gr(cl,t)),
+                  covariance = c(0.04,0.01),
+                  mean = rep(0,4),
+                  data=df,
+                  family=gaussian())
> ds <- DesignSpace$new(des)
experimental condition not provided, assuming each observation is a separate experimental condition. experimental condition can be changed manually in self$experimental_condition
> #add another design
> des2 <- Model$ne
...[truncated]...
*********
Removing: 12**|

|Iteration 120| Size: 31 Current value: 0.13282
Calculating removals: 
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
************************************************
Removing: 7**|

FINISHED REVERSE GREEDY SEARCH> 
> #let the experimental condition be the cluster
> # these experimental conditions are independent of one another
> ds <- DesignSpace$new(des,experimental_condition = df$cl)
> # now find the optimal 4 clusters to include
> # approximately, finding the weights for each condition
> opt <- ds$optimal(4,C=list(c(rep(0,5),1)))
Checking experimental condition correlations...
Experimental conditions uncorrelated, using second-order cone program
Error in Rmosek::mosek(prob, opts) : 
  Unknown exported object to be built. Please use 'Rmosek::mosek_attachbuilder' to complete the installation of Rmosek.
Calls: <Anonymous> ... method(solve_via_data, CVXR::Mosek_Solver) -> <Anonymous>
Execution halted
ERROR r-devel-macos-arm64

examples

Running examples in ‘glmmrOptim-Ex.R’ failed
The error most likely occurred in:

> ### Name: DesignSpace
> ### Title: A GLMM Design Space
> ### Aliases: DesignSpace
> 
> ### ** Examples
> 
> 
> ## ------------------------------------------------
> ## Method `DesignSpace$new`
> ## ------------------------------------------------
> 
> ## Don't show: 
> glmmrBase::setParallel(FALSE) # for the CRAN check
> setParallelOptim(FALSE)
> ## End(Don't show)
> df <- nelder(~ ((int(2)*t(3)) > cl(3)) > ind(5))
> df$int <- df$int - 1
> des <- Model$new(formula = ~ int + factor(t) - 1+ (1|gr(cl)) + (1|gr(cl,t)),
+                  covariance = c(0.04,0.01),
+                  mean = rep(0,4),
+                  data=df,
+                  family=gaussian())
> ds <- DesignSpace$new(des)
experimental condition not provided, assuming each observation is a separate experimental condition. experimental condition can be changed manually in self$experimental_condition
> #add another design
> des2 <- Model$ne
...[truncated]...
*********
Removing: 7**|

|Iteration 120| Size: 31 Current value: 0.13282
Calculating removals: 
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
************************************************
Removing: 12**|

FINISHED REVERSE GREEDY SEARCH> 
> #let the experimental condition be the cluster
> # these experimental conditions are independent of one another
> ds <- DesignSpace$new(des,experimental_condition = df$cl)
> # now find the optimal 4 clusters to include
> # approximately, finding the weights for each condition
> opt <- ds$optimal(4,C=list(c(rep(0,5),1)))
Checking experimental condition correlations...
Experimental conditions uncorrelated, using second-order cone program
Error in Rmosek::mosek(prob, opts) : 
  Unknown exported object to be built. Please use 'Rmosek::mosek_attachbuilder' to complete the installation of Rmosek.
Calls: <Anonymous> ... method(solve_via_data, CVXR::Mosek_Solver) -> <Anonymous>
Execution halted
NOTE r-oldrel-macos-arm64

installed package size

installed size is 45.7Mb
  sub-directories of 1Mb or more:
    libs  45.5Mb
ERROR r-oldrel-macos-x86_64

examples

Running examples in ‘glmmrOptim-Ex.R’ failed
The error most likely occurred in:

> ### Name: DesignSpace
> ### Title: A GLMM Design Space
> ### Aliases: DesignSpace
> 
> ### ** Examples
> 
> 
> ## ------------------------------------------------
> ## Method `DesignSpace$new`
> ## ------------------------------------------------
> 
> ## Don't show: 
> glmmrBase::setParallel(FALSE) # for the CRAN check
> setParallelOptim(FALSE)
> ## End(Don't show)
> df <- nelder(~ ((int(2)*t(3)) > cl(3)) > ind(5))
> df$int <- df$int - 1
> des <- Model$new(formula = ~ int + factor(t) - 1+ (1|gr(cl)) + (1|gr(cl,t)),
+                  covariance = c(0.04,0.01),
+                  mean = rep(0,4),
+                  data=df,
+                  family=gaussian())
> ds <- DesignSpace$new(des)
experimental condition not provided, assuming each observation is a separate experimental condition. experimental condition can be changed manually in self$experimental_condition
> #add another design
> des2 <- Model$ne
...[truncated]...
*********
Removing: 12**|

|Iteration 120| Size: 31 Current value: 0.13282
Calculating removals: 
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
************************************************
Removing: 7**|

FINISHED REVERSE GREEDY SEARCH> 
> #let the experimental condition be the cluster
> # these experimental conditions are independent of one another
> ds <- DesignSpace$new(des,experimental_condition = df$cl)
> # now find the optimal 4 clusters to include
> # approximately, finding the weights for each condition
> opt <- ds$optimal(4,C=list(c(rep(0,5),1)))
Checking experimental condition correlations...
Experimental conditions uncorrelated, using second-order cone program
Error in Rmosek::mosek(prob, opts) : 
  Unknown exported object to be built. Please use 'Rmosek::mosek_attachbuilder' to complete the installation of Rmosek.
Calls: <Anonymous> ... method(solve_via_data, CVXR::Mosek_Solver) -> <Anonymous>
Execution halted
NOTE r-oldrel-macos-x86_64

installed package size

installed size is 46.7Mb
  sub-directories of 1Mb or more:
    libs  46.4Mb
ERROR r-oldrel-windows-x86_64

examples

Running examples in 'glmmrOptim-Ex.R' failed
The error most likely occurred in:

> ### Name: DesignSpace
> ### Title: A GLMM Design Space
> ### Aliases: DesignSpace
> 
> ### ** Examples
> 
> 
> ## ------------------------------------------------
> ## Method `DesignSpace$new`
> ## ------------------------------------------------
> 
> ## Don't show: 
> glmmrBase::setParallel(FALSE) # for the CRAN check
> setParallelOptim(FALSE)
> ## End(Don't show)
> df <- nelder(~ ((int(2)*t(3)) > cl(3)) > ind(5))
> df$int <- df$int - 1
> des <- Model$new(formula = ~ int + factor(t) - 1+ (1|gr(cl)) + (1|gr(cl,t)),
+                  covariance = c(0.04,0.01),
+                  mean = rep(0,4),
+                  data=df,
+                  family=gaussian())
> ds <- DesignSpace$new(des)
experimental condition not provided, assuming each observation is a separate experimental condition. experimental condition can be changed manually in self$experimental_condition
> #add another design
> des2 <- Model$ne
...[truncated]...
128099
Calculating removals: 
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
************************************************
Removing: 12**|

|Iteration 120| Size: 31 Current value: 0.13282
Calculating removals: 
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
************************************************
Removing: 7**|

FINISHED REVERSE GREEDY SEARCH> 
> #let the experimental condition be the cluster
> # these experimental conditions are independent of one another
> ds <- DesignSpace$new(des,experimental_condition = df$cl)
> # now find the optimal 4 clusters to include
> # approximately, finding the weights for each condition
> opt <- ds$optimal(4,C=list(c(rep(0,5),1)))
Checking experimental condition correlations...
Experimental conditions uncorrelated, using second-order cone program
Error: 'solve' is not an exported object from 'namespace:CVXR'
Execution halted
ERROR r-release-macos-arm64

examples

Running examples in ‘glmmrOptim-Ex.R’ failed
The error most likely occurred in:

> ### Name: DesignSpace
> ### Title: A GLMM Design Space
> ### Aliases: DesignSpace
> 
> ### ** Examples
> 
> 
> ## ------------------------------------------------
> ## Method `DesignSpace$new`
> ## ------------------------------------------------
> 
> ## Don't show: 
> glmmrBase::setParallel(FALSE) # for the CRAN check
> setParallelOptim(FALSE)
> ## End(Don't show)
> df <- nelder(~ ((int(2)*t(3)) > cl(3)) > ind(5))
> df$int <- df$int - 1
> des <- Model$new(formula = ~ int + factor(t) - 1+ (1|gr(cl)) + (1|gr(cl,t)),
+                  covariance = c(0.04,0.01),
+                  mean = rep(0,4),
+                  data=df,
+                  family=gaussian())
> ds <- DesignSpace$new(des)
experimental condition not provided, assuming each observation is a separate experimental condition. experimental condition can be changed manually in self$experimental_condition
> #add another design
> des2 <- Model$ne
...[truncated]...
*********
Removing: 7**|

|Iteration 120| Size: 31 Current value: 0.13282
Calculating removals: 
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
************************************************
Removing: 12**|

FINISHED REVERSE GREEDY SEARCH> 
> #let the experimental condition be the cluster
> # these experimental conditions are independent of one another
> ds <- DesignSpace$new(des,experimental_condition = df$cl)
> # now find the optimal 4 clusters to include
> # approximately, finding the weights for each condition
> opt <- ds$optimal(4,C=list(c(rep(0,5),1)))
Checking experimental condition correlations...
Experimental conditions uncorrelated, using second-order cone program
Error in Rmosek::mosek(prob, opts) : 
  Unknown exported object to be built. Please use 'Rmosek::mosek_attachbuilder' to complete the installation of Rmosek.
Calls: <Anonymous> ... method(solve_via_data, CVXR::Mosek_Solver) -> <Anonymous>
Execution halted
ERROR r-release-macos-x86_64

examples

Running examples in ‘glmmrOptim-Ex.R’ failed
The error most likely occurred in:

> ### Name: DesignSpace
> ### Title: A GLMM Design Space
> ### Aliases: DesignSpace
> 
> ### ** Examples
> 
> 
> ## ------------------------------------------------
> ## Method `DesignSpace$new`
> ## ------------------------------------------------
> 
> ## Don't show: 
> glmmrBase::setParallel(FALSE) # for the CRAN check
> setParallelOptim(FALSE)
> ## End(Don't show)
> df <- nelder(~ ((int(2)*t(3)) > cl(3)) > ind(5))
> df$int <- df$int - 1
> des <- Model$new(formula = ~ int + factor(t) - 1+ (1|gr(cl)) + (1|gr(cl,t)),
+                  covariance = c(0.04,0.01),
+                  mean = rep(0,4),
+                  data=df,
+                  family=gaussian())
> ds <- DesignSpace$new(des)
experimental condition not provided, assuming each observation is a separate experimental condition. experimental condition can be changed manually in self$experimental_condition
> #add another design
> des2 <- Model$ne
...[truncated]...
*********
Removing: 12**|

|Iteration 120| Size: 31 Current value: 0.13282
Calculating removals: 
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
************************************************
Removing: 7**|

FINISHED REVERSE GREEDY SEARCH> 
> #let the experimental condition be the cluster
> # these experimental conditions are independent of one another
> ds <- DesignSpace$new(des,experimental_condition = df$cl)
> # now find the optimal 4 clusters to include
> # approximately, finding the weights for each condition
> opt <- ds$optimal(4,C=list(c(rep(0,5),1)))
Checking experimental condition correlations...
Experimental conditions uncorrelated, using second-order cone program
Error in Rmosek::mosek(prob, opts) : 
  Unknown exported object to be built. Please use 'Rmosek::mosek_attachbuilder' to complete the installation of Rmosek.
Calls: <Anonymous> ... method(solve_via_data, CVXR::Mosek_Solver) -> <Anonymous>
Execution halted
ERROR r-release-windows-x86_64

examples

Running examples in 'glmmrOptim-Ex.R' failed
The error most likely occurred in:

> ### Name: DesignSpace
> ### Title: A GLMM Design Space
> ### Aliases: DesignSpace
> 
> ### ** Examples
> 
> 
> ## ------------------------------------------------
> ## Method `DesignSpace$new`
> ## ------------------------------------------------
> 
> ## Don't show: 
> glmmrBase::setParallel(FALSE) # for the CRAN check
> setParallelOptim(FALSE)
> ## End(Don't show)
> df <- nelder(~ ((int(2)*t(3)) > cl(3)) > ind(5))
> df$int <- df$int - 1
> des <- Model$new(formula = ~ int + factor(t) - 1+ (1|gr(cl)) + (1|gr(cl,t)),
+                  covariance = c(0.04,0.01),
+                  mean = rep(0,4),
+                  data=df,
+                  family=gaussian())
> ds <- DesignSpace$new(des)
experimental condition not provided, assuming each observation is a separate experimental condition. experimental condition can be changed manually in self$experimental_condition
> #add another design
> des2 <- Model$ne
...[truncated]...
128099
Calculating removals: 
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
************************************************
Removing: 12**|

|Iteration 120| Size: 31 Current value: 0.13282
Calculating removals: 
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
************************************************
Removing: 7**|

FINISHED REVERSE GREEDY SEARCH> 
> #let the experimental condition be the cluster
> # these experimental conditions are independent of one another
> ds <- DesignSpace$new(des,experimental_condition = df$cl)
> # now find the optimal 4 clusters to include
> # approximately, finding the weights for each condition
> opt <- ds$optimal(4,C=list(c(rep(0,5),1)))
Checking experimental condition correlations...
Experimental conditions uncorrelated, using second-order cone program
Error: 'solve' is not an exported object from 'namespace:CVXR'
Execution halted

Additional Issues

M1mac Details →

Check History

ERROR 4 OK · 2 NOTE · 0 WARNING · 8 ERROR · 0 FAILURE Mar 10, 2026
ERROR r-devel-linux-x86_64-debian-clang

examples

Running examples in ‘glmmrOptim-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: DesignSpace
> ### Title: A GLMM Design Space
> ### Aliases: DesignSpace
> 
> ### ** Examples
> 
> 

...[truncated]...
ndition
> opt <- ds$optimal(4,C=list(c(rep(0,5),1)))
Checking experimental condition correlations...
Experimental conditions uncorrelated, using second-order cone program
Error: 'solve' is not an exported object from 'namespace:CVXR'
Execution halted
ERROR r-devel-linux-x86_64-debian-gcc

examples

Running examples in ‘glmmrOptim-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: DesignSpace
> ### Title: A GLMM Design Space
> ### Aliases: DesignSpace
> 
> ### ** Examples
> 
> 

...[truncated]...
ndition
> opt <- ds$optimal(4,C=list(c(rep(0,5),1)))
Checking experimental condition correlations...
Experimental conditions uncorrelated, using second-order cone program
Error: 'solve' is not an exported object from 'namespace:CVXR'
Execution halted
ERROR r-devel-linux-x86_64-fedora-clang

examples

Running examples in ‘glmmrOptim-Ex.R’ failed
The error most likely occurred in:

> ### Name: DesignSpace
> ### Title: A GLMM Design Space
> ### Aliases: DesignSpace
> 
> ### ** Examples
> 
> 
> ## ------------------------------------------------
> ##
...[truncated]...
ndition
> opt <- ds$optimal(4,C=list(c(rep(0,5),1)))
Checking experimental condition correlations...
Experimental conditions uncorrelated, using second-order cone program
Error: 'solve' is not an exported object from 'namespace:CVXR'
Execution halted
ERROR r-devel-linux-x86_64-fedora-gcc

examples

Running examples in ‘glmmrOptim-Ex.R’ failed
The error most likely occurred in:

> ### Name: DesignSpace
> ### Title: A GLMM Design Space
> ### Aliases: DesignSpace
> 
> ### ** Examples
> 
> 
> ## ------------------------------------------------
> ##
...[truncated]...
ndition
> opt <- ds$optimal(4,C=list(c(rep(0,5),1)))
Checking experimental condition correlations...
Experimental conditions uncorrelated, using second-order cone program
Error: 'solve' is not an exported object from 'namespace:CVXR'
Execution halted
ERROR r-devel-windows-x86_64

examples

Running examples in 'glmmrOptim-Ex.R' failed
The error most likely occurred in:

> ### Name: DesignSpace
> ### Title: A GLMM Design Space
> ### Aliases: DesignSpace
> 
> ### ** Examples
> 
> 
> ## ------------------------------------------------
> ##
...[truncated]...
ndition
> opt <- ds$optimal(4,C=list(c(rep(0,5),1)))
Checking experimental condition correlations...
Experimental conditions uncorrelated, using second-order cone program
Error: 'solve' is not an exported object from 'namespace:CVXR'
Execution halted
ERROR r-release-linux-x86_64

examples

Running examples in ‘glmmrOptim-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: DesignSpace
> ### Title: A GLMM Design Space
> ### Aliases: DesignSpace
> 
> ### ** Examples
> 
> 

...[truncated]...
ndition
> opt <- ds$optimal(4,C=list(c(rep(0,5),1)))
Checking experimental condition correlations...
Experimental conditions uncorrelated, using second-order cone program
Error: 'solve' is not an exported object from 'namespace:CVXR'
Execution halted
ERROR r-release-windows-x86_64

examples

Running examples in 'glmmrOptim-Ex.R' failed
The error most likely occurred in:

> ### Name: DesignSpace
> ### Title: A GLMM Design Space
> ### Aliases: DesignSpace
> 
> ### ** Examples
> 
> 
> ## ------------------------------------------------
> ##
...[truncated]...
ndition
> opt <- ds$optimal(4,C=list(c(rep(0,5),1)))
Checking experimental condition correlations...
Experimental conditions uncorrelated, using second-order cone program
Error: 'solve' is not an exported object from 'namespace:CVXR'
Execution halted
NOTE r-oldrel-macos-arm64

installed package size

installed size is 45.7Mb
  sub-directories of 1Mb or more:
    libs  45.5Mb
NOTE r-oldrel-macos-x86_64

installed package size

installed size is 46.0Mb
  sub-directories of 1Mb or more:
    libs  45.7Mb
ERROR r-oldrel-windows-x86_64

examples

Running examples in 'glmmrOptim-Ex.R' failed
The error most likely occurred in:

> ### Name: DesignSpace
> ### Title: A GLMM Design Space
> ### Aliases: DesignSpace
> 
> ### ** Examples
> 
> 
> ## ------------------------------------------------
> ##
...[truncated]...
ndition
> opt <- ds$optimal(4,C=list(c(rep(0,5),1)))
Checking experimental condition correlations...
Experimental conditions uncorrelated, using second-order cone program
Error: 'solve' is not an exported object from 'namespace:CVXR'
Execution halted

Dependency Network

Dependencies Reverse dependencies Matrix glmmrBase Rcpp digest glmmrOptim

Version History

updated 0.3.7 ← 0.3.6 diff Mar 31, 2026
new 0.3.6 Mar 10, 2026
updated 0.3.6 ← 0.3.5 diff Dec 16, 2024
updated 0.3.5 ← 0.3.4 diff Jun 1, 2024
updated 0.3.4 ← 0.3.3 diff Mar 11, 2024
updated 0.3.3 ← 0.3.2 diff Nov 21, 2023
updated 0.3.2 ← 0.3.1 diff Sep 10, 2023
updated 0.3.1 ← 0.2.5 diff Aug 17, 2023
updated 0.2.5 ← 0.2.4 diff Jul 3, 2023
updated 0.2.4 ← 0.2.3 diff Apr 19, 2023
updated 0.2.3 ← 0.2.2 diff Feb 23, 2023
new 0.2.2 Jan 19, 2023