1
$\begingroup$

Greeting Homo Sapiens,

I am a Biology student and just stepped into the area of Statistical Genomics. I have gone through several posts from the forum and I must say the quality response from the community helped me to solve my 20-30% problem. Still I am finding some gap in my research area for which I am trying to write this question. Lets hope I can explain my problem and make you guys understand easily 0_0

So basically the aim of my study is to

  1. Perform Simulation through Mixed linear model
  2. Calculate Power of Statistical Models
  3. Find Type 1 error in my model

Now my model is a bit tricky (at least for me since I am from Bioscience department). I am trying to fit a model with Genotypic Variance, two random variables and these variables should be multivariant normally distributed. Next I am going to select some fixed positions from Genotype variance variable and multiply with two random multivariant normal distributed variable to simulate Phenotype (This will help me with finding Phenotypic Variance explained by my model). Finally I want to calculate the Power and Type 1 error of my model. The steps are mentioned below:

  1. Create Genotype Variance from Genotype .raw file
  2. Select any three positions from the variance variable
  3. Create First random effect by using mvnorm function from MASS package
  4. Create Second random effect by using mvnorm function
  5. Combine first three random effect columns with variance variable
  6. Create Simulation effect from two random variables (First three columns)
  7. Combine the simulated effect with variance variables i.e. effect_indiv_geno<-t(GEN_QTN)%*%effect_1_simu %*% effect_2_simu
  8. Create residual from rnorm
  9. Calculate Phenotype from effect_indiv_geno and residual

I need help from here onwards as I am stuck. I am not sure how to plan the Power calculation process and then follow type 1 error for the model. Looking forward to hearing from you guys. Thanks and Stay Safe.

$\endgroup$
3
  • 1
    $\begingroup$ it seems like you already know all the steps you want to do, so what is your problem actually? $\endgroup$
    – rep_ho
    Commented May 12, 2021 at 17:22
  • $\begingroup$ My problem is that I can't find a proper method or way to calculate Statistical power from my simulated phenotype. For example I see several authors using Fst, EigenGWAS and PLS to check the simulation power from simulated phenotype. $\endgroup$ Commented May 17, 2021 at 12:54
  • $\begingroup$ @rep_ho Actually I have found a little bit of hint to solve the power calculation through Fst. Since there is no p-value statistics in Fst, I have to go another way around and see if I can formulate any significant approach. $\endgroup$ Commented May 20, 2021 at 10:18

1 Answer 1

2
$\begingroup$

It's difficult (impossible?) to calculate the a-priori power of a mixed model with formulas. The best approach is to simulate not only your data but also your sampling from the data.

Simulate a very large data set via your steps so far, with your intended assignments of Phenotypes to the combinations of random-variable values. That provides the "alternative hypothesis" for your study of power/Type-II error. Then make a copy of that data set, but shuffle the Phenotype assignments randomly. That provides a null condition: no (intended) associations of Phenotype with the random variables. The null-condition data allow you to evaluate Type I-error.

Then sample (with replacement) the number of cases that you would intend to take in your actual study, from each simulated data set. Do this repeatedly, say 999 times. Run your model separately on each sample from each of those data sets. For each of those 2 data sets, keep all the coefficient estimates based on each sample. When you're done, for each of those 2 data sets, examine the empirical distributions of the 999 values of each of the coefficient estimates returned by your model.

Type I error, by definition, is the fraction of cases showing a "significant" result when there really is none--what you find on modeling the samples of null-condition data. If you want the limits for p < 0.05 "significance" based on the null, for each coefficient those would be the 25th and 975th of your 999 values (extreme 2.5% on each end of the distribution).

You also can use a nominal 5% probability cutoff with the tools provided by a package like lmer test on your 999 samples from the null, and see whether you actually find only 5% false positives. That way, you can see how well the nominal significance cutoff you specify for your model matches up with how it works in practice, under the null condition.

Type-II error (1 - power) is the fraction of times you miss a true positive result, based on an assumed cutoff for Type-I error: what you find on modeling samples from the "alternative hypothesis" data set. As you designed that data set to have a true relationship between the random-variable values and Phenotype, what fraction of the 999 models erroneously show no relationship based on your cutoff for Type-I error?

With this type of sampling, you can directly examine the inherent tradeoffs between actual Type I and Type II errors as you adjust the nominal significance cutoff. By changing the size of the samples taken from the large data set, you can estimate the sample size that you would need to obtain desired levels of Type I and Type II errors.

That's the general outline. This page has some hints for simulating mixed models. Also, be aware that the calculation or interpretation of p-values from mixed models isn't straightforward; see this page for an introduction and links.

$\endgroup$
5
  • $\begingroup$ Firstly, I agree with the part "power calculation is difficult from LMM". That's why I said I have to work other way around. I have gone through book chapters to learn how to calculate p-values from LMM. I must say its hard but I will try to code it in R and see the results. $\endgroup$ Commented May 20, 2021 at 15:29
  • $\begingroup$ @QamarRazaQadri note that sampling from the null-condition data set will provide something resembling a "ground truth" for p-values, to compare against calculated p-values. If something is "significant" you don't really care about the actual p-value. To avoid false positives, you just want to make sure that, say, a nominal p-value of 0.05 isn't really a p-value of 0.5 in practice. $\endgroup$
    – EdM
    Commented May 20, 2021 at 15:34
  • $\begingroup$ Yes you are right. That's what I am also thinking about p-values. Secondly, thank you for stating the general outline. I can understand the theory but what about actual examples. Do you know any such source from where I can understand "simulating two sample from data and check Type1 and Type2 error?" I have it in my mind but going through actual code can help me more. $\endgroup$ Commented May 20, 2021 at 15:37
  • $\begingroup$ @QamarRazaQadri I hadn't been very specific in what I meant in terms of sampling to estimate Type-I and Type-II errors. As you seem already to have a simulated data set with Phenotype assignments, all you need to do is to make another copy with shuffled Phenotype assignments for a null condition, then perform your modeling on multiple samples of those simulated data sets. See the now-expanded explanation in the answer. $\endgroup$
    – EdM
    Commented May 20, 2021 at 18:26
  • $\begingroup$ Thanks for the tip. I will surely try to simulate other phenotypes by using multiple sampling from simulated data sets. There is one more expansion to my code. I am also planning to replace the Phenotype with Population or more than one Populations and then calculate the effect of Genotype and Marker. Do you have any suggestions for this idea? Thanks. $\endgroup$ Commented May 22, 2021 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.