Resample Summary Statistics for Existing Simulation Object
Source:R/resample_sumstats.R
      resample_sumstats.RdResample Summary Statistics for Existing Simulation Object
Usage
resample_sumstats(
  dat,
  N,
  R_LD = NULL,
  af = NULL,
  est_s = FALSE,
  geno_scale = NULL,
  new_env_var = NULL,
  new_h2 = NULL,
  new_R_E = NULL,
  new_R_obs = NULL
)Arguments
- dat
- Object output by - sim_mv
- N
- Sample size, scalar, vector, matrix. See - ?sim_mvfor more details.
- R_LD
- LD pattern (optional). See - ?sim_mvfor more details.
- af
- Allele frequencies. See - ?sim_mvfor more details.
- est_s
- Logical, should estimates of se(beta_hat) be produced. 
- geno_scale
- Either "allele" or "sd". Specifies the scale of the effect sizes in the output data. 
- new_env_var
- Optional. The environmental variance in the new population. If missing the function will assume the environmental variance is the same as in the old population. 
- new_h2
- Optional. The heritability in the new population. Provide at most one of - new_env_varand- new_h2.
- new_R_E
- Optional, specify environmental correlation in the new population. If missing, the function will assume the environmental correlation is the same as in the original data. 
- new_R_obs
- Optional, specify overall trait correlation in the new population. Specify at most one of - new_R_Eor- new_R_obs. If missing, the function will assume the environmental correlation is the same as in the original data.
Details
This function can be used to generate new summary statistics for an existing simulation object.
For a discussion of this function and resample_inddata, see the "Resampling" vignette.
Examples
# Use resample_sumstats to generate new GWAS results with the same effect sizes.
N <- matrix(1000, nrow = 2, ncol =2)
G <- matrix(0, nrow = 2, ncol = 2)
R_E <- matrix(c(1, 0.8, 0.8, 1), nrow = 2, ncol = 2)
# original data
dat <- sim_mv(N = N, J = 20000, h2 = c(0.4, 0.3), pi = 1000/20000,
               G = G, R_E = R_E)
#> SNP effects provided for 20000 SNPs and 2 traits.
# data for second GWAS
dat_new <- resample_sumstats(dat,
                             N = 40000)
#> I will assume that the environmental variance is the same in the old and new population.
#> I will assume that environmental correlation is the same in the old and new population. Note that this could result in different overall trait correlations.
#> Original data have effects on the per-genotype sd scale. I will assume that per-genotype sd effects are the same in the new and old populations.
#> SNP effects provided for 20000 SNPs and 2 traits.