The function 'GRP()' generates random proportions based on a design, i.e., a list giving the factors and the categories with each factor. The data are returned in the 'wide' format.
GRP( props, n, BSDesign=NULL, WSDesign=NULL, sname = "s" )
rBernoulli(n, p)
How many simulated participants are in each between-subject group (can be a vector, one per group);
a proportion of success;
A list with the between-subject factor(s) and the categories within each;
A list with the within-subject factor(s) and the categories within each;
(optional) the proportion of succes in each cell of the design. Default 0.50;
(optional) the column name that will contain the success/failure;
GRP()
returns a data frame containing success (coded as 1) or failure (coded as 0)
for n participants per cells of the design. Note that correlated
scores cannot be generated by GRP()
; see (Lunn and Davies 1998)
.
rBernoulli()
returns a sequence of n success (1) or failures (0)
The name of the function GRP()
is derived from GRD()
,
a general-purpose tool to generate random data (Calderini and Harding 2019)
now bundled in the superb
package (Cousineau et al. 2021)
.
GRP()
is actually a proxy for GRD()
.
Calderini M, Harding B (2019).
“GRD for R: An intuitive tool for generating random data in R.”
The Quantitative Methods for Psychology, 15(1), 1--11.
doi:10.20982/tqmp.15.1.p001
.
Cousineau D, Goulet M, Harding B (2021).
“Summary plots with adjusted error bars: The superb framework with an implementation in R.”
Advances in Methods and Practices in Psychological Science, 4, 1--18.
doi:10.1177/25152459211035109
.
Lunn AD, Davies SJ (1998).
“A note on generating correlated binary variables.”
Biometrika, 85(2), 487--490.
doi:10.1093/biomet/85.2.487
.
# The first example generate scorse for 20 particants in one factor having
# two categories (low and high):
design <- list( A=c("low","high"))
GRP( design, props = c(0.1, 0.9), n = 20 )
#> id A s
#> 1 1 low 0
#> 2 2 low 0
#> 3 3 low 0
#> 4 4 low 0
#> 5 5 low 0
#> 6 6 low 0
#> 7 7 low 0
#> 8 8 low 0
#> 9 9 low 0
#> 10 10 low 0
#> 11 11 low 0
#> 12 12 low 0
#> 13 13 low 0
#> 14 14 low 0
#> 15 15 low 0
#> 16 16 low 0
#> 17 17 low 0
#> 18 18 low 0
#> 19 19 low 0
#> 20 20 low 1
#> 21 21 high 1
#> 22 22 high 1
#> 23 23 high 1
#> 24 24 high 1
#> 25 25 high 1
#> 26 26 high 1
#> 27 27 high 1
#> 28 28 high 1
#> 29 29 high 1
#> 30 30 high 1
#> 31 31 high 0
#> 32 32 high 1
#> 33 33 high 1
#> 34 34 high 1
#> 35 35 high 1
#> 36 36 high 1
#> 37 37 high 1
#> 38 38 high 1
#> 39 39 high 1
#> 40 40 high 1
# This example has two factors, with factor A having levels a, b, c
# and factor B having 2 levels, for a total of 6 conditions;
# with 40 participants per group, it represents 240 observations:
design <- list( A=letters[1:3], B = c("low","high"))
GRP( design, props = c(0.1, 0.15, 0.20, 0.80, 0.85, 0.90), n = 40 )
#> id A B s
#> 1 1 a low 0
#> 2 2 a low 0
#> 3 3 a low 0
#> 4 4 a low 0
#> 5 5 a low 1
#> 6 6 a low 0
#> 7 7 a low 0
#> 8 8 a low 0
#> 9 9 a low 0
#> 10 10 a low 0
#> 11 11 a low 0
#> 12 12 a low 0
#> 13 13 a low 0
#> 14 14 a low 0
#> 15 15 a low 0
#> 16 16 a low 0
#> 17 17 a low 0
#> 18 18 a low 0
#> 19 19 a low 0
#> 20 20 a low 0
#> 21 21 a low 0
#> 22 22 a low 1
#> 23 23 a low 0
#> 24 24 a low 0
#> 25 25 a low 1
#> 26 26 a low 0
#> 27 27 a low 0
#> 28 28 a low 0
#> 29 29 a low 0
#> 30 30 a low 0
#> 31 31 a low 0
#> 32 32 a low 0
#> 33 33 a low 0
#> 34 34 a low 0
#> 35 35 a low 0
#> 36 36 a low 0
#> 37 37 a low 0
#> 38 38 a low 0
#> 39 39 a low 0
#> 40 40 a low 0
#> 41 41 b low 0
#> 42 42 b low 0
#> 43 43 b low 0
#> 44 44 b low 0
#> 45 45 b low 0
#> 46 46 b low 0
#> 47 47 b low 0
#> 48 48 b low 1
#> 49 49 b low 0
#> 50 50 b low 0
#> 51 51 b low 0
#> 52 52 b low 1
#> 53 53 b low 0
#> 54 54 b low 0
#> 55 55 b low 0
#> 56 56 b low 0
#> 57 57 b low 0
#> 58 58 b low 0
#> 59 59 b low 1
#> 60 60 b low 0
#> 61 61 b low 0
#> 62 62 b low 0
#> 63 63 b low 0
#> 64 64 b low 0
#> 65 65 b low 0
#> 66 66 b low 0
#> 67 67 b low 0
#> 68 68 b low 0
#> 69 69 b low 0
#> 70 70 b low 0
#> 71 71 b low 0
#> 72 72 b low 0
#> 73 73 b low 0
#> 74 74 b low 0
#> 75 75 b low 0
#> 76 76 b low 0
#> 77 77 b low 0
#> 78 78 b low 0
#> 79 79 b low 0
#> 80 80 b low 0
#> 81 81 c low 0
#> 82 82 c low 0
#> 83 83 c low 1
#> 84 84 c low 0
#> 85 85 c low 0
#> 86 86 c low 0
#> 87 87 c low 1
#> 88 88 c low 1
#> 89 89 c low 1
#> 90 90 c low 1
#> 91 91 c low 0
#> 92 92 c low 0
#> 93 93 c low 1
#> 94 94 c low 0
#> 95 95 c low 0
#> 96 96 c low 1
#> 97 97 c low 0
#> 98 98 c low 0
#> 99 99 c low 0
#> 100 100 c low 1
#> 101 101 c low 0
#> 102 102 c low 1
#> 103 103 c low 0
#> 104 104 c low 0
#> 105 105 c low 0
#> 106 106 c low 0
#> 107 107 c low 0
#> 108 108 c low 0
#> 109 109 c low 0
#> 110 110 c low 0
#> 111 111 c low 0
#> 112 112 c low 0
#> 113 113 c low 0
#> 114 114 c low 1
#> 115 115 c low 1
#> 116 116 c low 0
#> 117 117 c low 0
#> 118 118 c low 0
#> 119 119 c low 0
#> 120 120 c low 0
#> 121 121 a high 1
#> 122 122 a high 1
#> 123 123 a high 0
#> 124 124 a high 0
#> 125 125 a high 1
#> 126 126 a high 1
#> 127 127 a high 1
#> 128 128 a high 1
#> 129 129 a high 0
#> 130 130 a high 1
#> 131 131 a high 1
#> 132 132 a high 1
#> 133 133 a high 1
#> 134 134 a high 1
#> 135 135 a high 0
#> 136 136 a high 0
#> 137 137 a high 1
#> 138 138 a high 1
#> 139 139 a high 1
#> 140 140 a high 1
#> 141 141 a high 0
#> 142 142 a high 1
#> 143 143 a high 1
#> 144 144 a high 1
#> 145 145 a high 1
#> 146 146 a high 1
#> 147 147 a high 1
#> 148 148 a high 1
#> 149 149 a high 1
#> 150 150 a high 1
#> 151 151 a high 1
#> 152 152 a high 1
#> 153 153 a high 0
#> 154 154 a high 1
#> 155 155 a high 1
#> 156 156 a high 1
#> 157 157 a high 1
#> 158 158 a high 0
#> 159 159 a high 1
#> 160 160 a high 1
#> 161 161 b high 1
#> 162 162 b high 1
#> 163 163 b high 1
#> 164 164 b high 1
#> 165 165 b high 1
#> 166 166 b high 1
#> 167 167 b high 1
#> 168 168 b high 1
#> 169 169 b high 1
#> 170 170 b high 1
#> 171 171 b high 1
#> 172 172 b high 1
#> 173 173 b high 0
#> 174 174 b high 1
#> 175 175 b high 1
#> 176 176 b high 1
#> 177 177 b high 1
#> 178 178 b high 0
#> 179 179 b high 1
#> 180 180 b high 0
#> 181 181 b high 1
#> 182 182 b high 1
#> 183 183 b high 1
#> 184 184 b high 1
#> 185 185 b high 1
#> 186 186 b high 1
#> 187 187 b high 1
#> 188 188 b high 1
#> 189 189 b high 1
#> 190 190 b high 1
#> 191 191 b high 0
#> 192 192 b high 1
#> 193 193 b high 0
#> 194 194 b high 1
#> 195 195 b high 1
#> 196 196 b high 1
#> 197 197 b high 1
#> 198 198 b high 0
#> 199 199 b high 1
#> 200 200 b high 1
#> 201 201 c high 1
#> 202 202 c high 1
#> 203 203 c high 1
#> 204 204 c high 1
#> 205 205 c high 1
#> 206 206 c high 1
#> 207 207 c high 1
#> 208 208 c high 1
#> 209 209 c high 0
#> 210 210 c high 1
#> 211 211 c high 1
#> 212 212 c high 1
#> 213 213 c high 0
#> 214 214 c high 1
#> 215 215 c high 1
#> 216 216 c high 1
#> 217 217 c high 1
#> 218 218 c high 1
#> 219 219 c high 1
#> 220 220 c high 1
#> 221 221 c high 1
#> 222 222 c high 1
#> 223 223 c high 1
#> 224 224 c high 1
#> 225 225 c high 0
#> 226 226 c high 1
#> 227 227 c high 1
#> 228 228 c high 1
#> 229 229 c high 1
#> 230 230 c high 1
#> 231 231 c high 1
#> 232 232 c high 1
#> 233 233 c high 1
#> 234 234 c high 1
#> 235 235 c high 1
#> 236 236 c high 1
#> 237 237 c high 1
#> 238 238 c high 1
#> 239 239 c high 1
#> 240 240 c high 1
# groups can be unequal:
design <- list( A=c("low","high"))
GRP( design, props = c(0.1, 0.9), n = c(5, 35) )
#> id A s
#> 1 1 low 0
#> 2 2 low 0
#> 3 3 low 0
#> 4 4 low 0
#> 5 5 low 0
#> 6 6 high 1
#> 7 7 high 1
#> 8 8 high 1
#> 9 9 high 1
#> 10 10 high 1
#> 11 11 high 1
#> 12 12 high 1
#> 13 13 high 1
#> 14 14 high 1
#> 15 15 high 1
#> 16 16 high 1
#> 17 17 high 1
#> 18 18 high 1
#> 19 19 high 1
#> 20 20 high 1
#> 21 21 high 1
#> 22 22 high 1
#> 23 23 high 1
#> 24 24 high 1
#> 25 25 high 1
#> 26 26 high 1
#> 27 27 high 0
#> 28 28 high 0
#> 29 29 high 1
#> 30 30 high 1
#> 31 31 high 1
#> 32 32 high 1
#> 33 33 high 1
#> 34 34 high 1
#> 35 35 high 1
#> 36 36 high 1
#> 37 37 high 1
#> 38 38 high 1
#> 39 39 high 1
#> 40 40 high 1
# Finally, repeated-measures can be generated
# but note that correlated scores cannot be generated with `GRP()`
wsDesign = list( Moment = c("pre", "post") )
GRP( WSDesign=wsDesign, props = c(0.1, 0.9), n = 10 )
#> id s.pre s.post
#> 1 1 1 1
#> 2 2 0 0
#> 3 3 0 1
#> 4 4 0 1
#> 5 5 0 1
#> 6 6 1 1
#> 7 7 0 0
#> 8 8 0 1
#> 9 9 0 1
#> 10 10 0 0
# This last one has three factors, for a total of 3 x 2 x 2 = 12 cells
design <- list( A=letters[1:3], B = c("low","high"), C = c("cat","dog"))
GRP( design, n = 30, props = rep(0.5,12) )
#> id A B C s
#> 1 1 a low cat 1
#> 2 2 a low cat 0
#> 3 3 a low cat 1
#> 4 4 a low cat 0
#> 5 5 a low cat 0
#> 6 6 a low cat 1
#> 7 7 a low cat 1
#> 8 8 a low cat 1
#> 9 9 a low cat 0
#> 10 10 a low cat 0
#> 11 11 a low cat 1
#> 12 12 a low cat 1
#> 13 13 a low cat 0
#> 14 14 a low cat 0
#> 15 15 a low cat 1
#> 16 16 a low cat 1
#> 17 17 a low cat 1
#> 18 18 a low cat 1
#> 19 19 a low cat 1
#> 20 20 a low cat 1
#> 21 21 a low cat 1
#> 22 22 a low cat 0
#> 23 23 a low cat 0
#> 24 24 a low cat 1
#> 25 25 a low cat 1
#> 26 26 a low cat 0
#> 27 27 a low cat 1
#> 28 28 a low cat 1
#> 29 29 a low cat 0
#> 30 30 a low cat 1
#> 31 31 b low cat 1
#> 32 32 b low cat 0
#> 33 33 b low cat 0
#> 34 34 b low cat 1
#> 35 35 b low cat 0
#> 36 36 b low cat 1
#> 37 37 b low cat 1
#> 38 38 b low cat 0
#> 39 39 b low cat 1
#> 40 40 b low cat 1
#> 41 41 b low cat 0
#> 42 42 b low cat 0
#> 43 43 b low cat 1
#> 44 44 b low cat 0
#> 45 45 b low cat 0
#> 46 46 b low cat 0
#> 47 47 b low cat 0
#> 48 48 b low cat 0
#> 49 49 b low cat 0
#> 50 50 b low cat 0
#> 51 51 b low cat 0
#> 52 52 b low cat 0
#> 53 53 b low cat 0
#> 54 54 b low cat 0
#> 55 55 b low cat 1
#> 56 56 b low cat 1
#> 57 57 b low cat 0
#> 58 58 b low cat 1
#> 59 59 b low cat 1
#> 60 60 b low cat 1
#> 61 61 c low cat 1
#> 62 62 c low cat 1
#> 63 63 c low cat 1
#> 64 64 c low cat 0
#> 65 65 c low cat 0
#> 66 66 c low cat 0
#> 67 67 c low cat 1
#> 68 68 c low cat 1
#> 69 69 c low cat 1
#> 70 70 c low cat 0
#> 71 71 c low cat 0
#> 72 72 c low cat 0
#> 73 73 c low cat 1
#> 74 74 c low cat 0
#> 75 75 c low cat 1
#> 76 76 c low cat 1
#> 77 77 c low cat 0
#> 78 78 c low cat 1
#> 79 79 c low cat 1
#> 80 80 c low cat 0
#> 81 81 c low cat 0
#> 82 82 c low cat 0
#> 83 83 c low cat 0
#> 84 84 c low cat 0
#> 85 85 c low cat 1
#> 86 86 c low cat 0
#> 87 87 c low cat 0
#> 88 88 c low cat 1
#> 89 89 c low cat 1
#> 90 90 c low cat 1
#> 91 91 a high cat 0
#> 92 92 a high cat 0
#> 93 93 a high cat 1
#> 94 94 a high cat 1
#> 95 95 a high cat 0
#> 96 96 a high cat 0
#> 97 97 a high cat 1
#> 98 98 a high cat 0
#> 99 99 a high cat 0
#> 100 100 a high cat 0
#> 101 101 a high cat 0
#> 102 102 a high cat 0
#> 103 103 a high cat 0
#> 104 104 a high cat 1
#> 105 105 a high cat 1
#> 106 106 a high cat 0
#> 107 107 a high cat 0
#> 108 108 a high cat 0
#> 109 109 a high cat 1
#> 110 110 a high cat 0
#> 111 111 a high cat 1
#> 112 112 a high cat 0
#> 113 113 a high cat 1
#> 114 114 a high cat 1
#> 115 115 a high cat 1
#> 116 116 a high cat 1
#> 117 117 a high cat 0
#> 118 118 a high cat 1
#> 119 119 a high cat 0
#> 120 120 a high cat 0
#> 121 121 b high cat 1
#> 122 122 b high cat 0
#> 123 123 b high cat 1
#> 124 124 b high cat 1
#> 125 125 b high cat 1
#> 126 126 b high cat 1
#> 127 127 b high cat 0
#> 128 128 b high cat 0
#> 129 129 b high cat 1
#> 130 130 b high cat 0
#> 131 131 b high cat 0
#> 132 132 b high cat 1
#> 133 133 b high cat 1
#> 134 134 b high cat 1
#> 135 135 b high cat 1
#> 136 136 b high cat 1
#> 137 137 b high cat 0
#> 138 138 b high cat 1
#> 139 139 b high cat 0
#> 140 140 b high cat 1
#> 141 141 b high cat 0
#> 142 142 b high cat 1
#> 143 143 b high cat 0
#> 144 144 b high cat 0
#> 145 145 b high cat 0
#> 146 146 b high cat 1
#> 147 147 b high cat 1
#> 148 148 b high cat 0
#> 149 149 b high cat 1
#> 150 150 b high cat 0
#> 151 151 c high cat 0
#> 152 152 c high cat 1
#> 153 153 c high cat 0
#> 154 154 c high cat 1
#> 155 155 c high cat 1
#> 156 156 c high cat 0
#> 157 157 c high cat 0
#> 158 158 c high cat 1
#> 159 159 c high cat 0
#> 160 160 c high cat 0
#> 161 161 c high cat 1
#> 162 162 c high cat 0
#> 163 163 c high cat 0
#> 164 164 c high cat 1
#> 165 165 c high cat 1
#> 166 166 c high cat 1
#> 167 167 c high cat 1
#> 168 168 c high cat 0
#> 169 169 c high cat 1
#> 170 170 c high cat 0
#> 171 171 c high cat 1
#> 172 172 c high cat 0
#> 173 173 c high cat 1
#> 174 174 c high cat 1
#> 175 175 c high cat 1
#> 176 176 c high cat 1
#> 177 177 c high cat 1
#> 178 178 c high cat 0
#> 179 179 c high cat 1
#> 180 180 c high cat 1
#> 181 181 a low dog 0
#> 182 182 a low dog 1
#> 183 183 a low dog 1
#> 184 184 a low dog 1
#> 185 185 a low dog 1
#> 186 186 a low dog 1
#> 187 187 a low dog 0
#> 188 188 a low dog 0
#> 189 189 a low dog 0
#> 190 190 a low dog 1
#> 191 191 a low dog 0
#> 192 192 a low dog 0
#> 193 193 a low dog 0
#> 194 194 a low dog 1
#> 195 195 a low dog 0
#> 196 196 a low dog 1
#> 197 197 a low dog 0
#> 198 198 a low dog 0
#> 199 199 a low dog 1
#> 200 200 a low dog 0
#> 201 201 a low dog 1
#> 202 202 a low dog 0
#> 203 203 a low dog 1
#> 204 204 a low dog 1
#> 205 205 a low dog 0
#> 206 206 a low dog 0
#> 207 207 a low dog 1
#> 208 208 a low dog 0
#> 209 209 a low dog 0
#> 210 210 a low dog 0
#> 211 211 b low dog 1
#> 212 212 b low dog 1
#> 213 213 b low dog 1
#> 214 214 b low dog 1
#> 215 215 b low dog 0
#> 216 216 b low dog 1
#> 217 217 b low dog 1
#> 218 218 b low dog 0
#> 219 219 b low dog 0
#> 220 220 b low dog 1
#> 221 221 b low dog 0
#> 222 222 b low dog 0
#> 223 223 b low dog 0
#> 224 224 b low dog 1
#> 225 225 b low dog 0
#> 226 226 b low dog 0
#> 227 227 b low dog 0
#> 228 228 b low dog 0
#> 229 229 b low dog 1
#> 230 230 b low dog 0
#> 231 231 b low dog 0
#> 232 232 b low dog 1
#> 233 233 b low dog 1
#> 234 234 b low dog 1
#> 235 235 b low dog 1
#> 236 236 b low dog 0
#> 237 237 b low dog 0
#> 238 238 b low dog 1
#> 239 239 b low dog 1
#> 240 240 b low dog 1
#> 241 241 c low dog 1
#> 242 242 c low dog 1
#> 243 243 c low dog 1
#> 244 244 c low dog 0
#> 245 245 c low dog 1
#> 246 246 c low dog 0
#> 247 247 c low dog 1
#> 248 248 c low dog 0
#> 249 249 c low dog 0
#> 250 250 c low dog 0
#> 251 251 c low dog 0
#> 252 252 c low dog 1
#> 253 253 c low dog 0
#> 254 254 c low dog 0
#> 255 255 c low dog 0
#> 256 256 c low dog 0
#> 257 257 c low dog 1
#> 258 258 c low dog 1
#> 259 259 c low dog 1
#> 260 260 c low dog 1
#> 261 261 c low dog 1
#> 262 262 c low dog 1
#> 263 263 c low dog 0
#> 264 264 c low dog 1
#> 265 265 c low dog 1
#> 266 266 c low dog 1
#> 267 267 c low dog 0
#> 268 268 c low dog 0
#> 269 269 c low dog 0
#> 270 270 c low dog 1
#> 271 271 a high dog 1
#> 272 272 a high dog 0
#> 273 273 a high dog 0
#> 274 274 a high dog 0
#> 275 275 a high dog 0
#> 276 276 a high dog 0
#> 277 277 a high dog 0
#> 278 278 a high dog 0
#> 279 279 a high dog 0
#> 280 280 a high dog 1
#> 281 281 a high dog 1
#> 282 282 a high dog 1
#> 283 283 a high dog 0
#> 284 284 a high dog 1
#> 285 285 a high dog 1
#> 286 286 a high dog 0
#> 287 287 a high dog 0
#> 288 288 a high dog 1
#> 289 289 a high dog 0
#> 290 290 a high dog 0
#> 291 291 a high dog 0
#> 292 292 a high dog 1
#> 293 293 a high dog 0
#> 294 294 a high dog 1
#> 295 295 a high dog 1
#> 296 296 a high dog 0
#> 297 297 a high dog 0
#> 298 298 a high dog 0
#> 299 299 a high dog 1
#> 300 300 a high dog 1
#> 301 301 b high dog 1
#> 302 302 b high dog 1
#> 303 303 b high dog 0
#> 304 304 b high dog 0
#> 305 305 b high dog 1
#> 306 306 b high dog 1
#> 307 307 b high dog 0
#> 308 308 b high dog 0
#> 309 309 b high dog 1
#> 310 310 b high dog 1
#> 311 311 b high dog 0
#> 312 312 b high dog 1
#> 313 313 b high dog 1
#> 314 314 b high dog 1
#> 315 315 b high dog 0
#> 316 316 b high dog 1
#> 317 317 b high dog 0
#> 318 318 b high dog 1
#> 319 319 b high dog 1
#> 320 320 b high dog 1
#> 321 321 b high dog 0
#> 322 322 b high dog 0
#> 323 323 b high dog 0
#> 324 324 b high dog 1
#> 325 325 b high dog 0
#> 326 326 b high dog 1
#> 327 327 b high dog 1
#> 328 328 b high dog 1
#> 329 329 b high dog 0
#> 330 330 b high dog 1
#> 331 331 c high dog 0
#> 332 332 c high dog 0
#> 333 333 c high dog 1
#> 334 334 c high dog 1
#> 335 335 c high dog 0
#> 336 336 c high dog 0
#> 337 337 c high dog 0
#> 338 338 c high dog 0
#> 339 339 c high dog 0
#> 340 340 c high dog 1
#> 341 341 c high dog 1
#> 342 342 c high dog 1
#> 343 343 c high dog 0
#> 344 344 c high dog 1
#> 345 345 c high dog 0
#> 346 346 c high dog 0
#> 347 347 c high dog 0
#> 348 348 c high dog 0
#> 349 349 c high dog 0
#> 350 350 c high dog 1
#> 351 351 c high dog 1
#> 352 352 c high dog 0
#> 353 353 c high dog 0
#> 354 354 c high dog 0
#> 355 355 c high dog 0
#> 356 356 c high dog 1
#> 357 357 c high dog 1
#> 358 358 c high dog 0
#> 359 359 c high dog 1
#> 360 360 c high dog 1
# To specify unequal probabilities, use
design <- list( A=letters[1:3], B = c("low","high"))
expProp <- c(.05, .05, .35, .35, .10, .10 )
GRP( design, n = 30, props=expProp )
#> id A B s
#> 1 1 a low 0
#> 2 2 a low 0
#> 3 3 a low 0
#> 4 4 a low 0
#> 5 5 a low 0
#> 6 6 a low 0
#> 7 7 a low 0
#> 8 8 a low 0
#> 9 9 a low 0
#> 10 10 a low 1
#> 11 11 a low 0
#> 12 12 a low 0
#> 13 13 a low 0
#> 14 14 a low 0
#> 15 15 a low 0
#> 16 16 a low 0
#> 17 17 a low 0
#> 18 18 a low 0
#> 19 19 a low 0
#> 20 20 a low 0
#> 21 21 a low 0
#> 22 22 a low 0
#> 23 23 a low 0
#> 24 24 a low 0
#> 25 25 a low 0
#> 26 26 a low 0
#> 27 27 a low 0
#> 28 28 a low 0
#> 29 29 a low 0
#> 30 30 a low 0
#> 31 31 b low 0
#> 32 32 b low 0
#> 33 33 b low 0
#> 34 34 b low 0
#> 35 35 b low 0
#> 36 36 b low 0
#> 37 37 b low 0
#> 38 38 b low 0
#> 39 39 b low 0
#> 40 40 b low 0
#> 41 41 b low 0
#> 42 42 b low 0
#> 43 43 b low 0
#> 44 44 b low 0
#> 45 45 b low 0
#> 46 46 b low 0
#> 47 47 b low 0
#> 48 48 b low 0
#> 49 49 b low 0
#> 50 50 b low 0
#> 51 51 b low 0
#> 52 52 b low 0
#> 53 53 b low 0
#> 54 54 b low 1
#> 55 55 b low 0
#> 56 56 b low 0
#> 57 57 b low 0
#> 58 58 b low 0
#> 59 59 b low 0
#> 60 60 b low 0
#> 61 61 c low 0
#> 62 62 c low 0
#> 63 63 c low 0
#> 64 64 c low 0
#> 65 65 c low 0
#> 66 66 c low 1
#> 67 67 c low 0
#> 68 68 c low 0
#> 69 69 c low 1
#> 70 70 c low 0
#> 71 71 c low 0
#> 72 72 c low 0
#> 73 73 c low 0
#> 74 74 c low 0
#> 75 75 c low 1
#> 76 76 c low 1
#> 77 77 c low 0
#> 78 78 c low 0
#> 79 79 c low 0
#> 80 80 c low 1
#> 81 81 c low 1
#> 82 82 c low 0
#> 83 83 c low 1
#> 84 84 c low 0
#> 85 85 c low 1
#> 86 86 c low 1
#> 87 87 c low 0
#> 88 88 c low 0
#> 89 89 c low 1
#> 90 90 c low 0
#> 91 91 a high 0
#> 92 92 a high 1
#> 93 93 a high 0
#> 94 94 a high 1
#> 95 95 a high 0
#> 96 96 a high 0
#> 97 97 a high 1
#> 98 98 a high 1
#> 99 99 a high 1
#> 100 100 a high 0
#> 101 101 a high 0
#> 102 102 a high 0
#> 103 103 a high 0
#> 104 104 a high 1
#> 105 105 a high 0
#> 106 106 a high 0
#> 107 107 a high 1
#> 108 108 a high 0
#> 109 109 a high 0
#> 110 110 a high 0
#> 111 111 a high 1
#> 112 112 a high 0
#> 113 113 a high 0
#> 114 114 a high 0
#> 115 115 a high 0
#> 116 116 a high 1
#> 117 117 a high 1
#> 118 118 a high 0
#> 119 119 a high 0
#> 120 120 a high 0
#> 121 121 b high 0
#> 122 122 b high 0
#> 123 123 b high 0
#> 124 124 b high 0
#> 125 125 b high 0
#> 126 126 b high 0
#> 127 127 b high 0
#> 128 128 b high 0
#> 129 129 b high 0
#> 130 130 b high 0
#> 131 131 b high 0
#> 132 132 b high 0
#> 133 133 b high 0
#> 134 134 b high 0
#> 135 135 b high 0
#> 136 136 b high 0
#> 137 137 b high 0
#> 138 138 b high 0
#> 139 139 b high 0
#> 140 140 b high 0
#> 141 141 b high 0
#> 142 142 b high 0
#> 143 143 b high 0
#> 144 144 b high 0
#> 145 145 b high 0
#> 146 146 b high 0
#> 147 147 b high 1
#> 148 148 b high 0
#> 149 149 b high 0
#> 150 150 b high 0
#> 151 151 c high 0
#> 152 152 c high 0
#> 153 153 c high 0
#> 154 154 c high 0
#> 155 155 c high 0
#> 156 156 c high 0
#> 157 157 c high 0
#> 158 158 c high 0
#> 159 159 c high 0
#> 160 160 c high 0
#> 161 161 c high 0
#> 162 162 c high 0
#> 163 163 c high 0
#> 164 164 c high 0
#> 165 165 c high 0
#> 166 166 c high 0
#> 167 167 c high 0
#> 168 168 c high 0
#> 169 169 c high 0
#> 170 170 c high 0
#> 171 171 c high 0
#> 172 172 c high 0
#> 173 173 c high 1
#> 174 174 c high 0
#> 175 175 c high 0
#> 176 176 c high 0
#> 177 177 c high 0
#> 178 178 c high 0
#> 179 179 c high 1
#> 180 180 c high 0
# The name of the column containing the proportions can be changed
GRP( design, n=30, props=expProp, sname="patate")
#> id A B patate
#> 1 1 a low 0
#> 2 2 a low 0
#> 3 3 a low 0
#> 4 4 a low 0
#> 5 5 a low 0
#> 6 6 a low 0
#> 7 7 a low 0
#> 8 8 a low 0
#> 9 9 a low 0
#> 10 10 a low 0
#> 11 11 a low 0
#> 12 12 a low 0
#> 13 13 a low 1
#> 14 14 a low 0
#> 15 15 a low 0
#> 16 16 a low 0
#> 17 17 a low 0
#> 18 18 a low 0
#> 19 19 a low 0
#> 20 20 a low 0
#> 21 21 a low 0
#> 22 22 a low 0
#> 23 23 a low 0
#> 24 24 a low 0
#> 25 25 a low 0
#> 26 26 a low 0
#> 27 27 a low 0
#> 28 28 a low 0
#> 29 29 a low 1
#> 30 30 a low 0
#> 31 31 b low 0
#> 32 32 b low 0
#> 33 33 b low 0
#> 34 34 b low 0
#> 35 35 b low 0
#> 36 36 b low 0
#> 37 37 b low 0
#> 38 38 b low 0
#> 39 39 b low 0
#> 40 40 b low 0
#> 41 41 b low 0
#> 42 42 b low 0
#> 43 43 b low 0
#> 44 44 b low 1
#> 45 45 b low 0
#> 46 46 b low 0
#> 47 47 b low 0
#> 48 48 b low 0
#> 49 49 b low 0
#> 50 50 b low 0
#> 51 51 b low 0
#> 52 52 b low 0
#> 53 53 b low 0
#> 54 54 b low 0
#> 55 55 b low 0
#> 56 56 b low 0
#> 57 57 b low 0
#> 58 58 b low 0
#> 59 59 b low 0
#> 60 60 b low 0
#> 61 61 c low 1
#> 62 62 c low 0
#> 63 63 c low 0
#> 64 64 c low 0
#> 65 65 c low 1
#> 66 66 c low 0
#> 67 67 c low 1
#> 68 68 c low 0
#> 69 69 c low 0
#> 70 70 c low 0
#> 71 71 c low 1
#> 72 72 c low 1
#> 73 73 c low 0
#> 74 74 c low 0
#> 75 75 c low 0
#> 76 76 c low 0
#> 77 77 c low 1
#> 78 78 c low 0
#> 79 79 c low 0
#> 80 80 c low 0
#> 81 81 c low 0
#> 82 82 c low 0
#> 83 83 c low 0
#> 84 84 c low 1
#> 85 85 c low 1
#> 86 86 c low 1
#> 87 87 c low 0
#> 88 88 c low 0
#> 89 89 c low 1
#> 90 90 c low 1
#> 91 91 a high 1
#> 92 92 a high 1
#> 93 93 a high 1
#> 94 94 a high 0
#> 95 95 a high 1
#> 96 96 a high 0
#> 97 97 a high 1
#> 98 98 a high 1
#> 99 99 a high 0
#> 100 100 a high 0
#> 101 101 a high 0
#> 102 102 a high 0
#> 103 103 a high 0
#> 104 104 a high 1
#> 105 105 a high 0
#> 106 106 a high 0
#> 107 107 a high 0
#> 108 108 a high 0
#> 109 109 a high 0
#> 110 110 a high 1
#> 111 111 a high 1
#> 112 112 a high 0
#> 113 113 a high 1
#> 114 114 a high 1
#> 115 115 a high 0
#> 116 116 a high 1
#> 117 117 a high 1
#> 118 118 a high 0
#> 119 119 a high 0
#> 120 120 a high 0
#> 121 121 b high 0
#> 122 122 b high 0
#> 123 123 b high 0
#> 124 124 b high 0
#> 125 125 b high 0
#> 126 126 b high 0
#> 127 127 b high 0
#> 128 128 b high 0
#> 129 129 b high 0
#> 130 130 b high 0
#> 131 131 b high 0
#> 132 132 b high 0
#> 133 133 b high 0
#> 134 134 b high 0
#> 135 135 b high 0
#> 136 136 b high 0
#> 137 137 b high 0
#> 138 138 b high 1
#> 139 139 b high 0
#> 140 140 b high 0
#> 141 141 b high 0
#> 142 142 b high 0
#> 143 143 b high 0
#> 144 144 b high 0
#> 145 145 b high 0
#> 146 146 b high 0
#> 147 147 b high 0
#> 148 148 b high 0
#> 149 149 b high 0
#> 150 150 b high 0
#> 151 151 c high 0
#> 152 152 c high 0
#> 153 153 c high 0
#> 154 154 c high 1
#> 155 155 c high 0
#> 156 156 c high 0
#> 157 157 c high 0
#> 158 158 c high 0
#> 159 159 c high 0
#> 160 160 c high 0
#> 161 161 c high 0
#> 162 162 c high 0
#> 163 163 c high 0
#> 164 164 c high 0
#> 165 165 c high 0
#> 166 166 c high 0
#> 167 167 c high 0
#> 168 168 c high 0
#> 169 169 c high 1
#> 170 170 c high 0
#> 171 171 c high 1
#> 172 172 c high 0
#> 173 173 c high 0
#> 174 174 c high 0
#> 175 175 c high 0
#> 176 176 c high 0
#> 177 177 c high 0
#> 178 178 c high 0
#> 179 179 c high 1
#> 180 180 c high 0
# Examples of use of rBernoulli
t <- rBernoulli(50, 0.1)
mean(t)
#> [1] 0.16