# In ClaudioZandonella/PRDAbeta: Conduct a Prospective or Retrospective Design Analysis

## Population effect size distribution

Defining the hypothetical population effect size as a single value could be limiting. Instead, researchers may prefer to use a probability distribution representing their uncertainty regarding the hypothetical population effect. Note that this could be interpreted as a prior distribution of the population effect in a Bayesian framework.

To define the hypothetical population effect size (effect_size) according to a probability distribution, it is necessary to specify a function that allows sampling values from a given distribution. The function has to be defined as function(x) my_function(x, ...), with only one single argument x representing the number of samples (e.g., function(x) rnorm(x, mean = 0, sd = 1)). See vignette("retrospective") for further details.

### Example 5: Effect size distribution

Consider the same scenario as in the correlation example (Example 1). This time we define the hypothesized effect size according to a normal distribution with mean .30 and standard deviation .10. Moreover, to avoid unreasonable values we truncate the distribution between .15 and .45.

prospective(effect_size = function(x) rnorm(x, .3, .1), power = .60,
effect_type = "correlation", test_method = "pearson",
tl = .15, tu = .45, B_effect = 500, B = 500,
display_message = FALSE, seed = 2020)


Note that we adjusted B_effect and B to find a good trade-off between computational times and results accuracy. Differently from previous outputs, we have now a summary for the sampled effects distribution and for the inferential risks.

## Graphical representation

Currently there are no personalized plot functions in {PRDA}. However, it is easy to access all the results and use them to create the plots according to your needs.

The function prospective() returns a list with class "design_analysis" that contains:

• design_analysis - a character string indicating the type of design analysis (prospective or retrospective).
• call_arguments - a list with all the arguments passed to the function.
• effect_info - a list with all the information regarding the considered hypothetical population effect size. In particular, in effect_samples we find the vector with the sampled effects (or unique value in the case of a single value).
• test_info - a list with all the information regarding the test performed.
• prospective_res - a data frame with the results of the design analysis (i.e., power, typeM, and typeS).

Output complete description is provided in the function help page ?prospective.

da_fit <- prospective(effect_size = function(x) rnorm(x, .3, .1), power = .60,
effect_type = "correlation", test_method = "pearson",
tl = .15, tu = .45, B_effect = 500, B = 500,
display_message = FALSE, seed = 2020)

str(da_fit, max.level = 1)


Similarly to the examples provided in vignette("retrospective"), results can be used to create the plots according to your needs. See vignette("retrospective") for further details.

nocite: | @gelmanPowerCalculationsAssessing2014 ...

### References

ClaudioZandonella/PRDAbeta documentation built on Sept. 23, 2020, 8:51 p.m.