Posts

Lecture 7

Oct 12th, 2026 Slides Jupiter Notebook HW7 due on Oct 14th In the single RNAseq data , investigate the following questions 1. Is stem cell Lgr5 expression different between two dietary groups?  2. Does the difference in Lgr5 expression depend on the sex of the mice?    

Lecture 6

Oct 9th, 2026 Slides Jupiter Notebook (lab 2) HW6 due on Oct 12th, you can submit the optional one any time before Oct 30th) 1. Run a permutation test on the linear regression model on the Father-Son height data.  2. (Optional) In the context of comparing means of several groups, compare the statistical power of the permutation tests using the F-statistic and permutation test using the range statistic (see Lab 2 for how the statistical significance can be obtained using permutation test).  To compare the statistical power, we will simulate the random data similar to the lymphocyte data. There are 5 groups, each with 8 mice. (But you can  Scenario 1: Generate group means $\mu_1,\mu_2,\mu_3,\mu_4,\mu_5$ from $N(0,1)$. Then for group $i$, generate data from $N(\mu_i,1)$, $i=1,2,3,4,5$   Scenario 2: Generate $\mu_1,\mu_2,\mu_3,\mu_4,\mu_5$ from $N(0,0.5)$. Then for group $i$, generate data from $N(\mu_i,1)$, $i=1,2,3,4,5$.  Note that in Scenario 2, the differ...

Final Exam

1. Identify a set of original data from your (or your group member's) research lab, of which the goal is to explore the relationship between at least TWO variables, and fit into the topics covered in QSBRII, linear regression, generalized linear regression, linear mixed effect model, generalized linear effect model. For unpublished data, the data and your analysis will be kept strictly confidential and will not be shared with anybody including the TAs.  You can also use publicly available data or published data from your lab as long as I will look from a new perspective. In general, you should NOT try to reproduce other's work. however if you think that a previous analysis on the data is inappropriate or incorrect, you can re-analyze them.  2. You can work as a group of as many as three members, or you can work alone if you choose to. Members of a group can work on the same dataset, or different aspects of a larger dataset.   3. On 10/14 and 10/16 during scheduled cl...

Lecture 5

Oct 7, 2025 Slides Jupyter Notebook datafile Rats HW5  (Due Friday Oct 9th) Analyze the data set warpbreaks that is included in R distribution. It is regarding the Number of Breaks in Yarn during Weaving. Describe how two factors affect the response. You can view the description and access the data in R by  data(warpbrea ks) Briefly explain the difference between "correlation" and "interaction". Decomposition of Variation Let's use the Guinea Pig study as an example.  We can see that there are 6 groups reflecting combination of two factors, the factor supplements has two levels (VC or OJ), and the factor dosage that has three levels (at 0.5, 1, and 2 mg), each group has 10 guinea pigs and we want to know how the two factors affect the tooth growth. To simplify our discussion, I will call supplement factor A, and dosage factor B, and let $y_{ijk}$ be the response of the kth guinea pig of the treatment group that is at the $i$th level of factor A, and $j$th level...

Install glmmTMB on google colab

Installing glmmTMB everytime starting a new R virtual machine on google Colab could take more than 20min each time. To save some time and electricity/computational power, a solution is to install it to MyDrive so that it can be loaded from there quicky next time.  First, you need to create a new folder named R_libs in MyDrive, then install R libraries to that directory. It will take about 500M space in your google Drive. The instructions is given in the jupyter notebook below.  Install.glmmTMB.ipynb

Lecture 4

Oct 5th, 2026 Slides Jupyter Notebook HW4: (Due on Oct 7th) 1.  In the plasma dataset, test if fibrinogen predicts the ESR<20 or not.  2. In the ER visit dataset, test if ER visits differ between two sites after taking the medication.  3. In the RNA seq data, pick a gene that is NOT CADM1, and test if its expression is associated with smoking status.   Maximum Likelihood Estimate To fit a logistic regression to data, the estimation of $\beta_0$ and $\beta_1$ has to follow some principles. In linear regression, we tried to find a straight line that minimized the sum of residual squares, and the estimate is called least square estimate. For generalized linear models, a different but more general principle is used. The two numbers are obtained as they maximize a so-called likelihood function. Essentially, if the assumptions of our model is true (logistic link function and binomial distribution), under these two numbers, the probability of observing our data is...

Lecture 3 and Lab 1

Image
Oct 2, 2026 Slides Jupyter Notebook Lab1 HW3 (Due on Monday Oct 5) Download the data file , which contains brain weight and body weight of 62 species, move it to a proper location in google drive or your local drive if you have jupyter notebook locally. a. Import the data to R. b. Draw a scatter plot, and you can see that the current scale is not the best for display. You can apply a log-transformation on both variables. This can be done by using the log() function, you can put the old data.frame in the parenthesis, and assign the output a name so that you will have a new data.frame of the transformed data, something like below > new.data <- log(old.data) Draw a scatter plot of the new data,  does it look much better. c. Fit a linear model on the original data. Draw plot the residual against the predictor using something similar to > plot(old.data$\$$BodyWeight, lm.fit$\$$res) d. Fit a linear model on the log-transformed data. Draw a plot the residual against the predicto...