Description Usage Arguments Details Value Examples
View source: R/simulate_data.R
function to generate simulation data for test
1 2 3 4 5 6 7 8 9 | simulate_data(
datasize1,
datasize2,
error_range,
data_range,
offsets_range,
weights_range,
coefficients
)
|
datasize1 |
a integer represents the amounts of every variables . |
datasize2 |
a integer represents the numbers of variables. |
error_range |
the range of errors of outcomes. This should be NULL or a numeric vector of size datasize1 |
data_range |
a datasize2*2 matrix: every row represents the range of every variable. |
offsets_range |
the range of expected offsets. This should be NULL or a numeric vector of size datasize1. |
weights_range |
the range of expected weights. This should be NULL or a numeric vector of size datasize1. |
coefficients |
a numeric vector with length datasize1: the simulated coefficient for every variable. |
you can use this function to create random datasets for testing.
'simulate' returns a dataframe of results containing the following components:
V1: the simulated Outcome. It should be a numeric vector with length of datasize1
V2, V3,...: the simulated Predictors. It should be a numeric vector with length of datasize1
(weights): If not NULL, the simulated weights. It should be a numeric vector with length of datasize1
(offsets): If not NULL, the simulated offsets. It should be a numeric vector with length of datasize1
1 2 3 4 5 | data_range = matrix(c(0,0,0,1,1,1),3,2)
offsets_range = c(0,1)
weights_range = c(0,1)
coefficients = c(1,2,3)
data = simulate_data(10, 3, error_range= c(0,1), data_range, offsets_range, weights_range,coefficients)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.