<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.3">Jekyll</generator><link href="https://zoeyyylyu.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://zoeyyylyu.github.io/" rel="alternate" type="text/html" /><updated>2023-11-10T12:35:28-08:00</updated><id>https://zoeyyylyu.github.io/feed.xml</id><title type="html">ZHUOJUN LYU</title><subtitle>personal description</subtitle><author><name>Zhuojun Lyu</name></author><entry><title type="html">Bootstrap and Monte Carlo Simulation</title><link href="https://zoeyyylyu.github.io/posts/2021/08/blog-post-1/" rel="alternate" type="text/html" title="Bootstrap and Monte Carlo Simulation" /><published>2021-08-12T00:00:00-07:00</published><updated>2021-08-12T00:00:00-07:00</updated><id>https://zoeyyylyu.github.io/posts/2021/08/blog-post-4</id><content type="html" xml:base="https://zoeyyylyu.github.io/posts/2021/08/blog-post-1/">&lt;p&gt;&lt;strong&gt;Methods&lt;/strong&gt;: Bootstrap, Monte Carlo Simulation&lt;/p&gt;

&lt;p&gt;I found myself perplexed by the difference and relationship between Bootstrap and Monte Carlo Simulation. Then, I read &lt;em&gt;Comparing Groups: Randomization and Bootstrap Methods Using R&lt;/em&gt; and it clearly explains these two methods. This book uses simple language to explain intricate statistical concepts,offering concrete examples with orgnized code. It also introduced about effectively presenting statistical findings in research papers. This book is highly beneficial for individuals inclined toward statistical analysis within the realm of social sciences. The primary content of this blog post draws heavily from insights gleaned from this book.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The bootstrap methodology uses Monte Carlo simulation to resample many replicate data sets from a probability model assumed to underlie the population, or from a model that can be estimated from the data. (p.140)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I think both Bootstrap and Monte Carlo Simulation are resampling methods. Monte Carlo Simulation resamples in a random way, while Bootstrap resamples according to the empirical distribution of the data.&lt;/p&gt;

&lt;h3 id=&quot;example&quot;&gt;Example&lt;/h3&gt;
&lt;p&gt;The dataset &lt;em&gt;Latino&lt;/em&gt; has 150 observations with two columns. Column 1 is “Mex” which suggests whether the person is from Mexico, and Column 2 is “Achieve” which is the level of the person’s fluency in English. In the dataset, 116 people of them are from Mexico and the other 34 are not.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;H0 Hypothesis&lt;/strong&gt;: People from and not from Mexico have the same level of English. In other words, the average difference of their English level is not statistically significant&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Monte Carlo Simulation&lt;/strong&gt;：&lt;/p&gt;

&lt;p&gt;Step 1: Resample 5000 times&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;permuted &amp;lt;- replicate(n = 4999, expr = sample(latino$Achieve))
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Step 2: For the resampled dataset, calculate the difference in means of the two groups&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mean.diff &amp;lt;- function(data) {
  mean(data [1:34]) - mean(data[35:150]) 
  }
diffs &amp;lt;- apply(X = permuted, MARGIN = 2, FUN = mean.diff)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Step3：Calculate p-value&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;(length(diffs[abs(diffs) &amp;gt;= 0.39])+1) /5000 
# 0.39 is the group difference in mean in the original dataset.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Bootstrap&lt;/strong&gt;：&lt;/p&gt;

&lt;p&gt;Step 1: Resample 5000 times under empirical distribution&lt;/p&gt;

&lt;p&gt;Step 2: For the resampled dataset, calculate the difference in means of the two groups&lt;/p&gt;

&lt;p&gt;Step3：Calculate p-value&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;library(boot)
mean.diff.np &amp;lt;- function(data, indices) {
  d &amp;lt;- data[indices, ]
  mean(d$Achieve[1:34]) - mean(d$Achieve[35:150])
 }  
nonpar.boot &amp;lt;- boot(data = latino, statistic = mean.diff.np, R = 4999)
(length(par.boot$t[abs(par.boot$t) &amp;gt;= 0.39])+1)/5000
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;references&quot;&gt;References&lt;/h3&gt;
&lt;p&gt;Zieffler, Harring, Long (2011). Comparing Groups: Randomization and Bootstrap Methods Using R. Wiley.&lt;/p&gt;</content><author><name>Zhuojun Lyu</name></author><summary type="html">Methods: Bootstrap, Monte Carlo Simulation</summary></entry><entry><title type="html">Paper Reading 1: Analysis</title><link href="https://zoeyyylyu.github.io/posts/2021/06/blog-post-2/" rel="alternate" type="text/html" title="Paper Reading 1: Analysis" /><published>2021-06-13T00:00:00-07:00</published><updated>2021-06-13T00:00:00-07:00</updated><id>https://zoeyyylyu.github.io/posts/2021/06/blog-post</id><content type="html" xml:base="https://zoeyyylyu.github.io/posts/2021/06/blog-post-2/">&lt;p&gt;&lt;strong&gt;Concepts&lt;/strong&gt;: Clustered Standard Errors &lt;br /&gt;
&lt;strong&gt;Methods&lt;/strong&gt;: Hendonic Regression, Test for Randomization&lt;/p&gt;

&lt;h3 id=&quot;gender-peer-effects-on-students-academic-and-noncognitive-outcomes-evidence-and-mechanisms&quot;&gt;Gender Peer Effects on Students’ Academic and Noncognitive Outcomes: Evidence and Mechanisms&lt;/h3&gt;
&lt;p&gt;Jie Gong, Yi Lu and Hong Song, 2019, &lt;em&gt;Journal of Human Resources&lt;/em&gt;&lt;/p&gt;

&lt;h3 id=&quot;empirical-analysis&quot;&gt;Empirical analysis:&lt;/h3&gt;
&lt;p&gt;$Y_{ics}=\alpha+\beta_{1}Peerfem_{-ics}+\beta_{2}Female_{ics}+\phi X_{ics}+ \tau W_{cs}+\lambda_{sg}+\epsilon_{ics}$&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;$Y_{ics}$: Measures of academic and noncognitive outcomes for student i in class c of school s&lt;/li&gt;
  &lt;li&gt;$Peerfem_{ics}$: Proportion of females in i’s class, excluding i;&lt;/li&gt;
  &lt;li&gt;$Female_{ics}$: Binary. whether i is female;&lt;/li&gt;
  &lt;li&gt;$X_{ics}$: i’s predetermined characteristics and teacher controls;&lt;/li&gt;
  &lt;li&gt;$W_{cs}$: Peers’ ability controls, including baseline academic ability for male and female peer.&lt;/li&gt;
  &lt;li&gt;$\lambda_{sg}$: school-grade fixed effect;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We cluster standard errors at the class level, accounting for correlation in outcomes for students in the same class.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Clustered standard errors&lt;/strong&gt;: Estimate the standard error of a regression parameter in settings where observations may be subdivided into smaller-sized groups (“clusters”) and where the treatment assignment is correlated within each group. It’s useful when &lt;ins&gt;treatment is assigned at the level of a cluster instead of at the individual level&lt;/ins&gt;.
    &lt;ul&gt;
      &lt;li&gt;E.g., we want to discover whether a teaching technique improves student test scores. We assign teachers in “treated” classrooms to try new technique, while leaving “control” classrooms unaffected. When analyzing results, we want to keep data at the student level (However, classical SE are inappropriate because student test scores within each class are not independently distributed. Instead, students in classes with better teachers have high test scores regardless of whether they receive the experimental treatment). Thus we cluster SE at classroom level to account for this aspect of the experiment.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;main-results&quot;&gt;Main Results&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;A. Gender Peer Effects on Academic Performance&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Examine the gender peer effect on students’ academic outcomes using regression model &lt;br /&gt;
&lt;strong&gt;Interpretation&lt;/strong&gt;: All regressions include subject and school-grade fixed effects. The coefficient for the proportion of female peers is positive and statistically significant, which suggests that on average, when a student has more female peers in the class, he or she tends to achieve higher grades. After controlling for predetermined characteristics of the focal student, the teachers, and the academic ability of female and male peers, we find that the effect is consistently positive and statistically significant at the 1% level. The coefficient, 1.019, suggests that a 10-percentage-point (approximately 1.25 standard deviation) increase in the proportion of female classmates raises a student’s test score by 10.19% of a standard deviation.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;img src=&quot;/images/PaperReading1.png&quot; alt=&quot;Editing a markdown file for a talk&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;B. Gender Peer Effects on Noncognitive Outcomes&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;Interpretation&lt;/strong&gt;: the estimated impact on mental stress is small in magnitude and statistically insignificant, which suggests that having more female peers does not appear to influence students’ mental stress levels. Table 4, columns 4 to 6, report the estimated effects on students’ social acclimation and general satisfaction in school. Overall, we find a positive effect of having more female classmates on students’ outcomes along this dimension. The effect remains robust after controlling for student and teacher characteristics, as well as for peers’ ability.&lt;/p&gt;

&lt;h3 id=&quot;robustness-checks&quot;&gt;Robustness Checks&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;1.Effects from female students’ ability spillover.&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;Concern&lt;/strong&gt;: Effects may come from the spillover of female students’ academic ability and performance, given that the literature has established girls’ advantage in test scores during primary and middle school.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;There are some gender differences between female and male characteristics and baseline academic ability, but the magnitudes are small. The pattern of academic performance before middle school is mixed: while male students are more likely to repeat grades, they are also more likely to skip grades.&lt;/li&gt;
  &lt;li&gt;when we control for the academic ability of female and male peers, the main results remain similar.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2.Teacher assignment, differential teaching and grading.&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;Concern&lt;/strong&gt;: it may not reflect better academic achievement, but rather differential teaching and grading by teachers.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Conduct a balancing test on teachers characteristics(i.e., regressing teacher pre-determined characteristics (gender, education, etc.) on female peer proportion and controlling for school-grade fixed effect.)&lt;/li&gt;
  &lt;li&gt;Results: Most estimates are statistically insignificant, suggesting no strong correlation between teachers characteristics and the percentage of female students.&lt;/li&gt;
&lt;/ul&gt;</content><author><name>Zhuojun Lyu</name></author><category term="Empirical Paper" /><category term="Education" /><summary type="html">Concepts: Clustered Standard Errors Methods: Hendonic Regression, Test for Randomization</summary></entry><entry><title type="html">Paper Reading 1: Overview</title><link href="https://zoeyyylyu.github.io/posts/2021/06/blog-post-1/" rel="alternate" type="text/html" title="Paper Reading 1: Overview" /><published>2021-06-11T00:00:00-07:00</published><updated>2021-06-11T00:00:00-07:00</updated><id>https://zoeyyylyu.github.io/posts/2021/06/blog-post</id><content type="html" xml:base="https://zoeyyylyu.github.io/posts/2021/06/blog-post-1/">&lt;p&gt;&lt;strong&gt;Concepts&lt;/strong&gt;: Heterogeneity, Endogeneity, Exogeneity.&lt;br /&gt;
&lt;strong&gt;Methods&lt;/strong&gt;: Balancing Test, Cross-cohort Design, Permutation Test with Resampling;&lt;/p&gt;

&lt;h3 id=&quot;gender-peer-effects-on-students-academic-and-noncognitive-outcomes-evidence-and-mechanisms&quot;&gt;Gender Peer Effects on Students’ Academic and Noncognitive Outcomes: Evidence and Mechanisms&lt;/h3&gt;
&lt;p&gt;Jie Gong, Yi Lu and Hong Song, 2019, &lt;em&gt;Journal of Human Resources&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data&lt;/strong&gt;: China Education Panel Survey 2014 (CEPS 2014)&lt;/p&gt;
&lt;h3 id=&quot;challenge-nonrandom-grouping-of-students&quot;&gt;Challenge: Nonrandom grouping of students&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;if there are unobserved characteristics of students that are associated with both gender composition in the classroom and students’ outcomes, the estimation of gender peer effects would be biased.&lt;/li&gt;
  &lt;li&gt;To address this identification problem, researchers often exploit cross-cohort variation or use random assignment\&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Solutions&lt;/strong&gt;:&lt;br /&gt;
a) &lt;ins&gt;Cross-cohort Design&lt;/ins&gt; : samples a cohort (a group of people who share a defining characteristic, typically those who experienced a common event in a selected period, such as birth or graduation) e.g., In order to research on the relationship between smoking &amp;amp; lung cancer, we match obs in terms of variables such as economic status and other health status so that the variable being assessed, the smoking(independent) can be isolated as the cause of the lung cancer(dependent).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Test for Randomization&lt;/strong&gt;  &lt;br /&gt;
b) &lt;ins&gt;Permutation test with a resampling approach&lt;/ins&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;for classroom i in grade j, school k:
    &lt;ul&gt;
      &lt;li&gt;for all student characteristics:
        &lt;ul&gt;
          &lt;li&gt;randomly draw 10,000 synthetic classrooms of the same size from the sample of all students from grade j, school k.&lt;/li&gt;
          &lt;li&gt;Calculate the average value for each characteristic within classroom i&lt;/li&gt;
          &lt;li&gt;Obtain an empirical p-value (proportion of the 10,000 resampled classrooms with lower statistics for the corresponding characteristic within the observed classrooms.)&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;c) &lt;ins&gt;Randomly drop observations and see whether regression results change dramatically.&lt;/ins&gt;&lt;/p&gt;

&lt;h3 id=&quot;data-processing&quot;&gt;Data Processing:&lt;/h3&gt;
&lt;ol&gt;
  &lt;li&gt;Noncognitive outcomes are obtained from students’ responses to eight survey items⇒use component analysis to classify the eight survey items into two categories: (1) the level of mental stress, and (2) the level of social acclimation and satisfaction in school.&lt;/li&gt;
  &lt;li&gt;Students’ academic performance is measured by test scores, supplement with test scores with students’ self-assessed performance scores.&lt;/li&gt;
  &lt;li&gt;Normalize each index to have a mean of zero and a standard deviation of one.&lt;/li&gt;
  &lt;li&gt;Conduct balancing test
    &lt;ul&gt;
      &lt;li&gt;&lt;strong&gt;Balancing test&lt;/strong&gt;: female proportion (dependent)~ predetermined characteristics (independent). test the factor one-by-one. Null hypothesis: insignificant t-statistics, which means predetermined characteristics do not related to the proportion of female students.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Endogenous school choice. While random class assignment is conducted, students’ school choices may not be random⇒ introduce school-grade fixed effects $\lambda_{sg}$ to control.
    &lt;ul&gt;
      &lt;li&gt;&lt;strong&gt;Endogeneity&lt;/strong&gt;: situations in which an explanatory variable is correlated with the error term.
        &lt;ul&gt;
          &lt;li&gt;When the independent and dependent variables are mutually causal, it leads to endogeneity. In a model, the variable whose value is determined by its relationship with other variables within the model, are endogenous; In contrast, &lt;ins&gt;exogenous variables&lt;/ins&gt; are independent, which have no formulaic relationship.&lt;/li&gt;
          &lt;li&gt;In a model, the dependent variable should be endogenous, and independent variables should be exogenous, whose values not determined by the model. Endogeneity refers to the situation where explanatory variables are not entirely exogenous but exhibit endogeneity.&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;main-takeaway&quot;&gt;Main takeaway:&lt;/h3&gt;
&lt;p&gt;This paper examines gender peer effects on students’ academic and non-cognitive outcomes&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Higher proportion of female peers in class improves students’ test scores and noncognitive outcomes, which include their social acclimation and general satisfaction in school.&lt;/strong&gt; ⇒10% increase in the proportion of female classmates raises students’ test scores by 10.2% of agi standard deviation and improves their social acclimation and satisfaction in school by 7.7% of a standard deviation.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Heterogeneity of gender peer effects.&lt;/strong&gt; ⇒ Positive effect on test score is stronger among male students, or when the teacher is male.
    &lt;ul&gt;
      &lt;li&gt;&lt;strong&gt;Heterogeneity&lt;/strong&gt;: differences across the units being studied&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;channels&quot;&gt;Channels:&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;More interactive teaching style, more time allocated to teaching-related tasks&lt;/strong&gt; ⇒ when there are more female students in class, teachers tend to introduce more discussions with and among students, allocate more time to teaching and grading, and be more patient with and responsible for their students.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Improved classroom environment&lt;/strong&gt; ⇒Students also report that the environment is friendlier and more satisfying, and that they devote more hours to homework and tutorials.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Clarification&lt;/strong&gt;: noncognitive outcome: mental stress, social acclimation and general satisfaction in school.&lt;br /&gt;
&lt;strong&gt;Caveats&lt;/strong&gt;: No strong support for ability-based spillover from female students.&lt;/p&gt;</content><author><name>Zhuojun Lyu</name></author><category term="Empirical Paper" /><category term="Education" /><summary type="html">Concepts: Heterogeneity, Endogeneity, Exogeneity. Methods: Balancing Test, Cross-cohort Design, Permutation Test with Resampling;</summary></entry></feed>