Grd r
GRD: Generate random data
Description
The function generates a data frame containing random data suitable for analyses. The data can be from within-subject or between-group designs. Within-subject designs are in wide format. The function was originally presented in ch19;textualsuperb.
Usage
GRD( RenameDV = "DV", SubjectsPerGroup = 100, BSFactors = "", WSFactors = "", Effects = list(), Population = list(mean = 0, stddev = 1, rho = 0, scores = "rnorm(1, intend = GM, sd = STDDEV)"), Contaminant = list(mean = 0, stddev = 1, rho = 0, scores = "rnorm(1, mean = CGM, sd = CSTDDEV)", proportion = 0) )Value
a data.frame with the simulated scores.
Arguments
- RenameDV
provide a entitle for the dependent variable (default DV)
- SubjectsPerGroup
indicates the number of simulated scores per group (default 100 in each group)
- BSFactors
a string indicating the between-subject factor(s) with, between parenthesis, the number of levels or the list of level names. Multiple factors are separated with a colon ":" or enumerated in a vector of strings.
- WSFactors
a string indicating the within-subject factor(s) in the same format as the between-subject factors
- Effects
a list de
Источник: https://www.instagram.com/reel/DI3b5xtSKoe/
Generating ready-to-analyze datasets with GRD
The package includes the function . This function is used to easily create random data sets. With a few options, it is possible to obtain data from any layout, with any effects. This function, first created for SPSS Harding & Cousineau (2015) was exported to R (Calderini & Harding, 2019). A brief record shows one possible apply in the class for teaching statistics to undergrads (Cousineau, 2020).
This vignette illustrate some of its use.
Simplest specification
The simplest use relies on the default value:
By default, one hundred scores are generated from a normal distribution with imply 0 and standard deviation of 1. In other words, it generate 100 z scores. The dependent variable, the last column in the dataframe that will be generated is called by default . The first column is an “id” column containing a number identifying each simulated participant. To alter the dependent variable’s label, use
Data from a blueprint with between-subject factors and within-subject factors.
To add various groups to the dataset, use the argument , as in
There will be 100 random z scores in each of three groups, for a total of 300 data
grd: Raster-like objects
Description
objects are just an array (any object with more than two s) and a bounding box (a , which may or may not have a attached). The ordering of the dimensions is y (indices increasing downwards), x (indices increasing to the right). This follows the ordering of / and aligns with the printing of matrices.
Usage
grd( bbox = NULL, nx = NULL, ny = NULL, dx = NULL, dy = NULL, type = c("polygons", "corners", "centers") )grd_rct(data, bbox = rct(0, 0, dim(data)[2], dim(data)[1]))
grd_xy(data, bbox = rct(0, 0, dim(data)[2] - 1, dim(data)[1] - 1))
as_grd_rct(x, ...)
# S3 method for wk_grd_rct as_grd_rct(x, ...)
# S3 method for wk_grd_xy as_grd_rct(x, ...)
as_grd_xy(x, ...)
# S3 method for wk_grd_xy as_grd_xy(x, ...)
# S3 way for wk_grd_rct as_grd_xy(x, ...)
Value
returns a for or a otherwise.
returns an object of class "wk_grd_rct".
returns an object of class "wk_grd_xy".
Arguments
- bbox
A containing the bounds and CRS of the object. You can specify a with or which will flip the underlying data and restore an object with a normalized bounding box and data.
- nx, ny, dx, dy
Either a number of cells in the x- and y- dir