[{"categories":["Commentary"],"collections":["Institutions, Choice, and Development"],"content":" Economics is the science of choice. If the world could always have it both ways, there would be no need for economics. Too often we view policy through the lens of \u0026ldquo;either perfect or a dead end,\u0026rdquo; but what we ultimately have to learn is trade-offs. Just as politics is the art of compromise, economics too must compromise for the sake of choice. Recently Professor Zhou Li\u0026rsquo;an proposed two new terms: the impossible triangle of governance and organized discovery. I\u0026rsquo;d like to talk about my own understanding. Zhou Li\u0026rsquo;an discusses the impossible triangle of governance in the context of bureaucratic governance under fiscal constraints; we can generalize it a bit. The impossible triangle of governance, Society, 2026, Issue 3\rThe administrative subcontracting system (xingzheng fabao zhi) is essentially a center-centered governance structure. The center plans, then distributes goals downward, forming layers of management, with each layer given different goals and constraints1. Within this framework we\u0026rsquo;ve already assumed a premise: that any governance is governance with a center. Why do the concepts of state, collective, and ethnic group exist? Over the long course of social evolution, organizational forms like the state and the firm — centered groups — always seem to appear, and anarchism never really evolved into being. So we can treat grand unification and center-based governance as seemingly inevitable 🧙. The second point: center-based governance also has costs. Center-based governance may be inevitable, but inevitability has a price — otherwise why would Bitcoin\u0026rsquo;s idea of decentralization be so celebrated in principle? The cost of centralization is the limits of information use. For an organization, information can be divided into public information and private information. Individuals usually know their own private information best, but once a collective forms, the leader or our delegated authority may not know as much of that private information as we do ourselves. Meanwhile, to be efficient, management inevitably forms hierarchies, and as information passes up layer by layer it is full of loss and distortion. For example, along a management chain of a-b-c, if your private information passed upward hurts b, then once b knows it, b will conceal it or distort it into information that favors b. The person at the very top might manage tens of thousands of people alone. On the one hand, the cost of knowing each person\u0026rsquo;s information is very high; on the other, the information among different people is interest-laden, and striking a balance is extremely hard — something already proven mathematically by the \u0026ldquo;Arrow impossibility theorem\u0026rdquo;2. This is where the principal-agent model, information asymmetry, and public choice theory come from. People used to imagine a parental government. The social contract told us that once we hand power to the government, the government \u0026ldquo;naturally\u0026rdquo; serves the community. But real-world corruption tells us this imagination is too idealistic: even with a social contract in place, the performance of obligations is not automatic. So what to do? Checks and balances on power arrived. I hand power to you, and then we assess and compete with each other. Hence the official promotion tournament theory. But it has problems too. Once any goal becomes a target of assessment, it ceases to be a good goal (Goodhart\u0026rsquo;s Law). Take GDP: local governments keep borrowing and investing in infrastructure3 because it makes their assessments look good. In the end, our country\u0026rsquo;s assessment system patches in multi-target assessment this way and that, tweaking constantly, and if a mistake slips in, it gets amplified layer by layer. Professor Zhou Li\u0026rsquo;an\u0026rsquo;s classic 2007 paper in Economic Research Journal, \u0026ldquo;A Study of the Promotion Tournament Model of Chinese Local Officials\u0026rdquo;\rWe can also look at the Hayek–Keynes debate from the angle of i","date":"2026-11-06","heading":"","objectID":"/en/posts/econ_zl/:0:0","tags":["Bureaucratic Governance"],"title":"The Impossible Triangle of Governance (an Information-Use View)","uri":"/en/posts/econ_zl/#"},{"categories":["Commentary"],"collections":[],"content":" The theorist is science\u0026rsquo;s messenger: when two armies clash, you don\u0026rsquo;t kill the messenger. A practice called p hacking is popular in economics: using all sorts of techniques that skirt the edges of academic ethics to make results look better. Of course, this isn\u0026rsquo;t unique to economics; it\u0026rsquo;s just that the dark humor of the p-value gets magnified in this particular term. I often wonder: is science invented or discovered? If it\u0026rsquo;s discovery, then data and regularities are objective. Setting aside applied work like prediction and mechanism design, most econometricians are really just messengers of regularities. As the saying goes — when two armies clash, you don\u0026rsquo;t kill the messenger. Because whether the news is good or bad does not, objectively, depend on the messenger. But take empirical economics: economists are both the messengers and the ones who choose whom to report to. Yet academia only rewards successful good news. So two situations have arisen in academia: The first: we don\u0026rsquo;t know which regularities are verifiable and reliable, so academia has come up with mystical words like intuition and taste, and rewards the economic messengers who deliver good news. Since significance is an existential proposition and non-significance is a universal one, proving existence is more credible in probabilistic science than proving non-existence. In econometric significance, the difficulty of verification and the reward are asymmetric. In fact, regularities are objective, but evaluation is subjective. The same topic earns higher praise when a big name says it. For example, under the AI shock, top journals and ordinary ones, economics and non-economics, may all have studies on the danger that AI pushes human capital into long-term decline — but depending on the author\u0026rsquo;s status, the level of the publication will be completely different. See the empirical evidence: From Peer Review to Team Building: 14 Science-of-Science Papers Reveal the Origins of Inequality in Science The second is p hacking. Since not everyone brings good news, under this institutional design many people dress up bad news as good news to claim the reward, even if it isn\u0026rsquo;t real. In the AI era, this might improve. First, messengers who misreport are more easily punished. AI can improve code review\rSecond, statistical regularities as an empirical paradigm for discovering laws may see the independence of the messenger strengthened. AI is actually someone who cannot be \u0026ldquo;selected.\u0026rdquo; When AI acts as the researcher, it may really be the case that when two armies clash, the messenger isn\u0026rsquo;t killed. Third, a kind of \u0026ldquo;Great Steel Campaign\u0026rdquo; for everyone. In the AI era, anyone can go mining for regularities, and the lucky ones can come from entirely unexpected places. Example\rExample\rI once asked my parents what they\u0026rsquo;d each want to research: one said the relationship between free highways and GDP growth1, the other wanted to study holidays and consumption2. As you can see, these topics have all been published in top journals. When AI becomes the main subject of research, science\u0026rsquo;s messenger will be more independent, but the joy of exploration will always belong to humans. So there\u0026rsquo;s at least one piece of good news now: like Ratatouille says, anyone can cook — everyone can enjoy the fun of research exploration. Not everyone can become a great artist, but a great artist can come from anyone. Another line I like from Ratatouille\rIn a way, being a critic is far too easy: we risk almost nothing. From on high, we put workers and their contributions under our pens and judge them at will; we lean toward negative reviews because they please both the writer and the reader. But critics must face a hard truth: in this wide world, a tiny, insignificant creature may not be as lowly as the critics attack it for being. Critics sometimes face a tricky problem: discovering and protecting the new. This worl","date":"2026-09-17","heading":"","objectID":"/en/posts/econ_xs/:0:0","tags":["Empirical Research"],"title":"Academia and the Messenger","uri":"/en/posts/econ_xs/#"},{"categories":["Commentary"],"collections":[],"content":" The mountain passes are hard to cross. Not only because of the passes themselves, but because the rules at their foot have never been in the hands of those who travel the road. Recently I came across some of the real-world problems around primary and secondary school teachers applying for the title of Senior Teacher. I suddenly found that the history of the relevant policy documents is rather interesting and says something about how bureaucratic governance works in China. Hence this record. ","date":"2026-08-21","heading":"","objectID":"/en/posts/zcpx/:0:0","tags":["Bureaucratic Governance"],"title":"The Mountain Pass Is Hard to Cross: A Brief Analysis of Sichuan's Teacher Title Evaluation Documents","uri":"/en/posts/zcpx/#"},{"categories":["Commentary"],"collections":[],"content":"The Road to Professional Title Promotion\r","date":"2026-08-21","heading":"The Road to Professional Title Promotion","objectID":"/en/posts/zcpx/:1:0","tags":["Bureaucratic Governance"],"title":"The Mountain Pass Is Hard to Cross: A Brief Analysis of Sichuan's Teacher Title Evaluation Documents","uri":"/en/posts/zcpx/#the-road-to-professional-title-promotion"},{"categories":["Commentary"],"collections":[],"content":"Posts and Professional Titles\rPosts and professional titles are not the same thing. A post is the position a teacher occupies (logistics, administration, teaching, and so on), while a professional title reflects the teacher\u0026rsquo;s level of professional and technical competence. In China\u0026rsquo;s compulsory-education stage, meaning primary and junior secondary schools, teachers\u0026rsquo; professional titles run, from lowest to highest, through the five grades of Third-Grade Teacher, Second-Grade Teacher, First-Grade Teacher, Senior Teacher, and Professor-Grade Senior Teacher. For most teachers, the title mainly affects their salary. Pensions are tied to years of service too: the earlier you obtain a title, the higher your retirement salary, because it grows with the number of years you taught while holding that title1. The two harder hurdles are the moves to First-Grade Teacher and to Senior (Associate) Teacher. For Second-Grade Teacher, the required years of service are usually enough to establish seniority. First-Grade Teacher, by contrast, carries award requirements such as teaching-reform competitions and Outstanding Teacher awards, and you have to go through a selection process. The pyramid of teacher promotion in the compulsory-education stage\r","date":"2026-08-21","heading":"Posts and Professional Titles","objectID":"/en/posts/zcpx/:1:1","tags":["Bureaucratic Governance"],"title":"The Mountain Pass Is Hard to Cross: A Brief Analysis of Sichuan's Teacher Title Evaluation Documents","uri":"/en/posts/zcpx/#posts-and-professional-titles"},{"categories":["Commentary"],"collections":[],"content":"National-Level Policy Documents\rBefore 2015, the documents governing primary and secondary school title evaluation were the Notice on the Three Guiding Opinions on Post Establishment and Management in Educational Institutions (Guo Ren Bu Fa [2007] No. 59), which in turn inherited from the earlier management document Provisional Regulations on the Professional Positions of Secondary School Teachers (Zhi Gai Zi [1986] No. 112). The key points are as follows: The posts and titles of primary schools and junior secondary schools were kept separate. Secondary schools had Secondary Senior and First- to Third-Grade titles; primary schools had Primary Senior and First- to Third-Grade titles. Titles depended on posts. In most cases a teacher\u0026rsquo;s professional title matched a work post. Primary Senior Teacher, for example, was both a post and a title. Post levels were subject to proportional-control requirements. Document Guo Ren Bu Fa [2007] No. 59: The establishment of posts in institutions of higher education is subject to controls on total number of posts, structural proportions, and the highest grade. Management posts in compulsory-education schools generally have 6 staff grades. The highest grade of management posts, their structural proportions, and the number of staff at each management grade are determined according to the school\u0026rsquo;s scale, size, and administrative affiliation, in accordance with the relevant regulations and authority on cadre and personnel management. In other words, the quota of professional titles was basically tied to posts, and the grade proportions of posts were adjusted according to the scale of the workforce. Take region A as an example. With 100 teachers in 2000, the government might hand out 10% of the Senior Teacher post quotas (10 slots) and 20% of the First-Grade Teacher quotas. By 2010 there were 200 teachers, and the quotas rose in proportion, so 10% came to mean 20 Senior Teacher posts. Over those ten years, as the teaching force grew, ten extra Senior Teacher posts were created. Professor-Grade Senior Teacher is controlled in total at the national level, so the proportional control on Senior (Associate) Teacher is, for ordinary teachers, the ceiling of the professional-title ladder. A First-Grade Teacher is at the intermediate level; a Senior Teacher is at the associate-senior level. Above that, the quotas for Professor-Grade Senior Teacher are extremely scarce, so for most teachers the ceiling they can reach in a lifetime is really just Senior Teacher. The \u0026ldquo;mountain pass\u0026rdquo; that hundreds of thousands of teachers across Sichuan are squeezed through is, in the end, that single leap from First-Grade to Senior Teacher. After 2015, the guiding document became the Guiding Opinions on Deepening the Reform of the Professional Title System for Primary and Secondary School Teachers (Ren She Bu Fa [2015] No. 79). The main changes: The title systems of primary and secondary schools were merged, effectively unifying allocation within the compulsory-education stage. Title evaluation conditions were required to keep pace with the times. Appropriate preferential treatment was given to rural schools. Around 2015: The title quotas of primary and secondary schools were merged, which enlarged the power of principals in integrated primary-junior secondary schools2. Title requirements kept pace with the times, marking the start of teachers competing in teaching-reform competitions, lesson-plan competitions, micro-lecture competitions, and paper publication. If the size of the teaching establishment did not change, the quota of title posts stayed basically unchanged. ","date":"2026-08-21","heading":"National-Level Policy Documents","objectID":"/en/posts/zcpx/:1:2","tags":["Bureaucratic Governance"],"title":"The Mountain Pass Is Hard to Cross: A Brief Analysis of Sichuan's Teacher Title Evaluation Documents","uri":"/en/posts/zcpx/#national-level-policy-documents"},{"categories":["Commentary"],"collections":[],"content":"Personnel Authority\rThe allocation of authority over title evaluation is a textbook bureaucratic structure: the center sets the framework, the province sets the floor, the city adds more, and the county implements. The state uniformly sets the overall direction. It decides broad matters such as reasonable proportions, evaluation standards that fit the era, and appropriate support for rural areas. The remaining implementation details are left to local discretion, so localities can tailor their indicators to local conditions. Provinces issue more specific implementation rules. Prefecture-level or county-level cities dominate personnel-appointment authority and the concrete selection standards and plans. That is, title quotas are basically coordinated and arranged at the tier of the prefecture- or county-level city. ","date":"2026-08-21","heading":"Personnel Authority","objectID":"/en/posts/zcpx/:1:3","tags":["Bureaucratic Governance"],"title":"The Mountain Pass Is Hard to Cross: A Brief Analysis of Sichuan's Teacher Title Evaluation Documents","uri":"/en/posts/zcpx/#personnel-authority"},{"categories":["Commentary"],"collections":[],"content":"Local Policy: The Case of Sichuan\r","date":"2026-08-21","heading":"Local Policy: The Case of Sichuan","objectID":"/en/posts/zcpx/:2:0","tags":["Bureaucratic Governance"],"title":"The Mountain Pass Is Hard to Cross: A Brief Analysis of Sichuan's Teacher Title Evaluation Documents","uri":"/en/posts/zcpx/#local-policy-the-case-of-sichuan"},{"categories":["Commentary"],"collections":[],"content":"Escalation and Lag in Local Policy\rHere Sichuan is used as an example. The center sets the overall route while localities formulate the detailed rules. This is an allocation problem of discretionary power. Localities know local information better and can make better decisions, but the arrangement also carries risks of local protectionism and corruption. In practice, localities also need time to respond, so implementation lags behind signals from the center. Bureaucratic governance carries a risk of layer-by-layer escalation: local selection standards rise above the central baseline and produce involutionary competition. Seen through a principal-agent lens, localities do have easier access to the information needed for implementation. But if local agents have no incentive to gather and understand that information, the institution never achieves its intended effect. This is the dilemma at the heart of contemporary institutional design. If title evaluation is tied to the interests of the policymakers, they will seek private gain. If it is not, and only people who have already obtained titles are allowed to make policy, they tend toward bureaucratic indolence. After the central reform, Sichuan\u0026rsquo;s formal documents were noticeably slow to follow. The relatively complete formal document is roughly the Basic Conditions for the Declaration and Evaluation of Professional Titles for Primary and Secondary School Teachers in Sichuan Province (Chuan Jiao [2020] No. 85). It piles on, layer by layer, extra requirements on annual assessment, academic credentials, years of teaching, and so on. Most importantly, it adds a teaching-support (zhi jiao) requirement: (1) Teachers in urban (including county-town) primary and secondary schools who apply for a position at or above First-Grade Teacher must have 1 year or more of teaching-support (or teaching) experience since taking the current post, or 2 years or more since beginning teaching, at a weak school, a rural school, or a school in one of the \u0026ldquo;four major regions.\u0026rdquo; (2) For those who teach weak schools, rural schools, or schools in the \u0026ldquo;four major regions\u0026rdquo; online, or provide high-quality resources free of charge, the relevant education administrative department at or above the county level shall determine the equivalent class hours by considering usage, online click-through rates, and so on. The time converted according to the local standard workload for teachers shall be regarded as corresponding teaching-support (teaching) experience. Teaching by teachers at \u0026ldquo;Sichuan Cloud Education\u0026rdquo; anchor schools, and the teaching (teaching-in-post) time of college students participating in Liangshan in-post teaching support, shall be regarded as teaching-support (teaching) experience. But note that this requirement targets urban teachers seeking title promotion. Urban teachers must complete teaching support before they can be promoted. The corresponding requirement for rural teachers was not filled in until 2024 (Chuan Ren She Ban Fa [2024] No. 56). More striking still, such an important document cannot be found on Sichuan\u0026rsquo;s government websites. We can only learn its requirements through \u0026ldquo;Ask Sichuan Government\u0026rdquo; (Wenzheng Sichuan) and secondary citations by local governments. Source: Ask Sichuan Government, Chuan Ren She Ban Fa [2024] No. 56\rThe most important part is the requirement of urban-rural job rotation: As shown\rThis document formally published the special title requirements aimed at rural teachers. (Such documents, surprisingly, count as internal files that cannot be made public.) Its main device is to use the teaching-support requirement to divide rural teachers into three tiers. Taking the Nine Measures (Chuan Ren She Fa [2023] No. 95) as the time node, that is January 1, 2024, the rules for rural teachers are: Those employed for fewer than 25 years take part normally in the competition for title quotas. Teachers with 25-27 years of serv","date":"2026-08-21","heading":"Escalation and Lag in Local Policy","objectID":"/en/posts/zcpx/:2:1","tags":["Bureaucratic Governance"],"title":"The Mountain Pass Is Hard to Cross: A Brief Analysis of Sichuan's Teacher Title Evaluation Documents","uri":"/en/posts/zcpx/#escalation-and-lag-in-local-policy"},{"categories":["Commentary"],"collections":[],"content":"Examples from Ask Sichuan Government\rThe Ask Sichuan Government platform is a good channel for public supervision and assistance! 👍 Ask Sichuan Government-https://ly.scol.com.cn/thread/details/3899023\rAsk Sichuan Government-https://ly.scol.com.cn/thread/details/3899023\rAsk Sichuan Government-https://ly.scol.com.cn/thread/details/3766710\rAsk Sichuan Government-https://ly.scol.com.cn/thread/details/3766710\rOther, more general feedback examples from Ask Sichuan Government: Suining City, Anju District: The Deteriorating Educational Ecology Guanghan City: On the Issue of Rural Teachers Rotating into Urban Posts Chengdu Gaoxin Yunxin School\u0026rsquo;s Opaque Title Evaluation and Performance Pay Serious Procedural Violations in the Senior (Associate) Title Evaluation for Teachers in Nanchong City Longquanyi District\u0026rsquo;s Quota Restrictions on 2024 First-Grade Title Evaluation ","date":"2026-08-21","heading":"Examples from Ask Sichuan Government","objectID":"/en/posts/zcpx/:2:2","tags":["Bureaucratic Governance"],"title":"The Mountain Pass Is Hard to Cross: A Brief Analysis of Sichuan's Teacher Title Evaluation Documents","uri":"/en/posts/zcpx/#examples-from-ask-sichuan-government"},{"categories":["Commentary"],"collections":[],"content":"Some Reflections\rFirst, the black and red of bureaucratic governance. Understanding Chinese policy means understanding central-local relations. In the most ideal conception, the center coordinates the whole and sets up a division of labor and cooperation; otherwise each locality goes its own way, and fragmentation is not a good outcome either. Bureaucratic governance is therefore fundamentally a problem of dividing residual discretionary power. The key is how to design incentives. Yet the choice of implementers itself faces a dilemma. If title evaluation is tied to the interests of the policymakers, they will seek private gain. If it is not, and only people who have already obtained titles are allowed to make policy, they tend toward bureaucratic indolence. This is especially true for indicators like human capital that are hard to quantify meaningfully. Official tournament competition and bureaucratic governance can sometimes edge toward a law of the jungle, and both end up accountable upward. On university campuses I often hear teachers complain about academic assessment: laymen directing experts, unreasonable standards. But the moment students feel the postgraduate-recommendation rules are unreasonable, almost every teacher seems to wave off student grievances as pure utilitarianism and wish to keep their distance. Is that not also a form of accountability upward? Why does the law of the jungle so often become the social norm? The opposite of accountability upward is fragmentation and internal attrition downward. Once that sets in, it is hard to build united resistance. Second, economic problems and management problems. The old joke only gets more classic: the intentions above are good, the implementation below goes wrong. Economic problems are not merely economic. The top-level ideas are all positive: scientific assessment, preferential treatment for rural areas. But implementation suffers from internal response lags and missing incentives. Since personnel authority sits with the lower-level cities, it is hardly surprising that every locality first arranges how urban teachers are promoted and assessed, and only later considers rural teachers. The waste of time in implementation can also create crises. The policy was meant to benefit rural areas, dividing teachers into three batches by years of service. Yet by the time the favorable policy came out, many teachers had long since retired. Third, openness and transparency. The most concentrated complaints about title evaluation on Ask Sichuan Government are about \u0026ldquo;non-disclosure\u0026rdquo;: quotas not published, reserved quotas, differential review results announced only by word of mouth, scoring rules that cannot be explained, and shortlists in which frontline teachers appear once while leaders take up most of the slots. The more complex and opaque the rules, the more the power of interpretation concentrates at the top. Undisclosed rules become bargaining chips in the hands of those above. The unquantifiable \u0026ldquo;local conditions\u0026rdquo; added by layer upon layer of escalation are precisely the most convenient places for \u0026ldquo;manipulation.\u0026rdquo; Get the associate-senior title and retire five years later; get the associate-senior title and retire three years later. The salary and performance pay also differ.\u0026#160;\u0026#x21a9;\u0026#xfe0e; In rural areas there are still many schools that integrate primary and junior secondary education.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2026-08-21","heading":"Some Reflections","objectID":"/en/posts/zcpx/:3:0","tags":["Bureaucratic Governance"],"title":"The Mountain Pass Is Hard to Cross: A Brief Analysis of Sichuan's Teacher Title Evaluation Documents","uri":"/en/posts/zcpx/#some-reflections"},{"categories":["Economic Studies","Reading"],"collections":["Lecture Reflections"],"content":"I recently attended some lectures by Professor Wang Yongqin and found them very interesting, so I am recording them here. Professor Wang\u0026rsquo;s doctoral advisor was Oliver Hart (Nobel laureate 2016, known for incomplete contracts and the ownership of the firm). Professor Wang is himself building his own macroeconomic understanding from a financial angle. In his analytical framework, the important financial structures are debt, equity, and collateral. Within this framework he strings together China\u0026rsquo;s involutionary competition, economic growth, the official promotion tournament, and tax incentives as economic theories. Some of Professor Wang\u0026rsquo;s public lecture videos\r","date":"2026-08-03","heading":"","objectID":"/en/posts/involution_econ/:0:0","tags":["Involution"],"title":"The Economics of Involution: A Division-of-Labor and Incentives Perspective","uri":"/en/posts/involution_econ/#"},{"categories":["Economic Studies","Reading"],"collections":["Lecture Reflections"],"content":"The Manifestations of Involutionary Competition: Externalities from Division of Labor\rHas China fallen into involutionary competition? The UK and the US have held a stable annual growth rate of about 2%, while China, Germany, and other countries briefly grew at around 10% before rapidly dropping to 4%. That shift may indicate that China is facing a dynamic transition challenge. The concrete manifestations of involution are: The high homogeneity of actors Competition on a single dimension only Insufficient innovation In China, first, people have fallen into involution. As the economy slows, homogeneous zombie firms multiply, enterprise wages fall, the labor distribution relationship deteriorates, consumption is insufficient, and vicious competition creates a vicious cycle. Second, industrial policy has fallen into involution. Every region\u0026rsquo;s policy drifts toward convergence, detached from local comparative advantage. This contradiction appears at different levels in the same form internationally and domestically. As I once noted in Is This the Innovation We Mean?: If everyone does what they are good at, everyone divides labor, and total social welfare rises. Let the US innovate, for example, because that suits it, and let China manufacture, because that is our comparative advantage. But in reality, for the sake of an autonomous and controllable industrial chain, the US seeks to bring manufacturing back while China seeks disruptive innovation. At that point the choice of division of labor aims at defeating the other side, international trade relations deteriorate, and countries fall into involutionary competition with one another. The same holds domestically. The state prefers each region to divide work and cooperate, but regions, all chasing GDP, pursue similarly comprehensive industrial chains. So the global optimum of \u0026ldquo;small and refined\u0026rdquo; and the local optimum of \u0026ldquo;big and complete\u0026rdquo; come into conflict, producing a prisoner\u0026rsquo;s dilemma. Because comparative advantage is dynamic, the prisoner\u0026rsquo;s dilemma is dynamic too. In Adam Smith\u0026rsquo;s view, the division of labor determines the market. We can then also say that the division of labor determines the share of market profit. When China\u0026rsquo;s comparative advantage shifts from manufacturing to innovation, the formerly innovative countries feel threatened. An example of division of labor and markets: The Ministry of Commerce released its \u0026ldquo;China\u0026rsquo;s Position on the So-Called \u0026lsquo;Overcapacity\u0026rsquo; Issue.\u0026rdquo; China holds that protectionism only disrupts the global trade order. How should we read this? A Zhihu answer by Gu Du Xian Yun The development structure opposite to involution is Adam Smith\u0026rsquo;s \u0026ldquo;great society\u0026rdquo; and Hayek\u0026rsquo;s \u0026ldquo;extension of the order\u0026rdquo;: everyone divides labor, everyone does their own assigned work, and different people\u0026rsquo;s work complements the rest. It is the opposite of homogeneous involutionary competition. That is, each person considers their own optimal local division of labor, yet under the general equilibrium the global development deteriorates. In Professor Wang\u0026rsquo;s view, building a great society requires a sound property-rights environment, and the reality of incomplete contracts all around brings various externalities. This is why Professor Wang has recently published a lot of research on judicial reform and financial-market development. ","date":"2026-08-03","heading":"The Manifestations of Involutionary Competition: Externalities from Division of Labor","objectID":"/en/posts/involution_econ/:1:0","tags":["Involution"],"title":"The Economics of Involution: A Division-of-Labor and Incentives Perspective","uri":"/en/posts/involution_econ/#the-manifestations-of-involutionary-competition-externalities-from-division-of-labor"},{"categories":["Economic Studies","Reading"],"collections":["Lecture Reflections"],"content":"Financial System, Fiscal System, and Economic Governance\r","date":"2026-08-03","heading":"Financial System, Fiscal System, and Economic Governance","objectID":"/en/posts/involution_econ/:2:0","tags":["Involution"],"title":"The Economics of Involution: A Division-of-Labor and Incentives Perspective","uri":"/en/posts/involution_econ/#financial-system-fiscal-system-and-economic-governance"},{"categories":["Economic Studies","Reading"],"collections":["Lecture Reflections"],"content":"The Financial System\rIn Professor Wang\u0026rsquo;s view, the key to financial order lies in understanding insurance, collateral, and information. Information means we know what to do. Insurance means we dare to do it. Financing (collateral) means we can do it. Property-rights protection represents the incentive for innovation (patents, for example). Collateral can supply enterprises with financial strength. Collateral means trading today\u0026rsquo;s assets for tomorrow\u0026rsquo;s ability to pay. China has used real estate as a major form of collateral, which brings a big hidden danger: real estate is a non-renewable resource, and the potential of property-rights confirmation (quequan) in Chinese real estate has not yet been released. First, China has overleveraged its real-estate collateral, losing more credit in the future. Second, stocks can absorb consequences internally, but collateral carries externalities. Real estate as collateral has a strong multiplier effect. Real estate is a general-purpose collateral. Any enterprise in any industry can use real estate as collateral. Once the economy turns down and the collateral value of real estate falls, every industry takes a hit. (Debt is bad for innovation.) Third, property-rights confirmation in Chinese real estate is insufficient. Once rights are confirmed, real estate can serve as collateral. Otherwise it has only the use value of its physical attributes. In Latin America, for example, illegal self-built housing has only physical residential attributes, without a property-rights environment that can be turned into collateral. In China the issue is that a large amount of real estate has not been confirmed: rural land belongs to the collective, for instance, and cannot be turned into collateral. Property-rights protection and national development can be divided into four quadrants: Weak property-rights protection\rStrong property-rights protection\rStrong competitiveness\rChina\rUnited States\rWeak competitiveness\rDeveloping countries\rEurope\rBased on this division of property rights and competitiveness, development can be divided into several stages: Step one: the development trap Step two: the middle-income trap Step three: imitative innovation Step four: innovation, or improved innovation, or involutionary competition The move from step three to step four can have different outcomes. The crux is whether the local property-rights structure is sound and whether society\u0026rsquo;s ability to safeguard innovation is sufficient. Without a sound property-rights structure, firms lack collateral, financial strength, and innovative capacity. Property-rights protection is also the incentive mechanism for innovation. And without a sufficient social financial system to fund and protect enterprises, firms tend toward harmful involutionary competition. World Economy, 2026 issue 7: \u0026ldquo;Involutionary\u0026rdquo; Competition and High-Quality Innovation: An Analysis Based on the Schumpeterian Growth Model ","date":"2026-08-03","heading":"The Financial System","objectID":"/en/posts/involution_econ/:2:1","tags":["Involution"],"title":"The Economics of Involution: A Division-of-Labor and Incentives Perspective","uri":"/en/posts/involution_econ/#the-financial-system"},{"categories":["Economic Studies","Reading"],"collections":["Lecture Reflections"],"content":"The Fiscal System\rThe first issue is the incentive objective: One reason for involutionary homogeneity is the singleness of the incentive objective. China stresses high-quality development, but GDP remains the unified yardstick. The second issue is the fiscal system: China\u0026rsquo;s main tax revenue is the value-added tax (VAT), which is levied on the place of production. Local governments therefore prefer to keep firms local. Even if a firm is losing money, as long as its VAT is positive, the government has an incentive to keep it at home, which breeds local protectionism, local fragmentation, and related problems. ","date":"2026-08-03","heading":"The Fiscal System","objectID":"/en/posts/involution_econ/:2:2","tags":["Involution"],"title":"The Economics of Involution: A Division-of-Labor and Incentives Perspective","uri":"/en/posts/involution_econ/#the-fiscal-system"},{"categories":["Economic Studies","Reading"],"collections":["Lecture Reflections"],"content":"How to Govern\rHow to break the cycle: protect property rights, for example by protecting private enterprises and confirming property rights in real estate. A financial system that gets out of involution. Reform of the involutionary competitive tax system. Improving social security and the safety-net system. The government\u0026rsquo;s role shifts toward primarily providing public goods such as health care and education. ","date":"2026-08-03","heading":"How to Govern","objectID":"/en/posts/involution_econ/:3:0","tags":["Involution"],"title":"The Economics of Involution: A Division-of-Labor and Incentives Perspective","uri":"/en/posts/involution_econ/#how-to-govern"},{"categories":["Reading"],"collections":["Lecture Reflections"],"content":"The most durable frontiers of science are usually about redefining one\u0026rsquo;s object of study in the present environment. What is public finance? The question reaches into what a state is, where states come from, and whether the state is inevitable. The natural sciences are no different. What is force? Newton and Einstein gave very different answers. In current economic research, with the introduction of \u0026ldquo;new quality productive forces\u0026rdquo; and the latest Nobel Prizes, innovation has become the darling of journal topics. But what exactly is innovation? What is it for? My sense is that many occasions blur together competitive innovation and cooperative innovation. If we take innovation to mean \u0026ldquo;creating something from nothing,\u0026rdquo; we can actually break that down further: something that did not exist in the world and now does; something the enemy had and I did not, and now I have it too. Going back to the origin of innovation theory, we first run into entrepreneurship. From the start, the word innovation was bound up with inventors, entrepreneurs, and scientists. Our intuition is that innovation means completing a creation from nothing: releasing a new product, leading a new industry, discovering a new law. But the actors in innovation are far more numerous than that. Let\u0026rsquo;s take them one by one. ","date":"2026-06-09","heading":"","objectID":"/en/posts/innovation/:0:0","tags":["Innovation","Economic Growth"],"title":"Is This the Innovation We Mean?","uri":"/en/posts/innovation/#"},{"categories":["Reading"],"collections":["Lecture Reflections"],"content":"Who Innovates\r","date":"2026-06-09","heading":"Who Innovates","objectID":"/en/posts/innovation/:1:0","tags":["Innovation","Economic Growth"],"title":"Is This the Innovation We Mean?","uri":"/en/posts/innovation/#who-innovates"},{"categories":["Reading"],"collections":["Lecture Reflections"],"content":"Innovation by Theoretical Scientists\rIs science invention or discovery? What about mathematics? And the social sciences? Theoretical innovation does not lie in the object of study itself. What theorists create from nothing is, at bottom, the perspectives and frameworks for understanding regularities. Creating from nothing has nothing to do with being right or wrong. Geocentrism once had an extremely elegant, highly self-consistent theoretical system, and in that era the concept of the ellipse had not yet been born, so heliocentrism was actually very crude. You cannot dismiss the mathematical tools born from that \u0026ldquo;wrong\u0026rdquo; object just because geocentrism was wrong. Theoretical innovation happens in the viewpoint and means of observation, in the way we understand things, not in whether the object of observation is correct. The quarrel between Western economics and political economy over negating each other\u0026rsquo;s object of observation is just kids scrapping. A common route for social-science papers is to take a theory and find different applications. The proposition that \u0026ldquo;childhood experience shapes adult decisions\u0026rdquo; can be extended to officials who lived through famine being more inclined to spend money in bursts, and to officials who lived through heat waves caring more about climate issues. Conversely, you can find the same structural constraint across different fields. Economics is the science of choice, and we can rarely have it both ways. Monetary policy has its impossible trinity, and the Phillips curve makes us weigh inflation against unemployment again and again. The essence of theoretical innovation is, in the end, redefining the \u0026ldquo;lens\u0026rdquo; through which we understand the world. The scale of an innovation depends on how large the lens is that it challenges. To overturn a specific model or formula, you only need to question its assumptions and parameters. To overturn a mature economic theory, you need enough historical contexts to refute it. To overturn a discipline\u0026rsquo;s basic paradigm, you have to shake the default assumptions of the entire academic community. The larger the lens, the harder the argument, and the easier it is to slide into vagueness. For any given question, we need to know what scale we actually want to interrogate. A lot of people nowadays trace every gender issue back to the patriarchal system. Even if that is true, we can say that physiological structure, patriarchal society, historical evolution, and the wage gap are all bound up in one logical chain, and every entry point can be defended. So which one should we choose? Whichever link is more workable in reality. Many people jump straight to asking \u0026ldquo;has anyone done this before?\u0026rdquo; without asking the other question: how large a lens is this new idea trying to challenge, and at which link of the chain does the conclusion intend to take effect? If you only care about extending a conclusion from nothing, then swapping a dataset or a scenario is innovation. If you care about a larger level and more logical chains, innovation becomes an endless pursuit. I think the contingency of domestic peer review lies in the fact that journals and reviewers do not share a unified standard. Journals at different levels ought to pursue questions at different levels. Journals have their standards and reviewers have theirs. Since journals rely on star authors\u0026rsquo; submissions to raise their own standing, in practice the reviewers\u0026rsquo; standards usually override the journals'. ","date":"2026-06-09","heading":"Innovation by Theoretical Scientists","objectID":"/en/posts/innovation/:1:1","tags":["Innovation","Economic Growth"],"title":"Is This the Innovation We Mean?","uri":"/en/posts/innovation/#innovation-by-theoretical-scientists"},{"categories":["Reading"],"collections":["Lecture Reflections"],"content":"Innovation by Entrepreneurs\rEntrepreneurial innovation is more concrete and closer to the public\u0026rsquo;s image of a \u0026ldquo;feat from nothing.\u0026rdquo; Unless you fold the entire evolution of life from carbon to silicon into a natural process, a computer cannot appear out of thin air. But does that count as innovation? Professor Zhang Weiying once lamented that most people in modern society choose civil-service exams rather than innovation and entrepreneurship. Without entrepreneurs, development hits a bottleneck. But for an entrepreneur, is innovation only innovation in product form? What about assembly-line management systems? Or the organizational form of equity investment? I once heard two teachers argue. Teacher Y argued that as long as China still has companies like Xiaomi and Pinduoduo, there is no real soil for innovation. They only play tricks in logistics management and chase cost compression, and they have not brought anything essentially new to the world. Once you can profit easily by integrating the logistics chain, who still has the incentive to create something new? In Teacher Y\u0026rsquo;s view, logistics-chain management innovation is mere imitation, not innovation. But those two positions point at two different levels of innovation. The first is cooperative innovation. Let the countries with better conditions for innovation innovate, and the countries with cheaper labor manufacture. With each country dividing work and cooperating, as a community with a shared future for mankind, the welfare of the earth as a whole must rise. The second is competitive innovation. In this scenario, innovation can be a lose-lose outcome, competition in a game-theoretic setting. In the game between political actors, China\u0026rsquo;s technological progress threatens the position the US currently holds in the global division of labor, hence the friction. The innovation China seeks is the autonomous, adversarial innovation of great-power competition. The \u0026ldquo;from nothing\u0026rdquo; here is not from nothing in the world; it is from nothing relative to the US, relative to home. The US has it, China does not, and now China does. In that process, welfare for the earth as a whole definitely falls, while China\u0026rsquo;s welfare rises somewhat along with its technological progress. Back to the teachers\u0026rsquo; example. The mobile-phone manufacturing industry is a whole, but the individual manufacturers are competing actors. The \u0026ldquo;from nothing\u0026rdquo; Teacher Y talks about assumes the mobile-phone industry as a whole: cooperative innovation, welfare innovation from not existing to existing. Xiaomi and Pinduoduo, by contrast, are competitive innovation: integrating advantages or imitating technology when competing actors exist. Cooperative innovation is good for everyone, but the game-theoretic background of the actors pushes everyone toward competitive innovation. Phone and e-commerce decisions are just a microcosm of great-power competition. ","date":"2026-06-09","heading":"Innovation by Entrepreneurs","objectID":"/en/posts/innovation/:1:2","tags":["Innovation","Economic Growth"],"title":"Is This the Innovation We Mean?","uri":"/en/posts/innovation/#innovation-by-entrepreneurs"},{"categories":["Reading"],"collections":["Lecture Reflections"],"content":"Unifying Innovation\rSo the transition from competitive innovation to cooperative innovation hinges on whether competition exists among the actors. Within a country, or across countries, if there is a higher-level organization to coordinate the division of labor, then the leap from competitive to cooperative innovation becomes possible. The crux is how strong the control of that higher-level actor is. At that point the problem becomes one of asymmetric information and incomplete contracts, such as central-local contradictions. China\u0026rsquo;s central government, for example, can coordinate the positioning and division of labor of each province and concentrate resources on major undertakings. But each province also has its own little calculations. Local fragmentation and local protectionism are closely tied to central-local issues. So both kinds of innovation are outcomes of market structure. For efficiency in economic analysis: First, cooperative innovation is the first-best choice, but it is constrained by the competitive relations among the actors, so it requires strong government intervention. Second, cooperative innovation implicitly assumes that as long as the division of labor is right, the actors with innovation advantages will throw themselves fully into innovation. But reality lacks that incentive by nature. An environment of competitive innovation, by contrast, is good at incentivizing rivals to innovate. Third, putting the two together, a real leap may need two conditions. One, a strong government able to adjust the division of labor and promote cooperation. Two, and at the same time, enough incentive for the innovating actors to genuinely invest in innovation, whether through heavy government subsidies or a large enough market incentive (including market profits and the property-rights system). ","date":"2026-06-09","heading":"Unifying Innovation","objectID":"/en/posts/innovation/:2:0","tags":["Innovation","Economic Growth"],"title":"Is This the Innovation We Mean?","uri":"/en/posts/innovation/#unifying-innovation"},{"categories":["Commentary"],"collections":["Institutions, Choice, and Development","Lecture Reflections"],"content":"Professor Lu Ming has developed a spatial political economy framework for understanding China\u0026rsquo;s economic development. Since the policy push for a \u0026ldquo;unified national market,\u0026rdquo; the framework has found a more concrete anchor. To my mind, the phrase that captures Lu Ming\u0026rsquo;s spatial political economy better than any other is — balancing through agglomeration. The research program centers on interventions and distortions in the processes of population mobility, urban growth, and factor concentration. But what is \u0026ldquo;development\u0026rdquo;? What is \u0026ldquo;balance\u0026rdquo;? These are the kinds of questions that, like \u0026ldquo;what is justice?\u0026rdquo; or \u0026ldquo;what is morality?\u0026rdquo;, generate endless debate. After watching several of Lu Ming\u0026rsquo;s lectures and reading his books, I found a number of his ideas1 worth writing down. What follows is a summary with my own commentary. ","date":"2026-05-19","heading":"","objectID":"/en/posts/kjzz_econ/:0:0","tags":["Spatial Political Economy"],"title":"The Monetary Framework of Spatial Political Economy: A Summary and Critical Review","uri":"/en/posts/kjzz_econ/#"},{"categories":["Commentary"],"collections":["Institutions, Choice, and Development","Lecture Reflections"],"content":"The Monetary Theory of Spatial Political Economy\rInternational economics gives us the \u0026ldquo;impossible trinity\u0026rdquo; — the idea that a country cannot simultaneously maintain monetary policy independence, exchange rate stability, and free capital mobility. Though this looks like a macro-level framework for trade between nations in an open economy, it applies just as well within a single country — giving micro-level research a macro foundation2 😜. Think of it this way: each province is, in effect, a small country. Inter-provincial protectionism functions like trade barriers between nations. But here\u0026rsquo;s the difference. Unlike sovereign states, provinces cannot run independent monetary policies. The situation is closer to the Eurozone. Monetary unification requires one of two conditions3: Similar industrial structures across regions, so a single monetary policy suits everyone. Free population mobility, so factor flows endogenously offset the differential impact of a uniform policy across regions. China, however, is a unified country with a single currency, diverse regional industrial structures, and a hukou system that restricts population mobility. The combination creates serious problems. The question that follows: under these constraints, how do you promote development in lagging regions? ","date":"2026-05-19","heading":"The Monetary Theory of Spatial Political Economy","objectID":"/en/posts/kjzz_econ/:1:0","tags":["Spatial Political Economy"],"title":"The Monetary Framework of Spatial Political Economy: A Summary and Critical Review","uri":"/en/posts/kjzz_econ/#the-monetary-theory-of-spatial-political-economy"},{"categories":["Commentary"],"collections":["Institutions, Choice, and Development","Lecture Reflections"],"content":"The Development Theory of Spatial Political Economy\r","date":"2026-05-19","heading":"The Development Theory of Spatial Political Economy","objectID":"/en/posts/kjzz_econ/:2:0","tags":["Spatial Political Economy"],"title":"The Monetary Framework of Spatial Political Economy: A Summary and Critical Review","uri":"/en/posts/kjzz_econ/#the-development-theory-of-spatial-political-economy"},{"categories":["Commentary"],"collections":["Institutions, Choice, and Development","Lecture Reflections"],"content":"Three Modes of Competition\rLu Ming argues that competitiveness boils down to three channels: Wages: Lagging regions can compete on cheap factor prices, but this widens regional wage gaps and works against common prosperity. Exchange rates: With a unified monetary policy, this path is closed. Labor productivity: This route encompasses both GDP and population. Development theory\r","date":"2026-05-19","heading":"Three Modes of Competition","objectID":"/en/posts/kjzz_econ/:2:1","tags":["Spatial Political Economy"],"title":"The Monetary Framework of Spatial Political Economy: A Summary and Critical Review","uri":"/en/posts/kjzz_econ/#three-modes-of-competition"},{"categories":["Commentary"],"collections":["Institutions, Choice, and Development","Lecture Reflections"],"content":"Approaching Development through GDP\rStart with GDP — which largely reflects local fiscal capacity and industrial capacity. Regions with comparative advantages find those advantages constrained by geography and natural endowments4. Regions without them need central government support through fiscal channels: local debt and transfer payments. Example 1: The structure and impact of public finance Many people treat local government debt as productive investment. But China\u0026rsquo;s local debt ratio has been rising steadily. Treat debt as $x$ and local output as $f(x)$ — the proposition loses money. Calling local debt \u0026ldquo;productive investment\u0026rdquo; doesn\u0026rsquo;t hold up. Example 2: The structure and impact of public finance Why are provinces like Shandong notorious for their civil service exam culture? There may be an economic explanation beyond the cultural one. Shandong lacks strong comparative advantages, and its private sector is underdeveloped. The result: heavy reliance on public-sector hiring to absorb employment. With a weak local private sector, fiscal capacity depends on central transfers. This gives us a unified framework for understanding why lagging regions simultaneously suffer from weak growth momentum, dependence on transfer payments, and ballooning government debt5. ","date":"2026-05-19","heading":"Approaching Development through GDP","objectID":"/en/posts/kjzz_econ/:2:2","tags":["Spatial Political Economy"],"title":"The Monetary Framework of Spatial Political Economy: A Summary and Critical Review","uri":"/en/posts/kjzz_econ/#approaching-development-through-gdp"},{"categories":["Commentary"],"collections":["Institutions, Choice, and Development","Lecture Reflections"],"content":"Approaching Development through People\rThe idea is to relax restrictions on population mobility, letting migration offset the uneven regional effects of a single monetary policy. For population-sending regions, per capita GDP rises. The gaps between regions narrow. In The Centripetal City, Lu Ming uses data from the Shenzhen metropolitan area to show that stronger inter-city mobility shrinks regional disparities6. Example 3: Individual welfare and local welfare Lu Ming tells of an entrepreneur in one of his classes who said that, after the course, he understood that his greatest contribution to his hometown was leaving it. Capable people develop their potential more fully in places better suited to them, without crowding out local resources — leaving jobs for those who stay, and so on. Per capita welfare at the local level improves. For population-receiving regions, labor is deployed more efficiently, driving growth. The main cost is widening income inequality within cities. But weighed against widening regional gaps and mounting local debt, this trade-off looks favorable. ","date":"2026-05-19","heading":"Approaching Development through People","objectID":"/en/posts/kjzz_econ/:2:3","tags":["Spatial Political Economy"],"title":"The Monetary Framework of Spatial Political Economy: A Summary and Critical Review","uri":"/en/posts/kjzz_econ/#approaching-development-through-people"},{"categories":["Commentary"],"collections":["Institutions, Choice, and Development","Lecture Reflections"],"content":"Commentary\r","date":"2026-05-19","heading":"Commentary","objectID":"/en/posts/kjzz_econ/:3:0","tags":["Spatial Political Economy"],"title":"The Monetary Framework of Spatial Political Economy: A Summary and Critical Review","uri":"/en/posts/kjzz_econ/#commentary"},{"categories":["Commentary"],"collections":["Institutions, Choice, and Development","Lecture Reflections"],"content":"Economic Phenomena vs. Physical Phenomena\rA fascinating finding in urban economics is that city sizes in developed countries tend to follow Zipf\u0026rsquo;s law. City rank and population are inversely related: the second-largest city is about half the size of the largest, the third-largest about a third, and so on. The figure below shows Zipf distribution fits for Japan and China, from The Centripetal City. Japan\u0026rsquo;s city size distribution (left panel) tracks Zipf\u0026rsquo;s law closely; China\u0026rsquo;s (right panel) deviates considerably. The implication: China\u0026rsquo;s big cities aren\u0026rsquo;t big enough, and its small cities aren\u0026rsquo;t small enough. City population size distributions for Japan and China, Zipf\u0026rsquo;s law fit\rZipf\u0026rsquo;s law was first discovered in linguistics: word frequencies in a book follow a Zipf-like distribution. But the pattern turns up widely — in income distributions, city sizes, and firm sizes. The book Zipf wrote after discovering the law that bears his name\rAt the physical level, the explanation comes down to the principle of least action — what we colloquially call the 80/20 rule or the Matthew effect. A small subset of agents, being far more efficient, accounts for most of what happens in a system. They are few but carry disproportionate weight. Unlike uniform or normal distributions, Zipf\u0026rsquo;s law is a limiting case of power-law distributions. Such systems minimize energy expenditure. By the same logic, big cities are more economically efficient than small ones — much like the tax question: do you tax the rich or the poor? Money genuinely is more productive in the hands of the rich, so absent intervention, the concentration of wealth starts to look almost like a physical law. But economics sees the question differently. Efficiency versus fairness is growth versus distribution — a question that goes beyond physical efficiency. Right now, population mobility in China faces institutional frictions. The hukou system is the obvious one, but cultural attachments to one\u0026rsquo;s native place also play a role. That is why Lu Ming argues we must first promote mobility and agglomeration in large cities. Since big cities enjoy the gains from agglomeration, they should bear the cost of fiscal transfers. The remaining questions are practical: how to transfer, to where, and into which sectors? ","date":"2026-05-19","heading":"Economic Phenomena vs. Physical Phenomena","objectID":"/en/posts/kjzz_econ/:3:1","tags":["Spatial Political Economy"],"title":"The Monetary Framework of Spatial Political Economy: A Summary and Critical Review","uri":"/en/posts/kjzz_econ/#economic-phenomena-vs-physical-phenomena"},{"categories":["Commentary"],"collections":["Institutions, Choice, and Development","Lecture Reflections"],"content":"Does Zipf\u0026rsquo;s Law Have Physical Roots?\rCan economic phenomena be reduced to physical properties? On theoretical elegance, there is a gap. Between the principle of maximum physical efficiency and the pursuit of fairness in economic and social policy, a logical link is still missing. If population flows freely and city sizes converge toward Zipf\u0026rsquo;s law, does that mean development has become \u0026ldquo;balanced\u0026rdquo;? Can we build a bridge — some kind of optimization framework — between physical efficiency and socio-economic fairness? The convergence toward Zipf distributions has been demonstrated repeatedly. What remains is the question of the conditions under which Zipf\u0026rsquo;s law arises7. Still, Lu Ming\u0026rsquo;s conclusions point toward some physical underpinnings of economic phenomena: Zipf\u0026rsquo;s law tends to appear in phenomena with network effects. Bootstrap-style growth — money making money, compounding returns, economies of scale, websites linking to one another — these settings reliably generate Zipf distributions. The scale externalities of large cities follow the same logic. The size distributions of large firms do too. Zipf\u0026rsquo;s law tends to appear in phenomena with fractal structure. A tree trunk branches repeatedly into self-similar forms. Statistically, the distribution of node connections follows Zipf\u0026rsquo;s law. We see something analogous in Lu Ming\u0026rsquo;s framework: Trade and development between nations → between provinces → between cities → between districts or zones within cities. Development theory\rNotice also that in Lu Ming\u0026rsquo;s diagram, red marks the downside and green the upside. When population flows freely, disparities between cities shrink, but disparities within cities may grow — precisely the layered-transfer pattern characteristic of fractal economies. ","date":"2026-05-19","heading":"Does Zipf\u0026rsquo;s Law Have Physical Roots?","objectID":"/en/posts/kjzz_econ/:3:2","tags":["Spatial Political Economy"],"title":"The Monetary Framework of Spatial Political Economy: A Summary and Critical Review","uri":"/en/posts/kjzz_econ/#does-zipfs-law-have-physical-roots"},{"categories":["Commentary"],"collections":["Institutions, Choice, and Development","Lecture Reflections"],"content":"Overlooked Externalities in the Analysis\rA thought on \u0026rsquo;externality\u0026rsquo; — tangential to the article above\rI\u0026rsquo;m fond of an illustration from The Economics of Crime and Law Enforcement that clarifies the concept of externality — the divergence between private and social costs and benefits. The Economics of Crime and Law Enforcement: Professor Anthony\u0026rsquo;s undergraduate econometrics-of-crime lecture notes\rWhy does China have both civil and criminal law? Legally, it\u0026rsquo;s about who holds the authority to punish. Economically, it\u0026rsquo;s about externalities. Speeding on a national highway falls under civil law; speeding on an expressway falls under criminal law. On a national highway, the parties can negotiate compensation — costs are internalized. On an expressway, things are far less controllable, and the social cost is much larger. Two places in the argument strike me as logically thin. First, the GDP-based contrast between regions with and without comparative advantages. This path is foreclosed only under the assumption that comparative advantages are tightly constrained. If comparative advantages are relative and frictions are small, the set of viable choices is more flexible — which brings us back to the framework of Justin Yifu Lin\u0026rsquo;s New Structural Economics. To be fair, population outflow (turning cheap labor into a competitive advantage and triggering industrial relocation) is also an answer, and one consistent with everyday observation. But in Lu Ming\u0026rsquo;s diagram, this path is explicitly ruled out. Lu Ming also welcomes attempts to identify competitive advantages beyond the three in the diagram. Second, Lu Ming seems to underweight the externalities of scale. \u0026ldquo;Balancing through agglomeration\u0026rdquo; — the diagram suggests that after population outflow, per capita welfare in the sending region may rise. The emphasis is on the rise in per capita levels. But in practice, absolute scale carries powerful externalities, and these are a major source of market failure. In Lu Ming\u0026rsquo;s framework, per capita welfare might be $y = f(\\frac{Y}{N})$. But with the network effects that operate within scale, the function is more likely $y = f(\\frac{Y}{N}, N)$. Or, accounting for the compositional structure of the population, there are compositional externalities: $y = f(\\frac{Y}{N}, \\sum p_i n, p_i)$. This would explain why, in the Northeast, population outflow has been accompanied by declining per capita GDP — or rather, why per capita welfare should ultimately fall. So even with frictionless population mobility, the resulting urban pattern may still be unbalanced. The Beijing-Tianjin-Hebei megaregion is a case in point. ","date":"2026-05-19","heading":"Overlooked Externalities in the Analysis","objectID":"/en/posts/kjzz_econ/:3:3","tags":["Spatial Political Economy"],"title":"The Monetary Framework of Spatial Political Economy: A Summary and Critical Review","uri":"/en/posts/kjzz_econ/#overlooked-externalities-in-the-analysis"},{"categories":["Commentary"],"collections":["Institutions, Choice, and Development","Lecture Reflections"],"content":"Recommended Online Materials\r","date":"2026-05-19","heading":"Recommended Online Materials","objectID":"/en/posts/kjzz_econ/:4:0","tags":["Spatial Political Economy"],"title":"The Monetary Framework of Spatial Political Economy: A Summary and Critical Review","uri":"/en/posts/kjzz_econ/#recommended-online-materials"},{"categories":["Commentary"],"collections":["Institutions, Choice, and Development","Lecture Reflections"],"content":"Physical Intuition\rWhy Is Zipf\u0026rsquo;s Law So Pervasive? From the Principle of Least Effort to Maximizing Diversity Choice Matters More Than Effort (Power-Law Distributions) Quantum Mechanics Tells Us That Matter Takes All Paths ","date":"2026-05-19","heading":"Physical Intuition","objectID":"/en/posts/kjzz_econ/:4:1","tags":["Spatial Political Economy"],"title":"The Monetary Framework of Spatial Political Economy: A Summary and Critical Review","uri":"/en/posts/kjzz_econ/#physical-intuition"},{"categories":["Commentary"],"collections":["Institutions, Choice, and Development","Lecture Reflections"],"content":"Lu Ming on the Practice of Economic Research\rLu Ming: China\u0026rsquo;s Economics Research Has Become Seriously Disconnected from Reality Lu Ming: Revisiting \u0026ldquo;Taking Empirical Research All the Way\u0026rdquo; Lu Ming: Reality, Theory, and Evidence — On How to Do Research and Write Papers The framework leans heavily toward policy recommendations and has not yet been published in top domestic or international journals at the theoretical level. Several footnote citations are therefore drawn from Chinese C-tier journals. But de-emphasizing journal hierarchies and focusing on ideas is itself a welcome trend.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Lu Ming notes that Professor Wang Yongqin\u0026rsquo;s phrasing of this perspective is particularly apt.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Zhong Huiyong, Lu Ming, and Li Ruifeng. \u0026ldquo;Growth, Subsidies, and Debt: The Spatial Political Economy of a Unified Currency Area.\u0026rdquo; Journal of Renmin University of China, 2022, 36(06): 75–88.\u0026#160;\u0026#x21a9;\u0026#xfe0e; The argument here feels somewhat vague. Extending this line of thought leads to the question of whether every region possesses some comparative advantage. If so, the analysis continues within the framework of New Structural Economics.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Lu Ming, Cai Xinyi, and Zhong Huiyong. \u0026ldquo;Decentralized Incentives and Moral Hazard: Central–Local Relations and Debt Governance in International Comparison.\u0026rdquo; Contemporary Finance \u0026amp; Economics, 2025, (05): 3–16. DOI: 10.13676/j.cnki.cn36-1030/f.20250318.001.\u0026#160;\u0026#x21a9;\u0026#xfe0e; This does not, however, appear consistent with the development trajectories of the Chengdu–Chongqing or Beijing–Tianjin–Hebei megaregions.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Toda, A. A. (2017). \u0026ldquo;Zipf\u0026rsquo;s Law: A Microfoundation.\u0026rdquo; Available at SSRN 2808237.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2026-05-19","heading":"Lu Ming on the Practice of Economic Research","objectID":"/en/posts/kjzz_econ/:4:2","tags":["Spatial Political Economy"],"title":"The Monetary Framework of Spatial Political Economy: A Summary and Critical Review","uri":"/en/posts/kjzz_econ/#lu-ming-on-the-practice-of-economic-research"},{"categories":["Reading"],"collections":[],"content":" I cannot stress enough that the moment, and the experience, are far more important than any method. ——DAVID BERGLAS ","date":"2026-04-27","heading":"","objectID":"/en/posts/bgls/:0:0","tags":["Magic"],"title":"The Berglas Effect","uri":"/en/posts/bgls/#"},{"categories":["Reading"],"collections":[],"content":"The Berglas Effect\rMagic feels like a miracle because what happens onstage seems to outrun ordinary reality. When people think of magic, they usually picture something flashy and impossible: flying through the air, escaping from impossible traps, producing objects out of nowhere, making a person appear in an instant. The Berglas Effect is much plainer than that1: Imagine a magician taking out a deck of cards, letting people examine it to make sure nothing has been done to it, and then never touching the deck again. Next, the magician randomly picks spectator A and asks them to think of any suit and any value. Then the magician asks spectator B to shuffle the deck and name a number at random. Spectator B turns over the cards one by one, counting to that number, and the card there is exactly the one spectator A only thought of. The power of the Berglas Effect is that, from the structure of the performance alone, it feels almost absurdly impossible: No stooges. The spectators are chosen at random, and the key decisions are random too. No sleight of hand. The magician does not touch the deck. No gimmicks. The deck is open for inspection. The logical shock: two random choices somehow produce an event with vanishingly small odds. It feels like a miracle. We will teach you how to use your personality instead of your hands; your charm instead of your sweat; your mind instead of your fingers ——The Berglas Effect In China, the version that really made the Berglas Effect widely known was Liu Qian\u0026rsquo;s performance at the Essential Magic Conference: 《【Liu Qian】EMC performance of the Berglas Effect that no one has cracked》 Screenshot from the performance\r","date":"2026-04-27","heading":"The Berglas Effect","objectID":"/en/posts/bgls/:1:0","tags":["Magic"],"title":"The Berglas Effect","uri":"/en/posts/bgls/#the-berglas-effect"},{"categories":["Reading"],"collections":[],"content":"The appeal: exposing magic and performing it\rCover of The Berglas Effect\rBefore getting to the explanations in this book, I want to pass on one of its core ideas: magic performance has a deeper appeal than magic explanation. Sleight of hand and props can absolutely produce the outward form of a trick, but the way those tools are used belongs to performance. Once the method is exposed, people quickly lose interest. What never runs out are the details inside a performance that makes people believe the magician has done nothing at all. Even in a scientific age, how do you lead people to believe that a miracle happened here and now? There is a philosophy inside performance and presentation, and that is where part of a magician\u0026rsquo;s charm 🎩 comes from. Once we start caring about the essence of performance, the techniques of magic stop belonging to magic alone. A matador lifting a bright red cape high overhead makes the same point: exaggerated movement and the choice of color are indispensable parts of a bullfight too2! Highly recommended: Liu Qian\u0026rsquo;s magic lessons on Bilibili: Liu Qian\u0026rsquo;s magic lessons\rBerglas himself says this at the beginning of the chapter 😆: I\u0026rsquo;ve been waiting for you \u0026hellip; you with that crazed look in your eye. You\u0026rsquo;re the one who just tore the shrink-wrap off this book and immediately opened it to the table of contents looking for the words \u0026ldquo;The Berglas Effect,\u0026rdquo; then turned right to this page. Stop. Please close the book and start reading from the beginning. You won\u0026rsquo;t understand what follows if you haven\u0026rsquo;t read what comes before. Screenshot from the book\r","date":"2026-04-27","heading":"The appeal: exposing magic and performing it","objectID":"/en/posts/bgls/:2:0","tags":["Magic"],"title":"The Berglas Effect","uri":"/en/posts/bgls/#the-appeal-exposing-magic-and-performing-it"},{"categories":["Reading"],"collections":[],"content":"How the Berglas Effect is performed\rThe biggest secret is that the Berglas Effect is not one single performance but a whole series of performances. Berglas\u0026rsquo;s real brilliance is that he shows how a \u0026ldquo;miracle\u0026rdquo; gets created. The rules of the Berglas Effect are: No card force: no using suggestion, sleight of hand, or similar methods to make the spectator land on a specific card. No relying on psychological ploys, like asking someone to choose a favorite color or number. During the performance, the magician is not allowed to walk around holding a prepared deck. The deck needs to stay on the table or out of sight. The magician is not allowed to use their hands to locate the card in the deck, and the count cannot simply be run backward. The magician is not allowed to use secret maneuvers to control the card into the required position. In reality, no single performance satisfies all five conditions completely. Sometimes David only meets 1-4. Sometimes he only meets 2-5. But if you perform it often enough, what people remember is the impression that all of them were met. For example, after the spectator has settled on a card, the magician may only then start thinking about how to present the Berglas Effect. But the performance has to make the audience believe the effect was already in place before the card was ever chosen. One technique is this: David really does touch the deck in some performances, but spectators are likely to forget that later. In magic, every action produces a result, and one result can cover another, or a larger action can hide a smaller one3. That is why David keeps stressing this point: in magic, the moment and the experience matter far more than any method. What matters about the Berglas Effect is not being able to reproduce it under every possible condition, but knowing what kinds of conditions allow the Berglas Effect to appear. The magician has actually memorized the deck. That means when the spectator names a number, the magician already knows where the target card sits in the stack. What remains is figuring out how to make that card appear there. This means the magician can quickly track a card\u0026rsquo;s relative position from the top, the bottom, or the middle\rAt the number-selection stage, the magician may first give prompts like these: pick a number under 10, around 10, between 10 and 20, or above 20. The moment the magician starts giving examples, the choice is already being influenced. Once the spectator has chosen a number, there are still ways to handle it: directly cut off that many cards, count from the bottom up, or count from the top down. Even the reveal after the spectator cuts the deck can help, because the spectator may expose the position of the bottom card, which gives you a rough sense of the relative positions in the whole deck. For example, if the magician knows the needed position is 8, they might say, \u0026ldquo;Give me an example - 5, 6, 7, something like that.\u0026rdquo; That is really a way of nudging the spectator toward a small number, and it works more strongly than simply saying, \u0026ldquo;Give me a small number.\u0026rdquo; Tone, cadence, and pauses can all function as suggestion. The most important part of the performance is making the spectator feel that they are choosing freely. Doing all of that quietly and naturally is the hardest part of performing magic. At minimum, the magician has to judge before which spectator action they need to finish their thinking. One useful fact is this: the spectators do not actually know what the magician\u0026rsquo;s next step is. So when the spectator cuts the deck and you miss the key card, you can simply let them keep cutting until you recognize the locator card. From the magician\u0026rsquo;s point of view, this is just making the trick easier; from the spectator\u0026rsquo;s point of view, the extra cutting only makes the trick seem more complicated. Another technique lies in how the number is interpreted. Suppose the magician knows the correct card is","date":"2026-04-27","heading":"How the Berglas Effect is performed","objectID":"/en/posts/bgls/:3:0","tags":["Magic"],"title":"The Berglas Effect","uri":"/en/posts/bgls/#how-the-berglas-effect-is-performed"},{"categories":["Reading"],"collections":[],"content":"Liu Qian\u0026rsquo;s version\rLiu Qian currently has four recorded versions on video. Liu Qian\u0026rsquo;s four performances of the Berglas Effect [full HD collection] Compared with David\u0026rsquo;s version of the Berglas Effect, the most startling thing is how mature Liu Qian\u0026rsquo;s later two performances are4. He always turns the cards over from the top down, which means there is no need to over-explain the number. In Liu Qian\u0026rsquo;s version, there are always two people: one names the suit and value, and the other names the number. That alone completes the double randomness. (It almost feels as if true freedom under any conditions has really been achieved!) During the actual performance phase, Liu Qian really does not touch the cards. The decks are not identical. I actually compared the order of the suits in two performances, and the relative order is not the same. It really does look as though Liu Qian may have performed a full version of the Berglas Effect (except for not displaying the deck at the beginning), which is why Berglas once praised Liu Qian\u0026rsquo;s version as better than his own. From Liu Qian\u0026rsquo;s Weibo: Berglas\u0026rsquo;s signed inscription for Liu Qian, praising his version as better than his own\rSince there is no shuffling or cutting at all, it is reasonable to guess that Liu Qian had memorized the deck. If there are no stooges, then the key must lie either in the card-selection stage or in the props. While we\u0026rsquo;re here, I also recommend Liu Qian\u0026rsquo;s interview with Luo Yonghao: 【Full interview】Magic master Liu Qian × Luo Yonghao! The Liu Qian you may not know ","date":"2026-04-27","heading":"Liu Qian\u0026rsquo;s version","objectID":"/en/posts/bgls/:4:0","tags":["Magic"],"title":"The Berglas Effect","uri":"/en/posts/bgls/#liu-qians-version"},{"categories":["Reading"],"collections":[],"content":"Other recommended materials\rMagic magazine Genii Magic forum TalkMagic Card magic forum Theory11 Zhihu answer: how is the Berglas Effect done? Rather than a card trick in the narrow sense, this is better understood as a magic effect presented with cards as the prop.\u0026#160;\u0026#x21a9;\u0026#xfe0e; This book once came with a DVD that recorded David performing the Berglas Effect at the Bull Theater, which is what made me think of this analogy. For related discussion, take a look at this forum thread.\u0026#160;\u0026#x21a9;\u0026#xfe0e; This technique also shows up in Liu Qian\u0026rsquo;s magic lessons. It is crucial to make the audience believe a miracle happened while overlooking the ordinary little details.\u0026#160;\u0026#x21a9;\u0026#xfe0e; In the first two performances, Liu Qian actually does touch the cards; they use gimmicked cards.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2026-04-27","heading":"Other recommended materials","objectID":"/en/posts/bgls/:5:0","tags":["Magic"],"title":"The Berglas Effect","uri":"/en/posts/bgls/#other-recommended-materials"},{"categories":["Reading","Economic Studies"],"collections":["Reflections on Learning Economics"],"content":" When we talk about what AI can do, we are really circling back to an older question: what, exactly, is irreducibly human about research? A refrain that keeps getting louder in academia goes something like this: now that AI has become a research assistant, academic taste will matter more than ever. I find that phrase — \u0026ldquo;academic taste\u0026rdquo; — deeply contradictory. On one hand, it is maddeningly vague. It runs against everything research is supposed to be: making things clear, making things precise, making things accessible. On the other, that very vagueness, while it can encode genuine practical wisdom, slips all too easily into survivor bias and the kind of condescension that comes wrapped in institutional identity. A recent conversation between Terence Tao and the YouTuber Dwarkesh Patel gave me a fresh angle on this. Maybe what we casually call \u0026ldquo;academic taste\u0026rdquo; really is a phantom category — just one that operates at different levels. Macro level: How is truth actually discovered? Micro level: Which theories get picked up, propagated, and funded first? At the macro level, academic taste has nothing to do with where truth comes from. At the micro level, taste is real enough — but it functions less as a faculty of judgment and more as in-group shorthand. Original interview: Terence Tao – How the world\u0026rsquo;s top mathematician uses AI Chinese summaries: 量子位, 网易, 51CTO. ","date":"2026-04-04","heading":"","objectID":"/en/posts/taste_ai/:0:0","tags":["Artificial Intelligence","Economic Methodology"],"title":"The Copernican Moment and Academic Taste","uri":"/en/posts/taste_ai/#"},{"categories":["Reading","Economic Studies"],"collections":["Reflections on Learning Economics"],"content":"Revisiting the \u0026ldquo;Copernican Moment\u0026rdquo;\rStrictly speaking, the \u0026ldquo;Copernican moment\u0026rdquo; I am talking about here belongs more to Kepler — the one who actually corrected the model of planetary motion. Copernicus proposed heliocentrism, sure. But he never let go of perfect circles. Source: the anime Orb: On the Movements of the Earth. Mars observation records played a decisive role in early astronomy and cosmology.\rKepler, for a long time, believed planetary orbits had to conform to some deeply harmonious geometric structure — Platonic solids, even. What he lacked was a high-quality observational dataset. So he got one from Tycho Brahe. The planets do not move in circles. They do not trace out regular polyhedra. Kepler spent years trying everything: shifting the circle\u0026rsquo;s center, tweaking parameters, searching for a fit that would not come. What finally broke the impasse was data: the ellipse was the shape that worked. Translated into the language of modern empirical science, the process looks like this: High-quality data: Tycho\u0026rsquo;s long-run observational records. Model assumptions: circular orbits, geometric harmony, and other prior commitments. Residual analysis: the model could not account for a crucial deviation in Mars\u0026rsquo;s orbit. Iterative revision: shifting circles, adjusting parameters, trying new geometries. Abandoning the old assumption: accepting that \u0026ldquo;the circle\u0026rdquo; itself might be wrong. Abstracting a new law: elliptical orbits, and eventually the general laws of planetary motion. The history of science tends to magnify the \u0026ldquo;moment of discovery\u0026rdquo; while shrinking the long, grinding stretch of failure, trial, and data accumulation that came before it. In that light, the macro-level pursuit of truth is less about \u0026ldquo;a person of taste seeing through to the essence at a glance\u0026rdquo; and more about who has better data, who can afford a longer chain of failed attempts, and who is willing to delete an old assumption — until the truth finally comes into view. ","date":"2026-04-04","heading":"Revisiting the \u0026ldquo;Copernican Moment\u0026rdquo;","objectID":"/en/posts/taste_ai/:1:0","tags":["Artificial Intelligence","Economic Methodology"],"title":"The Copernican Moment and Academic Taste","uri":"/en/posts/taste_ai/#revisiting-the-copernican-moment"},{"categories":["Reading","Economic Studies"],"collections":["Reflections on Learning Economics"],"content":"Taste and the cost of trial and error\rWhy does academia keep invoking taste and intuition? Strip away the mystique, and they serve a single function: lowering the cost of trial and error. Every day, scientists face an infinite space of theoretical conjectures and a finite budget of attention. Peer review exists to filter that space into something more tractable. But in a world shaped by data-driven methods and AI, the cost of verification is racing toward zero. That shifts the advantage toward whoever can: marshal higher-quality data; expose the weaknesses of old models faster; admit that a cherished assumption is wrong; hold onto something rough but right through a long sequence of failures. This naturally calls to mind that perennial question in the social sciences: why didn\u0026rsquo;t the Industrial Revolution happen in China (or Asia more broadly)? The question travels under different names in different fields — the Needham Question, the Weber Thesis, the Great Divergence, the Qian Xuesen Question — Justin Yifu Lin\u0026rsquo;s classic answer runs like this: science, at bottom, raises productivity. China had abundant labor and scarce capital; Europe had the reverse. Europe therefore had incentives to invest in science, while China developed the imperial examination system. China\u0026rsquo;s early growth came from empirical know-how accumulated at population scale. The Industrial Revolution needed something else: an institutional environment that steered elites toward scientific enterprise. A sharper follow-up: was the Industrial Revolution driven by the masses or by elites? In the long arc of history, it is tempting to see it as a dialectical wave of its time — yet spatial inequality hints that the story is not so tidy. If we suppose that scientific development has bottleneck phases, could that be where AI and the Industrial Revolution share a theoretical logic? There seems to be an inverted-U relationship between trial-and-error cost and population quality: When the cost of trial and error is low, volume and breadth of attempts matter most. When the cost of trial and error is high, elite selection and intensive training matter most. And when AI starts driving down the cognitive cost of certain kinds of trial and error, the filtering structures that once relied on the \u0026ldquo;taste\u0026rdquo; of a small number of people may begin to crack. What is really changing at the macro level is not that truth has suddenly become a matter of taste — it is that the organizational form through which we approach truth, through trial and error, is transforming. ","date":"2026-04-04","heading":"Taste and the cost of trial and error","objectID":"/en/posts/taste_ai/:2:0","tags":["Artificial Intelligence","Economic Methodology"],"title":"The Copernican Moment and Academic Taste","uri":"/en/posts/taste_ai/#taste-and-the-cost-of-trial-and-error"},{"categories":["Reading","Economic Studies"],"collections":["Reflections on Learning Economics"],"content":"Taste and selection mechanisms\rThe uncomfortable fact is that scientists do not live inside macro-history. They live inside today: inside deadlines, inside grant cycles, inside peer review.1 Liu Cixin wrote a beautiful metaphor for this in his short story \u0026ldquo;The Poetry Cloud.\u0026rdquo; An advanced alien civilization brute-forces every possible combination of Chinese characters — and still cannot tell which poem will, in some future age, truly surpass Li Bai. The problem is not just can it be generated. It is also which one should be believed. The world of theory is the same. We can rarely tell, in the present, which theory will matter later — because a theory\u0026rsquo;s value is never just about whether it looks elegant, mature, or complete right now. It also depends on whether it turns out, in the future, to carry more explanatory power. The history of economic thought is full of such cases. Many contemporaries could not accept Augustin Cournot\u0026rsquo;s use of mathematics in Researches into the Mathematical Principles of the Theory of Wealth to express the price–demand relationship. Ramsey touched on the endogenization of the savings rate long before the Solow growth model, but his insight only became visible inside a later theoretical frame. In these examples, \u0026ldquo;taste\u0026rdquo; starts to look more like: sensitivity to the questions of one\u0026rsquo;s own time; a rough, pre-theoretical hunch about a theory\u0026rsquo;s future explanatory reach; tolerance for the gap between \u0026ldquo;roughly right\u0026rdquo; and \u0026ldquo;elegantly wrong.\u0026rdquo; ","date":"2026-04-04","heading":"Taste and selection mechanisms","objectID":"/en/posts/taste_ai/:3:0","tags":["Artificial Intelligence","Economic Methodology"],"title":"The Copernican Moment and Academic Taste","uri":"/en/posts/taste_ai/#taste-and-selection-mechanisms"},{"categories":["Reading","Economic Studies"],"collections":["Reflections on Learning Economics"],"content":"Roughly right and elegantly wrong\rTerence Tao put this wonderfully: Science is always advancing. When you only have a partial answer, it can look worse than a theory that is wrong but has been refined to the point where it seems to answer everything. Newton\u0026rsquo;s theory was full of puzzles — puzzles that took centuries to resolve, and only through a conceptually different approach. Progress often comes not from adding more theory but from deleting an assumption you have been carrying in your head. This passage explains, almost exactly, why \u0026ldquo;taste\u0026rdquo; keeps getting invoked at the micro level. Because researchers, in practice, are constantly staring at two kinds of things: a very polished wrong theory; a very rough right theory. Seen from the endpoint of history, time may eventually vindicate the right theory. But seen from the middle of a career — with its disciplinary divisions, its resource constraints, its professional incentives — researchers have to choose before the evidence is complete. Taste, then, is not some sacred faculty. It is the capacity to place a bet. ","date":"2026-04-04","heading":"Roughly right and elegantly wrong","objectID":"/en/posts/taste_ai/:4:0","tags":["Artificial Intelligence","Economic Methodology"],"title":"The Copernican Moment and Academic Taste","uri":"/en/posts/taste_ai/#roughly-right-and-elegantly-wrong"},{"categories":["Reading","Economic Studies"],"collections":["Reflections on Learning Economics"],"content":"Taste and narrative\rIf all you see is \u0026ldquo;more data, stronger models,\u0026rdquo; it is easy to drift into the illusion that theoretical competition will eventually collapse into a pure data race. Tao pushes back: The art of exposition, the organization of arguments, the construction of a narrative — these are also essential parts of science. Data helps, of course. But people need to be persuaded, or they will not invest in moving a direction forward. They need to make that initial investment to learn your theory and really explore it. This gets at something real about the micro level: science is not only a process of discovery; it is also a process of organization. Data does not persuade on its own. A theory can be, in some sense, closer to the truth — and still need to be explained, transmitted, learned, put into curricula, written into papers, and funded for further exploration. Even in empirical economics, a p-value is just one check among many necessary conditions;2 what we really need to convince others of is why the combination of those conditions is credible enough. See \u0026ldquo;The Rhetoric of Economics\u0026rdquo; and \u0026ldquo;Empirical Economics: Intuitive ≠ Obvious.\u0026rdquo; Take a single topic — say, the idea that long-term AI use erodes cognitive ability (or skills, or attention). You can find versions of this same question across statistics, economics, life sciences, and medicine. Different methods, different narrative angles. Some people manage to wrap it into a top-tier publication; others end up in a low-tier journal. The gap between them is bigger than anything the word \u0026ldquo;taste\u0026rdquo; can capture. Academic taste at the macro level carries a built-in contradiction. The spirit of science we absorb growing up is that behind any seemingly trivial phenomenon lies a deep mystery. Taste, meanwhile, is easily co-opted into something cruder: the impulse to dismiss an entire line of inquiry as simply boring. Microfoundations of macroeconomics?\rAt the micro level, \u0026ldquo;taste\u0026rdquo; takes on an unmistakably communal flavor. It is not just individual judgment. It is club culture inside a discipline: which questions are worth asking, which evidence counts as decisive, which style of expression reads as serious, which assumptions feel \u0026ldquo;natural\u0026rdquo; — none of these are purely personal decisions. In that club setting, academic taste is less about a topic being boring or uninteresting. It is more about the research being out of step with the group. To sharpen the point: for a labor economist, gender may be a fundamental dimension for analyzing social structure. A sociologist working on LGBT issues may not accept the same framing at all. A new structural economist may treat endowments as the primary constraint; an institutional economist will push back hard. The disagreement here is not simply about who is \u0026ldquo;more right.\u0026rdquo; It is about which community prioritizes what, how they organize questions, and how they allocate attention. So yes — at the micro level, \u0026ldquo;academic taste\u0026rdquo; exists. But it functions mostly as club vocabulary.3 ","date":"2026-04-04","heading":"Taste and narrative","objectID":"/en/posts/taste_ai/:5:0","tags":["Artificial Intelligence","Economic Methodology"],"title":"The Copernican Moment and Academic Taste","uri":"/en/posts/taste_ai/#taste-and-narrative"},{"categories":["Reading","Economic Studies"],"collections":["Reflections on Learning Economics"],"content":"AI and the question\rAt the macro level, taste is an empty word. Wrong theories can be exquisitely polished; right theories can be embarrassingly rough. Taste has never had anything to do with truth — because even with peer review as refined as it is today, important research does not automatically rise to the top. At the micro level, taste is genuinely consequential. No researcher can wait for \u0026ldquo;the verdict of history\u0026rdquo; before deciding what to read today, what to work on, what to submit, what to teach. Finite resources force every community to develop its own pre-filtering rules — and \u0026ldquo;taste\u0026rdquo; is often just the everyday name for those rules. That is why the change AI brings is not \u0026ldquo;academic taste matters more\u0026rdquo; or \u0026ldquo;academic taste no longer matters.\u0026rdquo; A more precise way to put it might be: The technical cost of trial and error is falling. AI can help generate candidate ideas, search the literature, check derivations, and further compress low-level labor. The social cost of verification has not gone away. Data quality, theoretical interpretability, peer persuasion, training barriers, institutional incentives — AI does not reach any of these. The carrier of taste is shifting. It used to be embodied disproportionately in the individual judgment of a small number of experts. Now it is increasingly embedded in datasets, citation networks, model weights, recommendation systems, and community feedback loops. Consider how canonical literature used to form: an author reads papers, cites them, and gets discovered by others through search. Now people may ask an AI to recommend papers, or have an AI read them. Should we expect that, going forward, papers in formats more legible to AI — those shipping with code libraries, Markdown documentation, reproducible GitHub repositories — will carry more weight? The real-world influence of literature and its AI-mediated influence may split into two interlocking but distinct systems. Academic taste is not a shortcut to truth. At the macro level, truth is not decided by taste. At the micro level, taste remains a survival strategy under finite resources. What AI is changing is not the pursuit of truth itself, but the way truth is discovered, filtered, propagated, and invested in. Maybe that, more than anything, is the Copernican moment we are actually living through. ","date":"2026-04-04","heading":"AI and the question","objectID":"/en/posts/taste_ai/:6:0","tags":["Artificial Intelligence","Economic Methodology"],"title":"The Copernican Moment and Academic Taste","uri":"/en/posts/taste_ai/#ai-and-the-question"},{"categories":["Reading","Economic Studies"],"collections":["Reflections on Learning Economics"],"content":"Further reading\rTeaching Econometrics in the Age of AI Some Thoughts on AI and Research The Consequences of Abundant Intelligence Can Mathematical Taste Be Quantified? If the Primary Audience for Papers Is No Longer Human Does Scientific Progress Depend on \u0026ldquo;Outliving\u0026rdquo; the Old Guard? A Science Study Reveals Academia\u0026rsquo;s Brutal Truth Keynes: in the long run, we are all dead.\u0026#160;\u0026#x21a9;\u0026#xfe0e; A fun philosophical experiment: can statistical evidence serve directly as legal evidence? What exactly is the difference between how mathematical models and probabilistic models \u0026ldquo;prove\u0026rdquo; something?\u0026#160;\u0026#x21a9;\u0026#xfe0e; At the very least, my own feeling is that evaluating whether a question is worth studying requires a certain humility — a posture of restraint.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2026-04-04","heading":"Further reading","objectID":"/en/posts/taste_ai/:7:0","tags":["Artificial Intelligence","Economic Methodology"],"title":"The Copernican Moment and Academic Taste","uri":"/en/posts/taste_ai/#further-reading"},{"categories":["Software Tools"],"collections":["Stata Empirical Tools"],"content":"When AI defeated Ke Jie, people still felt AI was far removed from their own work, much as a younger Ke Jie had once watched AI beat Lee Sedol with a certain youthful nonchalance. Only by 2026 did people learning empirical research start to feel a very specific kind of fear around \u0026ldquo;automation.\u0026rdquo; Recently, Professor David Yanagizawa-Drott launched an agent-based empirical analysis project (APEP project); Terence Tao started a project on agent contributions to the Erdős problem list (AI contributions to Erdős problems). New buzzwords keep spilling out of computer science too: agent, skill, vibe coding, MCP, ABM model\u0026hellip;1 For concrete research, take two examples2: A dataset on the spatiotemporal distributions of street and neighborhood crime in China: uses LLMs to extract variables from criminal case judgments. Decoding China\u0026rsquo;s Industrial Policies: uses LLMs to code and parse a massive body of policy documents. A loose summary would be this: if you turn AI into an agent with some specific traits, let it operate software on your computer through MCP, and combine that with AI APIs and VSCode plugins, you get a kind of automated programming workflow - the thing people now like to call vibe coding. Here we can build a rough setup and get a feel for it. ","date":"2026-02-20","heading":"","objectID":"/en/posts/stata_auto/:0:0","tags":["Stata","Artificial Intelligence","Obsidian"],"title":"Stata and AI Agents: A Powerful Pair for Empirical Work","uri":"/en/posts/stata_auto/#"},{"categories":["Software Tools"],"collections":["Stata Empirical Tools"],"content":"Letting AI control software\rThe simplest integrated versions are Cursor and Claude Code3. But you can also build an all-in-one setup inside VSCode. You\u0026rsquo;ll need the following software: VSCode: the coding environment Git: version control and file-transfer management Node.js: for backend work, file operations, and hardware control cc Switch: for routing integrated AI API calls If you\u0026rsquo;re setting this up in mainland China, the following video is a useful reference: Once everything is in place, you can call an AI API directly inside VSCode and let it operate on the editor. If this is your first time using VSCode, remember to create a new folder first. Then open VSCode, click File, and open that new folder. After that, you can do the rest of the work inside it. ","date":"2026-02-20","heading":"Letting AI control software","objectID":"/en/posts/stata_auto/:1:0","tags":["Stata","Artificial Intelligence","Obsidian"],"title":"Stata and AI Agents: A Powerful Pair for Empirical Work","uri":"/en/posts/stata_auto/#letting-ai-control-software"},{"categories":["Software Tools"],"collections":["Stata Empirical Tools"],"content":"Taking it further with Stata plugins\r","date":"2026-02-20","heading":"Taking it further with Stata plugins","objectID":"/en/posts/stata_auto/:2:0","tags":["Stata","Artificial Intelligence","Obsidian"],"title":"Stata and AI Agents: A Powerful Pair for Empirical Work","uri":"/en/posts/stata_auto/#taking-it-further-with-stata-plugins"},{"categories":["Software Tools"],"collections":["Stata Empirical Tools"],"content":"The StataMCP plugin\rOnce you finish the previous step, you can absolutely let the AI service help you with the rest of the setup 😀. Plugin name\rThese are the Stata extensions I personally recommend installing in VSCode. Stata language: recognizes Stata syntax Stata Outline: lets the editor recognize document structure. The heading format is **#. The number of # marks the heading level, up to six levels. Stata MCP: the core extension that gives VSCode the ability to control Stata. The extra setup is simple too. In the Stata MCP settings page, just enter the folder where your Stata installation lives. For example, mine is D:\\stata. I use the Stata MP version4. Your Stata installation folder\rThe Stata MCP extension will add the following buttons to the interface. They more or less correspond to running Stata. Buttons|127\r","date":"2026-02-20","heading":"The StataMCP plugin","objectID":"/en/posts/stata_auto/:2:1","tags":["Stata","Artificial Intelligence","Obsidian"],"title":"Stata and AI Agents: A Powerful Pair for Empirical Work","uri":"/en/posts/stata_auto/#the-statamcp-plugin"},{"categories":["Software Tools"],"collections":["Stata Empirical Tools"],"content":"Giving AI permission to call Stata\rTo let AI actually control the Stata application, the first thing you need is the MCP bridge mcp-proxy. ai \u003c-\u003e mcp-proxy \u003c-\u003e stata-mcp \u003c-\u003e Stata\rYou can install it by running the following command directly in a powershell window. pip install mcp-proxy\r","date":"2026-02-20","heading":"Giving AI permission to call Stata","objectID":"/en/posts/stata_auto/:2:2","tags":["Stata","Artificial Intelligence","Obsidian"],"title":"Stata and AI Agents: A Powerful Pair for Empirical Work","uri":"/en/posts/stata_auto/#giving-ai-permission-to-call-stata"},{"categories":["Software Tools"],"collections":["Stata Empirical Tools"],"content":"Connecting Claude Code to StataMCP\rclaude code is fairly cautious about MCP management, and the integration is not as convenient as Codex. At the moment, I seem to have made it work by adding the following .json file under .claude. { \"mcpServers\": { \"stata-mcp\": { \"command\": \"mcp-proxy\", \"args\": [\"http://localhost:4000/mcp\"] } } }\r","date":"2026-02-20","heading":"Connecting Claude Code to StataMCP","objectID":"/en/posts/stata_auto/:2:3","tags":["Stata","Artificial Intelligence","Obsidian"],"title":"Stata and AI Agents: A Powerful Pair for Empirical Work","uri":"/en/posts/stata_auto/#connecting-claude-code-to-statamcp"},{"categories":["Software Tools"],"collections":["Stata Empirical Tools"],"content":"Connecting Codex to StataMCP\rThis setup requires a licensed copy of Stata. If you\u0026rsquo;re using a cracked version, it needs to be one built around a license. Next, in the AI tool\u0026rsquo;s local settings, let the AI know that the permission chain for calling Stata is already in place. Right now I\u0026rsquo;m using the vscode+codex combination, and the local config file is C:\\Users\\Administrator\\.codex\\config.toml. At this step, you can simply let the AI edit the file for you. Add the following settings. [mcp_servers.stata-mcp] command = \"mcp-proxy\" args = [\"http://localhost:4000/mcp\"]\rAt that point, the AI finally has the ability to run code on its own. Prompt: revise and improve the code, using sysuse auto to carry out an empirical analysis. Add outline hierarchy to the code. Use ** # as the heading format. The number of # marks the heading level, up to six levels. Runtime interface\r","date":"2026-02-20","heading":"Connecting Codex to StataMCP","objectID":"/en/posts/stata_auto/:2:4","tags":["Stata","Artificial Intelligence","Obsidian"],"title":"Stata and AI Agents: A Powerful Pair for Empirical Work","uri":"/en/posts/stata_auto/#connecting-codex-to-statamcp"},{"categories":["Software Tools"],"collections":["Stata Empirical Tools"],"content":"Other StataMCP plugins\rProfessor Thomas Monk at LSE also released his own StataMCP-style plugin, Stata Workbench. Personally, though, I don\u0026rsquo;t think it\u0026rsquo;s as handy as the StataMCP extension. As for choosing a local CLI editor, if you\u0026rsquo;re not limited to VSCode, I personally recommend Claude Code. It is easier to switch models there, and it seems better suited to cross-platform use. If you only work inside VSCode, I would recommend Codex. At the moment, its engineering-side optimization really does feel better than Claude Code. As shown here, I downloaded four firm-level variables from CSMAR, then asked Codex to merge them and run some exploratory regression analysis.\r","date":"2026-02-20","heading":"Other StataMCP plugins","objectID":"/en/posts/stata_auto/:2:5","tags":["Stata","Artificial Intelligence","Obsidian"],"title":"Stata and AI Agents: A Powerful Pair for Empirical Work","uri":"/en/posts/stata_auto/#other-statamcp-plugins"},{"categories":["Software Tools"],"collections":["Stata Empirical Tools"],"content":"Paper tests\rSo far, I\u0026rsquo;ve used this workflow to test three papers: First paper: I let AI clean CSMAR firm data on its own and run the analysis, Organization Size, Human Capital Structure, and the Risk of Violations by Listed Firms: Panel Evidence from Chinese Listed Companies Second paper: a test of AI\u0026rsquo;s mathematical modeling, Gift-Giving in Household Visits, Relational Capital, and Intertemporal Wealth Allocation: An Economic Explanation of Gift Flows in China Third paper: a test of AI\u0026rsquo;s visualization ability, Firm Entry, Exit, and Urban Business Vitality: A Descriptive Study Based on a Nationwide City-Year Panel, 2000-2023 ","date":"2026-02-20","heading":"Paper tests","objectID":"/en/posts/stata_auto/:3:0","tags":["Stata","Artificial Intelligence","Obsidian"],"title":"Stata and AI Agents: A Powerful Pair for Empirical Work","uri":"/en/posts/stata_auto/#paper-tests"},{"categories":["Software Tools"],"collections":["Stata Empirical Tools"],"content":"Bringing AI into Obsidian\rLikewise, once you finish the first step - configuring Claude to call the DeepSeek API - you can do the same thing in other editors, such as obsidian. BRAT is the tool Obsidian uses to install beta plugins. Install BRAT: In Obsidian settings, go to Community plugins -\u0026gt; Browse. Search for and install BRAT (Beta Reviewers Auto-update Tester). After installing it, click Enable. Add the Claudian repository: Open BRAT plugin settings. Click Add Beta plugin. In the pop-up window, enter the GitHub address: YishenTu/claudian. Click Add Plugin. I personally like using it to translate the Chinese posts on this blog and produce matching English versions. ","date":"2026-02-20","heading":"Bringing AI into Obsidian","objectID":"/en/posts/stata_auto/:4:0","tags":["Stata","Artificial Intelligence","Obsidian"],"title":"Stata and AI Agents: A Powerful Pair for Empirical Work","uri":"/en/posts/stata_auto/#bringing-ai-into-obsidian"},{"categories":["Software Tools"],"collections":["Stata Empirical Tools"],"content":"Which API do I recommend?\r","date":"2026-02-20","heading":"Which API do I recommend?","objectID":"/en/posts/stata_auto/:5:0","tags":["Stata","Artificial Intelligence","Obsidian"],"title":"Stata and AI Agents: A Powerful Pair for Empirical Work","uri":"/en/posts/stata_auto/#which-api-do-i-recommend"},{"categories":["Software Tools"],"collections":["Stata Empirical Tools"],"content":"API platforms\rPersonally, among domestic API options, I think DeepSeek gives the best value for money. These major platforms all give you some free credit when you sign up: Alibaba Bailian SiliconFlow: recommended. It includes free models, plus a 65 RMB newcomer voucher and a collaboration program. Zhipu5 Volcano Engine (ByteDance) The resource pack GLM gives you at sign-up. I burned through most of it in two days.\r","date":"2026-02-20","heading":"API platforms","objectID":"/en/posts/stata_auto/:5:1","tags":["Stata","Artificial Intelligence","Obsidian"],"title":"Stata and AI Agents: A Powerful Pair for Empirical Work","uri":"/en/posts/stata_auto/#api-platforms"},{"categories":["Software Tools"],"collections":["Stata Empirical Tools"],"content":"Reading the LLM market through API spending data\rRecently, some papers have already started using API-platform data for analysis. A typical example is OpenRouter, which is also accessible from China. OpenRouter also offers some free large models, though in practice the free tier mostly works as a way of pulling users toward topping up their balance. Limits of OpenRouter\u0026rsquo;s free models\rFor the limits, see: limits Users who have not topped up, or whose balance is under $10: 50 requests per day. (It used to be 200.) Users whose account balance is above $10: the daily request limit has been raised from 200 to 1000 20 requests per minute: regardless of user type, free models still have a hard cap of 20 requests per minute. Some free models\rOpenRouter\u0026rsquo;s overall user-data visualization is genuinely well done. You can use it to get a quick sense of which models people are using and what kinds of tasks they mainly run.\rNBER recently published a paper that scraped data from the OpenRouter website for market analysis: A New Market for Intelligence: Pricing, Supply, and Demand for LLMs The figures that stuck with me most were these: The chart shows the distribution of model performance released over the past six months, based on the IntelligenceIndex. The red line is the median model intelligence. The dark and light gray shaded areas show the 25-75 percentile range and the 10-90 percentile range. The widening spread reflects continued progress at the frontier: today\u0026rsquo;s best models perform at roughly six times the level of the earliest models in the sample.\rThe vertical axis is the log price per million tokens. After dropping sharply from mid-2023 to early 2024, prices stayed relatively stable even as newer and stronger models entered the market. At any given moment, models in the lowest decile are 50 to 150 times cheaper than those in the highest decile.\rBefore the NBER paper, the OpenRouter team had already done its own data analysis here: An Empirical 100 Trillion Token Study with OpenRouter Each point represents a model offered on OpenRouter, colored by source type. Closed-source models tend to cluster in the high-cost, high-usage quadrant, while open-source models dominate the low-cost, high-traffic region. The dashed trend line is almost flat, which suggests that cost and total usage are only weakly correlated.\r","date":"2026-02-20","heading":"Reading the LLM market through API spending data","objectID":"/en/posts/stata_auto/:5:2","tags":["Stata","Artificial Intelligence","Obsidian"],"title":"Stata and AI Agents: A Powerful Pair for Empirical Work","uri":"/en/posts/stata_auto/#reading-the-llm-market-through-api-spending-data"},{"categories":["Software Tools"],"collections":["Stata Empirical Tools"],"content":"Installing skills\r","date":"2026-02-20","heading":"Installing skills","objectID":"/en/posts/stata_auto/:6:0","tags":["Stata","Artificial Intelligence","Obsidian"],"title":"Stata and AI Agents: A Powerful Pair for Empirical Work","uri":"/en/posts/stata_auto/#installing-skills"},{"categories":["Software Tools"],"collections":["Stata Empirical Tools"],"content":"Installation and explanation\rSkills are basically instruction manuals for AI. They tell it how to handle specific situations. If you add scripts or workflows to them, you can constrain how the model behaves in a given context. If you want a better sense of what skills are, I especially recommend reading this blog post: Context Is a Scarce Resource: Notes on the Design Philosophy of RAG, Memory, and Skills At this point, if you enter the following commands in order, you can download the official skills package prepared by Claude. Install the skills marketplace: /plugin marketplace add anthropics/skills\rInstall some of the official skills packages: https://github.com/anthropics/skills\rAs shown here\rFor example, I once directly handed Claude the GitHub page for an economics skills collection and let it download things on its own: https://github.com/meleantonio/awesome-econ-ai-stuff\rEconomics skills\rFor example, after I downloaded Obsidian skills, I asked it to draw a mind map for one blog post: As shown here\rWhat often works together with a skill is a hook. If a skill is the AI\u0026rsquo;s manual, then a hook is the guide that forces a script to run in a specific scenario. For example, the moment you read a paper, it could trigger a preset word-cloud analysis script. Skills and hooks can be paired to create a process of instruction judgment, workflow selection, and script execution. ","date":"2026-02-20","heading":"Installation and explanation","objectID":"/en/posts/stata_auto/:6:1","tags":["Stata","Artificial Intelligence","Obsidian"],"title":"Stata and AI Agents: A Powerful Pair for Empirical Work","uri":"/en/posts/stata_auto/#installation-and-explanation"},{"categories":["Software Tools"],"collections":["Stata Empirical Tools"],"content":"Skill resources\rYou can find skills in the following places: Skills. Sh (my personal recommendation; I also recommend using the command style there as a unified way to install skills) skillsmp.com awesome-agent-skills First, let me recommend a command for finding skills. Once it\u0026rsquo;s installed, calling skills becomes noticeably smoother and more accurate. npx skills add https://github.com/vercel-labs/skills --skill find-skills\rAfter installing this skill, recognition really did become smoother.\r","date":"2026-02-20","heading":"Skill resources","objectID":"/en/posts/stata_auto/:6:2","tags":["Stata","Artificial Intelligence","Obsidian"],"title":"Stata and AI Agents: A Powerful Pair for Empirical Work","uri":"/en/posts/stata_auto/#skill-resources"},{"categories":["Software Tools"],"collections":["Stata Empirical Tools"],"content":"Deeper automation jargon?\rIf you want to dig further into today\u0026rsquo;s AI-driven automation workflows, it may be worth searching around vibe coding and the related vocabulary. Plenty of economists are now introducing their own Stata + agent programming setups. For example: Claude Code for Economists. (The author\u0026rsquo;s post on X includes more detailed links.) I made my paper-replication Claude Agent public on the sixth day of the Lunar New Year - feel free to use it As counterparts to Claude Code, OpenAI has Codex, and Google has Gemini CLI6. The competition is still in its early phase, and the sign-up perks are generous across the board. I suspect that now, in almost every econometrics class - maybe even every economics class - the opening question has become: how do we respond to the shock of AI? Still, I don\u0026rsquo;t think panic helps. Before an industrial revolution, there has to be an energy revolution. Right now AI burns through money and physical resources so inefficiently that general-purpose deployment is bound to remain a huge problem. But what feels unsettling is not AI\u0026rsquo;s absolute level; it is the speed of iteration. At the very least, that should keep us clear-eyed about the era we live in. Seen from another angle, racing cars exceeded human limits long ago, and yet a 100-meter sprint can still make us feel excitement, fear, and exhilaration. If things really turn out the way Liu Cixin imagined in Poem Cloud7, where some civilization can arrange every possible combination of words, then what matters even more is our human response to poetry itself. The live-action film One Hundred Meters: being fast does not solve everything, but if you can outrun everyone else within 100 meters, then you can solve anything.\rThe boundary lines among deep learning, machine learning, and large models are subtle too. In the end, what intelligence even is - that is already a deep question.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Honestly, I think this kind of LLM analysis mostly runs on brute force.\u0026#160;\u0026#x21a9;\u0026#xfe0e; OpenAI\u0026rsquo;s counterpart is Codex.\u0026#160;\u0026#x21a9;\u0026#xfe0e; I will always recommend the MP version. It can make flexible use of your computer\u0026rsquo;s CPU cores and improve computation speed.\u0026#160;\u0026#x21a9;\u0026#xfe0e; It burns tokens fast too. I used up the first free resource pack in a single afternoon.\u0026#160;\u0026#x21a9;\u0026#xfe0e; You could even consider giving Codex access to Claude Code through MCP and letting the two of them gang up on your code.\u0026#160;\u0026#x21a9;\u0026#xfe0e; For a version of this feeling, see Song Without a Heart: a small booklet on writing classical Chinese poetry in the age of AI.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2026-02-20","heading":"Deeper automation jargon?","objectID":"/en/posts/stata_auto/:7:0","tags":["Stata","Artificial Intelligence","Obsidian"],"title":"Stata and AI Agents: A Powerful Pair for Empirical Work","uri":"/en/posts/stata_auto/#deeper-automation-jargon"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":" Notes on spatial analysis and technical methods (simple hands-on practice). ","date":"2025-11-03","heading":"","objectID":"/en/posts/gis_econ/:0:0","tags":["GIS"],"title":"ArcGIS Pro: A Quick Operations Guide","uri":"/en/posts/gis_econ/#"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"Spatial econometrics\r","date":"2025-11-03","heading":"Spatial econometrics","objectID":"/en/posts/gis_econ/:1:0","tags":["GIS"],"title":"ArcGIS Pro: A Quick Operations Guide","uri":"/en/posts/gis_econ/#spatial-econometrics"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"Spatial relationships\rWhat is regional economics? Its core is using spatial data to characterize spatial relationships. Spatial data needs data and location. Location isn\u0026rsquo;t just latitude and longitude, but also distance. Distance isn\u0026rsquo;t just spatial distance; cultural similarity can also be seen as a kind of distance, as can the degree of a relationship (provincial GDP ranking, closeness between peers). There are also many ways to define locational relationships — point adjacency, edge adjacency, etc. ","date":"2025-11-03","heading":"Spatial relationships","objectID":"/en/posts/gis_econ/:1:1","tags":["GIS"],"title":"ArcGIS Pro: A Quick Operations Guide","uri":"/en/posts/gis_econ/#spatial-relationships"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"Why we need spatial econometrics\rRecommended reading: Introduction to Spatial Econometrics (James LeSage / R. Kelley Pace) Spatial dependence: the values at different observation points influence each other. Competition, cooperation, imitation, diffusion (spatial spillovers), rivalry\u0026hellip;\u0026hellip; This endogeneity could be that x in location a affects y in location b; or that y in a directly affects y in b. Spatial autocorrelation: a measure of spatial dependence. Spatial heterogeneity: spatial dependence is not evenly distributed. With domestic data, for example, the Northeast might have negative correlation across many internal locations, while the Southwest has positive correlation internally. Measurement is also divided into global autocorrelation and local autocorrelation. Therefore, different spatial autocorrelations need to be estimated with different models. ","date":"2025-11-03","heading":"Why we need spatial econometrics","objectID":"/en/posts/gis_econ/:1:2","tags":["GIS"],"title":"ArcGIS Pro: A Quick Operations Guide","uri":"/en/posts/gis_econ/#why-we-need-spatial-econometrics"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"Software versions\rR, Stata, and MATLAB each have suitable spatial econometrics packages. GeoDa is a free, open-source spatial econometrics software. The focus is GIS software: if you choose the ArcGIS line, it\u0026rsquo;s divided into the old series and the Pro series. ArcGIS Pro is an upgrade of ArcGIS, but it\u0026rsquo;s still iterating and unstable; in theory Pro can be compatible with all old versions. Because the country needs version stability, the surveying industry generally requires arcgis 10.2 or arcgis 10.8. Most online tutorials also target the old ArcGIS versions. I\u0026rsquo;m an economics major, not a professional surveyor, so following \u0026ldquo;learn the new, not the old,\u0026rdquo; I chose ArcGIS Pro. The official help documentation can be found at the official website. I\u0026rsquo;ve used the old version before too; the steps I recorded were converting tif to Excel. I feel the Pro version\u0026rsquo;s interface is cleaner and nicer-looking. ","date":"2025-11-03","heading":"Software versions","objectID":"/en/posts/gis_econ/:2:0","tags":["GIS"],"title":"ArcGIS Pro: A Quick Operations Guide","uri":"/en/posts/gis_econ/#software-versions"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"Operations\r","date":"2025-11-03","heading":"Operations","objectID":"/en/posts/gis_econ/:3:0","tags":["GIS"],"title":"ArcGIS Pro: A Quick Operations Guide","uri":"/en/posts/gis_econ/#operations"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"Basic setup\rLearning Stata requires cultivating good habits for managing code files, e.g. starting from do-files, and GIS likewise starts from creating a directory. The new directory is your own project. As shown\rHere I created a new map (Insert - New Map), currently the default online global map. Click anywhere on the map to formally start the project. If you\u0026rsquo;re not happy with the page layout, drag the panels around to reposition them. You can see along the right edge: Catalog: the Add Folder in the Insert interface lets you add other folders to the catalog. Later, create processing layers in the catalog folder. If you have map data (.geodatabase files), you can also load the map file into the catalog\u0026rsquo;s database via the Connect option in the Insert interface. Geoprocessing: the main analysis tools. Attributes: data attributes, since the data may be boundary outlines or point/polygon data. History: operation history. On the left is the map\u0026rsquo;s content, mainly layer display management; on the right are the catalog and toolbar\rAs shown\rThe whole file-catalog environment is essentially computer folders. Creating a .gdb is really creating a folder for a GIS project. Under the .gdb you can create a feature dataset. And under the feature dataset is where the GIS data are stored. For example, in the figure it\u0026rsquo;s ex22 - network analysis - network - with a bunch of dataset files under it. Every time you create a new environment you create a .gdb, then create a database under it, and then import the data you want to use. ","date":"2025-11-03","heading":"Basic setup","objectID":"/en/posts/gis_econ/:3:1","tags":["GIS"],"title":"ArcGIS Pro: A Quick Operations Guide","uri":"/en/posts/gis_econ/#basic-setup"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"Buffer analysis\rA buffer is a range delimited around a boundary or a point. \u0026ldquo;Immediate Results upon Erecting the Pole\u0026rdquo;: Strategic Environmental Regulation and the Structural Improvement of Environmental Quality (2024, China Economic Quarterly (Chinese)) makes use of the buffer strategy. The study finds that after monitoring stations were set up, the PM2.5 concentration within 4 km of a station fell by 0.74 percentage points more than in the 4-8 km zone, indicating a structural improvement in environmental quality around the stations (local authorities deliberately sprayed water near the monitoring stations to beautify their assessment metrics). Its buffer analysis used GIS software to identify the 4 km zone around each monitoring station. Right-click the folder we added under the Catalog page in the right sidebar. Right-click and create a Mobile Geodatabase. Right-click the new Mobile Geodatabase. Create a Feature Class: choose the point data type, and follow the prompts for the rest. You can see the newly created point data already in the content pane on the left. At this point, continue by clicking Edit - Create, then click anywhere on the page to create point locations. Similarly, follow the earlier steps to create a polygon feature class, and the corresponding editing creates different polygon data. Editing self-created point data; you can likewise self-create polygon data\rAt this point, click the Geoprocessing toolbar (the toolbox-shaped icon), then follow the prompts to choose. For example, here I ran a buffer analysis on the point data, requiring it to delineate a 100000-meter zone around each point; the result is shown below. Buffers can of course also target line data. Buffer analysis result\r","date":"2025-11-03","heading":"Buffer analysis","objectID":"/en/posts/gis_econ/:3:2","tags":["GIS"],"title":"ArcGIS Pro: A Quick Operations Guide","uri":"/en/posts/gis_econ/#buffer-analysis"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"Proximity analysis\rGoing further, the tool used here is Generate Near Table. For example, here the input features and near features are both the same point dataset, meaning which point is closest to each point? After outputting the table data, right-click to open it. If you want a visual comparison, right-click Contents - point file - Labels to add labels. The situation is like this: for example, the first point is closest to the second point. Proximity analysis can analyze the adjacency relationships among points, lines, and polygons. Analyzing the closest point data\rThe near table only joins FID by default; if you want to add name labels, right-click the output near-result table and choose Add Join. As shown\r","date":"2025-11-03","heading":"Proximity analysis","objectID":"/en/posts/gis_econ/:3:3","tags":["GIS"],"title":"ArcGIS Pro: A Quick Operations Guide","uri":"/en/posts/gis_econ/#proximity-analysis"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"Raster data\rGIS has vector, raster, and image data. In fact, remote-sensing images are also raster data, divided and colored through a grid — like the pixel concept of a phone photo. Different vector-to-raster interpolation methods yield different results. For example, characterizing urban form in regional economics is actually quite difficult — what if there\u0026rsquo;s a big mountain or river in the middle of the city? How do you interpolate then? As shown, this is point-set vector data of population density\rYou can convert via the Feature to Raster command — typically coloring uniformly into the corresponding grid cells. Directly converting point data to raster\rUse interpolation for filling; here I use the Inverse Distance Weighting method in Interpolation. Interpolating the point data with Inverse Distance Weighting\rUse Density for calculation; here I use Kernel Density estimation. Kernel density\rIn addition, via Surface - Contour you can insert contour lines. Contour lines and kernel density\rIf you want to change the classification levels, right-click the layer and click Symbology to modify it. Symbology can modify the classification levels\rFor example, in urban planning, we have vector density maps of urban land-use planning, population density, school distribution, and road traffic. Next, thinking about where to build a new school, we can use Map Algebra - Raster Calculator to overlay and compute the value of each raster. As shown\rFor example, where population flow is high, add five points; where there\u0026rsquo;s a mountain, subtract five; where there\u0026rsquo;s school coverage, subtract five — ultimately getting a raster score for building a new school. I randomly picked some rasters and did map geometry computations; the gray-black parts are the final computed results of several rasters.\r","date":"2025-11-03","heading":"Raster data","objectID":"/en/posts/gis_econ/:3:4","tags":["GIS"],"title":"ArcGIS Pro: A Quick Operations Guide","uri":"/en/posts/gis_econ/#raster-data"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"Network analysis\r","date":"2025-11-03","heading":"Network analysis","objectID":"/en/posts/gis_econ/:3:5","tags":["GIS"],"title":"ArcGIS Pro: A Quick Operations Guide","uri":"/en/posts/gis_econ/#network-analysis"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"The Question of Institutions vs. Geography\rIn the long course of economic development, the nation-state appears to be an inevitable formation, but why must it be a nation? Why are there such vast disparities between nations? This is a critical question. Fascinating elements abound in national development—such as the Mafia123, natural resource endowments, foreign trade, natural disasters4, and power rivalries5\u0026hellip; Yet for the most part these can be distilled into innate geographical endowments and acquired cultural-institutional evolution. Much like how we no longer debate whether liberalism or Keynesianism is superior, but instead clarify their respective policy boundaries. Resource endowments and cultural-institutional factors invariably influence each other; the critical question lies in which factor influenced the other first. For instance, the seminal paper on rice in the south and wheat in the north6: Rice cultivation requires collective collaboration; wheat farming favors individual labor. The difference in planting structures created cultural divides between north and south. Geographic discontinuities, to some extent, can mitigate the endogeneity of the mutual influence between geography, culture, and institutions—just as Daron illustrated in \u0026ldquo;Why Nations Fail\u0026rdquo; through examples of the United States and Mexico7; South Korea and North Korea; and East and West Germany. Now the crucial question is: Through what characteristics do cultural institutions bring about such tremendous disparities in development? \u0026ldquo;Political hierarchy and regional economic development: Evidence from a spatial discontinuity in China\u0026rdquo; utilizes the geographic discontinuity created when Chongqing was elevated from a prefecture-level city in Sichuan Province to a municipality directly under the central government in 1997 to investigate the phenomenon that empowering local governments through increased political hierarchy can promote regional development. ","date":"2025-10-26","heading":"The Question of Institutions vs. Geography","objectID":"/en/posts/rsc_econ/:1:0","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#the-question-of-institutions-vs-geography"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Political Structure and Economic Growth\rIn the introduction of the paper, the research question is introduced from the perspective of informational advantages in governance: In terms of economic phenomena, national political governance is invariably hierarchical8, with different levels wielding different decision-making powers. In 1997, Chongqing was elevated from a prefecture-level city in Sichuan Province to a municipality directly under the central government. The expansion of decision-making power brought by this change manifests as: Increased administrative, personnel, and fiscal decision-making powers. More surplus in fiscal allocation. Can promoting administrative rank drive development?\rThe core mechanism by which administrative power stimulates economic growth is informational advantage + power coordination. However, there is a contradiction between decentralization and local fragmentation. The problem with decentralizing to all cities is local fragmentation and the consequences of corruption, so the dilemma of overall governance is always how to balance decentralization to allow localities to fully leverage informational advantages with centralization to weaken local protectionism, rent-seeking, and corruption—government power structure and economic growth. Diagram\rIn terms of power allocation, the paper\u0026rsquo;s theory and the points to explore can be divided into the following parts: Core Question: Does the allocation of power structure affect economic growth? For example, converting counties to districts When local government in South Africa is very decentralized, existing studies show weak effects9. The Tradeoff Dilemma: The decentralization and diffusion of political power bring benefits of flexible decision-making, but also bring local protectionism, corruption, and rent-seeking. Impact: Do these behaviors represent spontaneous order? Public choice theory reveals that politicians are motivated by the desire to expand their power networks rather than maximizing social welfare. Marginal Contribution: Methodologically using geographic discontinuities to discuss government power diffusion and decentralization. Sichuan and Chongqing share very similar geographic, cultural environments, and ethnic composition. Compared to South Africa, China\u0026rsquo;s power decentralization involves substantive enhancement; the appointment system from higher levels can better prevent corruption. ","date":"2025-10-26","heading":"Political Structure and Economic Growth","objectID":"/en/posts/rsc_econ/:2:0","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#political-structure-and-economic-growth"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Background\rLet\u0026rsquo;s learn how comparative expressions are framed (adapt for foreign editors + strengthen the central theme, the particularity of decentralization under political systems): Political systems differ from federalism: Lower-level governments are completely subordinate to higher-level governments\u0026hellip; unitary states rather than federal states\u0026hellip; higher-level governments can easily intervene in the policy decisions of lower-level governments because the former determines the latter\u0026rsquo;s career prospects\u0026hellip; Power of municipalities directly under the central government: Municipalities directly under the central government possess powers comparable to provinces in administrative, personnel, and fiscal affairs, while prefecture-level cities must comply with provincial government policies. Comparability: Chongqing was once part of Sichuan Province. Since the Yuan Dynasty\u0026hellip; Event Background: According to official Chinese propaganda, the central government decided to elevate Chongqing for two reasons: to become an engine for western development and because the Sichuan provincial government was unable to provide excessive public goods. ","date":"2025-10-26","heading":"Background","objectID":"/en/posts/rsc_econ/:3:0","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#background"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Theoretical Analysis\rDifferent decentralization environments yield different results; it could be political patronage or political efficiency. Cost-Benefit Analysis Hierarchical management and power diffusion confer informational advantages in governance, while uniform laws and regulations can reduce governance costs; The proliferation of peer institutions (which also entails a decline in economies of scale) simultaneously incurs administrative costs and central coordination costs. Political Agency Problems Local voters likewise possess informational advantages and can monitor localities more effectively; Promotes mutual competition among localities; In regions receiving less oversight, local elites may more easily collude to foster corruption. Countermeasures: Sufficient electoral competition, transparency of budgetary procedures, voter awareness, media supervision, and reward-punishment mechanisms. Following status elevation, Chongqing gained: expanded personnel, fiscal decision-making, and construction planning powers better tailored to local conditions; greater fiscal resources (rendering investment more attractive). However, this came with increased coordination, administrative, and public service costs. ","date":"2025-10-26","heading":"Theoretical Analysis","objectID":"/en/posts/rsc_econ/:4:0","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#theoretical-analysis"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Data Sources\rDatabase\rMeasured Variable\rContent Used\rTime\rSatellite nighttime lighting\rEconomic growth\rLight intensity\r1992-2013\rGIS topography\rSlope, area\rTopography\rStatistical yearbooks\rEconomic data\rCounty-township level per capita industrial output, urbanization rate, and non-agricultural employment rate\rGoogle Maps\rPublic goods\rDistribution of roads, schools, and hospitals at town level\rEnterprise census\rIncludes enterprise-level basic financial statements, identifying enterprise towns through address\r2008\rWorld Bank Enterprise Survey\rBusiness environment\rNumber of licenses and registrations\r2005\rPopulation census\rPopulation\rEthnic composition, population migration\r2000、2005\rMinistry of Finance of China\rFinance\rCounty-level socioeconomic variables, including population, urbanization rate, industrial output, county-level GDP\rAudit yearbook\rCorruption\rCounties with misuse of public funds\r2003-2009\r","date":"2025-10-26","heading":"Data Sources","objectID":"/en/posts/rsc_econ/:5:0","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#data-sources"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Estimation Strategy\r$$Y_i=\\beta_0\u0026#43;\\beta_1Chongqing_i\u0026#43;f(geographiclocation_i)\u0026#43;\\epsilon_i$$ $$Y_{i}\\equiv ln(0.01\u0026#43;LightIntensity_{i,2013})-ln(0.01\u0026#43;LightIntensity_{i,1996})$$ $Y_i$: Economic growth rate estimated from nighttime light data. $i$: Township. $Chongqing$: Located in Chongqing is 1, located in Sichuan is 0. ","date":"2025-10-26","heading":"Estimation Strategy","objectID":"/en/posts/rsc_econ/:6:0","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#estimation-strategy"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Parallel Trends\rDiagram, showing no statistically significant differences in terrain elevation, ethnic composition, GDP, industrial output, tax revenue, and urbanization rates between the two regions\rLight data on both sides of the boundary\r","date":"2025-10-26","heading":"Parallel Trends","objectID":"/en/posts/rsc_econ/:6:1","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#parallel-trends"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Empirical Results\r","date":"2025-10-26","heading":"Empirical Results","objectID":"/en/posts/rsc_econ/:7:0","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#empirical-results"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Basic Regression\rExperimental and control groups first restricted to within 30km of the boundary\rDiagram\rDiagram\r","date":"2025-10-26","heading":"Basic Regression","objectID":"/en/posts/rsc_econ/:7:1","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#basic-regression"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Placebo Tests\rMethod 1: Shift the boundary 30km west and east respectively. Diagram\rMethod 2: Create random boundaries. ","date":"2025-10-26","heading":"Placebo Tests","objectID":"/en/posts/rsc_econ/:7:2","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#placebo-tests"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Excluding Spillover Effects\rChongqing Effect\rIf boundary points in Sichuan are subject to spillover effects from the Chongqing region, then the validity of the test would be compromised. Exclude boundary points\rFurther exclude towns within 10km of the boundary line (considering transportation costs). At the same time, compare population mobility rates between the two regions using census data (0.27% vs. 0.13%). Exclude boundary points\rExcluding Sichuan Effect\rSichuan\u0026rsquo;s reduced size might also improve the efficiency of public goods provision by the Sichuan provincial government. Therefore, use boundary region data from other provinces adjacent to Sichuan (Gansu, Guizhou, Qinghai, Shaanxi, and Yunnan) for testing. Diagram\rExcluding Political Spillover Effects\rThere are three sections in the Sichuan-Chongqing border area, where the northern and southern parts may differ in political influence. The closer to the north, the more significant the political influence may be. Adjacent areas\rDiagram\r","date":"2025-10-26","heading":"Excluding Spillover Effects","objectID":"/en/posts/rsc_econ/:7:3","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#excluding-spillover-effects"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Excluding Spillover Effects\rChongqing Effect\rIf boundary points in Sichuan are subject to spillover effects from the Chongqing region, then the validity of the test would be compromised. Exclude boundary points\rFurther exclude towns within 10km of the boundary line (considering transportation costs). At the same time, compare population mobility rates between the two regions using census data (0.27% vs. 0.13%). Exclude boundary points\rExcluding Sichuan Effect\rSichuan\u0026rsquo;s reduced size might also improve the efficiency of public goods provision by the Sichuan provincial government. Therefore, use boundary region data from other provinces adjacent to Sichuan (Gansu, Guizhou, Qinghai, Shaanxi, and Yunnan) for testing. Diagram\rExcluding Political Spillover Effects\rThere are three sections in the Sichuan-Chongqing border area, where the northern and southern parts may differ in political influence. The closer to the north, the more significant the political influence may be. Adjacent areas\rDiagram\r","date":"2025-10-26","heading":"Chongqing Effect","objectID":"/en/posts/rsc_econ/:7:3","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#chongqing-effect"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Excluding Spillover Effects\rChongqing Effect\rIf boundary points in Sichuan are subject to spillover effects from the Chongqing region, then the validity of the test would be compromised. Exclude boundary points\rFurther exclude towns within 10km of the boundary line (considering transportation costs). At the same time, compare population mobility rates between the two regions using census data (0.27% vs. 0.13%). Exclude boundary points\rExcluding Sichuan Effect\rSichuan\u0026rsquo;s reduced size might also improve the efficiency of public goods provision by the Sichuan provincial government. Therefore, use boundary region data from other provinces adjacent to Sichuan (Gansu, Guizhou, Qinghai, Shaanxi, and Yunnan) for testing. Diagram\rExcluding Political Spillover Effects\rThere are three sections in the Sichuan-Chongqing border area, where the northern and southern parts may differ in political influence. The closer to the north, the more significant the political influence may be. Adjacent areas\rDiagram\r","date":"2025-10-26","heading":"Excluding Sichuan Effect","objectID":"/en/posts/rsc_econ/:7:3","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#excluding-sichuan-effect"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Excluding Spillover Effects\rChongqing Effect\rIf boundary points in Sichuan are subject to spillover effects from the Chongqing region, then the validity of the test would be compromised. Exclude boundary points\rFurther exclude towns within 10km of the boundary line (considering transportation costs). At the same time, compare population mobility rates between the two regions using census data (0.27% vs. 0.13%). Exclude boundary points\rExcluding Sichuan Effect\rSichuan\u0026rsquo;s reduced size might also improve the efficiency of public goods provision by the Sichuan provincial government. Therefore, use boundary region data from other provinces adjacent to Sichuan (Gansu, Guizhou, Qinghai, Shaanxi, and Yunnan) for testing. Diagram\rExcluding Political Spillover Effects\rThere are three sections in the Sichuan-Chongqing border area, where the northern and southern parts may differ in political influence. The closer to the north, the more significant the political influence may be. Adjacent areas\rDiagram\r","date":"2025-10-26","heading":"Excluding Political Spillover Effects","objectID":"/en/posts/rsc_econ/:7:3","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#excluding-political-spillover-effects"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Alternative Economic Dependent Variables\rUse yearbook data to replace lighting data. Per capita industrial output, urbanization rate, and non-agricultural employment show similar effects. Diagram\r","date":"2025-10-26","heading":"Alternative Economic Dependent Variables","objectID":"/en/posts/rsc_econ/:7:4","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#alternative-economic-dependent-variables"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Mechanism Tests\r","date":"2025-10-26","heading":"Mechanism Tests","objectID":"/en/posts/rsc_econ/:8:0","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#mechanism-tests"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Official Accountability\rElevation of administrative rank may have improved officials\u0026rsquo; sense of accountability. Corrupt local officials tend to extract revenue by increasing administrative expenditures to expand the government workforce and augment bureaucratic consumption. Motivated officials will invest more in construction and infrastructure investment. The paper employs county-level fiscal expenditure panel data for analysis. Left: administrative expenditure; right: infrastructure investment\rResults indicate that following the elevation of administrative rank, the Chongqing region reduced the proportion of administrative expenditures while expanding the proportion of infrastructure investment. This outcome may be attributable to more robust accountability mechanisms. The audit yearbook indicates that counties audited and held accountable in the Chongqing region were significantly fewer than in the Sichuan region. Counties held accountable in audit yearbook as y\r","date":"2025-10-26","heading":"Official Accountability","objectID":"/en/posts/rsc_econ/:8:1","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#official-accountability"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Provision of Public Goods\rRoad, school, and hospital construction investments. Statistics using Google Maps\r","date":"2025-10-26","heading":"Provision of Public Goods","objectID":"/en/posts/rsc_econ/:8:2","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#provision-of-public-goods"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Business Environment\rUse enterprise registration and licensing data for analysis. Chongqing has more enterprise entries, and the growth rate of private enterprises is higher than that of state-owned enterprises. Diagram\r","date":"2025-10-26","heading":"Business Environment","objectID":"/en/posts/rsc_econ/:8:3","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#business-environment"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Exploring Other Possibilities\rMight the boundary disparities between Chongqing and Sichuan be attributable to other factors? ","date":"2025-10-26","heading":"Exploring Other Possibilities","objectID":"/en/posts/rsc_econ/:9:0","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#exploring-other-possibilities"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Three Gorges Project\rEliminate 9 town areas within the 30km range that were later submerged by the Three Gorges Project. Compare Yichang City in Hubei Province with surrounding cities, results are not significant. Comparison with Yichang City, Hubei Province\r","date":"2025-10-26","heading":"Three Gorges Project","objectID":"/en/posts/rsc_econ/:9:1","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#three-gorges-project"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Center-Periphery Theory\rUrban boundaries are affected by the development of urban centers. Although both are boundary regions, the Chongqing boundary is closer to the center. Adding distance from Chongqing center as a control variable, results are not significant. At the same time, further compared Yichang and Chengdu (separated by rivers), differences are not significant. Diagram\r","date":"2025-10-26","heading":"Center-Periphery Theory","objectID":"/en/posts/rsc_econ/:9:2","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#center-periphery-theory"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Transfer Payments\rDiagram\rTransfer payment data indicates that the gap in transfer payments began to widen in 2008; consequently, it cannot explain growth differences predating 2008. ","date":"2025-10-26","heading":"Transfer Payments","objectID":"/en/posts/rsc_econ/:9:3","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#transfer-payments"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Institutions, Choice, and Development"],"content":"Conclusion\rEmpowering local government officials fostered regional development. For centralized countries, well-functioning local reward-punishment systems may mitigate the adverse effects of local decentralization in fostering local corruption and regulatory capture. Outlook: The paper provides only a single case study; the administrative costs and coordination costs attendant upon widespread elevation remain unknown. Furthermore, local officials would experience a loss of power and would thus oppose large-scale elevation of administrative rank. Dipoppa, G. (2025). How criminal organizations expand to strong states: local agreements and migrant exploitation in Northern Italy. The Journal of Politics, 87(2), 000-000.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Acemoglu D, De Feo G, De Luca G D. Weak states: Causes and consequences of the Sicilian Mafia[J]. The Review of Economic Studies, 2020, 87(2): 537-581.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Sánchez De La Sierra R. On the origins of the state: Stationary bandits and taxation in eastern congo[J]. Journal of Political Economy, 2020, 128(1): 000-000.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Gallagher, J. (2014). Learning about an Infrequent Event: Evidence from Flood Insurance Take-Up in the United States. American Economic Journal: Applied Economics, 6(3), 206–233.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Allen R C, Bertazzini M C, Heldring L. The economic origins of government[J]. American Economic Review, 2023, 113(10): 2507-2545.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Talhelm T, Zhang X, Oishi S, et al. Large-scale psychological differences within China explained by rice versus wheat agriculture[J]. Science, 2014, 344(6184): 603-608.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Of course, personally I think one endogeneity of geographic discontinuity lies in the center-periphery city theory, where boundary development is strongly correlated with center development.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Why must governance be hierarchical? Seemingly obvious realities are often not easy to give obvious answers to. For example, continuing to ask deeper: What kind of political hierarchy is reasonable? This is a very complex question.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Gottlieb, J., Grossman, G., Larreguy, H., Marx, B., 2019. A signaling theory of distributive policy choice: evidence from Senegal. J. Polit. 81 (2), 631–647\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2025-10-26","heading":"Conclusion","objectID":"/en/posts/rsc_econ/:10:0","tags":["Economic Growth"],"title":"After the Split of Sichuan Province: Political Planning and Economic Growth","uri":"/en/posts/rsc_econ/#conclusion"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"For Chinese-speaking users, there is probably nothing more frustrating than wanting to type $$ but ending up with ￥￥ due to not switching input methods in time. Although there are now a series of $\\LaTeX$ online compilation websites like overleaf、texpage 、slager , they still struggle to provide convenience for this issue. Online rendering is becoming increasingly restrictive. If you want to try compiling larger, more complex, or longer documents without paying, local software is always the best choice (as long as there is no need for collaborative editing), which also means greater freedom. For $\\LaTeX$ tutorials, see How to Get Started with LaTeX in 1 Hour? ","date":"2025-10-10","heading":"","objectID":"/en/posts/texstudio/:0:0","tags":["TeXstudio","LaTeX"],"title":"Optimize Your TexStudio Editing Experience","uri":"/en/posts/texstudio/#"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"Macro Commands\rFor Chinese-speaking $\\LaTeX$ users, there is probably nothing more frustrating than wanting to type $$ but ending up with ￥￥ due to not switching input methods in time. What kept me using Obsidian is its extremely convenient writing plugins: Quick commands: commander, editing toolbar Image conversion: image converter Writing enhancement: easy typing \u0026hellip; Especially the writing enhancement plugin easy typing, which supports custom completions, automatic spacing between Chinese and English, seamless Chinese-English character switching—for example, typing ￥￥ twice will automatically become $$. So the question is, how to make TexStudio achieve the same functionality? The answer is custom macros. TexStudio supports custom macro definitions. For detailed syntax, refer to the official documentation Personal macros. Normal mode macros can be understood as text transformation and completion. I write ￥￥￥￥ in the trigger (note: intentionally leaving a space at the end). %| represents the cursor position after completion. Personal macros can also have custom shortcuts. For example, in the image below, I set Ctrl+M as the shortcut for inserting $$. When I type ￥*2 (space), it will also automatically trigger the transformation. Triggers are format detection that automatically activate when regular expressions match\rPersonal macros also support script sequences. If you know how to use them, you can create various tricks (like chained transformations). Therefore, when writing macros, pay attention to the order—place macros with stricter regular expression checks above. For example, ￥￥￥￥ to $$$$ should be placed before ￥￥ to $$. Environment mode feels quite redundant and can be completely replaced by normal mode. Script mode is more flexible and supports the JavaScript language. I wrote one that can transform content in the format -content1-content2-content2 (tab key) into code: \\begin{content1}[content2]\\label{content2} \\end{content1}\rI also further set up a mapping: if content1 is \u0026ldquo;证明\u0026rdquo;, it transforms to \u0026ldquo;proof\u0026rdquo;; if it\u0026rsquo;s \u0026ldquo;概念\u0026rdquo;, it transforms to \u0026ldquo;definition\u0026rdquo;. The code is as follows: // ===== Chinese-English environment mapping ===== var envMap = { \"定理\": \"theorem\", \"引理\": \"lemma\", \"命题\": \"proposition\", \"性质\": \"proposition\", \"练习\": \"exercise\", \"思考题\": \"exercise\", \"思考\": \"exercise\", \"问题\": \"exercise\", \"推论\": \"corollary\", \"定义\": \"definition\", \"概念\": \"definition\", \"例子\": \"example\", \"备注\": \"remark\", \"注意\": \"remark\", \"笔记\": \"note\", \"注释\": \"note\", \"案例\": \"case\", \"证明\": \"proof\", \"证\": \"proof\", \"练习\": \"exercise\" }; // ===== Get matched content ===== var env = triggerMatches[1]; // environment var title = triggerMatches[2]; // title var label = triggerMatches[3]; // label // ===== Convert Chinese environment to LaTeX English environment ===== if (envMap[env]) { env = envMap[env]; } // ===== Construct LaTeX code ===== var txt = \"\\\\begin{\" + env + \"}\"; if (title) txt += \"[\" + title + \"]\"; if (label) txt += \"\\\\label{\" + label + \"}\"; txt += \"\\n\\n\\\\end{\" + env + \"}\\n\"; // ===== Insert text ===== cursor.insertText(txt); // ===== Adjust cursor position inside the environment ===== cursor.movePosition(2, cursorEnums.Up); cursor.movePosition(1, cursorEnums.StartOfLine);\rThe trigger is set as: \\-(.+)\\-(.+)\\-(.+)\\t *\\t is the tab key *(.+) : Parentheses represent an environment, representing the content between separators -. Where .+ represents one or more characters. If at least two characters are required, use .+. instead.\rThe logic isn\u0026rsquo;t difficult either. The three parentheses in the trigger\u0026rsquo;s regular expression correspond to env, title, and label in the code. Fill them into the code template, then move the cursor. (The only problem is that TexStudio\u0026rsquo;s regular expression recognition has poor compatibility with Chinese characters.) As shown in the image\r","date":"2025-10-10","heading":"Macro Commands","objectID":"/en/posts/texstudio/:1:0","tags":["TeXstudio","LaTeX"],"title":"Optimize Your TexStudio Editing Experience","uri":"/en/posts/texstudio/#macro-commands"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"Configuring Language Assistant in TexStudio\rTexStudio page. As shown in the image\rFirst, download Java (please find tutorials yourself). Then download the free grammar checking assistant—https://languagetool.org/download/ Download the version corresponding to your computer. I\u0026rsquo;m using Windows system with the latest TexStudio, so I chose LanguageTool-6.6.Zip. After downloading, extract the corresponding LanguageTool zip file. Open cmd in the corresponding folder page (just type cmd in the address bar to open it from here). Then run java -jar languagetool. jar After opening, go to text checking - options to enter the page, set language, server port. As shown in the image\rAfter setting up, go to the LanguageTool section at the bottom of TexStudio settings. As shown in the image\rAfter restarting TexStudio, you can check the language tool in help: The wavy lines correspond to grammar errors. As shown in the image\rRight-click on the error location for correction suggestions: As shown in the image\r","date":"2025-10-10","heading":"Configuring Language Assistant in TexStudio","objectID":"/en/posts/texstudio/:2:0","tags":["TeXstudio","LaTeX"],"title":"Optimize Your TexStudio Editing Experience","uri":"/en/posts/texstudio/#configuring-language-assistant-in-texstudio"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"Some Keyboard Shortcuts\rCtrl + Left Mouse Click: Quickly navigate (jump to source code or corresponding PDF position). Ctrl + Shift + I: Quickly add \\item (for list environments itemize/enumerate). Ctrl + T: Quickly add/remove comments (for current line or selected multiple lines). Ctrl + Shift + M: Quickly add inline code, for example, add $ x $ at cursor position. Ctrl + Shift + N: Add equation environment (e.g., \\begin{equation} ... \\end{equation}). Alt + Shift + M: Add displayed code (usually math environment, e.g., $$...$$ or \\[ ... \\]). ","date":"2025-10-10","heading":"Some Keyboard Shortcuts","objectID":"/en/posts/texstudio/:3:0","tags":["TeXstudio","LaTeX"],"title":"Optimize Your TexStudio Editing Experience","uri":"/en/posts/texstudio/#some-keyboard-shortcuts"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"Other Tips\rMake good use of the symbol collection function in the left column. As shown in the image\rRight-click in the code editing page to jump to PDF rendering position. Press Ctrl key and click on PDF position to jump to code editing position. TexStudio supports inline preview. Alt+P to start, but it may conflict with other template rendering settings. For example, when I use the Elegant series template, I cannot view the preview. TexStudio supports inline preview. Alt+P to start\r","date":"2025-10-10","heading":"Other Tips","objectID":"/en/posts/texstudio/:4:0","tags":["TeXstudio","LaTeX"],"title":"Optimize Your TexStudio Editing Experience","uri":"/en/posts/texstudio/#other-tips"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"References\rAdvanced features TexStudio Macro Script Writing-2022-4-24 16:48:09 Installing Language Tool in TexStudio ","date":"2025-10-10","heading":"References","objectID":"/en/posts/texstudio/:5:0","tags":["TeXstudio","LaTeX"],"title":"Optimize Your TexStudio Editing Experience","uri":"/en/posts/texstudio/#references"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":" Education is what remains after one has forgotten everything learned in school. - Albert Einstein ","date":"2025-09-27","heading":"","objectID":"/en/posts/law_econ/:0:0","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Preface\rPicture this: an economics student comes home for the Lunar New Year and is still talking about neoclassical models, Bellman equations, and the Lucas critique, while no one at the dinner table understands a word. When relatives ask what he has gained from all those years of study, all he can say is that he has proved a general equilibrium, run some time-series analysis, and solved a dynamic optimization problem. While everyone else is stuffing red envelopes into their pockets, he may still be thinking about how to resolve endogeneity in a paper. In moments like that, we cannot help but ask: what does studying economics really change in a person? After the technical jargon fades from memory, what actually remains from an education in economics? This post discusses Ideas Have Consequences: The Impact of Law and Economics on American Justice, published in the QJE in 2025. The author\u0026rsquo;s website also contains a wealth of useful materials. The paper studies how judges changed their decision-making after participating in economics training. It finds that judges who attended the program used more economic language in their written opinions, opposed regulatory agencies more frequently, and imposed harsher criminal sentences. The paper not only examines the real-world consequences of the intersection between law and economics, but also provides evidence for the persuasive power of economic ideas. ","date":"2025-09-27","heading":"Preface","objectID":"/en/posts/law_econ/:1:0","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#preface"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Background\r","date":"2025-09-27","heading":"Background","objectID":"/en/posts/law_econ/:2:0","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#background"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"The Law and Economics Movement\rBeginning in the 1970s, the Chicago School became the center of the law-and-economics movement. Over the following decades, the application of economic ideas in legal thought moved from the margins to the mainstream. By the 1980s, economic reasoning had spread into nearly every field of law. Under the influence of the Chicago School, conservative scholars in law and economics often criticized regulation by emphasizing its unintended negative economic consequences and the risk of regulatory capture. Conservative scholars and judges became deeply involved in debates over labor law and environmental regulation. Economic deterrence theory also left a strong imprint on criminal law. ","date":"2025-09-27","heading":"The Law and Economics Movement","objectID":"/en/posts/law_econ/:2:1","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#the-law-and-economics-movement"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"The Manne Economics Institute for Federal Judges\rPart of economics\u0026rsquo; influence on legal thought can be traced to a training program for sitting judges: the Economics Institute for Federal Judges. The program ran from 1976 to 1998 and was offered once or twice a year. From the beginning, all federal judges were invited, beach-hotel expenses were covered, and places were allocated on a first-come, first-served basis. This means the program was not designed around a narrow preference for specific types of judges. As shown below.\rThe figure shows that by 1990, 40% of federal judges had attended the program. By the late 1990s, about half of all cases were directly affected. Lectures were delivered by leading economists such as Milton Friedman, Armen Alchian, Harold Demsetz, Martin Feldstein, Paul Samuelson, and Orley Ashenfelter. The curriculum covered many canonical topics in economics: the Coase theorem, supply and demand, consumer and producer theory, externalities, utility, property rights, torts, contracts, monopoly theory, regulation, and basic statistics. ","date":"2025-09-27","heading":"The Manne Economics Institute for Federal Judges","objectID":"/en/posts/law_econ/:2:2","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#the-manne-economics-institute-for-federal-judges"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"The Expected Impact of the Training Program\rFormalist theories of law hold that judges strictly apply written law without regard to non-legal factors. Attitudinal theories emphasize party affiliation and suggest that partisan replacement should wash out any effect of the Manne program. In reality, however, judges exercise substantial discretion, and a large literature shows that non-legal factors do affect judicial decisions. The variation in exposure generated by the Manne program allows us to test whether rigorous economic ideas can genuinely persuade judges and, if so, what legal consequences follow. ","date":"2025-09-27","heading":"The Expected Impact of the Training Program","objectID":"/en/posts/law_econ/:2:3","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#the-expected-impact-of-the-training-program"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Data\r","date":"2025-09-27","heading":"Data","objectID":"/en/posts/law_econ/:3:0","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#data"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Case Data\rThe U.S. federal court system has three levels: district courts, circuit courts, and the Supreme Court. The paper collects appellate decisions from U.S. circuit courts between 1970 and 2005 from Bloomberg Law, and cross-checks them against the Singer database, the Federal Judicial Center dataset, and LexisNexis. The data include judge characteristics such as gender, religion, family background, degrees, and work experience. In the case sample, 20% of cases involve regulation and 5% involve labor issues. As shown below.\r","date":"2025-09-27","heading":"Case Data","objectID":"/en/posts/law_econ/:3:1","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#case-data"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Judicial Writing Style\rThe paper uses a word-embedding approach to identify the economic style of judicial opinions. The authors first remove capitalization and punctuation from written opinions and preprocess the text into token lists. These lists are then linked to a legal-economic vocabulary database. Because only a small share of cases contain explicit economic terms, simple word-frequency measures are not very informative, so the paper instead relies on contextual similarity. As shown below.\r","date":"2025-09-27","heading":"Judicial Writing Style","objectID":"/en/posts/law_econ/:3:2","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#judicial-writing-style"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Judicial Outcomes\rThe paper focuses on three categories of outcomes: Labor and environmental regulation: whether judges vote against government agencies or labor authorities. A vote against the regulator is interpreted as a more deregulatory stance. Conservative judging: based on the legal claims in a manually coded subset of cases (5% of the sample), decisions are classified as liberal, conservative, neutral, or hard to code. The figure shows an upward trend in conservatism. As shown below.\rCriminal sentencing: including crime type and sentence severity, with the main outcome coded as a binary indicator for imprisonment. ","date":"2025-09-27","heading":"Judicial Outcomes","objectID":"/en/posts/law_econ/:3:3","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#judicial-outcomes"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Empirical Strategy\r","date":"2025-09-27","heading":"Empirical Strategy","objectID":"/en/posts/law_econ/:4:0","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#empirical-strategy"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Estimation Strategy\r$$ Y\\_{ijct}=\\alpha\\_{j}\u0026#43;\\alpha\\_{ct}\u0026#43;\\gamma Z\\_{jt}^{\\mathrm{post}}\u0026#43;X\\_{ijct}^{\\prime}\\beta\u0026#43;\\epsilon\\_{ijct} $$ $$ Y_{ijct}=\\alpha_{j}\u0026#43;\\alpha_{ct}\u0026#43;\\sum_{k\\in V}\\gamma_{k}Z_{jt}^{k}\u0026#43;X_{ijct}^{\\prime}\\beta\u0026#43;\\epsilon_{ijct} $$ Case $i$, judge $j$, court $c$, year $t$. The paper includes judge fixed effects and court-year fixed effects. Dependent variable $Y$: decisions, votes, or the economic style of written opinions. Independent variable $Z$: an indicator for whether the judge has entered the Manne program. ","date":"2025-09-27","heading":"Estimation Strategy","objectID":"/en/posts/law_econ/:4:1","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#estimation-strategy"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Tests of the Identification Assumptions\rRandom Assignment of Cases\rBecause training slots were allocated on a first-come, first-served basis, the paper adopts a staggered DID design. This requires additional checks: are cases randomly assigned across judges, and do early participants differ systematically from later participants? In the U.S. court system, cases are randomly assigned by computer, and repeated judicial panels are intentionally avoided. The figure below shows no statistically significant difference between Manne participants and non-participants in the types of economic cases assigned to district and circuit judges. As shown below.\rThe Assumption Behind Training-Cohort Assignment\rThe paper examines the characteristics of judges across Manne training cohorts. Judges appointed by Republican presidents were more likely to participate in the Manne program and to appear in earlier cohorts, but Republican appointment was not related to the precise timing of participation. As shown below.\rAs shown below.\rThe paper further compares judges within the same court and the same year, contrasting participants and non-participants, and finds that differences are not significant. To address any remaining selection concerns, the authors predict each judge\u0026rsquo;s participation year using all available controls and include that prediction in the analysis. As shown below.\rNo Spillover Effects (SUTVA)\rStrictly speaking, DID already assumes no spillovers. Yet many papers still end by testing for spillovers, even when they are not using spatial econometrics. To preserve the validity of staggered DID identification, the paper tests for spillovers from trained judges to their colleagues. Judges are generally thought to work relatively independently, and communication is limited when cases are randomly assigned. The authors also control for the share of colleagues in the same court who attended the training. Additional tests show that spillovers are weak. As shown below.\r","date":"2025-09-27","heading":"Tests of the Identification Assumptions","objectID":"/en/posts/law_econ/:4:2","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#tests-of-the-identification-assumptions"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Tests of the Identification Assumptions\rRandom Assignment of Cases\rBecause training slots were allocated on a first-come, first-served basis, the paper adopts a staggered DID design. This requires additional checks: are cases randomly assigned across judges, and do early participants differ systematically from later participants? In the U.S. court system, cases are randomly assigned by computer, and repeated judicial panels are intentionally avoided. The figure below shows no statistically significant difference between Manne participants and non-participants in the types of economic cases assigned to district and circuit judges. As shown below.\rThe Assumption Behind Training-Cohort Assignment\rThe paper examines the characteristics of judges across Manne training cohorts. Judges appointed by Republican presidents were more likely to participate in the Manne program and to appear in earlier cohorts, but Republican appointment was not related to the precise timing of participation. As shown below.\rAs shown below.\rThe paper further compares judges within the same court and the same year, contrasting participants and non-participants, and finds that differences are not significant. To address any remaining selection concerns, the authors predict each judge\u0026rsquo;s participation year using all available controls and include that prediction in the analysis. As shown below.\rNo Spillover Effects (SUTVA)\rStrictly speaking, DID already assumes no spillovers. Yet many papers still end by testing for spillovers, even when they are not using spatial econometrics. To preserve the validity of staggered DID identification, the paper tests for spillovers from trained judges to their colleagues. Judges are generally thought to work relatively independently, and communication is limited when cases are randomly assigned. The authors also control for the share of colleagues in the same court who attended the training. Additional tests show that spillovers are weak. As shown below.\r","date":"2025-09-27","heading":"Random Assignment of Cases","objectID":"/en/posts/law_econ/:4:2","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#random-assignment-of-cases"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Tests of the Identification Assumptions\rRandom Assignment of Cases\rBecause training slots were allocated on a first-come, first-served basis, the paper adopts a staggered DID design. This requires additional checks: are cases randomly assigned across judges, and do early participants differ systematically from later participants? In the U.S. court system, cases are randomly assigned by computer, and repeated judicial panels are intentionally avoided. The figure below shows no statistically significant difference between Manne participants and non-participants in the types of economic cases assigned to district and circuit judges. As shown below.\rThe Assumption Behind Training-Cohort Assignment\rThe paper examines the characteristics of judges across Manne training cohorts. Judges appointed by Republican presidents were more likely to participate in the Manne program and to appear in earlier cohorts, but Republican appointment was not related to the precise timing of participation. As shown below.\rAs shown below.\rThe paper further compares judges within the same court and the same year, contrasting participants and non-participants, and finds that differences are not significant. To address any remaining selection concerns, the authors predict each judge\u0026rsquo;s participation year using all available controls and include that prediction in the analysis. As shown below.\rNo Spillover Effects (SUTVA)\rStrictly speaking, DID already assumes no spillovers. Yet many papers still end by testing for spillovers, even when they are not using spatial econometrics. To preserve the validity of staggered DID identification, the paper tests for spillovers from trained judges to their colleagues. Judges are generally thought to work relatively independently, and communication is limited when cases are randomly assigned. The authors also control for the share of colleagues in the same court who attended the training. Additional tests show that spillovers are weak. As shown below.\r","date":"2025-09-27","heading":"The Assumption Behind Training-Cohort Assignment","objectID":"/en/posts/law_econ/:4:2","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#the-assumption-behind-training-cohort-assignment"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Tests of the Identification Assumptions\rRandom Assignment of Cases\rBecause training slots were allocated on a first-come, first-served basis, the paper adopts a staggered DID design. This requires additional checks: are cases randomly assigned across judges, and do early participants differ systematically from later participants? In the U.S. court system, cases are randomly assigned by computer, and repeated judicial panels are intentionally avoided. The figure below shows no statistically significant difference between Manne participants and non-participants in the types of economic cases assigned to district and circuit judges. As shown below.\rThe Assumption Behind Training-Cohort Assignment\rThe paper examines the characteristics of judges across Manne training cohorts. Judges appointed by Republican presidents were more likely to participate in the Manne program and to appear in earlier cohorts, but Republican appointment was not related to the precise timing of participation. As shown below.\rAs shown below.\rThe paper further compares judges within the same court and the same year, contrasting participants and non-participants, and finds that differences are not significant. To address any remaining selection concerns, the authors predict each judge\u0026rsquo;s participation year using all available controls and include that prediction in the analysis. As shown below.\rNo Spillover Effects (SUTVA)\rStrictly speaking, DID already assumes no spillovers. Yet many papers still end by testing for spillovers, even when they are not using spatial econometrics. To preserve the validity of staggered DID identification, the paper tests for spillovers from trained judges to their colleagues. Judges are generally thought to work relatively independently, and communication is limited when cases are randomly assigned. The authors also control for the share of colleagues in the same court who attended the training. Additional tests show that spillovers are weak. As shown below.\r","date":"2025-09-27","heading":"No Spillover Effects (SUTVA)","objectID":"/en/posts/law_econ/:4:2","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#no-spillover-effects-sutva"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Empirical Results\r","date":"2025-09-27","heading":"Empirical Results","objectID":"/en/posts/law_econ/:5:0","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#empirical-results"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Judicial Language Style\rThe results show that judges who attended the Manne program became more likely to use economics-related language in their written opinions. As a placebo exercise, the paper replaces the economics-language measure with a law-language similarity measure, and the effect is not significant. As shown below.\r","date":"2025-09-27","heading":"Judicial Language Style","objectID":"/en/posts/law_econ/:5:1","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#judicial-language-style"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Attitudes Toward Regulation\rThe paper mainly examines judicial votes in cases involving labor and environmental regulation. The results show that after the training, judges became more likely to oppose regulators. The authors also test a sample of antitrust cases. The estimate is positive but not statistically significant, possibly because the sample is relatively small. As shown below.\r","date":"2025-09-27","heading":"Attitudes Toward Regulation","objectID":"/en/posts/law_econ/:5:2","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#attitudes-toward-regulation"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Effects on Sentencing\rThe direction of economics\u0026rsquo; effect on sentence severity is not obvious in theory. But if one thinks in terms of deterrence and the reduction of crime-related economic losses, then a framework that raises the cost of crime might lead judges to impose harsher punishment. The results suggest that trained judges become more likely to sentence defendants to prison. As shown below.\r","date":"2025-09-27","heading":"Effects on Sentencing","objectID":"/en/posts/law_econ/:5:3","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#effects-on-sentencing"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Extended Analysis\rThe paper also reports short-run effects for circuit courts. As shown below.\rUsing a Poisson model for incarceration, the paper finds that training raises imprisonment by 6.2% in the short run and 3.5% in the long run. Sentence length itself does not change significantly, perhaps because judges have less discretion over duration than over the incarceration decision. As shown below.\rThe paper then proposes a persuasion model: $$ p=100\\times\\frac{\\Delta y}{\\Delta e}\\cdot\\frac{1}{(1-y_0)}. $$ $y_0$ is the share of judges who had participated in economics training, which is 46% in the descriptive statistics. $\\Delta y$ is the change in the share of persuaded judges, measured here as the increase in anti-regulatory voting. Using a conservative estimate from the robustness checks, this is 4.3%. $\\Delta e$ is the share of the population potentially exposed to persuasion. Under the assumption that all judges could in principle be affected, this equals 1. Plugging these numbers into the formula yields an estimated persuasion effect of about 8% from economics training. Comparable estimates in other settings include the effect of Fox News on Republican voting (11.6%) and the persuasive effect of a 10-week subscription to The Washington Post on Democratic vote share (19.5%). Even so, the paper\u0026rsquo;s 8% is probably conservative, because it only studies trained judges. The course materials were also read by students, lawyers, and other related groups, and many of the opinions written by trained judges using economic analysis may themselves become precedents that spread those ideas further. ","date":"2025-09-27","heading":"Extended Analysis","objectID":"/en/posts/law_econ/:6:0","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#extended-analysis"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Robustness Checks\rPre-trend tests are reported. The authors alter the sample window by restricting attention to judges observed within three years before and after training in a balanced panel, and by expanding post-training years to estimate long-run effects over the full judicial career. They also alter the variable definitions by replacing the word-embedding measure with a machine-learning-based similarity measure for economic language. Additional controls include the appointing president, the predicted participation year, the interaction between a judge\u0026rsquo;s own participation and the share of colleagues who participated, and case-type fixed effects. Standard errors are reported in robust form as well as with two-way clustering by court and year. Finally, the sample is reweighted so that court-year cells with more cases receive greater weight. ","date":"2025-09-27","heading":"Robustness Checks","objectID":"/en/posts/law_econ/:7:0","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#robustness-checks"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Conclusion\rEconomics is a general decision-making framework, and judges must make high-stakes decisions across many policy domains. What economics teaches is not just a set of technical tools, but a way of thinking about decisions. After training in economic reasoning, judges may become more skeptical and perhaps better able to recognize biased materials than before, even if they are not economists themselves. The paper is impressively careful in its identification strategy. Its tests of no spillovers and random assignment are especially worth learning from. Across the three categories of outcomes, the authors also choose closely related placebo variables, which makes the overall argument more persuasive. Although the paper uses word embeddings to measure economics-related language, there is still room to think more deeply about how ideas themselves should be measured. The paper openly notes, for instance, that the theoretical direction of economics\u0026rsquo; effect on sentencing is complex, and it does not fully explain the distinctive mechanism of the economic framework. There is still much to explore: How do economic ideas diffuse? How does language style differ across economics journals? Can judicial harshness be measured through word choice in written opinions? These all seem like promising research questions. Statistical evidence from economics can never substitute for legal evidence, but the habits of thought developed in economics can make the presentation of legal evidence more persuasive. That is why the Manne program chose a dialogue between law and economics rather than some other interdisciplinary pairing. As Deirdre N. McCloskey argues in The Rhetoric of Economics, economics may ultimately be a discipline that teaches people how to persuade. And that framework of persuasion may be the most precious legacy economics leaves behind, as well as the quiet contribution embedded in so many papers. ","date":"2025-09-27","heading":"Conclusion","objectID":"/en/posts/law_econ/:8:0","tags":["Law and Economics"],"title":"The Power of Ideas: When Judges Learn Economics","uri":"/en/posts/law_econ/#conclusion"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":" \u0026ldquo;Man is by nature a political animal, but the human heart is not easily fathomed.\u0026rdquo; — Aristotle ","date":"2025-09-25","heading":"","objectID":"/en/posts/gzhs/:0:0","tags":["Network Effects","Multiple Equilibria"],"title":"Explaining the Trendy Toy Craze: From Network Effects to Multiple Equilibria","uri":"/en/posts/gzhs/#"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Typical Facts about Pop Mart Products\rFrom a conventional business perspective, the collectible-toy economy should have emerged first in developed countries. The economic theory is quite simple: Consumption is divided into subsistence and developmental; developmental consumption can only be satisfied after subsistence needs are met. In practice, Asian developing countries have responded more rapidly to the collectible toy market than developed countries. From a micro perspective, individuals are willing to tighten their belts for the \u0026ldquo;guzi economy\u0026rdquo; (collectible toy economy); From a macro perspective, current social consumption upgrading is accompanied by declining birth rates1. Figure 1—An issue of \u0026ldquo;Kan Tian Xia\u0026rdquo;\rIn terms of functional relationships, the typical facts about products like Pop Mart are: When supply falls short of demand, prices (at least official prices) remain largely unchanged, while Pop Mart\u0026rsquo;s scalper prices have recently experienced a decline (around July 2025). Figure 2—Data from Qiandao APP on June 19\rIn other words: First, Pop Mart is not a Giffen good2, as its pricing is not cheap, defined as developmental consumption rather than an inferior good. It cannot be explained by price stickiness from Keynesian theory, as there is no union involvement here, and menu costs (the costs of changing prices) are low. Pop Mart\u0026rsquo;s official prices often don\u0026rsquo;t increase much, and its market prices hover near a certain high point, falling into a temporary equilibrium3. Pop Mart\u0026rsquo;s popularity is difficult to predict; a new release may either go viral or attract almost no attention, which is typical of products driven by social contagion. ","date":"2025-09-25","heading":"Typical Facts about Pop Mart Products","objectID":"/en/posts/gzhs/:1:0","tags":["Network Effects","Multiple Equilibria"],"title":"Explaining the Trendy Toy Craze: From Network Effects to Multiple Equilibria","uri":"/en/posts/gzhs/#typical-facts-about-pop-mart-products"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Incorporating Conspicuous Consumption into the Model\rThe basic idea is straightforward; the main task here is to see how it can be incorporated into an economic model. Meanwhile, in a 1991 University of Chicago economics class, Nobel laureate Gary S. Becker4 posed a question—why does a famous seafood restaurant he likes, with so many daily customers, never raise its prices? This phenomenon is quite common: even without scalpers, many successful restaurants, theaters, sporting events, and similar activities do not raise prices despite persistent excess demand. ","date":"2025-09-25","heading":"Incorporating Conspicuous Consumption into the Model","objectID":"/en/posts/gzhs/:2:0","tags":["Network Effects","Multiple Equilibria"],"title":"Explaining the Trendy Toy Craze: From Network Effects to Multiple Equilibria","uri":"/en/posts/gzhs/#incorporating-conspicuous-consumption-into-the-model"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Traditional Microeconomic Model\rFigure 3\rIn this price-demand diagram, $d_0$ represents the production function5, $d_1$ represents the demand function. $s$ is the number of seats in the popular restaurant. Currently, the popular restaurant faces demand exceeding supply, corresponding to price level $p_0$. Clearly, when the price increases to $p_e$, the restaurant could earn more. Raising the price to $p_{max}$, profits depend on the elasticity of both sides. A Small Derivation: Price Increase and Profit\r$$ \\pi(P)=P\\cdot Q(P)-C(Q(P)) $$ $$ \\frac{d\\pi}{dP}=Q(P)\u0026#43;P\\cdot\\frac{dQ}{dP}-C^{\\prime}(Q)\\cdot\\frac{dQ}{dP} $$ $C^{\\prime}(Q)$ can be written as marginal cost $MC$, while defining price-demand elasticity $\\varepsilon\\equiv\\frac{dQ}{dP}\\cdot\\frac{P}{Q}$. $$ \\begin{aligned}\\frac{d\\pi}{dP}\u0026amp;=Q\u0026#43;P\\cdot\\left(\\varepsilon\\frac{Q}{P}\\right)-MC\\cdot\\left(\\varepsilon\\frac{Q}{P}\\right)\\\\\\\\\u0026amp;=Q\u0026#43;\\varepsilon Q-\\varepsilon Q\\cdot\\frac{MC}{P}\\\\\\\\\u0026amp;=Q\\left(1\u0026#43;\\varepsilon-\\varepsilon\\frac{MC}{P}\\right).\\end{aligned} $$ The first-order condition is the famous: $$\\frac{P-MC}{P}=-\\frac{1}{\\varepsilon}$$ Consumption elasticity is closely related to firms\u0026rsquo; markup space. When examining firms\u0026rsquo; market power, we can attempt estimation starting from this equation. ","date":"2025-09-25","heading":"Traditional Microeconomic Model","objectID":"/en/posts/gzhs/:2:1","tags":["Network Effects","Multiple Equilibria"],"title":"Explaining the Trendy Toy Craze: From Network Effects to Multiple Equilibria","uri":"/en/posts/gzhs/#traditional-microeconomic-model"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Model with Conspicuous Consumption\rWhen consumers buy a good, they also care about the social environment surrounding it. For example, the value of subsequent posts on Xiaohongshu (Little Red Book), WeChat Moments, and group \u0026ldquo;screen resonance.\u0026rdquo; Here, the demand function becomes: $$ D=\\sum d^{\\prime}(p,D)=F(p,D),\\quad F_p\u0026lt;0,F_d\u0026gt;0 $$ Recursive structure—total market demand D is the sum of individual demands d, while each individual\u0026rsquo;s demand function considers total market demand D. The total market demand function still shows less demand at higher prices ($F_p\u0026lt;0$). The market also has a positive feedback structure: the more people buy, the more are attracted ($F_D\u0026gt;0$) (network effect). Next, we differentiate the total demand function: $$L(p,D)=F(p,D)-D=0$$ $$ dL=L_pdp\u0026#43;L_DdD=0 $$ Here, $$ L_p=F_p,\\quad L_D=F_D-1 $$ Finally, we obtain: $$ F_pdp\u0026#43;(F_D-1)dD=0 $$ Transforming, we get the rate of price change with respect to demand6: $$ \\frac{dp}{dD}=G_D=\\frac{1-F_D}{F_p} $$ Here, $G_d$ represents the derivative of the inverse demand function with respect to demand d. If the social effect is strong enough—$F_D\u0026gt;1$—then $\\frac{1-F_D}{F_p}\u0026gt;0$. From the rate of change perspective—price increases as demand increases. Until the firm reaches the third-stage inflection point of production $p_{max}$ (compatible with traditional explanation, which is Figure 3\u0026rsquo;s content). But now, based on the network model, there\u0026rsquo;s a new possibility— When total demand is low, $F_D\u0026lt;1$; when total demand is high, $F_D\u0026gt;1$. Here, the total social demand function is no longer a monotonically declining line but a curve that first declines then rises. Figure 4\rMR Curve in Figure 4\rAssuming fixed costs, $$ \\begin{aligned} MR\u0026amp;=\\frac{d(PD-C)}{dD}\\\\\\\\ \u0026amp;=P\u0026#43;D\\frac{dP}{dD}\\\\\\\\ \u0026amp;=P\u0026#43;D(\\frac{1-F_D}{F_p}) \\end{aligned} $$ Since in the low-demand stage $\\frac{dp}{dD}=G_D=\\frac{1-F_D}{F_p}\u0026lt;0$, this results in a downward-sloping curve. Actually, the height and slope of the MR curve relative to the D(P) demand curve can be compared as follows: Height (evident from the MR equation): $$ MR-D(P)=D(\\frac{1-F_D}{F_p}) $$ Therefore, initially the MR curve lies below the demand curve. This represents the multiple equilibria in reality! For example, pricing at $p^*$. If the product becomes an instant hit, with word-of-mouth spreading, then market demand accumulates to the $D_g^*$ level. If the product receives little attention, actual demand remains at the $D_b^*$ level. Given this uncertainty, firms generally dislike overproduction ($s-D_b^*$). Therefore, firms tend to choose the equilibrium level where $MR=0$. Significance of the Model\rThis model explains why advertising and marketing are so important in real-world store experience (this is natural). The least obvious point is—why viral firms maintain conservative pricing during hot sales periods. The essence lies in uncertainty brought by network effects. The model elegantly depicts why equilibrium during the popular phase is so brief—price function adjustment space is limited—when network effects continue to weaken, prices automatically decline. Currently, there remains exploration space for variables characterizing network effects. Stepping Back to Understand Network Effects\rIndividual utility is: $$ U_i=U(x_i,y_i;X) $$ where $X=\\sum x_{j}$ represents network effects. Next, we solve for marginal conditions: $$ MU_{x_i}=\\frac{\\partial U}{\\partial x_i}\u0026#43;\\frac{\\partial U}{\\partial X}\\cdot\\frac{\\partial X}{\\partial x_i} $$ If $\\frac{\\partial U}{\\partial X}$ is large, it signifies a positive externality: when consumers purchase viral products, the additional satisfaction from social attributes may even exceed the negative utility from price increases. ","date":"2025-09-25","heading":"Model with Conspicuous Consumption","objectID":"/en/posts/gzhs/:2:2","tags":["Network Effects","Multiple Equilibria"],"title":"Explaining the Trendy Toy Craze: From Network Effects to Multiple Equilibria","uri":"/en/posts/gzhs/#model-with-conspicuous-consumption"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Model with Conspicuous Consumption\rWhen consumers buy a good, they also care about the social environment surrounding it. For example, the value of subsequent posts on Xiaohongshu (Little Red Book), WeChat Moments, and group \u0026ldquo;screen resonance.\u0026rdquo; Here, the demand function becomes: $$ D=\\sum d^{\\prime}(p,D)=F(p,D),\\quad F_p\u0026lt;0,F_d\u0026gt;0 $$ Recursive structure—total market demand D is the sum of individual demands d, while each individual\u0026rsquo;s demand function considers total market demand D. The total market demand function still shows less demand at higher prices ($F_p\u0026lt;0$). The market also has a positive feedback structure: the more people buy, the more are attracted ($F_D\u0026gt;0$) (network effect). Next, we differentiate the total demand function: $$L(p,D)=F(p,D)-D=0$$ $$ dL=L_pdp\u0026#43;L_DdD=0 $$ Here, $$ L_p=F_p,\\quad L_D=F_D-1 $$ Finally, we obtain: $$ F_pdp\u0026#43;(F_D-1)dD=0 $$ Transforming, we get the rate of price change with respect to demand6: $$ \\frac{dp}{dD}=G_D=\\frac{1-F_D}{F_p} $$ Here, $G_d$ represents the derivative of the inverse demand function with respect to demand d. If the social effect is strong enough—$F_D\u0026gt;1$—then $\\frac{1-F_D}{F_p}\u0026gt;0$. From the rate of change perspective—price increases as demand increases. Until the firm reaches the third-stage inflection point of production $p_{max}$ (compatible with traditional explanation, which is Figure 3\u0026rsquo;s content). But now, based on the network model, there\u0026rsquo;s a new possibility— When total demand is low, $F_D\u0026lt;1$; when total demand is high, $F_D\u0026gt;1$. Here, the total social demand function is no longer a monotonically declining line but a curve that first declines then rises. Figure 4\rMR Curve in Figure 4\rAssuming fixed costs, $$ \\begin{aligned} MR\u0026amp;=\\frac{d(PD-C)}{dD}\\\\\\\\ \u0026amp;=P\u0026#43;D\\frac{dP}{dD}\\\\\\\\ \u0026amp;=P\u0026#43;D(\\frac{1-F_D}{F_p}) \\end{aligned} $$ Since in the low-demand stage $\\frac{dp}{dD}=G_D=\\frac{1-F_D}{F_p}\u0026lt;0$, this results in a downward-sloping curve. Actually, the height and slope of the MR curve relative to the D(P) demand curve can be compared as follows: Height (evident from the MR equation): $$ MR-D(P)=D(\\frac{1-F_D}{F_p}) $$ Therefore, initially the MR curve lies below the demand curve. This represents the multiple equilibria in reality! For example, pricing at $p^*$. If the product becomes an instant hit, with word-of-mouth spreading, then market demand accumulates to the $D_g^*$ level. If the product receives little attention, actual demand remains at the $D_b^*$ level. Given this uncertainty, firms generally dislike overproduction ($s-D_b^*$). Therefore, firms tend to choose the equilibrium level where $MR=0$. Significance of the Model\rThis model explains why advertising and marketing are so important in real-world store experience (this is natural). The least obvious point is—why viral firms maintain conservative pricing during hot sales periods. The essence lies in uncertainty brought by network effects. The model elegantly depicts why equilibrium during the popular phase is so brief—price function adjustment space is limited—when network effects continue to weaken, prices automatically decline. Currently, there remains exploration space for variables characterizing network effects. Stepping Back to Understand Network Effects\rIndividual utility is: $$ U_i=U(x_i,y_i;X) $$ where $X=\\sum x_{j}$ represents network effects. Next, we solve for marginal conditions: $$ MU_{x_i}=\\frac{\\partial U}{\\partial x_i}\u0026#43;\\frac{\\partial U}{\\partial X}\\cdot\\frac{\\partial X}{\\partial x_i} $$ If $\\frac{\\partial U}{\\partial X}$ is large, it signifies a positive externality: when consumers purchase viral products, the additional satisfaction from social attributes may even exceed the negative utility from price increases. ","date":"2025-09-25","heading":"Significance of the Model","objectID":"/en/posts/gzhs/:2:2","tags":["Network Effects","Multiple Equilibria"],"title":"Explaining the Trendy Toy Craze: From Network Effects to Multiple Equilibria","uri":"/en/posts/gzhs/#significance-of-the-model"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Model with Conspicuous Consumption\rWhen consumers buy a good, they also care about the social environment surrounding it. For example, the value of subsequent posts on Xiaohongshu (Little Red Book), WeChat Moments, and group \u0026ldquo;screen resonance.\u0026rdquo; Here, the demand function becomes: $$ D=\\sum d^{\\prime}(p,D)=F(p,D),\\quad F_p\u0026lt;0,F_d\u0026gt;0 $$ Recursive structure—total market demand D is the sum of individual demands d, while each individual\u0026rsquo;s demand function considers total market demand D. The total market demand function still shows less demand at higher prices ($F_p\u0026lt;0$). The market also has a positive feedback structure: the more people buy, the more are attracted ($F_D\u0026gt;0$) (network effect). Next, we differentiate the total demand function: $$L(p,D)=F(p,D)-D=0$$ $$ dL=L_pdp\u0026#43;L_DdD=0 $$ Here, $$ L_p=F_p,\\quad L_D=F_D-1 $$ Finally, we obtain: $$ F_pdp\u0026#43;(F_D-1)dD=0 $$ Transforming, we get the rate of price change with respect to demand6: $$ \\frac{dp}{dD}=G_D=\\frac{1-F_D}{F_p} $$ Here, $G_d$ represents the derivative of the inverse demand function with respect to demand d. If the social effect is strong enough—$F_D\u0026gt;1$—then $\\frac{1-F_D}{F_p}\u0026gt;0$. From the rate of change perspective—price increases as demand increases. Until the firm reaches the third-stage inflection point of production $p_{max}$ (compatible with traditional explanation, which is Figure 3\u0026rsquo;s content). But now, based on the network model, there\u0026rsquo;s a new possibility— When total demand is low, $F_D\u0026lt;1$; when total demand is high, $F_D\u0026gt;1$. Here, the total social demand function is no longer a monotonically declining line but a curve that first declines then rises. Figure 4\rMR Curve in Figure 4\rAssuming fixed costs, $$ \\begin{aligned} MR\u0026amp;=\\frac{d(PD-C)}{dD}\\\\\\\\ \u0026amp;=P\u0026#43;D\\frac{dP}{dD}\\\\\\\\ \u0026amp;=P\u0026#43;D(\\frac{1-F_D}{F_p}) \\end{aligned} $$ Since in the low-demand stage $\\frac{dp}{dD}=G_D=\\frac{1-F_D}{F_p}\u0026lt;0$, this results in a downward-sloping curve. Actually, the height and slope of the MR curve relative to the D(P) demand curve can be compared as follows: Height (evident from the MR equation): $$ MR-D(P)=D(\\frac{1-F_D}{F_p}) $$ Therefore, initially the MR curve lies below the demand curve. This represents the multiple equilibria in reality! For example, pricing at $p^*$. If the product becomes an instant hit, with word-of-mouth spreading, then market demand accumulates to the $D_g^*$ level. If the product receives little attention, actual demand remains at the $D_b^*$ level. Given this uncertainty, firms generally dislike overproduction ($s-D_b^*$). Therefore, firms tend to choose the equilibrium level where $MR=0$. Significance of the Model\rThis model explains why advertising and marketing are so important in real-world store experience (this is natural). The least obvious point is—why viral firms maintain conservative pricing during hot sales periods. The essence lies in uncertainty brought by network effects. The model elegantly depicts why equilibrium during the popular phase is so brief—price function adjustment space is limited—when network effects continue to weaken, prices automatically decline. Currently, there remains exploration space for variables characterizing network effects. Stepping Back to Understand Network Effects\rIndividual utility is: $$ U_i=U(x_i,y_i;X) $$ where $X=\\sum x_{j}$ represents network effects. Next, we solve for marginal conditions: $$ MU_{x_i}=\\frac{\\partial U}{\\partial x_i}\u0026#43;\\frac{\\partial U}{\\partial X}\\cdot\\frac{\\partial X}{\\partial x_i} $$ If $\\frac{\\partial U}{\\partial X}$ is large, it signifies a positive externality: when consumers purchase viral products, the additional satisfaction from social attributes may even exceed the negative utility from price increases. ","date":"2025-09-25","heading":"Stepping Back to Understand Network Effects","objectID":"/en/posts/gzhs/:2:2","tags":["Network Effects","Multiple Equilibria"],"title":"Explaining the Trendy Toy Craze: From Network Effects to Multiple Equilibria","uri":"/en/posts/gzhs/#stepping-back-to-understand-network-effects"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"From Network Effects to Complexity Economics\rNetwork effects are similar to multiple structures of positive and negative feedback. Expanding from Network Effects\rGreat principles never use narrow concepts. Regional economics, spatial autocorrelation is also a type of network effect. Distance and orientation in regional economics have never been \u0026ldquo;narrow\u0026rdquo;—cultural distance (e.g., dialect regions), economic distance (industrial structure), cognitive distance (e.g., industrial structure competition or complementarity, patent similarity)\u0026hellip;\u0026hellip;\u0026hellip; Just like the multiplier effect in Keynesian theory. Actually, Keynes also had the concept of multiple equilibria. An economy, under certain conditions, may have multiple equilibria. Screenshot from Williamson\u0026rsquo;s \u0026ldquo;Macroeconomics\u0026rdquo;\rDue to incomplete adjustment of interest rates, prices, and wages, society has a self-reinforcing effect. People\u0026rsquo;s sentiments alternate between optimism and pessimism and infect each other, which is what Keynes called \u0026ldquo;animal spirits.\u0026rdquo; Precisely because of this, adjustment of social expectations and regulation of economic signals are so important. This is why Keynes7 said: \u0026ldquo;In the short run, people\u0026rsquo;s psychological expectations and confidence (animal spirits) are more important than gold reserves.\u0026rdquo; Economics today has moved toward complexity economics. Complexity economists emphasize network effects, heterogeneous agents, multiple equilibria in society. At a basic level, network effects mean that individuals move with the rise and fall of public sentiment. The harder question is how to measure that sentiment and bring it into formal analysis. That, in my view, is one of the most worthwhile directions for future research. Too many macroeconomic explanations: caused by gender division of labor, social security, culture, parenting pressure, housing prices\u0026hellip;\u0026hellip; One macroeconomic explanation might refer to another blog post 《The Origin of Wealth》: A Thousand Years of Darkness, One Lamp Illuminates.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Under special circumstances, inferior goods show price and demand moving in the same direction, e.g., potatoes during famine (the textbook\u0026rsquo;s perennial example), where higher prices lead to more purchases.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Many call this financial manipulation to harvest \u0026ldquo;韭菜\u0026rdquo; (retail investors).\u0026#160;\u0026#x21a9;\u0026#xfe0e; This Nobel laureate enjoys modeling various economic phenomena, with labor economics research predominating.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Three-stage production function, so firms only produce in the second stage. The process involves comparing marginal product (mp) and average product (ap).\u0026#160;\u0026#x21a9;\u0026#xfe0e; Actually, elasticity can also be seen as dimensionless rate of change.\u0026#160;\u0026#x21a9;\u0026#xfe0e; The General Theory of Employment, Interest and Money (1936)\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2025-09-25","heading":"From Network Effects to Complexity Economics","objectID":"/en/posts/gzhs/:3:0","tags":["Network Effects","Multiple Equilibria"],"title":"Explaining the Trendy Toy Craze: From Network Effects to Multiple Equilibria","uri":"/en/posts/gzhs/#from-network-effects-to-complexity-economics"},{"categories":["Software Tools"],"collections":[],"content":"Recently, many economics papers have employed LDA topic modeling1 and social network analysis. Here, I attempt to visualize blog topic keywords using this methodology. The workflow is as follows: Python reads markdown documents. Cleans and tokenizes text. Builds LDA topics. Constructs network data. Visualizes using Gephi. ","date":"2025-08-31","heading":"","objectID":"/en/posts/lda_gephi/:0:0","tags":["LDA","Gephi","Social Networks"],"title":"LDA Topic Modeling and Gephi Visualization","uri":"/en/posts/lda_gephi/#"},{"categories":["Software Tools"],"collections":[],"content":"LDA Topic Modeling\rLDA is an established technique in computational text analysis, yet it remains simple and effective, serving as an unsupervised machine learning method. For economics, it suffices to understand that it summarizes the number of topic keywords in a text. In top-tier journal articles, it is often used to measure data types2. Examples of applications in research papers: JPE 2025\u0026rsquo;s \u0026ldquo;More Laws, More Growth? Evidence from US States\u0026rdquo; quantifies the distribution of new legislative topics across U. S. states, examining the relationship between legislation and economic growth. Legislation related to business environment topics proves more effective, with the mechanism being investment attraction and reduced economic uncertainty. RES 2025\u0026rsquo;s \u0026ldquo;Women in the Courtroom: Technology and Justice\u0026rdquo; uses panel data from live courtroom broadcasting pilot cases to study female case success rates, where case types are summarized into 50 topic categories based on legal content. For other text analysis references, see \u0026ldquo;Xiangzhang Article 3057: How to Use Text Analysis Algorithms in Economics?\u0026rdquo; For understanding LDA, I recommend a concise and intuitive YouTube video (requires VPN access): ","date":"2025-08-31","heading":"LDA Topic Modeling","objectID":"/en/posts/lda_gephi/:1:0","tags":["LDA","Gephi","Social Networks"],"title":"LDA Topic Modeling and Gephi Visualization","uri":"/en/posts/lda_gephi/#lda-topic-modeling"},{"categories":["Software Tools"],"collections":[],"content":"Gephi\r","date":"2025-08-31","heading":"Gephi","objectID":"/en/posts/lda_gephi/:2:0","tags":["LDA","Gephi","Social Networks"],"title":"LDA Topic Modeling and Gephi Visualization","uri":"/en/posts/lda_gephi/#gephi"},{"categories":["Software Tools"],"collections":[],"content":"Examples\rGephi is a network relationship visualization software. I was first introduced to this software by my blogger friend @Song\r. He used this software in his thesis to study the Global Lithium Product Trade Dependency Network. For foundational knowledge of network analysis, I highly recommend the open-source Iris Flower statistics textbook \u0026ldquo;The Way of Data.\u0026rdquo; The most classic example of social networks is Six Degrees of Separation—through six key individuals, one can connect with anyone in the world. This theory manifests in network analysis as (shortest) paths and network connectivity. The most classic dataset for social network analysis is the Karate Club. The karate club had two instructors who eventually parted ways. A statistician had previously recorded interpersonal relationships within the club, and after social network visualization and clustering, the resulting division closely matched the actual split. Karate Club dataset visualization, source: Wikipedia\rSocial network visualization primarily involves network evolution (clustering, fragmentation), distribution3 (key nodes, weights, density, structure4), and prediction. The paper \u0026ldquo;Ownership Networks and Firm Growth: What Do Forty Million Companies Tell Us About the Chinese Economy?\u0026rdquo; studies the distribution and evolution of China\u0026rsquo;s equity networks. As shown\rThe paper \u0026ldquo;Community Interaction and Conflict on the Web\u0026rdquo; examines Reddit community networks: less than 1% of communities initiated 74% of negative mobilization behaviors. These conflicts are typically started by core members of active communities, while the actual participants are less active peripheral members. Reddit community network\rLiterature review software like Citespace also constitutes a form of network analysis, specifically knowledge graphs. See another blog post \u0026ldquo;Citespace Literature Visualization.\u0026rdquo; Previously tested images. Anime theme, revealing Bilibili and Hatsune Miku as third-level keywords (homo is like this)\r","date":"2025-08-31","heading":"Examples","objectID":"/en/posts/lda_gephi/:2:1","tags":["LDA","Gephi","Social Networks"],"title":"LDA Topic Modeling and Gephi Visualization","uri":"/en/posts/lda_gephi/#examples"},{"categories":["Software Tools"],"collections":[],"content":"Analysis Software\rSummarized by GPT regarding available social network analysis software options. Tool\rPositioning\rAdvantages\rDisadvantages\rSuitable Scenarios\rGephi\rNetwork Visualization + Exploration\rUser-friendly interface; rich layout algorithms; community detection features\rVisualization-focused; not suitable for ultra-large networks\rRapid visualization, presentations, exploration\rCytoscape\rOriginally for biological networks → General-purpose\rRich plugin ecosystem; commonly used in research; tight integration of analysis and visualization\rLimited performance with large-scale data; slightly complex interface\rBioinformatics, scientific network analysis\rPajek\rClassic social network analysis software\rCan handle million-scale networks; common in academia\rOutdated interface; steep learning curve\rLarge-scale social network research\rNodeXL\rExcel plugin (Microsoft ecosystem)\rQuick to learn; convenient for social media data scraping\rLimited features; full version requires commercial license\rSocial media network analysis for beginners\rPython\rNetworkX / igraph programming tools\rFlexible; customizable; can integrate with machine learning and text mining\rNo visualization interface; requires coding\rHighly flexible, research experiments\r","date":"2025-08-31","heading":"Analysis Software","objectID":"/en/posts/lda_gephi/:2:2","tags":["LDA","Gephi","Social Networks"],"title":"LDA Topic Modeling and Gephi Visualization","uri":"/en/posts/lda_gephi/#analysis-software"},{"categories":["Software Tools"],"collections":[],"content":"Code\rThree folders: Blog markdown folder (original blog .md files) Tokenization folder (txt documents with one word per line, e.g., 了, 的, 得, 地, 他, 她, 滑翔闪\u0026hellip;) Results folder I used jieba for tokenization and gensim.models for model training. For further optimization, modifications can be made at these stages5. Note the version compatibility issues between gensim and numpy. import os import re import glob import itertools import jieba import pandas as pd import networkx as nx from collections import defaultdict from gensim import corpora from gensim.models import LdaModel # Global configuration parameters DOCS_GLOB = r'D:\\\\PyTorch_practice\\\\博客分析\\\\数据\\\\原始博客\\\\*.md' # Document path pattern STOPWORDS_PATH = r'D:\\\\PyTorch_practice\\\\博客分析\\\\数据\\\\设置\\\\分词stop.txt' # Optional stopwords file OUTPUT_DIR = r'D:\\\\PyTorch_practice\\\\博客分析\\\\数据\\\\结果输出\\\\' # Unified output folder NO_BELOW = 5 # Words with frequency below this threshold will be filtered NO_ABOVE = 0.5 # Words with frequency above this proportion will be filtered KEEP_N = 100000 # Number of highest-frequency words to retain NUM_TOPICS = 10 # Number of topics TOPN = 20 # Number of keywords to display per topic MAX_EDGES = 200 # Maximum number of edges to retain in word co-occurrence graph # Default stopwords set DEFAULT_STOPWORDS = set([ '的', '了', '和', '是', '在', '就', '都', '而', '及', '与', '或', '一个', '我', '你', '他', '她', '它', '我们', '你们', '他们', '她们', '这', '那', '其', '又', '被', '上', '中', '对', '所', '为', '于' ]) def load_stopwords(path): \"\"\"Load stopwords list\"\"\" sw = set() if os.path.exists(path): try: with open(path, 'r', encoding='utf-8', errors='ignore') as f: for line in f: w = line.strip() if w: sw.add(w) except Exception as e: print(f'Failed to read stopwords file {path}: {e}') # If custom stopwords is empty, use default stopwords return sw if sw else DEFAULT_STOPWORDS def load_documents(glob_pattern): \"\"\"Load document collection\"\"\" docs = [] filenames = [] # Get matching file list file_list = sorted(glob.glob(glob_pattern)) if not file_list: print(f'No matching files found: {glob_pattern}') return filenames, docs print(f'Found {len(file_list)} files') # Read each file content for fp in file_list: try: with open(fp, 'r', encoding='utf-8', errors='ignore') as f: text = f.read().strip() if text: docs.append(text) filenames.append(os.path.basename(fp)) except Exception as e: print(f'Failed to read file {fp}: {e}') return filenames, docs # Text cleaning and tokenization RE_CLEAN = re.compile(r\"[\\s\\d\\u0000-\\u007F]+\") # Remove ascii/digits/excessive whitespace, retain Chinese characters and punctuation def preprocess(text, stopwords): \"\"\"Text preprocessing: cleaning, tokenization, filtering\"\"\" text = RE_CLEAN.sub(' ', text) tokens = jieba.lcut(text) # Filter stopwords and single-character words tokens = [t for t in tokens if t.strip() and t not in stopwords and len(t) \u003e 1] return tokens def build_cooccurrence(tokens_list): \"\"\"Build word co-occurrence matrix\"\"\" cooc = defaultdict(int) freq = defaultdict(int) for tokens in tokens_list: # Deduplicate words within each document unique_tokens = list(dict.fromkeys(tokens)) # Update word frequency for w in unique_tokens: freq[w] += 1 # Build co-occurrence relationships for a, b in itertools.combinations(unique_tokens, 2): if a != b: # Ensure ordering to avoid duplicate counting key = (a, b) if a \u003c b else (b, a) cooc[key] += 1 return freq, cooc def main(): \"\"\"Main function\"\"\" # Create output directory os.makedirs(OUTPUT_DIR, exist_ok=True) print('Loading stopwords...') stopwords = load_stopwords(STOPWORDS_PATH) print(f'Loaded {len(stopwords)} stopwords') print('Loading documents...') filenames, docs = load_documents(DOCS_GLOB) print(f'Found {len(docs)} documents') if len(docs) == 0: print('No documents found, check DOCS_GLOB setting') return print('Tokenizing and preprocessing... (this may take some time)') texts = [preprocess(d, stopwords) for d in docs] # Statistics for processed vocabulary total_tokens = sum(len(text) for text in texts) print(f'Prepr","date":"2025-08-31","heading":"Code","objectID":"/en/posts/lda_gephi/:3:0","tags":["LDA","Gephi","Social Networks"],"title":"LDA Topic Modeling and Gephi Visualization","uri":"/en/posts/lda_gephi/#code"},{"categories":["Software Tools"],"collections":[],"content":"Some Reflections\rI often criticize machine learning as a black box, but for someone like me who uses various analysis software, how different are many software methods from black boxes? If a Stata external command has an error, without deep understanding or theoretical cross-validation from multiple perspectives, it\u0026rsquo;s difficult to detect the mistake. For example, \u0026ldquo;Stata\u0026rdquo; bdiff+reghdfe correct usage, many papers have been misled. I recall a previous did external command also had errors. I believe AI will enhance positive feedback in code-based learning, but simultaneously, AI also brings the illusion of \u0026ldquo;I understand.\u0026rdquo; As Feynman consistently emphasized—knowing and understanding are not the same7. Running code and understanding code are far from the same level of learning. In the era of AI learning knowledge illusions, what truly constitutes understanding? Perhaps this needs to be reconsidered. Although LDA is an old method, economics excels at repurposing established techniques.\u0026#160;\u0026#x21a9;\u0026#xfe0e; In recent years, the exploration of heterogeneous agents has become increasingly important\u0026#160;\u0026#x21a9;\u0026#xfe0e; Descriptive statistics alone can be sufficiently eye-catching.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Viewing the universe as a network space, recent research suggests Earth may reside within a cosmic void. After reading a Zhihu answer about interstellar travel (Can humans truly never leave the Laniakea Supercluster?), I no longer believe in extraterrestrials on Earth 😢.\u0026#160;\u0026#x21a9;\u0026#xfe0e; With AI, data analysis isn\u0026rsquo;t difficult; the challenge lies in obtaining suitable materials.\u0026#160;\u0026#x21a9;\u0026#xfe0e; However, with large datasets, beautification calculations for dispersed distributions become too complex and are rarely used.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Hence Feynman\u0026rsquo;s criticism that social sciences might be pseudoscience.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2025-08-31","heading":"Some Reflections","objectID":"/en/posts/lda_gephi/:4:0","tags":["LDA","Gephi","Social Networks"],"title":"LDA Topic Modeling and Gephi Visualization","uri":"/en/posts/lda_gephi/#some-reflections"},{"categories":["Travel"],"collections":[],"content":"Siguniang Mountain\r","date":"2025-07-30","heading":"Siguniang Mountain","objectID":"/en/posts/sgns/:1:0","tags":["Travel"],"title":"Siguniang Mountain: A Hiking Journey at the Foot of Snow-Capped Peaks","uri":"/en/posts/sgns/#siguniang-mountain"},{"categories":["Travel"],"collections":[],"content":"The Mountain Guardian Deity\rSiguniang Mountain graces western Sichuan\u0026rsquo;s landscape with four interconnected peaks. The name \u0026ldquo;Siguniang\u0026rdquo; originates from Tibetan transliteration: Standard Tibetan: སྐུ་བླ་, Romanized: Sku—Skuladur (signifying \u0026ldquo;Mountain Guardian Deity\u0026rdquo;). With four distinct peaks, local Han Chinese later misinterpreted \u0026ldquo;Sigu\u0026rdquo; as Chinese, transforming it into \u0026ldquo;Siguniang\u0026rdquo; (Four Girls Mountain)1. From eldest sister to youngest, while familial rank diminishes, mountaineering challenges intensify. Since 1981, merely 41 individuals have conquered the youngest sister peak2. Ranking these four peaks by climbing difficulty reveals Siguniang Mountain\u0026rsquo;s progression mirrors four tiers of elite global mountaineering routes. Image, summarized using Google AI\r","date":"2025-07-30","heading":"The Mountain Guardian Deity","objectID":"/en/posts/sgns/:1:1","tags":["Travel"],"title":"Siguniang Mountain: A Hiking Journey at the Foot of Snow-Capped Peaks","uri":"/en/posts/sgns/#the-mountain-guardian-deity"},{"categories":["Travel"],"collections":[],"content":"Route Selection\rCurrently, Siguniang Mountain offers three common tourist or hiking routes: Shuangqiao Valley: Commercial development level 90%, suitable for all ages, mainly featuring canyon rafting. Changping Valley: Commercial development level 50%, featuring canyons, snow mountains, and primeval forests. It\u0026rsquo;s one of China\u0026rsquo;s classic hiking routes, requiring a guide beyond the Muluozi3 scenic spot. Haizi Valley: Commercial development level 20%, not suitable for non-professional hiking enthusiasts. Most people spend two days and one night. When choosing Shuangqiao Valley, you can stay inside the scenic area for an extra day. Beyond these three routes, there\u0026rsquo;s the free Maobiliang viewpoint. Climbing up at dusk allows you to witness the \u0026ldquo;Golden Mountain Sunset\u0026rdquo;—the evening glow bathing Siguniang Mountain\u0026rsquo;s glaciers. Each route is one-way, so you only need to manage your overall time, not consult a map. Source: Backpacker Inn, https://www.backpackers.com.tw/forum/showthread.php?t=10606664#post12439890|668\r","date":"2025-07-30","heading":"Route Selection","objectID":"/en/posts/sgns/:1:2","tags":["Travel"],"title":"Siguniang Mountain: A Hiking Journey at the Foot of Snow-Capped Peaks","uri":"/en/posts/sgns/#route-selection"},{"categories":["Travel"],"collections":[],"content":"Changping Valley\r","date":"2025-07-30","heading":"Changping Valley","objectID":"/en/posts/sgns/:2:0","tags":["Travel"],"title":"Siguniang Mountain: A Hiking Journey at the Foot of Snow-Capped Peaks","uri":"/en/posts/sgns/#changping-valley"},{"categories":["Travel"],"collections":[],"content":"How to Explore\rAccommodation outside the scenic area is typically near Siguniangshan Town (close to the visitor center). In Siguniangshan Town, the cheapest hot meal is 15 yuan tofu rice. This image shows a corner outside the Siguniang Mountain scenic area\rStarting at 7:40 AM, you can wait at the visitor center for the sightseeing bus, which begins circulating at 8 AM to transport visitors to the Changping Valley entrance. Image\rThe route is divided into boardwalks and horse trails. Horse trails allow paid horseback riding. Non-professional hikers typically reach Muluozi as their farthest point, taking about 4 hours, then return. Horses at Siguniang Mountain\rRecommended 8:00-13:00: Walk the boardwalks, savor the deep valleys and serene forests, and enjoy proper rest and viewing at the endpoint. Recommended 13:00-16:00: Return via the horse trails. Although you don\u0026rsquo;t need to ride horses, the horse trails are flatter and easier to walk. My step count for the day is shown below. Looking back, this number seems quite auspicious: WeChat step count for reference only\r","date":"2025-07-30","heading":"How to Explore","objectID":"/en/posts/sgns/:2:1","tags":["Travel"],"title":"Siguniang Mountain: A Hiking Journey at the Foot of Snow-Capped Peaks","uri":"/en/posts/sgns/#how-to-explore"},{"categories":["Travel"],"collections":[],"content":"Scenery\rSnow-capped mountains, canyons, primeval forests I visited during Sichuan\u0026rsquo;s warmest average temperature period, yet Siguniang Mountain\u0026rsquo;s permafrost remained steadfast. Upon entering, distant, majestic snow-capped peaks shimmer with crystalline light, while lush greenery carpets the slopes below. One can readily comprehend why this \u0026ldquo;sacred mountain\u0026rdquo; holds such profound significance for local communities. Snow mountains at the entrance\rMelting snow and ice water slowly flows down, nourishing the primeval forest below. Note that you should leave the boardwalk-free primeval forest section before 3 PM and the forest section with boardwalks before 5 PM because bears are present. Trees lie haphazardly in piles, merging with the earth and each other through moss and lichen. Forest and river in the boardwalk section\rImage\rIcy meltwater from the snow mountains converges into rivers, dancing playfully through stone crevices. Clouds serve as the ever-changing skirts of the snow mountain goddess, while converging rivers form graceful emerald ribbons cascading from her hem. Image\rSuspended springs and waterfalls cascade between them; withered trees and rugged stones complement each other delightfully. Chongchong Waterfall\rImage\rAt the entrance, majestic snow-capped mountains rise before you, with lush forests carpeting the slopes beneath. Venturing along boardwalks into verdant depths, admiring crystalline streams and cascading waterfalls, you feel the snow mountains\u0026rsquo; watchful presence as you draw nearer. As flanking mountains gradually recede and a rustic wooden gate materializes, you\u0026rsquo;ve arrived at Muluozi. Suddenly, the landscape unfolds dramatically—it\u0026rsquo;s ambiguous whether mountains pierce the heavens or skies cradle the emerald peaks. Cattle and sheep graze contentedly nearby, and the snow mountains appear more benevolent than ever. Snow mountains at Muluozi, right at the endpoint when you look up, with stunning scenery ahead\rAs mountains retreat, expansive plains unfurl, with glaciers standing sentinel alongside. This landscape evokes an earthly paradise. Experiencing this profound emotional transition—from distant snow mountains and narrow, shadowed boardwalks to snow mountains towering before you and sweeping open plains—constitutes the very soul of this hiking journey. Be careful with these yaks—they can attack, so don\u0026rsquo;t get too close\r","date":"2025-07-30","heading":"Scenery","objectID":"/en/posts/sgns/:2:2","tags":["Travel"],"title":"Siguniang Mountain: A Hiking Journey at the Foot of Snow-Capped Peaks","uri":"/en/posts/sgns/#scenery"},{"categories":["Travel"],"collections":[],"content":"Important Notes\r","date":"2025-07-30","heading":"Important Notes","objectID":"/en/posts/sgns/:3:0","tags":["Travel"],"title":"Siguniang Mountain: A Hiking Journey at the Foot of Snow-Capped Peaks","uri":"/en/posts/sgns/#important-notes"},{"categories":["Travel"],"collections":[],"content":"Temperature and Clothing\rI visited during Sichuan\u0026rsquo;s warmest average temperature period, when Siguniang Mountain temperatures range around 14-24°C. However, temperature variations at high altitudes are more extreme—it can drop to 8°C during morning rain and rise to 26°C under afternoon sunshine. Therefore, long sleeves and pants suitable for mid-to-late autumn are recommended for versatility. For a two-day, one-night trip, no special sun protection is needed—just a hat will suffice. To combat low blood sugar, consider bringing a bottle of cola to drink along the way. For a day trip covering approximately 15 kilometers round trip, proper hiking shoes are highly recommended. ","date":"2025-07-30","heading":"Temperature and Clothing","objectID":"/en/posts/sgns/:3:1","tags":["Travel"],"title":"Siguniang Mountain: A Hiking Journey at the Foot of Snow-Capped Peaks","uri":"/en/posts/sgns/#temperature-and-clothing"},{"categories":["Travel"],"collections":[],"content":"Air Pressure and Altitude Sickness\rPersonally, I didn\u0026rsquo;t purchase any oxygen bottles or take any related medications. While running and hurrying didn\u0026rsquo;t cause specific discomfort, I still experienced some reactions: Reference Huawei smartwatch data (values for reference only): Smartwatch values are for reference only and don\u0026rsquo;t represent rigorous medical measurements\rMy usual awake blood oxygen level is around 99%, with sleep blood oxygen around 96%. After ascending the mountain, my awake blood oxygen dropped to around 96%, with sleep blood oxygen around 86%. The yellow section in the image shows my sleep situation on the mountain. Upon waking, I indeed felt some chest pressure. After descending at 10 PM, my awake blood oxygen returned from 96% to 99%. Bread brought along, crazily expanded due to pressure difference\r","date":"2025-07-30","heading":"Air Pressure and Altitude Sickness","objectID":"/en/posts/sgns/:3:2","tags":["Travel"],"title":"Siguniang Mountain: A Hiking Journey at the Foot of Snow-Capped Peaks","uri":"/en/posts/sgns/#air-pressure-and-altitude-sickness"},{"categories":["Travel"],"collections":[],"content":"Budget\rRound-trip transportation from Chengdu: relatively inexpensive options around 120 yuan. Scenic area ticket (includes shuttle bus from visitor center to scenic area): 90 yuan. Cheapest accommodation: 60 yuan per night. Food: Personally chose two 20-yuan yak beef noodle soups + bread + found a 65-yuan double meal set in Siguniangshan Town. You can basically stay within 400 yuan. Adding some food purchases along the way, staying under 500 yuan is more than sufficient. ","date":"2025-07-30","heading":"Budget","objectID":"/en/posts/sgns/:3:3","tags":["Travel"],"title":"Siguniang Mountain: A Hiking Journey at the Foot of Snow-Capped Peaks","uri":"/en/posts/sgns/#budget"},{"categories":["Travel"],"collections":[],"content":"Weather and Lighting\rSince snow mountain vistas constitute this hiking route\u0026rsquo;s primary allure, overcast or rainy conditions can diminish your experience\u0026rsquo;s value by half while significantly elevating risk factors. I was fortunate—during my ascent, glorious sunshine prevailed, with rain commencing only toward my journey\u0026rsquo;s conclusion. The left image below shows the clear morning weather with snow mountains clearly visible. The right image shows the same location during my return, where distant snow mountains were completely obscured by clouds and mist. During our return, there were three road landslides along the route (cleared by the time we passed) and one traffic accident. As shown in the images, we had perfect sunny weather during our ascent with snow mountains visible throughout, but rain began during our return, completely burying the snow mountains in dark clouds. Weather determines viewing quality. Left image shows clear morning weather during ascent; right image shows rainy conditions beginning during descent. Both locations are at the entrance visitor center\rSee Wikipedia\u0026#160;\u0026#x21a9;\u0026#xfe0e; Only 41 successful summits in 40 years: Revealing why Siguniang Mountain\u0026rsquo;s youngest sister peak is \u0026ldquo;difficult to climb\u0026rdquo;\u0026#160;\u0026#x21a9;\u0026#xfe0e; For amateur hikers and ordinary tourists, Muluozi is the endpoint\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2025-07-30","heading":"Weather and Lighting","objectID":"/en/posts/sgns/:3:4","tags":["Travel"],"title":"Siguniang Mountain: A Hiking Journey at the Foot of Snow-Capped Peaks","uri":"/en/posts/sgns/#weather-and-lighting"},{"categories":["Software Tools"],"collections":["Stata Empirical Tools"],"content":"With the rise of the \u0026ldquo;building an independent knowledge system\u0026rdquo; trend, Chinese journals\u0026rsquo; typesetting requirements are getting stricter1 — for example, table variables can\u0026rsquo;t contain English names. And there\u0026rsquo;s the long-standing requirement that figures use SimSun for Chinese and Times for English. Stata\u0026rsquo;s graph box only supports setting one font uniformly, so the Chinese and English fonts need to be set separately in the code. ","date":"2025-07-07","heading":"","objectID":"/en/posts/stata_font/:0:0","tags":["Stata"],"title":"Setting Chinese and English Fonts in Stata Figures","uri":"/en/posts/stata_font/#"},{"categories":["Software Tools"],"collections":["Stata Empirical Tools"],"content":"Coefficient Plots and Mixed Chinese-English Fonts\rUse the local macro command to store the font commands. local zh1 `\"fontface \"SimSun\":\"' // SimSun local en1 `\"fontface \"times\":\"' // times\rThen apply the corresponding settings in the graph, for example: title(`\"{`zh1' 模拟数据中}{`en1' x}{`zh1'与六个}{`en1' y}{`zh1'的回归系数}\"', size(medium))\rThe concrete code: Generate six y variables Generate one x variable Regress the six y variables on x (six regressions) Visualize the coefficients The plot style is stcolor, the new default style added in Stata 18. I personally like the fully-enclosing frame2. I\u0026rsquo;d recommend setting both the label and font size to medium; otherwise it\u0026rsquo;s hard to see when you later combine figures. clear set seed 20250707 set obs 1000 * explanatory variable x gen x = rnormal(0, 1) * six dependent variables y1–y6 (each with a coefficient close to 0) gen y1 = 0.01*x + rnormal(0, 1) gen y2 = -0.02*x + rnormal(0, 1) gen y3 = 0.015*x + rnormal(0, 1) gen y4 = -0.005*x + rnormal(0, 1) gen y5 = 0.012*x + rnormal(0, 1) gen y6 = 0.00*x + rnormal(0, 1) local ys y1 y2 y3 y4 y5 y6 foreach y of local ys { reg `y' x estimates store m_`y' } local zh1 `\"fontface \"SimSun\":\"' // Chinese font local en1 `\"fontface \"times\":\"' // English and number font * draw the figure coefplot /// (m_y1, rename(x = `\"{`zh1' 被解释变量1}\"')) /// (m_y2, rename(x = `\"{`zh1' 被解释变量2}\"')) /// (m_y3, rename(x = `\"{`zh1' 被解释变量3}\"')) /// (m_y4, rename(x = `\"{`zh1' 被解释变量4}\"')) /// (m_y5, rename(x = `\"{`zh1' 被解释变量5}\"')) /// (m_y6, rename(x = `\"{`zh1' 被解释变量6}\"')), /// keep(x) /// drop(_cons) /// horizontal /// xline(0, lcolor(red) lpattern(solid) lwidth(vthin)) /// xlabel(-0.15(0.05)0.15, labsize(medium) grid glcolor(gs12) format(%4.2f)) /// ylabel( /// 1 `\"{`zh1'变量一}\"' /// 2 `\"{`zh1'变量二}\"' /// 3 `\"{`zh1'变量三}\"' /// 4 `\"{`zh1'变量四}\"' /// 5 `\"{`zh1'变量五}\"' /// 6 `\"{`zh1'变量六}\"', /// labsize(medium) nogrid) /// ytitle(\"\", margin(small)) /// xtitle(`\"{`en1' (a)}{`zh1' 系数可视化}\"', size(medium) margin(medium)) /// title(`\"{`zh1' 模拟数据中}{`en1' x}{`zh1'与六个}{`en1' y}{`zh1'的回归系数}\"', size(medium)) /// legend(off) /// scheme(stcolor) /// recast(scatter) /// ciopts(recast(rcap) lcolor(black) lwidth(vthin)) /// graphregion(color(white) lcolor(black) lwidth(vthin)) /// plotregion(lcolor(black) lwidth(vthin))\rAs shown, this kind of figure is often used in exogeneity tests and heterogeneity tests\rIf the above approach fails\rStata\u0026rsquo;s Chinese support is really poor. So even after using the method above, your English might all come out in SimSun, or the Chinese might still be in Hei. That\u0026rsquo;s because the system hasn\u0026rsquo;t truly recognized the fonts. In that case, as shown below, first open a graph and, under Edit - Preferences - Fonts, set each part of the figure to the font you want. After that, running it again should be recognized properly.\rAs shown\rThis kind of visualization test is becoming more common. For example, is a city policy (a 0/1 binary variable) an exogenous shock3? You regress policy adoption on variables like city GDP, city population, and city economic growth rate — variables that are exogenous to the study and represent city characteristics. The theoretical meaning of the regression coefficient is then the average difference between pilot and non-pilot cities; if it\u0026rsquo;s insignificant, the difference is small, which to some extent tests whether the policy\u0026rsquo;s implementation is exogenous4. Another issue with mixed Chinese-English typesetting is that the Times font sits a bit higher (for example, the x, y, and (a) in the figure titles), so it\u0026rsquo;s best to avoid mixing Chinese and English in titles. If you want to show different coefficient terms across multiple regressions, just use the keep command to limit the coefficients: clear set obs 1000 set seed 20250707 * generate explanatory variables x1-x3 forvalues i = 1/3 { gen x`i' = rnormal(0, 1) } * generate dependent variables y1-y4, with coefficients randomly close to 0 gen y1 = 0.01*x1 - 0.02*x2 ","date":"2025-07-07","heading":"Coefficient Plots and Mixed Chinese-English Fonts","objectID":"/en/posts/stata_font/:1:0","tags":["Stata"],"title":"Setting Chinese and English Fonts in Stata Figures","uri":"/en/posts/stata_font/#coefficient-plots-and-mixed-chinese-english-fonts"},{"categories":["Software Tools"],"collections":["Stata Empirical Tools"],"content":"Side Discussion: Do Different Disciplines Plot Differently?\rMy roommate is in electronic information engineering, and every time he sees my regression figures he wonders how a paper can get published with such plain graphs. But honestly, compared with all the fancy figures in biostatistics, information statistics, and health statistics, the most complex figure in economics — aside from GIS — is probably the coefficient plot in an event study; the rest is just big tables. Even aesthetics have involution now?\rStill, there does seem to be a trend — coefficient plots are becoming more and more common. Now look at the economics articles published in Nature and Science. Many of my teachers complain these papers couldn\u0026rsquo;t get into a top economics journal, yet they make it into Nature and Science — does that mean the discipline of economics is falling apart? I personally think they\u0026rsquo;re exploiting interdisciplinarity, and environmental and resource economics is especially good at cashing in on this bonus. The figure styles in these papers are also completely different, closer to the plotting style and analytical paradigm of science and engineering. Example: Ageing threatens sustainability of smallholder farming in China, published in Nature5. This paper uses a panel model with survey data from over 30,000 rural households in China to explore the relationship between rural population aging (the share of household members over 65) and agricultural sustainability. It selects nine indicators to describe agricultural sustainability, including farm size, farmer education, labor productivity, total agricultural input and output, cost-profit margin, machinery input, fertilizer input, and fertilizer use efficiency (FUE). As shown, Ageing threatens sustainability of smallholder farming in China, published in Nature\rAs shown, Ageing threatens sustainability of smallholder farming in China, published in Nature\rExample 2: Climate policies that achieved major emission reductions: Global evidence from two decades, published in Science (There are plenty more similar Chinese environmental-economics papers out there) This paper conducts a global, systematic ex-post evaluation to identify the policy combinations that achieved major emission reductions among 1,500 climate policies implemented in 41 countries across six continents from 1998 to 2022. Our approach combines a comprehensive climate policy database with a machine-learning-based extension of the common difference-in-differences method. We identify 63 successful policy interventions, with total reductions of between 0.6 and 1.8 billion metric tons of CO2. Our insights into effective but rarely studied policy combinations highlight the important role of price-based instruments in well-designed policy mixes, and the policy effort needed to close the emissions gap. As shown, Climate policies that achieved major emission reductions: Global evidence from two decades, published in Science\rMany universities are now raising the reward level for Chinese-language publications and lowering it for English-language ones.\u0026#160;\u0026#x21a9;\u0026#xfe0e; A teacher once told me the figure frames should be very thin, because thick ones look bad in print — though most top journals I\u0026rsquo;ve seen use thick outer borders. Either way, I\u0026rsquo;d recommend a medium font size to balance clarity and looks.\u0026#160;\u0026#x21a9;\u0026#xfe0e; The exclusion restriction of instrumental variables and the exogeneity of explanatory variables are getting more attention, and tests of random assignment are becoming more common.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Of course, this is only a test of a necessary condition — all econometric tests are necessary conditions, not sufficient ones. That\u0026rsquo;s why some people think econometrics is just a discipline of persuasion, convincing people that something might be a sufficient condition by piling up countless necessary conditions.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Science and Nature papers have always been very short, so","date":"2025-07-07","heading":"Side Discussion: Do Different Disciplines Plot Differently?","objectID":"/en/posts/stata_font/:2:0","tags":["Stata"],"title":"Setting Chinese and English Fonts in Stata Figures","uri":"/en/posts/stata_font/#side-discussion-do-different-disciplines-plot-differently"},{"categories":["Economic Studies"],"collections":[],"content":" The market is by no means a simple concept, and its definition should not be too broad. Equally important is recognizing that the \u0026ldquo;correct\u0026rdquo; definition of the market depends on how the concept is used. ——Jean Marcel Tirole, The Theory of Industrial Organization Antitrust is widely regarded as a matter of justice. Yet once we enter the actual sea of markets, where countless firms compete, merge, maneuver, and collide, the very meaning of monopoly becomes far more complicated than it first appears. How should monopoly be defined? What kinds of monopoly ought to be restrained? This essay records a set of reflections drawn from coursework in industrial economics. The first half briefly reviews the economic foundations of monopoly; the second half turns to reforms in China\u0026rsquo;s antitrust law. ","date":"2025-05-01","heading":"","objectID":"/en/posts/fld/:0:0","tags":["Monopoly","Industrial Economics"],"title":"What Are We Really Opposing When We Fight Monopoly?","uri":"/en/posts/fld/#"},{"categories":["Economic Studies"],"collections":[],"content":"Review of Basic Economic Knowledge\r","date":"2025-05-01","heading":"Review of Basic Economic Knowledge","objectID":"/en/posts/fld/:1:0","tags":["Monopoly","Industrial Economics"],"title":"What Are We Really Opposing When We Fight Monopoly?","uri":"/en/posts/fld/#review-of-basic-economic-knowledge"},{"categories":["Economic Studies"],"collections":[],"content":"What is Monopoly?\rIn practice, monopoly usually appears in several broad forms: Natural Monopoly: Monopoly generated by cost subadditivity, meaning that a single large-scale producer can operate more efficiently, with lower average costs, than several firms producing simultaneously. In practice, this often appears where resources are scarce or economies of scale are strong. A firm may lower costs by integrating upstream and downstream businesses or by acquiring strategically scarce resources. A contemporary example is the platform economy. Platform industries often have high fixed costs in infrastructure and very low marginal costs for serving additional users. Once a platform has invested heavily in infrastructure, it has every incentive to keep expanding, because doing so reduces average cost. This is why industries with natural-monopoly characteristics, such as electricity, gas, telecommunications, and long-distance transportation, are often directly controlled by the state or subject to price regulation. This is why Coase contemplated that the origin of firms might stem from transaction costs—achieving transactions requires additional costs, and corporate entities help reduce transaction costs. Natural monopoly reduces average costs through corporate expansion. Administrative Monopoly: The state grants a firm exclusive rights to produce a particular good or provide a particular service. Resource Monopoly: Key resources are owned by a single enterprise. An Interesting Historical Story\rThere was once a very popular childhood board game, Monopoly. Players roll dice, buy and sell property, and try to accumulate wealth. The original purpose of the game, however, was not to glorify monopoly but to illustrate its harms. Image\r","date":"2025-05-01","heading":"What is Monopoly?","objectID":"/en/posts/fld/:1:1","tags":["Monopoly","Industrial Economics"],"title":"What Are We Really Opposing When We Fight Monopoly?","uri":"/en/posts/fld/#what-is-monopoly"},{"categories":["Economic Studies"],"collections":[],"content":"Causes of Monopoly\rTo understand monopoly is also to understand firms. Because firms pursue profit maximization, they are naturally drawn toward market power, collusion, and strategic exclusion. Monopoly therefore offers one important lens through which to study how markets actually operate. It is also a topic with no single definitive framework; even today there remains room for new models, new explanations, and more unified ways of thinking about how monopoly arises. Cost Subadditivity: This may arise from technological conditions or from economies of scale. Resource Control: The crucial resource need not be natural. In today\u0026rsquo;s economy, for example, Tencent\u0026rsquo;s social platforms command enormous user resources. The social dimension of Honor of Kings depends heavily on those network resources, and premium liquor brands such as Moutai enjoy strong bargaining power over downstream markets. Administrative Causes: Government policy can create or reinforce monopoly, whether through licensing systems, price controls, or other forms of regulatory privilege. Corporate Collusion: In empirical research, it is often important to consider the interaction among several causes at once. Government policy, for example, may induce or stabilize collusion. One of Tirole\u0026rsquo;s major contributions was to bring game theory deeply into the analysis of market competition, thereby advancing industrial organization as a field. Historical Causes: Sometimes a firm gains advantage simply because it was first to establish a favorable industry standard. What is now called the first-mover economy can also be understood as historical contingency or an extension of first-mover advantage. The diamond industry is a classic case: not merely a story of marketing, but of an early dominant firm shaping the very way the market came to function. ","date":"2025-05-01","heading":"Causes of Monopoly","objectID":"/en/posts/fld/:1:2","tags":["Monopoly","Industrial Economics"],"title":"What Are We Really Opposing When We Fight Monopoly?","uri":"/en/posts/fld/#causes-of-monopoly"},{"categories":["Economic Studies"],"collections":[],"content":"The Good and Bad of Monopoly\rWhy break monopolies? Do all monopolies need to be broken? The central normative goal of antitrust is the maximization of social welfare, or more broadly, the maximization of efficiency. In perfectly competitive markets, equilibrium corresponds to $MC=P$. In monopoly markets, the profit maximization condition for firms is: $MC=MR$. Pricing above marginal cost and output below the level corresponding to social welfare maximization are considered inefficient. Image, source: Varian\u0026rsquo;s Microeconomic Analysis\rBut does monopoly have no positive side at all? Not necessarily. The patent system, for example, is a form of limited monopoly, and under some conditions such monopoly can stimulate innovation. This gives rise to a familiar inverted-U style debate: how much monopoly power promotes innovation, and at what point does it begin to suppress it? At the level of patent design, questions such as the length of protection, filing costs, and the scope of protection all remain open and important. In perfectly competitive markets, firms have no pricing power; price is exogenous to the firm. Under monopoly or market power, however, firms acquire some control over pricing, which naturally raises the issue of price discrimination. Although the term often carries a negative connotation in ordinary language, in economics it refers to a pricing strategy. In some settings, if price discrimination expands the volume of trade, it may even raise social welfare. ","date":"2025-05-01","heading":"The Good and Bad of Monopoly","objectID":"/en/posts/fld/:1:3","tags":["Monopoly","Industrial Economics"],"title":"What Are We Really Opposing When We Fight Monopoly?","uri":"/en/posts/fld/#the-good-and-bad-of-monopoly"},{"categories":["Economic Studies"],"collections":[],"content":"Monopoly Behavior\rPrice: Includes price discrimination (first-degree price, second-degree quantity, third-degree object preference). Market Power: Can be subdivided with many hypotheses: consumer market or producer market? Products or factors? Homogeneous or heterogeneous products? Upstream or downstream? Domestic or international market? Price leadership or quantity leadership? What is the sequence of the game? Is the game static or dynamic? Does it involve information asymmetry? In periods of economic slowdown, the transmission of market power and cost pressures has increasingly become a major research topic. ","date":"2025-05-01","heading":"Monopoly Behavior","objectID":"/en/posts/fld/:1:4","tags":["Monopoly","Industrial Economics"],"title":"What Are We Really Opposing When We Fight Monopoly?","uri":"/en/posts/fld/#monopoly-behavior"},{"categories":["Economic Studies"],"collections":[],"content":"How Governments Combat Monopoly: A Brief Discussion of Antitrust Law\rGovernments typically respond to monopoly through a mix of price controls, merger review, taxation, fines, administrative sanctions, and antitrust law. The earliest antitrust law in the United States was the Sherman Antitrust Act. China\u0026rsquo;s first antitrust case was the 2008 Coca-Cola Acquisition of Huiyuan Incident. Huiyuan, a major domestic private firm, wanted to sell itself to Coca-Cola. Chinese public opinion was broadly reluctant to see a well-known domestic brand sold abroad, while much of the international commentary argued that blocking the deal showed China to be excessively strict in regulating market conduct. How to Define Monopoly and Antitrust\rWhen should we prevent corporate mergers? When should we consider a company to hold a monopoly position? Must companies in monopoly positions always be targeted?\rIn the end, Chinese regulators judged the transaction to involve monopoly concerns. After the deal collapsed, Huiyuan\u0026rsquo;s stock price fell sharply and the firm\u0026rsquo;s operating condition continued to deteriorate. Chinese economist Lang Xianping memorably argued that Coca-Cola lost because it was too arrogant. ","date":"2025-05-01","heading":"How Governments Combat Monopoly: A Brief Discussion of Antitrust Law","objectID":"/en/posts/fld/:2:0","tags":["Monopoly","Industrial Economics"],"title":"What Are We Really Opposing When We Fight Monopoly?","uri":"/en/posts/fld/#how-governments-combat-monopoly-a-brief-discussion-of-antitrust-law"},{"categories":["Economic Studies"],"collections":[],"content":"What Are We Opposing in Antitrust?\rIn 2009, the Ministry of Commerce of the People\u0026rsquo;s Republic of China issued Announcement No. 22 of 2019 regarding the Coca-Cola acquisition of Huiyuan case: After the concentration, Coca-Cola Company would have the ability to extend its dominant position in the carbonated soft drink market to the juice beverage market, producing exclusionary and restrictive competitive effects on existing juice beverage enterprises, thereby harming the legitimate rights and interests of beverage consumers. Brand is a key factor affecting effective competition in the beverage market. After the concentration, Coca-Cola Company, by controlling the two well-known juice brands \u0026ldquo;Minute Maid\u0026rdquo; and \u0026ldquo;Huiyuan,\u0026rdquo; would significantly enhance its control over the juice market. Combined with its existing dominant position in the carbonated beverage market and corresponding transmission effects, the concentration would significantly raise barriers for potential competitors to enter the juice beverage market. The concentration squeezes the survival space of domestic small and medium-sized juice enterprises, inhibits domestic enterprises\u0026rsquo; ability to participate in competition and engage in independent innovation in the juice beverage market, adversely affects the effective competitive landscape of China\u0026rsquo;s juice beverage market, and is detrimental to the sustainable and healthy development of China\u0026rsquo;s juice industry. The core principle reflected here is simple: antitrust targets monopoly behavior, not monopoly position as such. From the standpoint of basic economics, there are two broad ways to judge whether a firm is monopolistic. Market Share. If a company becomes a behemoth in the market, we can consider it a monopoly. Monopoly Behavior. Our concern is that when a company\u0026rsquo;s share is sufficiently large, it may cause harm to other enterprises or consumers. The worry is not the monopoly position itself, but the monopoly behavior that may arise in the future. But how large must market share be before we are willing to call it monopoly? The 2001 U.S. case United States v. Microsoft Corp., for example, treated Microsoft\u0026rsquo;s bundling of Internet Explorer with Windows as monopolistic conduct in the browser wars. Microsoft\u0026rsquo;s defense was that Internet Explorer was a feature of the operating system, not a separate product. Ultimately, Microsoft was still found guilty of monopoly, though the federal government and Microsoft reached some compromises. If Internet Explorer were treated merely as one more feature of the operating system, then Microsoft\u0026rsquo;s operating-system share alone would not settle the monopoly question. This illustrates why market share by itself is often too crude a standard. Market share is itself hard to calculate, because it depends on how one defines the relevant market. In the Coca-Cola/Huiyuan case, China effectively relied on a market definition centered on \u0026ldquo;carbonated soft drinks.\u0026rdquo; There are other examples in China, such as Moutai and Wuliangye. Article 14 of the Antimonopoly Law explicitly prohibits business operators and trading counterparts from \u0026ldquo;reaching agreements that restrict the minimum price for resale to third parties.\u0026rdquo; The evidence that Wuliangye and Moutai constituted monopoly was: Wuliangye and Moutai issued marketing supervision and handling notices stating: A very small number of Wuliangye brand operators and Wuliangye specialty stores acted willfully, disregarding rules, ignoring the overall situation, and lacking broad perspective, engaging in low-price, cross-regional, cross-channel improper sales of Wuliangye. From the perspective of Moutai and Wuliangye, they were engaged in normal price negotiations as manufacturers with downstream distributors, combining their production costs for pricing. Other distilleries also had their own stipulated prices, representing normal market competition behavior. http://p","date":"2025-05-01","heading":"What Are We Opposing in Antitrust?","objectID":"/en/posts/fld/:2:1","tags":["Monopoly","Industrial Economics"],"title":"What Are We Really Opposing When We Fight Monopoly?","uri":"/en/posts/fld/#what-are-we-opposing-in-antitrust"},{"categories":["Economic Studies"],"collections":[],"content":"Defects of Market Share as a Monopoly Standard\rAs these cases show, once market share is used as the central standard, everything turns on market definition. Different concepts yield different shares, which makes a unified standard difficult to sustain. Two Nobel laureates, Friedman and Krugman, explicitly opposed the Microsoft monopoly case, viewing it as government interference harming market freedom. The corresponding theoretical basis is a Chicago School concept—\u0026quot;Contestable Market.\u0026quot; Suppose there is a market with a single firm holding 100 percent of market share, but barriers to entry are low and rival firms can enter and exit at little cost. In that case, antitrust intervention may be unnecessary. Likewise, if a firm arrived at its position through ordinary technological progress and does not use that position to block the technological progress of others, then its monopoly position alone need not be condemned. Historically, such cases may have been rare, but in the digital economy they are no longer hard to imagine. Tencent, for example, occupies an overwhelming share of China\u0026rsquo;s social-software market, yet because barriers to entry in internet-based social products are relatively low, monopoly in the strict antitrust sense is not automatic. The same logic helps explain why JD.com has recently challenged Meituan: for JD.com, its logistics infrastructure and platform-based model mean that entry barriers are significant but not insurmountable. However, the contestable market theory also has drawbacks. For instance, firms might first use below-cost pricing to capture market share, then raise prices. Lei Jun once criticized his subordinates, saying what he wanted was not profit but market share. This strategy involves using low prices to capture the market first, then gaining dominance, which is why international trade opposes dumping. Another example: Due to geographical factors, Shanxi people favor Fenjiu liquor. Should such substantial market share be subject to antitrust action? ","date":"2025-05-01","heading":"Defects of Market Share as a Monopoly Standard","objectID":"/en/posts/fld/:2:2","tags":["Monopoly","Industrial Economics"],"title":"What Are We Really Opposing When We Fight Monopoly?","uri":"/en/posts/fld/#defects-of-market-share-as-a-monopoly-standard"},{"categories":["Economic Studies"],"collections":[],"content":"Antitrust Law\rFinally, consider the broader reform of China\u0026rsquo;s antitrust framework. Before 2008, China had no dedicated antitrust law and relied mainly on anti-unfair-competition rules and consumer-protection law for related enforcement. Anti-Monopoly Law of the People\u0026rsquo;s Republic of China (2022 Amendment) Article 1: This Law is enacted to prevent and restrain monopoly conduct, protect fair market competition, encourage innovation, improve economic operational efficiency, safeguard consumer interests and social public interests, and promote the healthy development of the socialist market economy. The relationship between monopoly and innovation follows an inverted U-shape. The 2022 amendment added \u0026ldquo;encourage innovation\u0026rdquo; as an objective in the general provisions. Article 1 also clearly states that antitrust opposes monopoly behavior, not position. Article 3: Monopoly conduct as referred to in this Law includes: (1) Monopoly agreements reached between business operators; (2) Abuse of dominant market position by business operators; (3) Concentrations of business operators that have or may have effect of eliminating or restricting competition. The concept of concentration of business operators is thought-provoking, also involving the qualitative direction of industrial chains. Article 6: Business operators may, through fair competition and voluntary association, implement concentration according to law, expand business scale, and enhance market competitiveness. Article 7: Business operators with dominant market positions shall not abuse such positions to eliminate or restrict competition. Clarifies that antitrust opposes monopoly behavior, not position. At least monopoly positions driven by innovative technology are not problematic. Subsequent provisions also allow exemptions for reasons involving foreign trade, crisis rescue, and social responsibility. Article 8: For industries where the state-owned economy holds a controlling position and are related to national economic lifelines and national security, as well as industries legally subject to exclusive operation and monopoly sales, the state protects the lawful business activities of their operators, and exercises supervision and regulation over their business conduct and the prices of their commodities and services according to law, safeguarding consumer interests and promoting technological progress. State-monopolized industries possess special characteristics. Article 9: Business operators shall not use data and algorithms, technology, capital advantages, platform rules, etc., to engage in monopoly conduct prohibited by this Law. Special background of the digital economy era. Article 24: Under any of the following circumstances, a business operator may be presumed to have a dominant market position: (1) The market share of one business operator in the relevant market reaches one-half; (2) The combined market share of two business operators in the relevant market reaches two-thirds; (3) The combined market share of three business operators in the relevant market reaches three-fourths. Quantitative standards for monopoly position. The Coca-Cola and Huiyuan acquisition case standards relate to this. Article 25: Concentration of business operators refers to the following circumstances: (1) Merger of business operators; (2) A business operator acquiring control over other business operators by obtaining equity or assets; (3) A business operator acquiring control over other business operators or being able to exert decisive influence on other business operators through contracts or other means. Concentration of business operators. Subsequent provisions also exclude equity situations and subsidiary-related companies. Article 27: Under any of the following circumstances, concentration of business operators need not be declared to the State Council\u0026rsquo;s anti-monopoly enforcement agency: (1) One business operator participating in the concentration holds more t","date":"2025-05-01","heading":"Antitrust Law","objectID":"/en/posts/fld/:3:0","tags":["Monopoly","Industrial Economics"],"title":"What Are We Really Opposing When We Fight Monopoly?","uri":"/en/posts/fld/#antitrust-law"},{"categories":["Economic Studies"],"collections":[],"content":"Summary\rWhy is monopoly such a central topic in industrial organization? Because industrial economics begins from the logic of profit maximization. Firms\u0026rsquo; objectives shape how they compete, cooperate, exclude, collude, and negotiate. Once government and social welfare enter the analysis, the structure of market interaction becomes much clearer. So what are we really opposing when we oppose monopoly? In one sentence: we oppose monopoly behavior, not monopoly position in itself. Monopoly becomes a legal and economic problem when a firm possesses market power, occupies a dominant position, and abuses that position to distort market outcomes. We have become accustomed to denouncing monopoly, yet many questions remain unsettled. How large is \u0026ldquo;too large\u0026rdquo;? What hidden distortions do policies themselves create? Antitrust still leaves enormous room for inquiry. In this sense, monopoly often resembles a cycle in which dragon-slayers become dragons in turn. That is precisely why it remains such a powerful key to understanding market behavior. ","date":"2025-05-01","heading":"Summary","objectID":"/en/posts/fld/:4:0","tags":["Monopoly","Industrial Economics"],"title":"What Are We Really Opposing When We Fight Monopoly?","uri":"/en/posts/fld/#summary"},{"categories":["Economic Studies"],"collections":[],"content":"New Issues in the Digital Economy Era\r","date":"2025-05-01","heading":"New Issues in the Digital Economy Era","objectID":"/en/posts/fld/:5:0","tags":["Monopoly","Industrial Economics"],"title":"What Are We Really Opposing When We Fight Monopoly?","uri":"/en/posts/fld/#new-issues-in-the-digital-economy-era"},{"categories":["Economic Studies"],"collections":[],"content":"Involution\rIn this context, involution can be understood in at least two ways: Increased input, decreased output (diminishing returns to scale) Increased input, decreased product quality (quality, technology, materials, etc.) Are the price wars produced by involution a monopoly problem? Not necessarily. Price wars are still, in one sense, market competition. The key question is what kind of equilibrium they produce. In an ideal setting, price competition should generate differentiation, expand product variety, and encourage innovation. If involution\u0026rsquo;s price wars lack the step of differentiated competition, they represent undesirable competitive outcomes. ","date":"2025-05-01","heading":"Involution","objectID":"/en/posts/fld/:5:1","tags":["Monopoly","Industrial Economics"],"title":"What Are We Really Opposing When We Fight Monopoly?","uri":"/en/posts/fld/#involution"},{"categories":["Economic Studies"],"collections":[],"content":"Platform Economy\rIf Meituan forces users or merchants into exclusivity, that plainly raises monopoly concerns. But if Ele.me holds only 30 percent of the market and still imposes exclusivity, should we call that monopoly too? This is why digital markets and platform economies require analysis beyond the framework of traditional physical markets. Older monopoly analysis focuses mainly on power between firms or platforms. What increasingly matters now is power within the platform itself: between the platform and merchants, between the platform and users, and between the platform and consumers. The power dynamics among platforms, operators, users, and consumers. ","date":"2025-05-01","heading":"Platform Economy","objectID":"/en/posts/fld/:5:2","tags":["Monopoly","Industrial Economics"],"title":"What Are We Really Opposing When We Fight Monopoly?","uri":"/en/posts/fld/#platform-economy"},{"categories":["Commentary"],"collections":[],"content":"A recent high-profile legal case has attracted widespread attention: \u0026ldquo;Shanxi Datong 'Engagement Rape Case'.\u0026rdquo; While the apparent controversy centers on the question of marital rape following engagement—undoubtedly wrongful conduct—the question remains: why do online debates persist? The fundamental issue is that the two opposing factions are actually debating at different conceptual levels. From an economic perspective, this case reveals two particularly interesting phenomena: The two sides are fundamentally addressing different issues at different analytical levels. Gender significantly influences the cognitive framework through which each party approaches the problem. This dimension warrants careful consideration. ","date":"2025-04-20","heading":"","objectID":"/en/posts/sfjs-en/:0:0","tags":["Law and Economics"],"title":"Shanxi Datong Engagement Case Second Trial: An Economic Perspective on Judicial Spirit and Execution","uri":"/en/posts/sfjs-en/#"},{"categories":["Commentary"],"collections":[],"content":"The Supportive Perspective: Ex Ante \u0026ldquo;Judicial Spirit\u0026rdquo; and Legal Principles\rThe core judicial principles of this case are as follows1: Presiding Judge: Sexual intercourse with women cannot violate their will, regardless of whether the parties are engaged. Presiding Judge: The state vigorously advocates for the integration of socialist core values and excellent traditional Chinese culture into social life. The trial of this case demonstrates the clear stance and firm position of the People\u0026rsquo;s Court in lawfully protecting women\u0026rsquo;s rights and interests and punishing criminal acts. From the perspective of supporters and the presiding judge, the controversy is whether non-consensual sexual conduct after engagement constitutes a violation. In this context, classifying it as illegal is unequivocal. The spirit of the law provides ex ante constraints on our behavior. What should be done, what should not be done, and how society can develop better—all these are reflected in the forward-looking moral concepts emphasized in social sciences2. The constraint here is that regardless of engagement status, marital status, or relationship dynamics, we should maintain sufficient respect toward our partners. However, from the current judicial system, the law has not truly implemented genuine judicial fairness in such cases. In terms of terminology, male rape cases are not adequately considered. Rape violates human rights, not merely women\u0026rsquo;s rights. Without this principle, what is primarily protected is \u0026ldquo;objectified chastity\u0026rdquo;3. The judicial terminology used here is \u0026ldquo;violation of women\u0026rsquo;s will,\u0026rdquo; but rape should not be limited by gender. This linguistic limitation creates the first controversy, diverting the discussion to the issue of betrothal gifts. ","date":"2025-04-20","heading":"The Supportive Perspective: Ex Ante \u0026ldquo;Judicial Spirit\u0026rdquo; and Legal Principles","objectID":"/en/posts/sfjs-en/:1:0","tags":["Law and Economics"],"title":"Shanxi Datong Engagement Case Second Trial: An Economic Perspective on Judicial Spirit and Execution","uri":"/en/posts/sfjs-en/#the-supportive-perspective-ex-ante-judicial-spirit-and-legal-principles"},{"categories":["Commentary"],"collections":[],"content":"The Opposition Perspective: Ex Post \u0026ldquo;Judicial Execution\u0026rdquo; and Procedural Concerns\rAdditional note: In Chinese judicial cases, a second trial reversal is relatively rare, especially in cases involving public security and prosecution. Court second trial reversal rate is extremely low, which defies judicial norms Source: Caixin News\rConsidering the particular nature of rape cases4, their adjudication differs from other types of cases: Physical evidence over testimonial evidence? Presumption of innocence? Regarding Procedural Justice\rRegarding procedural justice, I recall a personal experience that illustrates these tensions. During comprehensive evaluations, competition participation scores and award scores were calculated separately, with upper limits established for both categories. When my award scores reached the maximum allowable limit, I sought to transfer one award point to a participation point. The class committee, however, ruled against this transfer, insisting that I provide formal documentation of participation (the school issued separate certificates for both participation and awards). The complication arose because my proof of participation had been misplaced, leading the committee to conclude that the award certificate could not procedurally validate my participation! 😅 This experience frequently comes to mind when I observe distortions in execution processes. It demonstrates that equilibrium exists across multiple dimensions: flexibility, precision, and cost-efficiency. The judicial system often faces the challenge of making necessary compromises among these competing elements. The most troublesome aspect of such cases—protecting procedural justice is highly susceptible to distortion. The discretionary space regarding when testimonial evidence outweighs physical evidence is enormous. The opposition expresses concern about moral hazards arising ex post, which should be understood as information asymmetry5. Given the elevated importance of testimonial evidence during judicial execution, the cost-benefit calculus for attempting to frame male defendants in such cases becomes fundamentally imbalanced. In particular, these cases involve significant information asymmetry: What evidence can prove women\u0026rsquo;s consent? This is already extremely difficult. It should be noted that in this case, there was a complete evidence chain. As we know, economics papers are constantly criticized for endogeneity in causal inference. But if we need to establish a unified standard? How much evidence is required to prove something? We may never know.\rPost-fact moral hazard refers to: Will women\u0026rsquo;s mentality change after learning about this type of adjudication? This moral hazard is also difficult to guarantee. ","date":"2025-04-20","heading":"The Opposition Perspective: Ex Post \u0026ldquo;Judicial Execution\u0026rdquo; and Procedural Concerns","objectID":"/en/posts/sfjs-en/:2:0","tags":["Law and Economics"],"title":"Shanxi Datong Engagement Case Second Trial: An Economic Perspective on Judicial Spirit and Execution","uri":"/en/posts/sfjs-en/#the-opposition-perspective-ex-post-judicial-execution-and-procedural-concerns"},{"categories":["Commentary"],"collections":[],"content":"Why Gender Influences Thinking Perspectives?\rSynthesizing these perspectives, the answer becomes clear—if rape cases are classified solely as violations of women\u0026rsquo;s rights rather than fundamental human rights violations, while the judicial spirit may appear correct on the surface, the practical effect of judicial execution becomes problematic. In such framework, the system tends to protect objectified notions of chastity rather than genuinely safeguard women\u0026rsquo;s rights. This context naturally leads to the overvaluation of testimonial evidence credibility while simultaneously increasing moral hazards, thereby creating position-based conflicts of interest. Prospect Theory; Why Cancer Insurance Rates Are So High\rWhy do people tend to purchase cancer insurance with extremely low incidence rates? Because people tend to imagine what would happen if they had cancer. That is, they always use the outcome of having cancer as their reference point.\rAs for how much evidence is required to convince someone of a crime? At least in this case, it involves prospect theory6—women worry about being violated in the future, while men worry about being falsely accused. For female respondents, the evocative nature of the case generates higher empathy levels, and the available evidence proves sufficient to convince them of the shared experiential reality. Their cognitive reference point typically centers on \u0026ldquo;what would happen if I were in the same situation\u0026rdquo; (adverse selection). In contrast, male respondents exhibit greater concern about \u0026ldquo;what is the risk of being falsely accused\u0026rdquo; (moral hazard). Historically, verdicts in male rape cases have been disproportionately influenced by cultural values. However, as societal openness and legal consciousness continue to evolve, this concern should diminish in significance. In this particular case, additional corroborating evidence exists, and I maintain considerable confidence in China\u0026rsquo;s public security and judicial institutions. It is worth noting that the defendant in this case did, In practice, admit to the criminal acts in question. Despite the controversies inherent in such cases, the process of debate and legal discourse remains essential. As the philosophical adage suggests, truth often emerges through the dialectical process of uncertainty, and these arguments enable us to address each case on its individual merits while advancing our collective understanding of justice. What are the legal grounds for Xi?？\u0026rsquo;s conviction of rape? Does the plaintiff\u0026rsquo;s constitute fraudulent marriage? Shanxi \u0026amp;#34;Engagement Rape Case\u0026amp;#34; Presiding Judge\u0026amp;#39;s Response\u0026#160;\u0026#x21a9;\u0026#xfe0e; However, the legality of capital punishment and abortion remains a subject of ongoing debate\u0026#160;\u0026#x21a9;\u0026#xfe0e; Dongyan Lao: The cacophony of voices in Shanxi Datong engagement rape case\u0026#160;\u0026#x21a9;\u0026#xfe0e; The cost of destroying evidence is low while obtaining physical evidence is extremely difficult\u0026#160;\u0026#x21a9;\u0026#xfe0e; Ex ante information asymmetry leads to adverse selection, where inferior quality drives out superior quality (Gresham\u0026rsquo;s Law)\u0026#160;\u0026#x21a9;\u0026#xfe0e; Each individual has a reference point when making judgments.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2025-04-20","heading":"Why Gender Influences Thinking Perspectives?","objectID":"/en/posts/sfjs-en/:3:0","tags":["Law and Economics"],"title":"Shanxi Datong Engagement Case Second Trial: An Economic Perspective on Judicial Spirit and Execution","uri":"/en/posts/sfjs-en/#why-gender-influences-thinking-perspectives"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":" Finding simplicity amid chaos — Einstein Nature is full of magic. Random assignment makes natural experiments possible, and it is one of the foundational stones from which causal inference springs1. It is generally held that random assignment averages out the bias related to the explanatory variable, thereby yielding treatment and control groups with good properties. In 2022, an instrumental-variable idea based on random assignment began to appear more and more frequently in the top-five economics journals. ","date":"2025-04-01","heading":"","objectID":"/en/posts/judge_iv/:0:0","tags":["Causal Inference"],"title":" Judge IV (Examiner Designs): Causal Inference via Random Assignment","uri":"/en/posts/judge_iv/#"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Development\rAn example: In a large standardized exam we pray we\u0026rsquo;ll get a kind grader. When applying for a loan we pray we\u0026rsquo;ll meet a lenient examiner. When traveling we pray we\u0026rsquo;ll meet a kind passerby. The random assignment of fate is full of magic: some people really are randomly assigned to more lenient examiners, and so their fate diverges from that of the people randomly assigned to strict examiners. This is the core causal idea of Judge_IV: first quantify how strict these examiners are, then compare the later development of the groups randomly assigned to their hands, and thus obtain a kind of causal inference based on random assignment. Judge leniency IV designs: Now not just for Crime Studies ——David McKenzie JUDGE–IV can also be called Examiner Designs, or Judge leniency IV designs. The idea of this kind of instrumental variable originated in descriptive statistics, when people tallied the grading and ruling tendencies of different teachers and different judges and found significant differences. In 2006 a paper directly used this instrumental variable for testing. As shown\rThe construction of the instrumental variable is very simple, and similar to the construction of other instrumental variables2 — a de-meaned mean expectation. Since 2018, studies have continually extended this method. This measure focuses on the examiner\u0026rsquo;s strictness. Simply put, it is the probability of {pass, fail}. The de-meaned mathematical expectation ranges between 0 and 1 and is used to measure strictness. That is to say, as long as you have randomly assigned examiners and a directional outcome, you can try using Judge IV. For example, whether a domestic-violence investigator chooses to take the child away; ambulance companies in the U.S. are randomly assigned, but their prices vary and can have different effects in a rescue; some mortgage examiners are careless and pass loan applications very easily\u0026hellip; ","date":"2025-04-01","heading":"Development","objectID":"/en/posts/judge_iv/:1:0","tags":["Causal Inference"],"title":" Judge IV (Examiner Designs): Causal Inference via Random Assignment","uri":"/en/posts/judge_iv/#development"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Empirical Analysis\rDefine the explanatory variable $D_i$: it represents the direction of the examiner\u0026rsquo;s decision, 1 for pass and 0 for fail. Define the instrumental variable $Z_{a_{\\{-i\\}} }$: it represents the pass rate of the examiner\u0026rsquo;s other cases excluding the current one. The two-stage regression is then: $$ \\text{First stage:}D_i=Z_{a(-i)}\\pi\u0026#43;\\nu_i $$ $$ \\text{Second stage:}Y_i=\\alpha\u0026#43;\\delta D_i\u0026#43;\\epsilon_i $$\rComparability: What is the economic meaning of the coefficient?\rThe difference in later development of the reviewed subjects after being randomly assigned to examiners of different inclinations. Written in the form of a moment estimator, the instrumental variable can be seen as a kind of sample weight (a special moment condition in the GMM framework), and what is compared here is the difference in behavior among those assigned to judges of similar strictness. This is also similar in effect to sample matching. An ordinary IV cannot test a variable\u0026rsquo;s exclusion restriction and monotonicity and can only supplement them through theoretical exposition, but Judge IV\u0026rsquo;s advantage is that it can test the instrument\u0026rsquo;s monotonicity and exclusion restriction through experimental design3. ","date":"2025-04-01","heading":"Empirical Analysis","objectID":"/en/posts/judge_iv/:2:0","tags":["Causal Inference"],"title":" Judge IV (Examiner Designs): Causal Inference via Random Assignment","uri":"/en/posts/judge_iv/#empirical-analysis"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Random Assignment\rExample One\rRegress sample characteristics on the instrumental variable or the explanatory variable; if the coefficients are insignificant, or the F-test does not pass, it shows that sample characteristics do not intervene in the explanatory variable, that is, the explanatory variable is exogenous. In \u0026ldquo;Feedback and Learning: The Causal Effects of Reversals on Judicial Decision-Making,\u0026rdquo; the authors regress case characteristic variables on the reversal direction of the case (the instrumental variable); all are insignificant, verifying random assignment. That is, the case outcome is unrelated to the judge\u0026rsquo;s characteristics, and each case is randomly assigned to a different judge. Random assignment also proves the instrument\u0026rsquo;s exclusion restriction. A judge randomly draws a case and rules on it, cutting off factors other than the judge\u0026rsquo;s own temperament (for example, trading power for money). As shown\rAbove, the explanatory variable is regressed on other characteristics, and random assignment is tested through the F-test. Example Two\rThe 2025 Sloan award-winning doctoral dissertation below studies the random assignment of lawyers: poor defendants are randomly assigned to public- and private-organization defense lawyers. Using lawyer characteristics as an instrumental variable and regressing them on assignment type, the economic coefficients are close to 0 and insignificant, showing little difference between groups and thus random assignment. As shown\r","date":"2025-04-01","heading":"Random Assignment","objectID":"/en/posts/judge_iv/:2:1","tags":["Causal Inference"],"title":" Judge IV (Examiner Designs): Causal Inference via Random Assignment","uri":"/en/posts/judge_iv/#random-assignment"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Random Assignment\rExample One\rRegress sample characteristics on the instrumental variable or the explanatory variable; if the coefficients are insignificant, or the F-test does not pass, it shows that sample characteristics do not intervene in the explanatory variable, that is, the explanatory variable is exogenous. In \u0026ldquo;Feedback and Learning: The Causal Effects of Reversals on Judicial Decision-Making,\u0026rdquo; the authors regress case characteristic variables on the reversal direction of the case (the instrumental variable); all are insignificant, verifying random assignment. That is, the case outcome is unrelated to the judge\u0026rsquo;s characteristics, and each case is randomly assigned to a different judge. Random assignment also proves the instrument\u0026rsquo;s exclusion restriction. A judge randomly draws a case and rules on it, cutting off factors other than the judge\u0026rsquo;s own temperament (for example, trading power for money). As shown\rAbove, the explanatory variable is regressed on other characteristics, and random assignment is tested through the F-test. Example Two\rThe 2025 Sloan award-winning doctoral dissertation below studies the random assignment of lawyers: poor defendants are randomly assigned to public- and private-organization defense lawyers. Using lawyer characteristics as an instrumental variable and regressing them on assignment type, the economic coefficients are close to 0 and insignificant, showing little difference between groups and thus random assignment. As shown\r","date":"2025-04-01","heading":"Example One","objectID":"/en/posts/judge_iv/:2:1","tags":["Causal Inference"],"title":" Judge IV (Examiner Designs): Causal Inference via Random Assignment","uri":"/en/posts/judge_iv/#example-one"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Random Assignment\rExample One\rRegress sample characteristics on the instrumental variable or the explanatory variable; if the coefficients are insignificant, or the F-test does not pass, it shows that sample characteristics do not intervene in the explanatory variable, that is, the explanatory variable is exogenous. In \u0026ldquo;Feedback and Learning: The Causal Effects of Reversals on Judicial Decision-Making,\u0026rdquo; the authors regress case characteristic variables on the reversal direction of the case (the instrumental variable); all are insignificant, verifying random assignment. That is, the case outcome is unrelated to the judge\u0026rsquo;s characteristics, and each case is randomly assigned to a different judge. Random assignment also proves the instrument\u0026rsquo;s exclusion restriction. A judge randomly draws a case and rules on it, cutting off factors other than the judge\u0026rsquo;s own temperament (for example, trading power for money). As shown\rAbove, the explanatory variable is regressed on other characteristics, and random assignment is tested through the F-test. Example Two\rThe 2025 Sloan award-winning doctoral dissertation below studies the random assignment of lawyers: poor defendants are randomly assigned to public- and private-organization defense lawyers. Using lawyer characteristics as an instrumental variable and regressing them on assignment type, the economic coefficients are close to 0 and insignificant, showing little difference between groups and thus random assignment. As shown\r","date":"2025-04-01","heading":"Example Two","objectID":"/en/posts/judge_iv/:2:1","tags":["Causal Inference"],"title":" Judge IV (Examiner Designs): Causal Inference via Random Assignment","uri":"/en/posts/judge_iv/#example-two"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Visualizing the First-Stage Regression\rMonotonicity Test 1: Average Monotonicity\rThe first-stage regression tests monotonicity and relevance at the same time. $$ \\text{First stage:}D_i=Z_{a(-i)}\\pi\u0026#43;\\nu_i $$ The coding idea is: first use the Frisch–Waugh–Lovell theorem to regress the explanatory variable and the instrumental variable separately on control variables such as fixed effects, standardize the residuals, and then use the residuals for local linear fitting (the Stata command is lpoly). The results from \u0026ldquo;Examiner and Judge Designs in Economics: A Practitioner\u0026rsquo;s Guide\u0026rdquo; are shown below. It studies the relationship between judges of different inclinations and whether incarceration is chosen. NATIONAL BUREAU OF ECONOMIC RESEARCH|499\rThe horizontal axis is the standardized instrumental-variable residual, measuring the examiner\u0026rsquo;s strictness. The vertical axis is the residual of the corresponding explanatory variable (the review outcome of the specific event). The local fit takes the shape of a positively correlated straight line and passes the test. This test generally uses a second-degree polynomial local regression. What if the result is a continuous negatively-correlated straight line — does it pass?\rThe answer is no — a positive correlation and a relatively smooth straight-line trend are both indispensable. A positive fitted coefficient means that when a case is assigned to a stricter (or more lenient) examiner, the probability of failing (or passing) is correspondingly higher. The fitted coefficient further back must be higher than the one further ahead, to show that a case that would pass in a lenient judge\u0026rsquo;s hands is not easily passed in a strict judge\u0026rsquo;s hands. A positive coefficient not only verifies the relevance between the explanatory variable and the dependent variable, but also verifies the monotonicity of the pass rate across judges. Monotonicity Test 2: Multi-Peaked Preferences\rA judge should not be strict with some types of cases and lenient with others. One can try classifying cases by type and by severity and running the first-stage regression test. The grouping angles demonstrated in \u0026ldquo;Judging Judge Fixed Effects\u0026rdquo; are case type and case severity. \u0026ldquo;Judging Judge Fixed Effects\u0026rdquo;\r","date":"2025-04-01","heading":"Visualizing the First-Stage Regression","objectID":"/en/posts/judge_iv/:2:2","tags":["Causal Inference"],"title":" Judge IV (Examiner Designs): Causal Inference via Random Assignment","uri":"/en/posts/judge_iv/#visualizing-the-first-stage-regression"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Visualizing the First-Stage Regression\rMonotonicity Test 1: Average Monotonicity\rThe first-stage regression tests monotonicity and relevance at the same time. $$ \\text{First stage:}D_i=Z_{a(-i)}\\pi\u0026#43;\\nu_i $$ The coding idea is: first use the Frisch–Waugh–Lovell theorem to regress the explanatory variable and the instrumental variable separately on control variables such as fixed effects, standardize the residuals, and then use the residuals for local linear fitting (the Stata command is lpoly). The results from \u0026ldquo;Examiner and Judge Designs in Economics: A Practitioner\u0026rsquo;s Guide\u0026rdquo; are shown below. It studies the relationship between judges of different inclinations and whether incarceration is chosen. NATIONAL BUREAU OF ECONOMIC RESEARCH|499\rThe horizontal axis is the standardized instrumental-variable residual, measuring the examiner\u0026rsquo;s strictness. The vertical axis is the residual of the corresponding explanatory variable (the review outcome of the specific event). The local fit takes the shape of a positively correlated straight line and passes the test. This test generally uses a second-degree polynomial local regression. What if the result is a continuous negatively-correlated straight line — does it pass?\rThe answer is no — a positive correlation and a relatively smooth straight-line trend are both indispensable. A positive fitted coefficient means that when a case is assigned to a stricter (or more lenient) examiner, the probability of failing (or passing) is correspondingly higher. The fitted coefficient further back must be higher than the one further ahead, to show that a case that would pass in a lenient judge\u0026rsquo;s hands is not easily passed in a strict judge\u0026rsquo;s hands. A positive coefficient not only verifies the relevance between the explanatory variable and the dependent variable, but also verifies the monotonicity of the pass rate across judges. Monotonicity Test 2: Multi-Peaked Preferences\rA judge should not be strict with some types of cases and lenient with others. One can try classifying cases by type and by severity and running the first-stage regression test. The grouping angles demonstrated in \u0026ldquo;Judging Judge Fixed Effects\u0026rdquo; are case type and case severity. \u0026ldquo;Judging Judge Fixed Effects\u0026rdquo;\r","date":"2025-04-01","heading":"Monotonicity Test 1: Average Monotonicity","objectID":"/en/posts/judge_iv/:2:2","tags":["Causal Inference"],"title":" Judge IV (Examiner Designs): Causal Inference via Random Assignment","uri":"/en/posts/judge_iv/#monotonicity-test-1-average-monotonicity"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Visualizing the First-Stage Regression\rMonotonicity Test 1: Average Monotonicity\rThe first-stage regression tests monotonicity and relevance at the same time. $$ \\text{First stage:}D_i=Z_{a(-i)}\\pi\u0026#43;\\nu_i $$ The coding idea is: first use the Frisch–Waugh–Lovell theorem to regress the explanatory variable and the instrumental variable separately on control variables such as fixed effects, standardize the residuals, and then use the residuals for local linear fitting (the Stata command is lpoly). The results from \u0026ldquo;Examiner and Judge Designs in Economics: A Practitioner\u0026rsquo;s Guide\u0026rdquo; are shown below. It studies the relationship between judges of different inclinations and whether incarceration is chosen. NATIONAL BUREAU OF ECONOMIC RESEARCH|499\rThe horizontal axis is the standardized instrumental-variable residual, measuring the examiner\u0026rsquo;s strictness. The vertical axis is the residual of the corresponding explanatory variable (the review outcome of the specific event). The local fit takes the shape of a positively correlated straight line and passes the test. This test generally uses a second-degree polynomial local regression. What if the result is a continuous negatively-correlated straight line — does it pass?\rThe answer is no — a positive correlation and a relatively smooth straight-line trend are both indispensable. A positive fitted coefficient means that when a case is assigned to a stricter (or more lenient) examiner, the probability of failing (or passing) is correspondingly higher. The fitted coefficient further back must be higher than the one further ahead, to show that a case that would pass in a lenient judge\u0026rsquo;s hands is not easily passed in a strict judge\u0026rsquo;s hands. A positive coefficient not only verifies the relevance between the explanatory variable and the dependent variable, but also verifies the monotonicity of the pass rate across judges. Monotonicity Test 2: Multi-Peaked Preferences\rA judge should not be strict with some types of cases and lenient with others. One can try classifying cases by type and by severity and running the first-stage regression test. The grouping angles demonstrated in \u0026ldquo;Judging Judge Fixed Effects\u0026rdquo; are case type and case severity. \u0026ldquo;Judging Judge Fixed Effects\u0026rdquo;\r","date":"2025-04-01","heading":"Monotonicity Test 2: Multi-Peaked Preferences","objectID":"/en/posts/judge_iv/:2:2","tags":["Causal Inference"],"title":" Judge IV (Examiner Designs): Causal Inference via Random Assignment","uri":"/en/posts/judge_iv/#monotonicity-test-2-multi-peaked-preferences"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Points Still Worth Discussing\rJudge IV\u0026rsquo;s construction is very simple, but whether it can be used in a specific setting4 and how to test it are still worth discussing — especially the monotonicity of the instrument. Must an examiner design be a discrete variable? Can it not be a continuous one? How would negative weights affect the estimates5? What if an event has multiple examiners?6 Where does Judge IV\u0026rsquo;s asymptotic requirement show up? Should one focus on the number of times a subject is reviewed, or on the examiner\u0026rsquo;s number of cases? Personally I think both sample sizes matter. Haven\u0026rsquo;t many people had this thought? If at some moment we had met someone else, would our lives have turned out differently? Random assignment always makes me think about the relationship between chance and necessity. Necessity within chance — someone is bound to win the lottery; it is only by chance that the winner is you. Once we know about random assignment, how should we regard fate? For a person, should they choose the upper bound of chance, or the lower bound of the mean7? ","date":"2025-04-01","heading":"Points Still Worth Discussing","objectID":"/en/posts/judge_iv/:3:0","tags":["Causal Inference"],"title":" Judge IV (Examiner Designs): Causal Inference via Random Assignment","uri":"/en/posts/judge_iv/#points-still-worth-discussing"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Recommended References\r","date":"2025-04-01","heading":"Recommended References","objectID":"/en/posts/judge_iv/:4:0","tags":["Causal Inference"],"title":" Judge IV (Examiner Designs): Causal Inference via Random Assignment","uri":"/en/posts/judge_iv/#recommended-references"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Course Materials\rFor now, reference materials outside journal papers on Judge IV are relatively scarce: A Causal Inference Method You May Never Use in Your Life: The Lenient-Judge Instrumental Variable A blog post by a World Bank economist writing for the Development Economics column I particularly recommend following their econometric-techniques topics column. A Yale PhD teaching assistant\u0026rsquo;s course (econometrics topics) ","date":"2025-04-01","heading":"Course Materials","objectID":"/en/posts/judge_iv/:4:1","tags":["Causal Inference"],"title":" Judge IV (Examiner Designs): Causal Inference via Random Assignment","uri":"/en/posts/judge_iv/#course-materials"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Some AER Papers Discussing Judge IV\rMonotonicity among Judges: Evidence from Judicial Panels and Consequences for Judge IV Designs (AER, 2026) Judging judge fixed effects (AER, 2023) We can view the development of econometrics along two lines: optimization and causal inference. Optimization is about how to enhance the consistency of measurement; causal inference makes us think about how to design the experimental process.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Some ideas for finding instruments: relationships of relationships, distant historical variables, averaging, growth rates, and combinations of the preceding. For example, the shift-share instrumental variable is a de-meaned average plus a growth rate.\u0026#160;\u0026#x21a9;\u0026#xfe0e; All econometric tests test necessary conditions rather than sufficient ones.\u0026#160;\u0026#x21a9;\u0026#xfe0e; At present the relatively mature testing setting is judicial data, but the paradigm for other settings still has no settled answer.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Bhuller M, Sigstad H. 2SLS with multiple treatments[J]. Journal of Econometrics, 2024, 242(1): 105785.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Chyn E, Frandsen B, Leslie E C. Examiner and Judge Designs in Economics: A Practitioner\u0026rsquo;s Guide[R]. National Bureau of Economic Research, 2024.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Actually these aspects are more related to the theory of uncertainty.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2025-04-01","heading":"Some AER Papers Discussing Judge IV","objectID":"/en/posts/judge_iv/:4:2","tags":["Causal Inference"],"title":" Judge IV (Examiner Designs): Causal Inference via Random Assignment","uri":"/en/posts/judge_iv/#some-aer-papers-discussing-judge-iv"},{"categories":["Reading"],"collections":[],"content":" For a class presentation: some of the mathematical derivation details in The Origin of Rich Species. ","date":"2025-03-25","heading":"","objectID":"/en/posts/mess/:0:0","tags":["Economic History"],"title":" A Malthusian Two-Sector Model","uri":"/en/posts/mess/#"},{"categories":["Reading"],"collections":[],"content":"A Bounty on the Question\rThe doctoral dissertation of the author of The Origin of Rich Species hopes to be readable even by high school students; here I only introduce a simplified version of the classical model. This book was written to refute the mainstream Malthusian mechanism. The charm of macroeconomic history and economic growth lies in shaping a view of history through simple models. Wu Lemin\u0026rsquo;s The Origin of Rich Species argues that Malthus\u0026rsquo;s explanation of the Malthusian trap is wrong, so what is the real cause of the Malthusian trap? The bounty for rebuttal is as follows: As shown, reasonable challenges, rebuttals, and improvements can win prizes\r","date":"2025-03-25","heading":"A Bounty on the Question","objectID":"/en/posts/mess/:1:0","tags":["Economic History"],"title":" A Malthusian Two-Sector Model","uri":"/en/posts/mess/#a-bounty-on-the-question"},{"categories":["Reading"],"collections":[],"content":"The Malthusian Narrative\r","date":"2025-03-25","heading":"The Malthusian Narrative","objectID":"/en/posts/mess/:2:0","tags":["Economic History"],"title":" A Malthusian Two-Sector Model","uri":"/en/posts/mess/#the-malthusian-narrative"},{"categories":["Reading"],"collections":[],"content":"Malthus is the founding father of the population–resources–environment field.\rThe Malthusian Trap\rWhen society becomes rich, people have more children; When society becomes poor, people have fewer children. In the end per capita income settles at a level. By the same logic, when the growth of production cannot keep up with population growth, disaster follows. As shown\r","date":"2025-03-25","heading":"Malthus is the founding father of the population–resources–environment field.","objectID":"/en/posts/mess/:2:1","tags":["Economic History"],"title":" A Malthusian Two-Sector Model","uri":"/en/posts/mess/#malthus-is-the-founding-father-of-the-populationresourcesenvironment-field"},{"categories":["Reading"],"collections":[],"content":"A Growth Narrative\rIn the long history of economic growth, only one thing seems to have happened — the Industrial Revolution. — Gregory Clark (Gregory Clark) As shown\rAs shown\rAs shown, from Wikipedia: the Great Divergence, the Needham Puzzle, and the Weber Question.\rWas per capita real income in the Ming dynasty really the same as in the Song dynasty? If prosperity is perfect, why can it not last? Why does history always oscillate between democracy and non-democracy? Why could the Industrial Revolution break the Malthusian trap? Can a single unified model describe the whole history of economic growth? ","date":"2025-03-25","heading":"A Growth Narrative","objectID":"/en/posts/mess/:2:2","tags":["Economic History"],"title":" A Malthusian Two-Sector Model","uri":"/en/posts/mess/#a-growth-narrative"},{"categories":["Reading"],"collections":[],"content":"The Two-Sector Model\rFirst analyze sectoral progress and social welfare. As shown\rWhy does the author define the population-balance line as this shape?\rOnly survival is considered. To survive, people must have agricultural products, but not necessarily industrial goods. What if the population-balance line is a vertical line?\rThat is the single-sector Malthusian case, so the distinct properties of the two sectors are the core idea that generalizes this model.\rThe case where both sectors progress at the same time: As shown\rThe case where only the industrial sector progresses: Only the industrial sector expands, while the rest shrinks in equal proportion. As shown\rOnly the industrial sector expands, while the rest shrinks in equal proportion. As shown\rChanging Preferences By analogy with the moon and sixpence, let\u0026rsquo;s now turn industry and agriculture into two sectors: utility and survival. The utility sector: art, literature, roses\u0026hellip; The survival sector: national defense, engineering, rice\u0026hellip; As shown\rPeople prefer utility goods, so the fertility rate temporarily deviates (to the lower side), raising social welfare. A personal reflection\rI personally admire this two-sector improvement. Its conclusion also fits historical trends: as history develops, the pursuits of art, beauty, and spirit can all be seen as utility goods, and in fact human civilization has always attached increasing importance to utility goods beyond survival. At the same time, the pursuit of utility goods may be at odds with the reproduction of civilization. For example, pursuing a dream and giving up marriage, giving up the survival\u0026rsquo;s fivepence for the moon in the sky, and mistreating one\u0026rsquo;s body for the sake of appearance. The Origin of Rich Species makes the same assumption about reproduction as The Selfish Gene: genes prompt us to care about the continuation of our genes, but we do not deliberately calculate the probability of reproducing. Factors affecting the increase of social welfare: The rate of progress of the utility-goods and survival-goods sectors. The preference structure. Per capita consumption (the population-balance line) ","date":"2025-03-25","heading":"The Two-Sector Model","objectID":"/en/posts/mess/:3:0","tags":["Economic History"],"title":" A Malthusian Two-Sector Model","uri":"/en/posts/mess/#the-two-sector-model"},{"categories":["Reading"],"collections":[],"content":"An Algebraic Proof of the Model (the Simple Case)\r$$ \\max U(x,y)=x^{1-\\beta}y^\\beta $$$$ \\begin{cases} \\text{Survival sector:}X=AL_A^{1-\\gamma_A}H_A^{\\gamma_A} \\\\\\\\ \\text{Utility sector:}Y=BL_B^{1-\\gamma_B}H_B^{\\gamma_B} \\end{cases} $$","date":"2025-03-25","heading":"An Algebraic Proof of the Model (the Simple Case)","objectID":"/en/posts/mess/:4:0","tags":["Economic History"],"title":" A Malthusian Two-Sector Model","uri":"/en/posts/mess/#an-algebraic-proof-of-the-model-the-simple-case"},{"categories":["Reading"],"collections":[],"content":"Assumption 1: $\\gamma_A=\\gamma_B\\equiv\\gamma\u0026lt;1$ (if relaxed)\rWhat the assumption means\rBeing less than 1 is for diminishing marginal returns. Equality means population shrinkage delivers the same shock to both sectors (the factor contribution rate). $$ \\max U(x,y)=x^{1-\\beta}y^\\beta $$$$ \\begin{cases} \\text{Survival sector:}\u0026amp;X=AL_1^{1-\\gamma}H_1^\\gamma\\\\\\\\ \\text{Utility sector:}\u0026amp;Y=BL_2^{1-\\gamma}H_2^\\gamma\\\\\\\\ \\text{Land:}\u0026amp;L_1\u0026#43;L_2=L\\\\\\\\ \\text{Labor:}\u0026amp;H_1\u0026#43;H_2=H\u0026amp; \\end{cases} $$ Next, solve: backward induction — social decision — utility — product — factors. What needs to be decided is how many factors each product consumes. $$L_2=L-L_1,\\quad H_2=H-H_1$$$$ U=(AL_1^{1-\\gamma}H_1^{\\gamma})^{1-\\beta}[B(L-L_1)^{1-\\gamma}(H-H_1)^{\\gamma}]^{\\beta} $$ Taking logs makes it simpler to handle: $$ V=(1-\\beta)\\left[\\ln A\u0026#43;(1-\\gamma)\\ln L_1\u0026#43;\\gamma\\ln H_1\\right]\u0026#43;\\beta\\left[\\ln B\u0026#43;(1-\\gamma)\\ln\\left(L-L_1\\right)\u0026#43;\\gamma\\ln\\left(H-H_1\\right)\\right] $$ Optimization means the partial derivative is 0. $$ \\frac{\\partial V}{\\partial L_1}=\\frac{(1-\\gamma)(1-\\beta)}{L_1}-\\frac{(1-\\gamma)\\beta}{L-L_1}=0 $$ $$ L_1^\\*=(1-\\beta)L,\\quad L_2^\\*=\\beta L $$ Likewise, $$ \\frac{\\partial V}{\\partial H_1}=\\frac{\\gamma(1-\\beta)}{H_1}-\\frac{\\gamma\\beta}{H-H_1}=0 $$ $$H_1^\\*=(1-\\beta)H,\\quad H_2^\\*=\\beta H$$ After deciding the factors, next substitute into the product decision $X=AL_1^{1-\\gamma}H_1^\\gamma$. $$ \\begin{aligned}X^{\\*}\u0026amp;=A\\left(L_{1}^{\\*}\\right)^{1-\\gamma}(H_{1}^{\\*})^{\\gamma}=A[(1-\\beta)L]^{1-\\gamma}[(1-\\beta)H]^{\\gamma}\\\\\\\\\u0026amp;=A\\left(1-\\beta\\right)L^{1-\\gamma}H^{\\gamma}\\end{aligned} $$ For the per capita level, divide by H again, $$ \\begin{aligned} x\u0026amp;=A(1-\\beta)\\left(\\frac{H}{L}\\right)^{\\gamma-1} \\\\\\\\ y\u0026amp;=B\\beta\\left(\\frac{H}{L}\\right)^{\\gamma-1} \\end{aligned} $$ After the product decision, substitute into the utility $U=x^{1-\\beta}y^{\\beta}$, $$ \\begin{aligned}\\mathrm{U}\u0026amp;=A\\left(\\frac{H}{L}\\right)^{\\gamma-1}\\left(\\frac{B}{A}\\right)^\\beta(1-\\beta)^{1-\\beta}\\beta^\\beta\\\\\\\\\u0026amp;=x\\left(\\frac{B}{A}\\right)^\\beta\\left(\\frac{\\beta}{1-\\beta}\\right)^\\beta\\end{aligned} $$\rWhy factor out x\rWhy factor out x? Malthus\u0026rsquo;s assumption proceeds from per capita grain, that is, the equilibrium of per capita output.\r","date":"2025-03-25","heading":"Assumption 1: $\\gamma_A=\\gamma_B\\equiv\\gamma\u0026lt;1$ (if relaxed)","objectID":"/en/posts/mess/:4:1","tags":["Economic History"],"title":" A Malthusian Two-Sector Model","uri":"/en/posts/mess/#assumption-1--if-relaxed"},{"categories":["Reading"],"collections":[],"content":"Assumption 2: $g_H\\equiv\\frac{\\dot{H}}{H}=n=\\delta\\left(\\ln x-\\ln\\bar{x}\\right)$\rA description of the Malthusian trap. Differential equations — the relationship between a derivative and a value — the relationship between an increment and a stock — dynamic equations. $\\bar{x}$ is the average level of survival-goods consumption that keeps the population unchanged. ","date":"2025-03-25","heading":"Assumption 2: $g_H\\equiv\\frac{\\dot{H}}{H}=n=\\delta\\left(\\ln x-\\ln\\bar{x}\\right)$","objectID":"/en/posts/mess/:4:2","tags":["Economic History"],"title":" A Malthusian Two-Sector Model","uri":"/en/posts/mess/#assumption-2"},{"categories":["Reading"],"collections":[],"content":"Conclusion One\rThe expression for equilibrium utility: $$ U^E=\\bar{x}\\left(\\frac{B}{A}\\right)^\\beta\\left(\\frac{\\beta}{1-\\beta}\\right)^\\beta $$ Equilibrium per capita utility grows with the degree to which the output structure is utility-oriented ($\\frac{B}{A}$), with the relative preference for utility goods ($\\beta$), and with the per capita survival-goods consumption needed to maintain the population balance ($\\bar{x}$). The illustrated case, not yet proven: The relationship between the growth rates of the different sectors and social welfare. To keep the model simple, only a closed society is considered, with no foreign trade. The growth rate of survival goods is $g_A$; the growth rate of utility goods is $g_B$. ","date":"2025-03-25","heading":"Conclusion One","objectID":"/en/posts/mess/:4:3","tags":["Economic History"],"title":" A Malthusian Two-Sector Model","uri":"/en/posts/mess/#conclusion-one"},{"categories":["Reading"],"collections":[],"content":"Lemma: $g_A-(1-\\gamma)g_H\\to0$\rThe Malthusian population-growth assumption: $g_H\\equiv\\frac{\\dot{H}}{H}=n=\\delta\\left(\\ln x-\\ln \\bar{x}\\right)$ Meaning: population growth depends on the level of per capita survival-goods consumption. The equilibrium per capita consumption: $x=A(1-\\beta)\\left(\\frac{H}{L}\\right)^{\\gamma-1}$ Simplify land resources to 1, giving $x=A(1-\\beta)^{\\gamma}H^{\\gamma-1}$, and substitute into $g_H$: $$ g_H=\\delta\\left[\\ln A\u0026#43;\\gamma\\ln(1-\\beta)\u0026#43;(\\gamma-1)\\ln H-\\ln x\\right] $$ Use M to stand for $\\ln A\u0026#43;\\gamma\\ln(1-\\beta)$, simplifying to: $$g_H=\\delta\\left[M\u0026#43;\\gamma\\ln(1-\\beta)-\\ln x\\right]$$ Differentiate M, $$ \\mathrm{d}M=g_A\u0026#43;(\\gamma-1)g_H=g_A\u0026#43;(\\gamma-1)\\delta\\left[M\u0026#43;\\gamma\\ln(1-\\beta)-\\ln x\\right] $$ At the steady state, $dM=0$; substitute and solve, $$ M^*=\\frac{g_A}{(1-\\gamma)\\delta}-\\gamma\\ln(1-\\beta)\u0026#43;\\ln\\bar{x} $$ And at this point we also have: $\\mathrm{d}M=g_A\u0026#43;(\\gamma-1)g_H=0$ The process by which $M$ approaches the equilibrium $M^*$ is the process by which $dM$ approaches 0. ","date":"2025-03-25","heading":"Lemma: $g_A-(1-\\gamma)g_H\\to0$","objectID":"/en/posts/mess/:4:4","tags":["Economic History"],"title":" A Malthusian Two-Sector Model","uri":"/en/posts/mess/#lemma"},{"categories":["Reading"],"collections":[],"content":"Theorem Three: The Per Capita Utility Growth Rate and the Two Sectors\u0026rsquo; Growth Rates\rStudy the per capita utility growth rate (which can also be seen as per capita income) and its relationship to the growth of the two sectors. A macroeconomic balanced growth path; phase-diagram analysis is exactly this. Away from the steady state ($\\bar{x} \\neq x$), the utility is: $$ U=A\\left(\\frac{H}{L}\\right)^{\\gamma-1}\\left(\\frac{B}{A}\\right)^{\\beta}(1-\\beta)^{1-\\beta}\\beta^{\\beta} $$\rTake logs and differentiate to turn it into a growth rate.\rFor a factor X, the macro factor X changes with time (X(t)). Differentiate ln(X) with respect to t. $$ \\begin{aligned}\u0026amp;\\frac{d\\ln X(t)}{dt}=\\frac{d\\ln X(t)}{dX(t)}\\frac{dX(t)}{dt}\\\\\\\\\u0026amp;=\\frac{\\frac{dX(t)}{X(t)}}{dt}=\\frac{\\dot{X}(t)}{X(t)}=g(\\text{growth rate})\\end{aligned} $$\rTake logs and differentiate to linearize, and we get: $$g_U=\\beta\\left(g_B-g_A\\right)\u0026#43;g_A-(1-\\gamma)g_H$$ The part after is the lemma, already shown to tend to 0. Thus we obtain the relationship between per capita welfare (income) and survival goods and utility goods. $$ g_U=\\beta\\left(g_B-g_A\\right) $$ According to this conclusion, there should be only one reason for the long-run stagnation of per capita income: the growth rate of utility goods can never exceed the growth rate of survival goods. More complex cases would introduce migration and trade (by setting a migration rate to satisfy the population-balance line) and technological competition (requiring some mathematics of stochastic processes); intuitively they can be understood through multi-level games (The Three-Body Problem: The Dark Forest), and I will not elaborate the specific mathematical models here. For a simple reading of the latter part, see: Competitive Selection Theory ","date":"2025-03-25","heading":"Theorem Three: The Per Capita Utility Growth Rate and the Two Sectors\u0026rsquo; Growth Rates","objectID":"/en/posts/mess/:4:5","tags":["Economic History"],"title":" A Malthusian Two-Sector Model","uri":"/en/posts/mess/#theorem-three-the-per-capita-utility-growth-rate-and-the-two-sectors-growth-rates"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Academic Rhetoric","Lecture Reflections"],"content":"In short, rather than dwelling on what seems self-evident, economists should pay closer attention to the places where outcomes diverge from intentions. Unlike the natural sciences, social-science analysis is shaped by the fact that people adapt to policy. ","date":"2025-03-19","heading":"","objectID":"/en/posts/zcpg/:0:0","tags":["Policy Evaluation","Development Economics","Causal Inference"],"title":"Distortion or Surprise: Making Policy Evaluation Interesting","uri":"/en/posts/zcpg/#"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Academic Rhetoric","Lecture Reflections"],"content":"Introduction: What Makes Policy Evaluation Interesting?\rOnce economics leans more toward explanation than prediction, it begins to value narrative in much the same way literature does. People often summarize their impression of a paper with a simple question: Is the story interesting enough to make me want to keep reading? But what exactly counts as interesting? If we never make that explicit, then \u0026ldquo;interesting\u0026rdquo; and \u0026ldquo;research taste\u0026rdquo; become a black box controlled by discourse and authority. That is why, in Empirical Economics: Intuitive Does Not Equal Obvious, I pushed back against the tendency to mystify topic selection and tried to summarize the angles from which interesting papers are often built. The more teachers and researchers I meet, the more I realize that good topics rarely come out of nowhere. Their topics are deeply tied to their life experience. Once you hear enough of their stories, you start to feel that the insight behind a research question really is an expression of lived wisdom. Many things behind a paper become much clearer only after hearing the author explain it in person. To learn is also to understand oneself. If even those who study the social sciences never try to examine the source of their own insight, then the path of learning has already drifted away from the path of living. Here I want to introduce three papers, all centered on policy evaluation. For many students in economics and management, event-study designs and policy evaluation are their first encounter with thesis writing. Most papers now follow a familiar template: DID, regional heterogeneity, mediation analysis for mechanisms, spatial spillovers. The conclusion then becomes predictable: we see the policy effect, but not the policy cost. Naturally, that invites criticism. But we should remember that genuinely good papers are rare. In reality, most people write papers in order to survive. When we criticize a paper for being uninteresting, one side of that criticism should reflect a commitment to truth, but another side should remain sympathetic to present constraints. Criticizing dull work should also prompt us to ask whether our own papers suffer from ordinary topics or thin exposition. At the same time, we should stay alert to the possibility that the other side is merely judging from within a private rulebook, where \u0026ldquo;interesting\u0026rdquo; becomes an empty black hole of rhetoric. Real improvement comes from genuine understanding and two-way communication. Cost-benefit analysis and rational expectations are two core habits of economic thinking. So how can we make the story of policy evaluation more engaging? The narrative keyword I want to emphasize here is surprise or, more concretely, policy distortion. My advisor once said: any policy can make some splash if you throw enough money at it. But as researchers, are we really here just to measure how high the splash goes? When studying a policy, instead of asking only whether it worked or failed, we might look more closely at a few deeper questions: Does a policy necessarily unfold in line with its original intention? Can a policy really be implemented without distortion? After large costs have been paid, is the policy still worth it? \u0026hellip; Rather than stopping at what feels obvious, economists should pay attention to where outcomes run against the original vision. Unlike the natural sciences, social science must reckon with how people adapt to policy. That is precisely what makes it interesting. ","date":"2025-03-19","heading":"Introduction: What Makes Policy Evaluation Interesting?","objectID":"/en/posts/zcpg/:1:0","tags":["Policy Evaluation","Development Economics","Causal Inference"],"title":"Distortion or Surprise: Making Policy Evaluation Interesting","uri":"/en/posts/zcpg/#introduction-what-makes-policy-evaluation-interesting"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Academic Rhetoric","Lecture Reflections"],"content":"Judicial Reform and Local Strategic Interaction\rLocal protectionism and promotion incentives for officials are not new topics. Scholars have already documented them using tax data and GDP data. ","date":"2025-03-19","heading":"Judicial Reform and Local Strategic Interaction","objectID":"/en/posts/zcpg/:2:0","tags":["Policy Evaluation","Development Economics","Causal Inference"],"title":"Distortion or Surprise: Making Policy Evaluation Interesting","uri":"/en/posts/zcpg/#judicial-reform-and-local-strategic-interaction"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Academic Rhetoric","Lecture Reflections"],"content":"Strategic Interaction Across Local Governments\rBecause local GDP and national GDP are compiled separately, comparisons with nighttime light data can reveal GDP manipulation. As the figure below shows, nighttime lights declined sharply around 2008, yet county-level GDP continued to rise. Image source: \u0026ldquo;Mayors’ promotion incentives and subnational-level GDP manipulation\u0026rdquo; (JUE, 2024) |585\rIn 2013, the central government reduced the weight of GDP in cadre evaluation, and mayors over age 58 had little chance of further promotion. These two features generated many clever quasi-natural experiments.1 ","date":"2025-03-19","heading":"Strategic Interaction Across Local Governments","objectID":"/en/posts/zcpg/:2:1","tags":["Policy Evaluation","Development Economics","Causal Inference"],"title":"Distortion or Surprise: Making Policy Evaluation Interesting","uri":"/en/posts/zcpg/#strategic-interaction-across-local-governments"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Academic Rhetoric","Lecture Reflections"],"content":"Strategic Interaction Between Central and Local Governments\rTax revenue is a crucial state resource. The central government\u0026rsquo;s basic policy stance has been to cut taxes2 in order to stimulate business innovation. One example is the VAT reduction shown below. Source: \u0026ldquo;Tax Cuts and Local Government Debt: Evidence from VAT Rate Reductions\u0026rdquo; (Economic Research Journal, 2024)\rBut if the government loses fiscal revenue, what happens next? It has to adapt by taking on more debt. Increase revenue? The center is cutting taxes. Cut spending? Public officials, as agents in a principal-agent framework, will naturally consider their own welfare. Given that, it is not hard to understand why local governments may respond to national tax cuts by increasing debt. Source: \u0026ldquo;Tax Cuts and Local Government Debt: Evidence from VAT Rate Reductions\u0026rdquo; (Economic Research Journal, 2024)\r","date":"2025-03-19","heading":"Strategic Interaction Between Central and Local Governments","objectID":"/en/posts/zcpg/:2:2","tags":["Policy Evaluation","Development Economics","Causal Inference"],"title":"Distortion or Surprise: Making Policy Evaluation Interesting","uri":"/en/posts/zcpg/#strategic-interaction-between-central-and-local-governments"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Academic Rhetoric","Lecture Reflections"],"content":"Seeing Strategic Interaction Through Judicial Data\rIn judicial decisions, local protectionism often appears as judges favoring litigants from their own locality. “Local Bias and the Construction of a Unified Domestic Market: Evidence from Chinese Traffic-Accident Judgments” (China Economic Quarterly, 2024)\rOfficials also respond actively to higher-level policy signals in order to accumulate political achievements. For example, after a new party secretary takes office, bankruptcy-case filings rise significantly relative to the period under the previous secretary. “Policy Orientation, Official Turnover, and Corporate Bankruptcy: Evidence from Judicial Documents” (China Economic Quarterly, 2024)\rTo weaken this kind of local judicial protection and improve judicial efficiency, China implemented a series of reforms. One of the best-known papers in this area is Shaoda Wang\u0026rsquo;s Judicial Independence, Local Protectionism, and Economic Integration: Evidence from China (NBER, 2022). After the reform, the local win rate fell by about 7%.\rThe establishment of circuit courts by the central government also significantly increased the win rates of small firms and private firms. Judicial institutions, local protection and market segmentation: Evidence from the establishment of interprovincial circuit tribunals in China (CER, 2022)\r","date":"2025-03-19","heading":"Seeing Strategic Interaction Through Judicial Data","objectID":"/en/posts/zcpg/:2:3","tags":["Policy Evaluation","Development Economics","Causal Inference"],"title":"Distortion or Surprise: Making Policy Evaluation Interesting","uri":"/en/posts/zcpg/#seeing-strategic-interaction-through-judicial-data"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Academic Rhetoric","Lecture Reflections"],"content":"The Distortion Created by Judicial Crackdowns on Local Protection\rNow comes the key question. If earlier papers focus on how judicial reform successfully reduced local protectionism, does that mean the crackdown came at no cost? Tradeoff between local protection and public sector performance: Lessons from judicial fiscal centralization (JBOE, 2024) studies exactly this issue. For a long time, local governments and courts formed a community of shared interests around local protection. Once that durable relationship is broken, both sides inevitably go through an adjustment process. This is where policy evaluation often becomes genuinely interesting: higher-level policy produces lower-level adaptation. Judges favoring local parties can be understood as a kind of political contribution. Once that channel is interrupted, the regressions below show that court spending gradually shifts away from public welfare and toward private welfare, while local corruption cases rise significantly. Tradeoff between local protection and public sector performance: Lessons from judicial fiscal centralization (JBOE, 2024)\rIn other words, while the reform weakened local protectionism, it also destroyed the informational advantage that had grown out of long-term administrative-judicial collaboration. The result was a loss in administrative efficiency for both sides. That is one of the costs of reform. Judicial justice is a future everyone longs for, but the interests entangled in reform are complex, and the traps within reform should never be ignored. That is the most brilliant insight of this paper, and it is also the best example of surprise or policy distortion in its narrative. ","date":"2025-03-19","heading":"The Distortion Created by Judicial Crackdowns on Local Protection","objectID":"/en/posts/zcpg/:2:4","tags":["Policy Evaluation","Development Economics","Causal Inference"],"title":"Distortion or Surprise: Making Policy Evaluation Interesting","uri":"/en/posts/zcpg/#the-distortion-created-by-judicial-crackdowns-on-local-protection"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Academic Rhetoric","Lecture Reflections"],"content":"Environmental Regulation and Consumer Welfare\rChina places strong emphasis on sustainable development, so it has introduced environmental regulation. Each firm faces emission limits and pollution fees. Environmentally friendly firms with unused quotas can sell their pollution permits, while heavy polluters that need more room can buy permits from others. It sounds like everyone wins, doesn\u0026rsquo;t it? The paper Passive Collusion Among Firms: Welfare Effects of Environmental Regulation Under the Dual-Carbon Goal (China Industrial Economics, 2022) uses theory to analyze how environmental regulation affects social welfare. On Theoretical Modeling\rThe key tool is the Kuhn-Tucker conditions. Corner and interior solutions correspond to whether firms are effectively constrained by environmental regulation. Methodology matters more than clever tricks. Kuhn-Tucker conditions\rThe conclusion is shown below.\rLet me summarize the core argument briefly. Take the oil industry as an example. It is easy for cartel behavior to emerge: large firms collude, reduce output, and raise prices to earn monopoly profits. But such alliances are unstable. They are not equilibrium outcomes in game theory, because each member has an incentive to secretly expand output and betray the cartel.3 In reality, taxing highly polluting firms is usually seen as a good thing. But environmental regulation can induce originally rival firms to cut output together and raise prices, creating a form of passive cartelization. Under environmental regulation, both clean firms and polluting firms can earn higher profits, while consumers end up worse off. The relationship between external threats and social welfare has always made for rich historical stories. Why did the Three Kingdoms period last so long? Once one kingdom was destroyed, the fall of another was not far behind. External threats can foster internal unity, but external benefits can also dissolve it. A local optimum is not necessarily a global optimum; individuals and the collective are always caught in strategic interaction. That is the paper\u0026rsquo;s central story of policy distortion or unexpected consequences. ","date":"2025-03-19","heading":"Environmental Regulation and Consumer Welfare","objectID":"/en/posts/zcpg/:3:0","tags":["Policy Evaluation","Development Economics","Causal Inference"],"title":"Distortion or Surprise: Making Policy Evaluation Interesting","uri":"/en/posts/zcpg/#environmental-regulation-and-consumer-welfare"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Academic Rhetoric","Lecture Reflections"],"content":"When Agricultural Subsidies Accidentally Help in the Right Way\rThe policy surprises above were all negative. But can there also be positive surprises? Evaluating the Effects of Agricultural Subsidy Policy: Incentive Effects and Wealth Effects (Chinese Rural Economy, 2016) studies whether agricultural subsidies expand labor supply in agriculture. The paper finds that many households mainly use the subsidy to stop doing the farm work themselves and hire others instead. If that is the case, then labor supply has not really increased, has it? As shown below.\rAgricultural subsidies did not encourage family members to increase their own labor supply, but they significantly increased the likelihood of hiring labor, using agricultural machinery, and investing in inputs such as fertilizer, seeds, and pesticides. The main effect operated through greater use of production inputs such as fertilizer, seeds, and pesticides. But under today\u0026rsquo;s agenda of rural revitalization, scale management and factor inputs matter a great deal. So even though labor supply did not rise, subsidies still helped mechanization and larger-scale agricultural operations. That is why the paper argues that if output growth under labor-oriented subsidies does not come from greater labor supply, then policy should be designed more precisely. Agricultural subsidies should be paired with measures that promote larger-scale farming, reduce the opportunity cost of working in agriculture, or tilt support toward major grain-producing regions in order to improve policy effectiveness. These are also central themes in today\u0026rsquo;s rural-revitalization strategy and agricultural development.4 There is far too much formulaic language surrounding rural issues. Much of the policy advice people offer follows a pattern of flawed reasoning paired with a correct conclusion, which makes the discussion stiff and conventional. By contrast, this paper explains subsidy policy from the angle of policy distortion leading to unexpectedly desirable outcomes. That too is a form of policy distortion or surprise. ","date":"2025-03-19","heading":"When Agricultural Subsidies Accidentally Help in the Right Way","objectID":"/en/posts/zcpg/:4:0","tags":["Policy Evaluation","Development Economics","Causal Inference"],"title":"Distortion or Surprise: Making Policy Evaluation Interesting","uri":"/en/posts/zcpg/#when-agricultural-subsidies-accidentally-help-in-the-right-way"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes","Academic Rhetoric","Lecture Reflections"],"content":"Surprise and the Misuse of \u0026ldquo;Counterintuitive\u0026rdquo;\rSo please stop casually calling every good topic \u0026ldquo;counterintuitive.\u0026rdquo; Real science should first strike us as astonishing, but after repeated reflection it should come to seem almost inevitable.5 Do not stay intoxicated by the sense of astonishment alone. Turn back and appreciate why the result had to be that way. Rational expectations are one major reason economics struggles with prediction. Put simply, it is like fortune-telling that includes the fortune-teller in the forecast: once the prediction enters the world, the future changes. Of course, sometimes recursive equilibrium solutions exist. But it is precisely because of this sliver of uncertainty that \u0026ldquo;surprise\u0026rdquo; in research can reveal the researcher\u0026rsquo;s insight. For example, \u0026ldquo;Officials Producing Numbers: GDP Distortion Under Promotion Incentives\u0026rdquo; (China Industrial Economics, 2017).\u0026#160;\u0026#x21a9;\u0026#xfe0e; I often wonder when China will encounter its own version of \u0026ldquo;Ricardian equivalence.\u0026rdquo; If the policy stance is tax cuts plus debt expansion, when will those two sides finally balance?\u0026#160;\u0026#x21a9;\u0026#xfe0e; This is the familiar prisoner\u0026rsquo;s dilemma: a loose alliance cannot stop members from defecting.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Which is why policy recommendations should be evidence-based rather than ornamental.\u0026#160;\u0026#x21a9;\u0026#xfe0e; From The Origin of Wealth.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2025-03-19","heading":"Surprise and the Misuse of \u0026ldquo;Counterintuitive\u0026rdquo;","objectID":"/en/posts/zcpg/:5:0","tags":["Policy Evaluation","Development Economics","Causal Inference"],"title":"Distortion or Surprise: Making Policy Evaluation Interesting","uri":"/en/posts/zcpg/#surprise-and-the-misuse-of-counterintuitive"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":" \u0026ldquo;Once you start thinking about (how the economy grows), you can\u0026rsquo;t think about anything else.\u0026rdquo; — Robert E. Lucas ","date":"2025-03-02","heading":"","objectID":"/en/posts/solow/:0:0","tags":["MATLAB","Economic Growth"],"title":"Solow Model MATLAB Simulation Code","uri":"/en/posts/solow/#"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"The Idea of the Solow Model\rRobert Merton Solow, the 1987 Nobel laureate in economics, passed away on December 21, 2023, at the age of 99. This blog post was written in his memory1. Source: Wikipedia\rAlthough the Solow model\u0026rsquo;s assumptions are fairly strict2 and it has since given way to later models, he pioneered the neoclassical analytical paradigm of \u0026ldquo;economic growth\u0026rdquo;, and the \u0026ldquo;total factor productivity\u0026rdquo; (the Solow residual) that his conclusions produced has become one of the most important evaluation indicators of a contemporary economy. Its conceptual framework is: Decompose the contribution to economic growth (output) into several basic factors: labor, capital, technological progress, population growth\u0026hellip; The process of economic growth is the process of factor changes; we can try to characterize the dynamic process of factor growth. There is convergence in the dynamic changes of factors; the time-path of a factor moving from non-convergence to convergence is a balanced growth path of an economy. $$\\dot{k}=f(k)$$ Take the formula above, for example; simply put, it characterizes the relationship between the per-capita capital growth rate ($\\dot{k}$) and the per-capita capital stock (${k}$). Convergence means that after per-capita capital grows to a certain level, the growth rate becomes hard to increase further and instead approaches 0. In the formula, this is: $△k=0=\\dot{k}=f(k)$. Like the Malthusian population trap: when per-capita income rises, people get richer and are more likely to have children; the population grows, and per-capita income falls. When per-capita income falls, people get poorer and have fewer children; the population shrinks, and per-capita income rises again. This back-and-forth — the process that makes per-capita income tend toward stability — is the process in which per-capita income and its growth rate restrain each other. The Solow model does further decomposition on top of this. A lower starting point means progress may be faster; a higher starting point means progress may be slower. What the Solow model tries to explain is the phenomenon that \u0026ldquo;low-income countries develop faster than high-income countries in the early stage\u0026rdquo;. For example, after World War II, postwar Asian countries entered a golden age of development. After the war people preferred saving, which also inspired Solow to assume an exogenous saving rate. The convergence property of the Solow model later inspired scholars to discuss whether the economic levels of high-income and developing countries would converge. See another blog post, Convergence: From the \u0026ldquo;Limit of a Formula\u0026rdquo; to the \u0026ldquo;Limit of Growth\u0026rdquo;. Here I mainly introduce the MATLAB plotting code, so I won\u0026rsquo;t go into the mathematical proof. For a more detailed explanation of the Solow model, see: Solow Model Intermediate Macroeconomics | Lecture 3: The Solow Growth Model Advanced Macroeconomics Notes (Romer Edition) Speedrun for Test-Takers\rThe two core steady states of the Solow model: Solving for the steady state: $$ \\dot{k}=sf(k)-(n\u0026#43;\\delta)k=0 $$ Solving for the golden rule: $$ f^{\\prime}(k_{\\mathrm{gold}})=n\u0026#43;\\delta $$\r","date":"2025-03-02","heading":"The Idea of the Solow Model","objectID":"/en/posts/solow/:1:0","tags":["MATLAB","Economic Growth"],"title":"Solow Model MATLAB Simulation Code","uri":"/en/posts/solow/#the-idea-of-the-solow-model"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"MATLAB Convergence Plot\rAs shown, an economy\u0026rsquo;s per-capita capital k converges to the intersection point in the figure|585\rThe plotting code is divided into four parts: Set parameters: initial per-capita capital, depreciation rate, saving rate, technological progress rate, total factor productivity growth rate, population growth rate, number of periods, and capital input elasticity. t=100; % number of periods kmax=200; % maximum capital per worker alpha=0.3; % elasticity of output with respect to capital input s=0.5; % marginal propensity to save n=0.02; % population growth rate d=0.01; % capital depreciation rate A0=2; % total factor productivity K=1:kmax; % capital level per worker (horizontal axis)\rParameter Controversies\rVery often, the most controversial part of a macro model is the parameters. Improvements in mathematical models, empirical evidence from micro data, statistical methods, and our understanding of the roles of factors all affect the range of parameter values.\rSet the functions: $$f(k)=Ak^\\alpha$$ $$\\dot{k_t}=sf(k_t)-(n\u0026#43;g\u0026#43;d)k_t$$ for k1=1:kmax % loop along the horizontal axis to compute the function values y(k1,1)=A0*(k1^alpha); % total production function sy(k1,1)=s*y(k1,1); % actual investment nd(k1,1)=(n+d)*k1; % required investment end\rConvergence condition: naturally, this is $\\dot{k_t}=sf(k_t)-(n\u0026#43;g\u0026#43;d)k_t=0$. So the logic of the code below is to compare sy(k1,1) and nd(k1,1). When they are not equal, it increases or decreases per-capita capital $k$ based on the greater-than or less-than sign. The discrete case with population growth and technological progress\rHere we set the capital motion equation to $\\dot{k_t}=sf(k_t)-(n\u0026#43;g\u0026#43;d)k_t$, and based on its sign we set k to increase or decrease by one. Actually, when considering the discrete case, the most precise expression is: $$\\dot{k_t}=\\frac{sf(k_t)-dk_t}{1\u0026#43;g\u0026#43;n}$$ that is: $${k_{t\u0026#43;1}}=\\frac{sf(k_t)\u0026#43;(1-d)k_t}{1\u0026#43;n\u0026#43;g}$$ The equilibrium condition means ${k_{t\u0026#43;1}}={k_{t}}$; substituting and simplifying, only at equilibrium convergence can it be simplified to $0=\\dot{k_t}=sf(k_t)-(n\u0026#43;g\u0026#43;d)k_t$. But out of equilibrium ($\\dot{k_t} \\neq 0$), writing the motion equation as $\\dot{k_t}=sf(k_t)-(n\u0026#43;g\u0026#43;d)k_t$ is not rigorous. Macro: Python or MATLAB?\rFor economics, both R and MATLAB are close to being defeated by Python. The remaining advantage of R is that statisticians at top journals will prioritize developing R packages. Like Stata, MATLAB still holds the mainstream for now because most papers distribute code as .m and .do files. As models get more complex, Python has a bigger advantage in optimizing code and tuning algorithms for computation. I have seen quite a few new researchers doing macro models online starting to switch from MATLAB to Python to optimize their computation. if sy(k1,1) \u003e nd(k1,1) % decide based on the differential equation's result k1=k1+1; elseif sy(k1,1) \u003c nd(k1,1) k1=k1-1; end\rPlotting code For example: scatter(K,y, '.'); %plot per-capita capital (horizontal axis) and function values\rThe complete code is as follows: %% solow neoclassical growth model % a MATLAB dynamic simulation %% convergence simulation %% original code: https://github.com/DiegoCiccia/SolowGrowthModel/blob/main/solow.m % uncomment the commented parts below to compare the convergence of two economies starting from two different initial positions. %%————————————parameter settings——————————————%% t=100; % number of periods kmax=200; % maximum capital per worker alpha=0.3; % elasticity of output with respect to capital input s=0.5; % marginal propensity to save n=0.02; % population growth rate d=0.01; % capital depreciation rate A0=2; % total factor productivity K=1:kmax; % capital level per worker (horizontal axis) y=zeros(length(K),1); % output array sy=zeros(length(K),1); % actual investment array nd=zeros(length(K),1); % required investment array %%————————————formula definition——————————————%% for k1=1:km","date":"2025-03-02","heading":"MATLAB Convergence Plot","objectID":"/en/posts/solow/:2:0","tags":["MATLAB","Economic Growth"],"title":"Solow Model MATLAB Simulation Code","uri":"/en/posts/solow/#matlab-convergence-plot"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"MATLAB Phase Diagram: Different Initial Capital\rCompare two economies with all other parameters identical, differing only in initial per-capita capital $k_1$ (and thus in convergence direction). Under the given parameters, the Solow model\u0026rsquo;s per-capita capital converges to a level of 149.8. So if a country\u0026rsquo;s initial per-capita capital is above this value, it will fall; if below, it will rise. As shown\r%% Solow neoclassical growth model example % 1. capital convergence curves for two initial values % 2. phase diagram: the relationship between \\dot{k} and k (with arrows marking direction) % here I reuse the parameters set in the previous section's code clear; clc; close all; %% =============== parameter settings =============== t = 400; % total number of simulation periods alpha = 0.3; % elasticity of output with respect to capital s = 0.5; % saving rate n = 0.02; % population growth rate d = 0.01; % depreciation rate A0 = 2; % total factor productivity kmax = 250; % capital display range (dynamically adjusted based on simulation results) %% =============== convergence simulation with different initial values =============== k1_init = 100; % economy 1 initial capital k2_init = 200; % economy 2 initial capital % preallocation k1 = zeros(t+1,1); k2 = zeros(t+1,1); k1(1) = k1_init; k2(1) = k2_init; % iteratively update the capital level for i = 1:t k1(i+1) = k1(i) + s*A0*(k1(i)^alpha) - (n+d)*k1(i); k2(i+1) = k2(i) + s*A0*(k2(i)^alpha) - (n+d)*k2(i); end % dynamically adjust the display range kmax = max([k1; k2]) * 1.1; %% =============== 1) draw the convergence plot =============== figure(1); plot(0:t, k1, 'r-', 'LineWidth', 2); hold on; plot(0:t, k2, 'b-', 'LineWidth', 2); xlabel('时间', 'FontSize', 12); ylabel('人均资本 k', 'FontSize', 12); title('资本收敛过程', 'FontSize', 14); legend(sprintf('初始k=%.0f', k1_init), sprintf('初始k=%.0f', k2_init), ... 'Location','best'); grid on; set(gca, 'FontSize', 10) %% =============== 2) draw the phase diagram ( \\dot{k} vs k ) =============== % prepare the phase-diagram data k_cont = linspace(0, kmax); % continuous capital values f_k = A0 * k_cont.^alpha; % production function sy = s * f_k; % actual investment nd = (n + d) * k_cont; % required investment dotk = sy - nd; % capital change rate % compute the trajectory data dotk1 = s*A0*k1.^alpha - (n+d)*k1; dotk2 = s*A0*k2.^alpha - (n+d)*k2; % compute the steady-state value k_star = (s*A0/(n+d))^(1/(1-alpha)); figure(2); % 1) draw the main phase-diagram curve plot(k_cont, dotk, 'k-', 'LineWidth', 2); hold on; % 2) draw the steady-state line plot([0 kmax], [0 0], 'k--', 'LineWidth', 1); % 3) draw the steady-state marker plot(k_star, 0, 'mo', 'MarkerSize', 10, 'MarkerFaceColor', 'm') % 4) draw the trajectory points plot(k1, dotk1, 'r.-', 'MarkerSize', 12, 'LineWidth', 2); plot(k2, dotk2, 'b.-', 'MarkerSize', 12, 'LineWidth', 2); % 5) add the trajectory arrows arrow_step = 20; % arrow interval step % economy 1 arrows for i = 1:arrow_step:length(k1)-1 quiver(k1(i), dotk1(i),... k1(i+1)-k1(i), dotk1(i+1)-dotk1(i),... 0, 'Color', 'r', 'MaxHeadSize', 1.5, 'LineWidth', 2) end % economy 2 arrows for i = 1:arrow_step:length(k2)-1 quiver(k2(i), dotk2(i),... k2(i+1)-k2(i), dotk2(i+1)-dotk2(i),... 0, 'Color', 'b', 'MaxHeadSize', 1.5, 'LineWidth', 2) end % 6) graph annotations title('相图: 资本动态变化', 'FontSize', 14); xlabel('人均资本 k', 'FontSize', 12); ylabel('资本变化率 $\\dot{k}$', 'Interpreter', 'latex', 'FontSize', 12); legend('$\\dot{k} = s f(k) - (n + \\delta)k$',... '稳态线 ($\\dot{k}=0$)',... sprintf('稳态 k* = %.1f', k_star),... '经济体1：k初始值100',... '经济体2：k初始值200',... 'Location','best', 'Interpreter', 'latex'); grid on; set(gca, 'FontSize', 10) xlim([0 kmax])\r","date":"2025-03-02","heading":"MATLAB Phase Diagram: Different Initial Capital","objectID":"/en/posts/solow/:3:0","tags":["MATLAB","Economic Growth"],"title":"Solow Model MATLAB Simulation Code","uri":"/en/posts/solow/#matlab-phase-diagram-different-initial-capital"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"MATLAB Shock Plot: Different Saving Rates\rThe core figure of modern macro DSGE models is one that shows how factors change after being hit by a shock. The Solow model assumes the saving rate is exogenous. The code below assumes an initial saving rate of 0.4; with an initial per-capita capital of 6, the saving rate is later adjusted to 0.5. What it finally computes is per-capita capital, per-capita output, the per-capita output growth rate (take logs of output then first-difference: $\\log y_t-\\log y_{t-1}\\approx\\frac{y_t-y_{t-1}}{y_{t-1}}$), and per-capita consumption. The saving rate is adjusted at period 10\rclear all clc %%————————————parameter settings——————————————%% alpha=0.5; % elasticity of output with respect to capital delta=0.1; % depreciation rate g=0.05; % technological progress rate n=0.02; % population growth rate s=0.5; % saving rate (exogenous) k_ss=(s/(delta+g+n))^(1/(1-alpha)); % solve for the steady state T=1000; kt(1)=6; % initial value of per-capita capital k yt(1)=kt(1)^alpha; % initial value of per-capita output y ct(1)=(1-0.4)*yt(1); % initial consumption c; the Solow model assumes exogenous saving, and here the initial saving rate is 0.4 %%————————————function settings——————————————%% for j = 2:T kt(j) = (s * kt(j-1)^alpha + (1 - delta) * kt(j-1)) / (1 + g + n); yt(j)=kt(j-1)^alpha; ct(j)=(1-s)*yt(j); end %%————————————plotting——————————————%% tt=120; t=1:tt+10; subplot(4,1,1) % divide into four rows and one column, plot in the first row plot(t,[kt(1)*ones(1,10) kt(1:tt)],'-','LineWidth',2); % kt(1)*ones(1,10) artificially fills the first 10 points with the initial data hold on % keep the current figure and continue plotting plot(t,k_ss*ones(1,tt+10),'--','LineWidth',2) grid on % turn on the grid xlabel('k_{t}') axis([1 130 5 9]) % the minimum and maximum ranges of the x and y axes, respectively subplot(4,1,2) plot(t,[yt(1)*ones(1,10) yt(1:tt)],'-','LineWidth',2); hold on ; grid on plot(t,k_ss^alpha*ones(1,tt+10),'--','LineWidth',2) xlabel('y_{t}') axis([1 130 2 3]) subplot(4,1,3) gy=diff(log(yt(1:tt+1))); % take the log and then first-difference plot(t,[zeros(1)*ones(1,10) gy],'-','LineWidth',2); hold on ; grid on plot(t,zeros(1,tt+10),'--','LineWidth',2) xlabel('gy_{t}') axis([1 130 -0.01 0.025]) subplot(4,1,4) plot(t,[ct(1)*ones(1,10) ct(1:tt)],'-','LineWidth',2); hold on ; grid on plot(t,(1-s)*k_ss^alpha*ones(1,tt+10),'--','LineWidth',2) xlabel('c_{t}') axis([1 130 1 1.6])\rThe blog tags already have Stata, Python, and R; here I\u0026rsquo;m adding MATLAB.\u0026#160;\u0026#x21a9;\u0026#xfe0e; The Solow model assumes exogenous saving and is a single-sector model; these became points for later models to improve on.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2025-03-02","heading":"MATLAB Shock Plot: Different Saving Rates","objectID":"/en/posts/solow/:4:0","tags":["MATLAB","Economic Growth"],"title":"Solow Model MATLAB Simulation Code","uri":"/en/posts/solow/#matlab-shock-plot-different-saving-rates"},{"categories":["Reading"],"collections":[],"content":" Hide a leaf in the forest; hide a body in war; hide a legend in everyday life. —— Tuili Da Wuxian I\u0026rsquo;ve always loved fantasy, science fiction, and detective fiction1. Popular writing can teach you a lot about how to write papers, too. Great science fiction is always asking what happens when unusual material conditions or institutions meet ordinary human beings, and that isn\u0026rsquo;t so different from what economics papers do. Will the future world be one of extreme monopoly or extreme equality? How would a safe, controllable one-centimeter wormhole reshape industrial geography? What kind of monetary and trading system would space commerce need? Put fictional institutions next to real human nature, and real insight starts to appear. Reasoning matters even more in papers and in the way we speak. How do you plant suspense? When do you put forward evidence? A good paper always has a process: first it raises a question and makes clear why it matters, then it answers that question with rigor and a bit of narrative pull. To enjoy detective fiction doesn\u0026rsquo;t mean memorizing encyclopedias or hundreds of bizarre physical and chemical reactions. What matters is recognizing a narrative technique and an analytic technique. How does the human mind actually think? The recent excitement over AI chain-of-thought, for example, is one attempt to simulate reasoning. When people analyze, are we closer to Bayesians or to frequentists? A model of interstellar trade\rThe Nobel laureate Paul Krugman really did write an international trade paper about commerce in outer space. When a spaceship approaches the speed of light, time passes differently for the people on board and the people on the planet, which means capital turns over on different cycles. Each person has to decide whether to trade with people on the local planet or with people elsewhere, and equilibrium emerges from returns under different time conditions. A diagram\rDetective narrative\rI recommend The Great Economics Detective. It does a very good job of showing how top economics papers build suspense through causal identification and empirical analysis, then work their way toward an answer. The social-science bestseller The Calling of Spirits, by contrast, unfolds like a mystery from the Qianlong emperor\u0026rsquo;s point of view. It reconstructs the queue-cutting panic and then uses it to dissect the Qing communication system and its consequences. What I want to do here is summarize part of Tuili Da Wuxian. The author\u0026rsquo;s main goal is to let readers feel the pleasure of reading detective fiction, and the book also works as a kind of literary criticism of the genre. What caught my attention, though, was its discussion of the modernity of detective fiction. To be clear, this is not the book\u0026rsquo;s main argument. It\u0026rsquo;s simply the part that interested me most, so I\u0026rsquo;m recording it here. ","date":"2025-02-22","heading":"","objectID":"/en/posts/ztxs/:0:0","tags":["Literature"],"title":"The modernity of detective fiction","uri":"/en/posts/ztxs/#"},{"categories":["Reading"],"collections":[],"content":"The scope of detective fiction\rDetective fiction has two key elements: the detective as subject, and the process of reasoning. If we look only at the reasoning process, detective fiction is really a writing technique for creating suspense. The way we describe memory is itself blurry and full of gaps, like the waxing and waning of the moon, and good academic writing works the same way: it knows how to raise a question gracefully and then answer it. ","date":"2025-02-22","heading":"The scope of detective fiction","objectID":"/en/posts/ztxs/:1:0","tags":["Literature"],"title":"The modernity of detective fiction","uri":"/en/posts/ztxs/#the-scope-of-detective-fiction"},{"categories":["Reading"],"collections":[],"content":"A brief history of detective fiction\rDetective fiction begins with Edgar Allan Poe\u0026rsquo;s The Murders in the Rue Morgue, but its great flowering happened in Britain. Britain was in the middle of the Industrial Revolution, and detective fiction fit that historical background in several ways. First, it expressed a scientific spirit. Deduction celebrates science and positivism. Second, its stories take place in everyday life, and above all in urban everyday life. Some literary critics and urban theorists treat detective fiction as a defense of modern life. Detective work makes ordinary life feel more poetic. The culprits in detective stories are often bourgeois figures: wealthy urbanites, manor owners, local notables. The stage for crime is often the suburban edge of the city. Money disputes, romantic entanglements, and parental control over their children\u0026rsquo;s lives become the background to murder. The friction between private detectives and urban governance also becomes a recurring point of tension. All of this can be read as a way of interpreting city life. Solving the mystery gives everyday life its spell and then breaks it again; that is one of detective fiction\u0026rsquo;s sharpest tools for turning the ordinary into something uncanny. ","date":"2025-02-22","heading":"A brief history of detective fiction","objectID":"/en/posts/ztxs/:2:0","tags":["Literature"],"title":"The modernity of detective fiction","uri":"/en/posts/ztxs/#a-brief-history-of-detective-fiction"},{"categories":["Reading"],"collections":[],"content":"Schools of detective fiction\rThere are many ways to narrate deduction and revelation. Different writers sell different pleasures, and those different core attractions produce different schools: Honkaku: the main attraction is the pleasure of the puzzle itself. The rigor and ingenuity of the reasoning matter far more than the background of the crime or broader ethical and social concerns. Outside honkaku, the other branches go in different directions. The realist school can be divided into three kinds: Courtroom fiction: contests between right and wrong, crime and punishment, law and feeling. Hard-boiled fiction: character writing and a distinctive way of solving the case are what matter most. Social detective fiction: the main attraction is the social background. Henkaku: deduction is only a pretext; what matters is the thought it provokes. For honkaku fiction, the detective and the reader should have exactly the same clues. That is what gives the reader the pleasure of an intellectual contest with the protagonist. Henkaku fiction does not treat deduction as its main selling point, so it is more willing to rely on narrative tricks, last-minute premise changes, forced reversals, or a deus ex machina to bring the story home. ","date":"2025-02-22","heading":"Schools of detective fiction","objectID":"/en/posts/ztxs/:3:0","tags":["Literature"],"title":"The modernity of detective fiction","uri":"/en/posts/ztxs/#schools-of-detective-fiction"},{"categories":["Reading"],"collections":[],"content":"Detective fiction in different countries\rAmerican detective fiction tends to favor the hard-boiled mode: the detective\u0026rsquo;s experience in the course of the investigation matters more. Japanese detective fiction often favors the everyday mystery2: deduction is used on ordinary life, or else malice rises out of the ordinary, usually with a strong light-novel and anime flavor. Chinese detective fiction generally draws on anecdotal lore3 and mythic storytelling. One point is worth noting: whether in Britain, the United States, or Japan, detective fiction hit its stride only after capitalist reform. Faster urbanization and greater population mobility produced the kind of social background in which detectives could plausibly appear. In this age, the household replaced the clan, and the morning paper replaced morning prayer4. Chinese detective stories are different. Although officials in imperial China also moved through appointments and postings, they represented public authority. Their protagonists are more often court officials, secret state agents, or public-security personnel. This difference can be explained, tentatively, from several angles: The individual detective is itself one of the defining features of detective fiction as leisure reading. Cafés are a recurring image in detective stories from this period, and people also consumed detective fiction as a form of leisure. Only when people have enough leisure do they begin to reason for pleasure and enjoy reasoning on the page. At the same time, China was still in the middle of a struggle for national survival, so the social soil for that kind of idle pleasure was thin. In mainstream Chinese suspense, once you set aside historical figures, myths, and anecdotal lore, what often remains is espionage in the service of nation and family5. Even in the modern period, mainstream detective fiction is still dominated by police stories. Why does China not have as large an audience for detective fiction as Japan or the United States? The author offers one possible explanation: in China, Confucian li directly provides the norm, so people do not need to reason their way through process and justification. In this view, Eastern philosophy puts more emphasis on enlightenment and inward cultivation, whereas Western philosophy is more comfortable with layer-by-layer inference. A question about consumption\rBy the same logic, we can also ask: where does China\u0026rsquo;s appetite for science fiction stand in global terms? What kind of social soil produces the desire to consume science fiction?\rThe National Library in Beijing once hosted a Sherlock Holmes IP exhibition. I finished the Holmes stories before going, and my final verdict is: don\u0026rsquo;t spend money on that exhibition.\u0026#160;\u0026#x21a9;\u0026#xfe0e; It\u0026rsquo;s hard to talk about this branch without mentioning the Japanese classic Hyouka.\u0026#160;\u0026#x21a9;\u0026#xfe0e; A fun fact: the original author behind Judge Dee was the Dutch writer Robert van Gulik\u0026#160;\u0026#x21a9;\u0026#xfe0e; I found this line in a Zhihu post, but I can\u0026rsquo;t confirm whether that is the original source.\u0026#160;\u0026#x21a9;\u0026#xfe0e; I still miss my high-school days watching The Message.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2025-02-22","heading":"Detective fiction in different countries","objectID":"/en/posts/ztxs/:4:0","tags":["Literature"],"title":"The modernity of detective fiction","uri":"/en/posts/ztxs/#detective-fiction-in-different-countries"},{"categories":["Economic Studies"],"collections":["Reflections on Learning Economics"],"content":" In an age shaken by AI, what remains of the spirit of the social sciences? To me, it is the cultivation of a kind of resilience for living, much like Santiago in The Old Man and the Sea. People today are always asking how to live better. But when one lives in an era of stagnant growth and rapid advances in artificial intelligence, what if life does not go well at all? At that point, why live becomes a prior question to how to live. That is what led me to connect existentialism with the role of the social sciences. Imagine a world like this: in that world, \u0026ldquo;causality\u0026rdquo; as a cold and objective law stands exposed far more starkly than the moralized idea of karmic justice that people often invoke. Evil causes do indeed produce evil consequences, yet those consequences do not necessarily fall on the evil-doer.1 The will of justice does not fill every corner of the world as naturally as air. When someone prays sincerely for the happiness they feel they ought to have, what they are chasing is only the illusion of moral retribution, not causality itself. When causality overrides moral recompense, we arrive at the absurd. \u0026ldquo;Natural rights\u0026rdquo; emerge from emptiness; every complaint of the form \u0026ldquo;I only wanted xxx, what did I do wrong?\u0026rdquo; is often no more than an emotional outlet. The only thing one can really trust is that human beings are born without a preset purpose and with nothing in hand. From childhood, we are trained to ask what is, why, and how. Yet many times we slip too easily into the illusion of asking what the world ought to be like, rather than accepting what the world is actually like. Let me quote Yang Xiaokai here: After going to prison, my political philosophy became very different from what it had been when I wrote Where Is China Heading? At that time I pursued ideals and believed that democracy should be based on elections. But in prison I lost all idealism. I came to believe that the standards by which people judge what they value change with history, so how history develops is far more important than some ideal end point. Before, I cared about questions such as \u0026ldquo;What is good? What is bad? What should the world be like?\u0026rdquo; In prison I instead asked: \u0026ldquo;How will this world develop?\u0026rdquo; The worst things may happen within our own lifetimes, so subjective judgments of right and wrong are of no real importance. The important thing is to adapt to the environment and survive. Giving up illusions and admitting the irrational structure of causality is the first step toward grasping what existentialism is. Once people realize that this is what the world actually looks like, they become lost and distressed. And that is how they fall into nihilism. For example: What is the purpose of the universe?2 If all existence is destined to vanish, what meaning can there be in what we do? The greatest dividing line in life seems to begin in the womb. What some people spend their entire lives striving for may be something others casually disdain. Is there any fairness in fate? Is it really a universal law of the world that good people are rewarded? Does effort necessarily lead to return? How do talent and effort combine to shape a person\u0026rsquo;s choices? Questions like these can indeed drive people toward nihilism. In modern society, I think there are two main ways people cope with them: Avoid the questions altogether. Believe in some set of convictions: in earlier times these might have been religion or Confucian norms; today they may be moral principles, or some personal creed one has cultivated. And the latter is precisely part of the future that the social sciences help construct.3 Once traditions accumulate over time, we stop paying attention to the foundations beneath our feet. Yet every chain of thought, if we keep tracing it backward, eventually rests on some basic premise that cannot fully justify itself. These ideas seep into everyday life through film, literature, and art, and gradu","date":"2025-02-21","heading":"","objectID":"/en/posts/fs4/:0:0","tags":["Social Sciences"],"title":"Existentialism and Social Science: Flowers Blooming from Nothingness","uri":"/en/posts/fs4/#"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":" Give civilization to time, rather than giving time to civilization1 —— The Dark Forest ","date":"2025-01-18","heading":"","objectID":"/en/posts/fzqy/:0:0","tags":["Economic History","Economic Growth"],"title":"The Origin of Rich Species: A Lamp Can Light a Room Dark for a Thousand Years","uri":"/en/posts/fzqy/#"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"Why I recommend it\rThe Origin of Rich Species reconstructs a history of economic growth through a two-sector Malthusian model plus competitive selection theory. The Selfish Gene inspired the author to read economic history through evolution, while The Three-Body Problem inspired him to look for counterfactuals through science fiction and formal models. What they share is that both rely on game theory and evolutionary thinking: I think Zhao Dingxin\u0026rsquo;s Zhao Dingxin | Structural-mechanism explanations and the development of structural-mechanism relations after the Big Bang does a very good job summarizing what Malthus leaves out: The Malthusian equation describes the exponential relationship between the individual reproduction rate of a biological population and the growth of the population as a whole. But that relationship only fully holds under conditions where food is never scarce, there is no intra- or inter-species competition, no predators, no density-constrained disease, and no migration. The Origin of Rich Species is precisely an attempt to revise Malthus from the angle of intra-group and inter-group competition. Within the interpretive framework of the competitive-selection mechanism, the turning points of technological explosion and wealth growth, as well as history\u0026rsquo;s recurring cycles of prosperity and destruction, all receive a more inclusive explanation. Challenging the academic mainstream is obviously hard. Beyond its theoretical models, the book also reflects on scientific concepts and methodology. I have always felt that — the best social scientists are really selling a worldview. The Origin of Rich Species reaches that level. It builds a historical vision by bringing together evolutionary theory, economic phenomena, and historical context. Because the author clearly loves science fiction and popular science writing, the book is also a lively, genuinely fun read. Like The Selfish Gene, this book feels less like a standard monograph and more like a modeling handbook for bioeconomics. The author walks through the wrong turns he once took and the way the argument of the paper gradually came together. That mix of courage against the mainstream, tight logic, and solid academic training is something I genuinely admire. ","date":"2025-01-18","heading":"Why I recommend it","objectID":"/en/posts/fzqy/:1:0","tags":["Economic History","Economic Growth"],"title":"The Origin of Rich Species: A Lamp Can Light a Room Dark for a Thousand Years","uri":"/en/posts/fzqy/#why-i-recommend-it"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"Economic history under the traditional Malthusian framework\rWhat Malthus created was not just a discipline, but a way of telling history. ","date":"2025-01-18","heading":"Economic history under the traditional Malthusian framework","objectID":"/en/posts/fzqy/:2:0","tags":["Economic History","Economic Growth"],"title":"The Origin of Rich Species: A Lamp Can Light a Room Dark for a Thousand Years","uri":"/en/posts/fzqy/#economic-history-under-the-traditional-malthusian-framework"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"The Malthusian trap\rMalthusian population theory gave rise to the field of population, resources, and environment. When society gets richer, people have more children; when society gets poorer, people have fewer children. In the end, per capita income stabilizes at a certain level. By the same logic, if production growth cannot keep up with population growth, disaster follows. ","date":"2025-01-18","heading":"The Malthusian trap","objectID":"/en/posts/fzqy/:2:1","tags":["Economic History","Economic Growth"],"title":"The Origin of Rich Species: A Lamp Can Light a Room Dark for a Thousand Years","uri":"/en/posts/fzqy/#the-malthusian-trap"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"The history of economic growth\rPopulation-resources-environment studies approach the Malthusian trap through natural resource use and population control. But once you move into economic growth and economic history, you get a different set of striking charts. Before the Industrial Revolution, world per capita income was almost flat. After the Industrial Revolution, growth turned exponential. In the long history of economic growth, it seems that only one thing ever happened — the Industrial Revolution. —— Gregory Clark (Gregory Clark) As the chart shows, world per capita income is usually divided into two periods: before Malthus and after Malthus\rHeight data seems to move in sync as well\r","date":"2025-01-18","heading":"The history of economic growth","objectID":"/en/posts/fzqy/:2:2","tags":["Economic History","Economic Growth"],"title":"The Origin of Rich Species: A Lamp Can Light a Room Dark for a Thousand Years","uri":"/en/posts/fzqy/#the-history-of-economic-growth"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"Interesting questions\rWhen you look at historical trend charts like these, a few questions naturally come up: Image source: Wikipedia. Maddison\u0026rsquo;s estimates of per capita GDP for selected European and Asian countries from 1500 to 1950, measured in 1990 international dollars at purchasing power parity. It shows the explosive growth of Western Europe and Japan in the nineteenth century.\rCould the Ming dynasty really have had the same real per capita income as the Song dynasty? If prosperity were perfect, why could it not last? Why does history keep swinging between democracy and non-democracy? Democratic Athens was defeated by authoritarian Sparta; the Western Roman Empire was followed by the dark medieval centuries. Why could the Industrial Revolution break the Malthusian trap? Can one unified model describe the whole history of economic growth? The extended discussion around unified growth models is fascinating. At first, the most interesting issue to me was the Needham Question, which came from a high school history teacher who gave me The Gains and Losses of Economic Reform Through the Dynasties2. As for evolution, I owe that interest to senior Z, who gave me The Selfish Gene 😍. For my own reading notes on The Selfish Gene, see The Selfish Gene: The Question of Altruistic Morality. Related questions: the Needham Question3, the Weber Question4, the Great Divergence5\u0026hellip;\u0026hellip; Just recording an old undergraduate methods assignment here\rWhat has to be explained, all at once, are three things: Why are societies poor? What happened at the turning point? Why do societies become rich? Thought\rIt is exactly because this narrative has become mainstream that development economics today is largely the domain of labor economics and economic history.\r","date":"2025-01-18","heading":"Interesting questions","objectID":"/en/posts/fzqy/:2:3","tags":["Economic History","Economic Growth"],"title":"The Origin of Rich Species: A Lamp Can Light a Room Dark for a Thousand Years","uri":"/en/posts/fzqy/#interesting-questions"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"Competitive selection\rHere I will only sketch, in very simple terms, the book\u0026rsquo;s way of answering those questions. ","date":"2025-01-18","heading":"Competitive selection","objectID":"/en/posts/fzqy/:3:0","tags":["Economic History","Economic Growth"],"title":"The Origin of Rich Species: A Lamp Can Light a Room Dark for a Thousand Years","uri":"/en/posts/fzqy/#competitive-selection"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"The two-sector Malthusian model and utility goods\rTraditional Malthusian theory is single-sector. It only compares fertility and survival, treating the means-of-production sector as one whole. This book uses a two-sector analysis. People choose between utility goods and subsistence goods. On top of that, the Malthusian population-equilibrium line still matters. The additional equilibrium is this: the system returns to the population-equilibrium line. When population growth exceeds that line, per capita resources fall, which shows up as a proportional inward shift of the production possibility frontier. The figure below presents one of the scenarios: People\u0026rsquo;s preference for utility goods rises (the indifference curve becomes flatter). At that point equilibrium lies below the population-equilibrium line (the production possibility frontier expands). A new equilibrium is eventually formed. In economic terms, this theorem is almost shocking: social preferences change, people value utility goods more, and social welfare somehow rises! The price is a temporary deviation from the population-equilibrium line. As shown\rI really like this two-sector improvement. Its conclusion also fits the long historical trend. As history advances, art, beauty, and spiritual pursuits can all be treated as utility goods, and human civilization has in fact placed steadily more weight on things beyond mere survival. At the same time, the pursuit of utility goods may conflict with the reproduction of civilization itself. People give up marriage to chase a dream; they abandon the fivepence of survival for the moon in the sky; they mistreat their bodies in pursuit of beauty. The Origin of Rich Species makes the following assumption about reproduction: genes push us to care about their continuation, but we do not deliberately calculate the probability of reproduction. This also helps explain why explosive wealth growth and falling fertility seem to move together, even though our living standards are genuinely improving 6. Many people reduce the reason to child-rearing costs, but the framework of The Origin of Rich Species can absorb that point too: education, housing, and medical care, all of which count as subsistence goods, have today been turned by consumerism into utility goods. That conversion of subsistence goods into utility goods massively raises social welfare, but the price is weaker fertility on the whole7. ","date":"2025-01-18","heading":"The two-sector Malthusian model and utility goods","objectID":"/en/posts/fzqy/:3:1","tags":["Economic History","Economic Growth"],"title":"The Origin of Rich Species: A Lamp Can Light a Room Dark for a Thousand Years","uri":"/en/posts/fzqy/#the-two-sector-malthusian-model-and-utility-goods"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"The population funnel\rThe balanced growth path calculated in the author\u0026rsquo;s model is: $$ g\\_{社会福利}=\\beta(g\\_{效应品}-g\\_{生存品}) $$ In research on economic growth (that is, macroeconomics), $g$ usually denotes a growth rate. The balanced growth path is the path of growth-rate changes implied by solving the model. During the Malthusian era, per capita income did not change. In the equation, that means the rate of progress in the utility sector and the rate of progress in the subsistence sector should have been the same. The biggest difficulty is that commercial and industrial sectors are naturally easier to improve than agriculture. This is also where the author stops fully convincing me. It is the transition point between economic analysis and evolutionary-game analysis. The author\u0026rsquo;s explanation relies on population migration and regional trade: The earlier two-sector model already suggested that when preference for utility goods rises, social welfare rises too. Population then flows in naturally, and the production possibility frontier shrinks again. The system eventually returns to a new equilibrium. As shown\rI feel this can also accommodate the Lewis turning point. It also helps explain why people are always moving from places with simple, modest customs to places marked by extravagance and excess. ","date":"2025-01-18","heading":"The population funnel","objectID":"/en/posts/fzqy/:3:2","tags":["Economic History","Economic Growth"],"title":"The Origin of Rich Species: A Lamp Can Light a Room Dark for a Thousand Years","uri":"/en/posts/fzqy/#the-population-funnel"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"Group competitive selection\rThe mainstream explanation of the Malthusian mechanism is \u0026ldquo;resources are limited,\u0026rdquo; while The Origin of Rich Species points instead to group competitive selection, that is, the structural elimination of certain traits. From the perspective of evolution, competition at the individual level and competition at the collective level may well conflict with each other. The system below is a nonlinear Volterra system. It was originally used to describe lake-bottom ecosystems: big fish eat small fish, but once the small fish are eaten out, the big fish also struggle to survive, and the system finally reaches equilibrium. $$ \\begin{cases} \\dot{\\varepsilon}=-{\\varepsilon }h\\left\\( \\theta \\right\\)\\\\\\\\ \\dot{\\theta}=-{\\theta }g\\left\\( \\varepsilon \\right) \\end{cases} $$ That is why the New Cambridge school treated this equation like class struggle, reading it as the relationship between the wage share-output ratio and the employment rate. But its interpretive force goes much further than that. The natural philosophy of one side rising as the other falls is expressed here with unusual clarity. Take today\u0026rsquo;s economy. Everyone thinks becoming a civil servant is the iron rice bowl, the safest possible choice. But if most people think that way, society loses its drive to create wealth and starts to decay. Keynes\u0026rsquo;s liquidity trap works in a similar way. The book The Selfish Gene argues that gene competition is the best explanation of evolution. But this equation pushes back against that claim. In fact, mainstream biology also holds that competition among groups plays a major role in evolution. Take a species in which every individual strengthens its reproductive organs, or some other conspicuous mating trait, in order to pass on its genes. Yet competition within a population becomes internal waste once you look at it from the perspective of competition between groups. Fossil evidence from Cretaceous ostracods suggests that only populations with reproductive organs of moderate length were able to persist. The longer the organs, the lower the probability of long-term continuation8. A concrete example: Athens had an extraordinarily advanced civilization and practiced democracy, yet it failed to withstand the attacks of authoritarian Sparta. The reason is that Athenian democracy increased utility goods — art, rhetoric, democracy, literature — but did not improve subsistence goods — military capacity, agriculture, architecture. That prosperity attracted enemies, but it did not strengthen the means to resist them. From this angle, I think The Origin of Rich Species can even absorb Why Nations Fail, and it may also explain why inclusive institutions could fail in their early stages. It also suggests that time travelers would be useless 😄( To sum up, if the utility-goods sector grows far faster than the subsistence-goods sector, it becomes easier to attack. The same can be said of China\u0026rsquo;s Song dynasty. That is also why evolution did not make everyone morally noble. Just like the dark forest in The Three-Body Problem9, malice becomes a kind of subsistence good in the game of group competitive selection. So we arrive at one conclusion: on a global scale, the growth rates of subsistence goods and utility goods are almost the same. Computer simulation result\r","date":"2025-01-18","heading":"Group competitive selection","objectID":"/en/posts/fzqy/:3:3","tags":["Economic History","Economic Growth"],"title":"The Origin of Rich Species: A Lamp Can Light a Room Dark for a Thousand Years","uri":"/en/posts/fzqy/#group-competitive-selection"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"Unified theory\rWhat came before explained why per capita income stayed stuck in the Malthusian age. What follows explains why wealth began to surge after the Industrial Revolution. ","date":"2025-01-18","heading":"Unified theory","objectID":"/en/posts/fzqy/:4:0","tags":["Economic History","Economic Growth"],"title":"The Origin of Rich Species: A Lamp Can Light a Room Dark for a Thousand Years","uri":"/en/posts/fzqy/#unified-theory"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"Existing unified theories\rThe standard view is that the pre-industrial world was ruled by the Malthusian trap, while the later period was driven by endogenous technological progress. Most unified-growth models explain the transition through either population structure or factor scarcity. Jones (2001) builds a theoretical model that uses population structure as the bridge. The Malthusian trap assumes that when people get richer, they have more children, but in reality fertility falls once a society becomes rich enough. Technology strengthens that trend, and the Industrial Revolution was the turning point10. Galor and Weil (2000) work with two trade-offs: 1. pleasure versus child-rearing, since raising children sacrifices one\u0026rsquo;s own enjoyment; 2. childbirth versus child quality. There is an equilibrium between the return to fertility and the cost of child-rearing11. Galor and Moav (2002) strengthen the role of educational accumulation on that basis, linking the Industrial Revolution, education, and the accumulation implied by gene-selection theory12. This was a 2002 QJE paper. So evolution and economics had already been linked long ago. Go back even earlier and Malthus\u0026rsquo;s Essay on the Principle of Population was itself an important inspiration for Darwin. Malthus\u0026rsquo;s Essay on Population and Darwin\u0026rsquo;s On the Origin of Species also inspired Marx\u0026rsquo;s Capital. Hansen and Prescott (2002) try to explain the shift through technological transition. Early on, productivity was scarce and people depended on land as a factor of production. After the Industrial Revolution, technological progress replaced that dependence on land development, and wealth then grew explosively13. ","date":"2025-01-18","heading":"Existing unified theories","objectID":"/en/posts/fzqy/:4:1","tags":["Economic History","Economic Growth"],"title":"The Origin of Rich Species: A Lamp Can Light a Room Dark for a Thousand Years","uri":"/en/posts/fzqy/#existing-unified-theories"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"The explanation in The Origin of Rich Species\rWhen the clouds disperse, the sun comes out, and most people try to explain how the sun went from nonexistence to existence. But what if the sun had always been there? Take an analogy from Liu Cixin\u0026rsquo;s Ball Lightning: it is not that ball lightning appears out of nowhere; rather, its disguise goes from present to absent14. It is not that the sun moves, but that the earth moves. Many people think happiness is something brought into existence, but perhaps happiness is only the easing of pain. It is not that the sun goes from absent to present, but that the clouds go from present to absent. Three factors cleared away the clouds hanging over economic growth. Trade replaced migration Innovation in knowledge media An explosion of utility goods As shown\rIn other words, economic growth, the pursuit of utility goods, and gains in welfare never stopped. But before the Industrial Revolution, the strong were the ones who died. Think of the advanced Song dynasty, Athens, or the Roman Empire. What they developed were only the flashy traits of biological display — advantages in competition among individuals inside the group, not advantages in competition between groups. Today competition works across many levels. Subsistence goods and utility goods can be transformed into each other at the same time; manufacturing and national defense are closely tied together. In the past, overdevelopment of utility goods was an obstacle. Today, the development of utility goods has become a driving force instead. Just as China\u0026rsquo;s ancient feudal order once stood ahead of slave society, yet in the end held back modernization. Earlier accounts usually stop at a lifecycle-theory explanation; this book goes further by dissecting utility goods in much finer detail. A thought experiment\rA hole in a dam is blocked. The species on the two sides mutate separately. Then the hole opens again, the two sides reunite, and a third species appears. One species becomes three. If that opening had never existed, it seems there would have been only one species forever. To what cause should we attribute the change? The angle from which we look at a process of something coming into being matters enormously. In the prosperity of the world, the competitive-selection index is that opening. ","date":"2025-01-18","heading":"The explanation in","objectID":"/en/posts/fzqy/:4:2","tags":["Economic History","Economic Growth"],"title":"The Origin of Rich Species: A Lamp Can Light a Room Dark for a Thousand Years","uri":"/en/posts/fzqy/#the-explanation-in-the-origin-of-rich-species"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"Market fragility and resilience\rA further objection: if that is true, why did the Soviet Union still collapse after the Industrial Revolution? Competition is layered, and it unfolds over long stretches of time. Rural subsistence goods may become urban utility goods. Think of prairie dairy farms or green fruit and vegetables from the countryside. Today\u0026rsquo;s utility goods may become tomorrow\u0026rsquo;s subsistence goods. Aluminum and copper once functioned that way in history; as technology changes, so does their exchange value relative to gold. The United States and the Soviet Union were competing on the same level; fascist and non-fascist systems were competing on another level. The more developed an economy becomes, the larger the consequences of victory in competition. So if the backward side crushes the other, dark rule may also last longer. The sad conclusion is that eternal prosperity does not exist — but new prosperity keeps appearing. Beside the sunken ship, a thousand sails pass by; before the sick tree, ten thousand saplings bloom in spring. Prosperity always exists — this is the market\u0026rsquo;s resilience. Prosperity is never eternal — this is the market\u0026rsquo;s fragility. This is also how domestic history textbooks describe the ancient small-peasant economy. Computer simulation result\rPut differently, the development of prosperity has always existed, but its diffusion has always been suppressed. Only when the world\u0026rsquo;s economy as a whole reached a certain stage did a good institution finally gain the chance to spread. Wasn\u0026rsquo;t the Age of Discovery precisely the key that opened the Industrial Revolution? ","date":"2025-01-18","heading":"Market fragility and resilience","objectID":"/en/posts/fzqy/:4:3","tags":["Economic History","Economic Growth"],"title":"The Origin of Rich Species: A Lamp Can Light a Room Dark for a Thousand Years","uri":"/en/posts/fzqy/#market-fragility-and-resilience"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"The interpretability of economic history\r","date":"2025-01-18","heading":"The interpretability of economic history","objectID":"/en/posts/fzqy/:5:0","tags":["Economic History","Economic Growth"],"title":"The Origin of Rich Species: A Lamp Can Light a Room Dark for a Thousand Years","uri":"/en/posts/fzqy/#the-interpretability-of-economic-history"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"A philosophy of history\rI agree with the author\u0026rsquo;s view of science in the book: at first glance it seems unbelievable, but after analysis it begins to feel as if it could not have been otherwise. That sense of \u0026ldquo;it had to be this way\u0026rdquo; is what I would call science. That is also why I find economic growth almost unbeatable as a field: mathematical models, economic intuition, and accumulated history are all stitched together. Macroeconomics really does feel a bit like ritual dancing sometimes. Once nations are involved, everyone is chasing some kind of \u0026ldquo;grand unification\u0026rdquo; — one theory that can accommodate wildly different development paths. At that level, economic growth may care even more about goodness of fit than econometrics does 🤧. Microeconomics seeks optimization; econometrics seeks credibility. What does macroeconomics seek? The only phrase I can think of is a view of the whole. Once we realize that economic growth is actually the brief flare in the long river of history, while stagnant equilibrium makes up most of history\u0026rsquo;s surface, some of our real-world anxiety eases. Quiet permanence is always there, extinction may well be the end of the universe, yet life keeps cycling and renewing itself. In the end, the philosophy of this book is not so different from The Lion King, 21 Lessons for the 21st Century, and Wisteria Waterfall15. Adam Smith wrote in The Theory of Moral Sentiments that \u0026ldquo;man pursues inner peace and pleasure.\u0026rdquo; Once you give up being a happy pig and choose instead to be a suffering human, you step onto that journey of seeking inner calm. Isn\u0026rsquo;t that too a form of pursuing utility goods? 👨‍🎓 In my own view, for anyone who really wants to understand the world, the calm and inclusiveness that come from history being interpretable are far more precious than economics\u0026rsquo; predictive power and practical utility. Mencius said: I am good at cultivating my vast, flowing qi. Only by knowing something can one hold the myriad things with tolerance, strengthen oneself without rest, keep one\u0026rsquo;s face unchanged when Mount Tai collapses before one\u0026rsquo;s eyes, and not blink when a deer bolts to the left. I would say this: before academic spirit is cultivated, the human spirit itself probably needs cultivating first. This is a question of roots and branches — one must remember that the gentleman is not a mere tool. I recently read Jianlai, so this hit me especially hard\r","date":"2025-01-18","heading":"A philosophy of history","objectID":"/en/posts/fzqy/:5:1","tags":["Economic History","Economic Growth"],"title":"The Origin of Rich Species: A Lamp Can Light a Room Dark for a Thousand Years","uri":"/en/posts/fzqy/#a-philosophy-of-history"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"Problems\rJust as Sapiens and The Selfish Gene use evolution to understand the world, one can treat them as forms of broad evolutionary thinking — something that overlaps with Hayek\u0026rsquo;s spontaneous order. In that same sense, The Origin of Rich Species, as an extension of the evolutionary perspective, shares with those books a certain \u0026ldquo;de-anthropocentric\u0026rdquo; angle. For that very reason, I think the book still has the following problems: The dispute between the two-sector model and the one-sector model. Precisely because changes in population structure are slow16 and carry long-term inertia, Malthus\u0026rsquo;s one-sector analysis fits intuition rather well. If utility goods and subsistence goods can so easily transform into one another, then describing them rigorously becomes a real problem. The book only gives a more intuitive description of utility goods. But what exactly connects utility goods to genetic survival? If the whole argument rests on competitive selection, how can this transformation be so easy? Model assumptions. The production function in the model is Cobb-Douglas. I wonder whether the growth path would change if one used a function with increasing returns to scale instead. After all, that is one of the standard motives for international trade in mainstream theory. Empirical method. The author also argues that competitive-selection theory is a tautological logic17. Unlike mainstream counterfactual analysis built around the same object of comparison, the method in this book relies on computer simulation of growth patterns and the search for non-biological counterfactuals. That is obviously very different from the dominant methods in contemporary economics. We still lack a mainstream econometric identification strategy for estimating the growth rate of the utility sector and the growth rate of the subsistence sector18. The author argues that this kind of tautological definitional deduction can be treated as an axiomatic discussion: it cannot prove itself, and need not prove itself. Agency of organized actors. The Selfish Gene separately sets up memes, distinguishing natural society from human society. Applying evolution to social analysis is a fresh perspective, but it also has to face the problem of agency. If the structure and evolution of government are mutually causal, then this is no longer a one-way story of evolution. What does the construction of an organization imply for the development of utility goods and subsistence goods? Across the long history of human society, only morality and the state seem to have become formally necessary elements. Still, I do like this kind of evolutionary philosophy of history. When the tide goes out, there are stalwarts but no heroes on the stage; when the tide is in, heroes sometimes appear, and mediocrities sometimes do too. All things compete freely under the frosty sky. Contingency and necessity can both fit inside the same picture. ","date":"2025-01-18","heading":"Problems","objectID":"/en/posts/fzqy/:5:2","tags":["Economic History","Economic Growth"],"title":"The Origin of Rich Species: A Lamp Can Light a Room Dark for a Thousand Years","uri":"/en/posts/fzqy/#problems"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"Conclusion\rStepping back, The Origin of Rich Species builds a framework for understanding macroeconomic history through group competition and the two-sector Malthusian model. The author uses a spark setting the prairie ablaze to describe the movement of economic evolution from silence to turbulence. The chance for civilizations to flourish has never disappeared; what was missing were the right external conditions. Still, the author never fully explains why, even after the Industrial Revolution, backward civilizations can sometimes defeat more advanced ones. The logic in the second half is less smooth than in the first. Even so, the framework remains impressively inclusive. I would sum up this view of history in three sentences: Before Malthus: a tree that rises above the forest is the first to be broken by the wind. In the Malthusian age: a lamp can light a room dark for a thousand years. After Malthus: with the east wind at its back, a spark can set the prairie on fire. As shown\rThis line is from The Three-Body Problem (The Dark Forest). In the novel, it is described as coming from Blaise Pascal. But after looking through online discussions, I think Pascal only wrote passages or long sentences with a roughly similar meaning. Most people seem to agree that Liu Cixin partly invented this line.\u0026#160;\u0026#x21a9;\u0026#xfe0e; This book is about economic cycles and also argues that modern Chinese economics is in some sense a continuation of ancient ideas. At the time, debates over the advance and retreat of the state were very popular, and the book broadly shared that tone.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Despite China\u0026rsquo;s many important contributions to the development of human science and technology in antiquity, why did modern science and the Industrial Revolution not arise in China?\u0026#160;\u0026#x21a9;\u0026#xfe0e; Why did Eastern societies such as China and India fail to follow a path of rationalization in politics, economics, science, and even art that was independent of the West?\u0026#160;\u0026#x21a9;\u0026#xfe0e; In the nineteenth century, the Western world overcame growth constraints and surpassed the formerly dominant, or comparable, civilizations of the Middle East and Asia.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Could this also be mocking the shaky core of cyberpunk? In Marxist political economy, this topic is called human alienation.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Perhaps it can be understood as an intergenerational cost.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Höglund J, Sheldon B C. The cost of reproduction and sexual selection[J]. Oikos, 1998: 478-483.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Suppose an advanced civilization discovers a less advanced one. To prevent itself from being attacked first, the optimal game-theoretic strategy is to strike first.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Jones C I. Was an industrial revolution inevitable? Economic growth over the very long run[J]. The BE Journal of Macroeconomics, 2001, 1(2): 153460131028.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Galor O, Weil D N. Population, technology, and growth: From Malthusian stagnation to the demographic transition and beyond[J]. American economic review, 2000, 90(4): 806-828.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Galor O, Moav O. Natural selection and the origin of economic growth[J]. The Quarterly Journal of Economics, 2002, 117(4): 1133-1191.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Hansen G D, Prescott E C. Malthus to solow[J]. American economic review, 2002, 92(4): 1205-1217.\u0026#160;\u0026#x21a9;\u0026#xfe0e; In Liu Cixin\u0026rsquo;s novel, ball lightning is a kind of macro-atom that is hard to observe with the naked eye and becomes noticeable mainly when it reacts with lightning.\u0026#160;\u0026#x21a9;\u0026#xfe0e; A middle-school text. I remember it so clearly because a teacher once asked in class what the theme of Wisteria Waterfall was, and I happened to know the answer, so the impression stuck.\u0026#160;\u0026#x21a9;\u0026#xfe0e; For example, the baby boom in a Year of the Dragon reflects the joint effect of long-term superstition and population structure: cyclical, repetitive, and powered by massive inertia.\u0026#160;\u0026#x21a9;\u0026#xfe0e; A term ","date":"2025-01-18","heading":"Conclusion","objectID":"/en/posts/fzqy/:5:3","tags":["Economic History","Economic Growth"],"title":"The Origin of Rich Species: A Lamp Can Light a Room Dark for a Thousand Years","uri":"/en/posts/fzqy/#conclusion"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Court Judgment Data Cleaning Handbook\rAuthor: Huaxiangshan This document is both a report on the current work and a summary of some lessons learned. It may help later students get up to speed on court judgment data cleaning more quickly. I hope future students will value optimizing engineering techniques, summarizing them, and sharing documentation. Think about how to optimize the engineering, optimize team collaboration, and turn accumulation and output into a capability. The world needs not only input but also output; the sharing and transmission of knowledge is the bond that keeps human civilization advancing. ","date":"2025-01-13","heading":"Court Judgment Data Cleaning Handbook","objectID":"/en/posts/cpws_stata/:0:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#court-judgment-data-cleaning-handbook"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Foreword\r","date":"2025-01-13","heading":"Foreword","objectID":"/en/posts/cpws_stata/:1:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#foreword"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Which AI to choose\rOn AI tool recommendations: if you can use GPT or Claude, go with those top-tier ones. But just as vibe coding has delivered its shock to the world — vibe slop. When we use AI for programming, we need to care even more about the verifiability, reusability, safety, compatibility, and readability of the code. ","date":"2025-01-13","heading":"Which AI to choose","objectID":"/en/posts/cpws_stata/:1:1","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#which-ai-to-choose"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Code style\rThere is a tradeoff between reusability and readability. For example, I personally don\u0026rsquo;t love the top-journal style that frantically uses program, global, and capture. Statistical code is not product code; in research, unless we\u0026rsquo;re doing heavy numerical computation, we generally don\u0026rsquo;t need to bother with complex macros to optimize runtime. Most of the time we only care about how data cleaning reduces memory usage and improves reusability. All things considered, I think the readability of statistical code matters more in teamwork. In the AI era, rather than code runtime efficiency, what we need to strengthen more is code review. Writing more comments is also very important. I personally prefer to use local to implement code functionality, so I often restrict AI from using global and program. ","date":"2025-01-13","heading":"Code style","objectID":"/en/posts/cpws_stata/:1:2","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#code-style"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Human initiative\rAI may know a lot of functions, but it doesn\u0026rsquo;t know how to combine them. Understanding the algorithm of the overall design is our biggest advantage. When asking questions, help AI sort out the algorithm of the code. With AI around, knowing which package can achieve which function, and what role it plays under the algorithm, matters more than mastering the details. Another good habit is to promptly summarize into md documents. After doing a lot of work with AI, keeping these detail documents can improve the efficiency of AI programming. As shown, this contains some of the data cleaning code I wrote for court judgments, all summarized into detailed documentation\r","date":"2025-01-13","heading":"Human initiative","objectID":"/en/posts/cpws_stata/:1:3","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#human-initiative"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Websites for court judgments\rI don\u0026rsquo;t recommend querying cases on China Judgements Online, it lags and requires frequent verification. I recommend PKULaw and Wolters Kluwer (Weike Xianxing) (with built-in visualization and convenient querying) 💬 Note: Cleaning court judgments requires alternately handling Chinese characters and numbers. This document will cover several common Python and Stata regular expressions. AI may know a lot of functions, but it doesn\u0026rsquo;t know how to combine them. Understanding the algorithm of the overall design is our biggest advantage. When asking questions, help AI sort out the algorithm of the code. With AI around, knowing which package can achieve which function, and what role it plays under the algorithm, matters more than mastering the details. ","date":"2025-01-13","heading":"Websites for court judgments","objectID":"/en/posts/cpws_stata/:1:4","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#websites-for-court-judgments"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Court Judgment Data Sources\rRaw text data: a pile of txt files. Each line is one court judgment record. The txt files are named after \u0026ldquo;万\u0026rdquo; (ten-thousand), so below we use the integer part of the number to refer to each txt file. The accompanying documents are the archives, the document dictionary, and the variable-meaning table. Example\rTip😍: Each txt file is very large, and ordinary software usually can\u0026rsquo;t open them. I personally recommend using EmEditor to view them. Actively using EmEditor to look at examples lets us better understand the mojibake situation and the writing conventions of court judgments, so we can improve our text-processing code. Dta data: Stata files already cleaned by predecessors. Split into ans 1–ans 83. Formatted as Stata .dta files. Example\rA complete cleaning pipeline is: Filter and extract the information we need from the raw txt files, ultimately turning it into data that can be imported into Stata. ","date":"2025-01-13","heading":"Court Judgment Data Sources","objectID":"/en/posts/cpws_stata/:2:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#court-judgment-data-sources"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Processing the txt Files\rMost of the court judgment txt files have already been converted to JSON format, so Python can read them fairly easily. Most of the court judgment txt files use the s-series naming structure below: The important information is all in the third column, inside the data structure contained in the s* series\rThe important information is all in the third column, inside the data structure contained in the s* series. But getting one to three txt files to run through doesn\u0026rsquo;t mean all of them will run through. ⛔ Court judgment txt files also come in some other formats: So when processing you need to consider code compatibility and comprehensiveness, write separate processing code, and then process such txt files twice. Example\rExample\r","date":"2025-01-13","heading":"Processing the txt Files","objectID":"/en/posts/cpws_stata/:3:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#processing-the-txt-files"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Some Suggestions\rSince the loop is easily interrupted, when processing with txt I recommend referring to the following logic: Process the mojibake txt files (attached later) separately from the s-series txt files. The original files are txt; after cleaning, generate new cleaned_txt files. Since the cleaning loop command is easily interrupted, it\u0026rsquo;s best to add one more command: compare the file names of the txt and cleaned_txt files. Add one more step: move the processed txt documents to another folder, fix the erroring code, and continue the loop. Python\u0026rsquo;s default file-reading order is txt 1, txt 10, txt 111\u0026hellip; rather than 1, 2, 3\u0026hellip; ","date":"2025-01-13","heading":"Some Suggestions","objectID":"/en/posts/cpws_stata/:3:1","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#some-suggestions"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Mojibake Documents\rIt\u0026rsquo;s not only the s-series txt files that have this: Example\r","date":"2025-01-13","heading":"Mojibake Documents","objectID":"/en/posts/cpws_stata/:3:2","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#mojibake-documents"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Python Example: Extracting the Case Number Sequence\r","date":"2025-01-13","heading":"Python Example: Extracting the Case Number Sequence","objectID":"/en/posts/cpws_stata/:4:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#python-example-extracting-the-case-number-sequence"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Approach\rPython reads the JSON format of the txt. Extract the CourtInfo data from the third column. Example\rThe s23 variable holds all case numbers, which we use to trace first instance, second instance, retrial, and final instance. For example, （2016）沪0104民初33043号 is essentially the ID card number of a court judgment case. Regular expression filtering: extract strings that satisfy the (year) chu\\zhong\\zai hao rule. pattern = r\"[（(]\\d{4}[)）][^号]*?(?:初|终|再)[^号]*?号\"\rAfter extraction, remove duplicates and exclude case numbers containing \u0026ldquo;['X', 'x', 'Ｘ', '执', '不动产', '-', '第']\u0026rdquo;. If you keep using this method to extract, it\u0026rsquo;s best to also add 辖 to the exclusions. This kind of case number also has 辖初, 辖再, and 辖终, but they only indicate the division of a court\u0026rsquo;s jurisdiction. (Maybe someone in the future can think of a way to use this feature for research? 👍) exclusions = ['X', 'x', 'Ｘ', '执', '不动产', '-', '第']\rSort, prioritizing sorting by the (year) in the case number. Delete all rows where the number of case numbers is greater than or equal to 5. A case at most follows this order: First instance, appeal if unsatisfied, retrial, final instance, appeal again if unsatisfied, final instance. You can jump directly from first instance to final instance; after final instance there is one last chance for retrial, and after the retrial ends it generally won\u0026rsquo;t change again. My personal sorting logic: (the biggest hole here is that I can\u0026rsquo;t think of how to perfectly identify the position of a \u0026ldquo;再\u0026rdquo; case number) Generate four variables m1–m4. Case numbers containing 初 are classified into m1, case numbers containing 终 are classified into m3. The cases with 再: If there are only 初 and 再, the 再 is classified into m2. If there is only 再, I put it in m4 by default. If there are both 终 and 再, judge by relative position whether the 再 is m2 or m4. Later I found that 【辖终】 interferes with the order, so first clear out the case numbers containing 辖, then swap the order with the 【终】 case number that got squeezed into m4. This is the most troublesome part of big data: If the earlier work isn\u0026rsquo;t done perfectly, the cost of redoing it later keeps rising. The worst part is — big data can rarely exhaust all possible mojibake. ","date":"2025-01-13","heading":"Approach","objectID":"/en/posts/cpws_stata/:4:1","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#approach"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Processing a Single txt\rThe following code only targets documents named with the s series. import pandas as pd from collections import OrderedDict import json import re import os # Read the data data = pd.read_csv(\"F:/桌面/裁判文书数据库/test/test.txt\", delimiter='\\t') # Check the first few rows of data print(data.head(3)) # Assume the CourtInfo column contains JSON strings json_data = data['CourtInfo'] # Parse the JSON data def parse_json(json_str): try: return json.loads(json_str) except json.JSONDecodeError: return None # Apply the parsing function parsed_prac_c = json_data.apply(parse_json) # Convert the JSON dictionary to a DataFrame and handle missing values json_df = pd.json_normalize(parsed_prac_c.dropna(how='all')) # Check the converted DataFrame print(json_df.head(20)) # Regular expression pattern pattern = r\"[（(]\\d{4}[）)]\\s*.*?号\" # Use findall to extract all matches matches = json_df['s23'].apply(lambda x: re.findall(pattern, x) if isinstance(x, str) else []) # Check the converted DataFrame print(matches.head(3)) print(matches) # Create a new DataFrame to save the updated 's23' column matches_df = pd.DataFrame({ 's23': matches }) # Check the converted DataFrame print(matches_df.head(10)) # print(matches_df) # Select the columns to concatenate selected_data_columns = [] selected_json_df_columns = [] # Concatenate the selected columns combined_df = pd.concat([data[selected_data_columns], json_df[selected_json_df_columns],matches_df], axis=1) def clean_text(text): if isinstance(text, list): text = ', '.join(text) # Convert the list to a string, elements separated by comma and space if isinstance(text, str): if text == \"[]\": return '' cleaned_text = text.replace('[', '').replace(']', '').strip() return cleaned_text return '' # Split and generate column names def split_and_rename(content): content = clean_text(content) split_content = content.split(', ') result = {f'm{i+1}': split_content[i].strip() for i in range(len(split_content)) if split_content[i].strip()} return result # Apply the function expanded_df = combined_df['s23'].apply(split_and_rename).apply(pd.Series) # Check the result # print(\"Expanded DataFrame:\") # Function to extract the year def extract_year(text): match = re.search(r'[（(](\\d{4})[）)]', text) return int(match.group(1)) if match else float('inf') # Cleaning and sorting function def clean_and_sort(row): # Filter out non-string values filtered = [item for item in row if isinstance(item, str) and not any(keyword in item for keyword in exclusions)] # Remove duplicates while preserving order unique_items = list(OrderedDict.fromkeys(filtered)) # Sort by year sorted_items = sorted(unique_items, key=lambda x: extract_year(x)) return sorted_items # List of keywords to exclude exclusions = ['X', 'x', 'Ｘ', '执', '不动产', '-', '第'] # Select all m* columns m_columns = [col for col in expanded_df.columns if col.startswith('m')] # Apply the cleaning and sorting function to each row def process_row(row): # Get the content of the m* columns row_values = [row[col] for col in m_columns] # Flatten the list flattened = [item for sublist in row_values for item in (sublist if isinstance(sublist, list) else [sublist])] # Process and sort sorted_items = clean_and_sort(flattened) return sorted_items # Apply to each row of the DataFrame sorted_results = expanded_df.apply(process_row, axis=1) # Create a new DataFrame max_length = max(sorted_results.apply(len)) sorted_df = pd.DataFrame(sorted_results.tolist(), columns=[f'm_sorted_{i+1}' for i in range(max_length)]) # Print the result print(sorted_df.head(10)) # Concatenate to the original data combined_df2 = pd.concat([combined_df, sorted_df], axis=1) # Check the result print(combined_df.head(10)) # Check whether the 'm_sorted_5' column exists, and drop non-empty rows if 'm_sorted_5' in combined_df2.columns: combined_df2_cleaned = combined_df2[combined_df2['m_sorted_5'].isna() | (combined_df2['m_sorted_5'] == '')] else: # If the column doesn't exist, keep the original DataFrame combined_df","date":"2025-01-13","heading":"Processing a Single txt","objectID":"/en/posts/cpws_stata/:4:2","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#processing-a-single-txt"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Batch Processing\rMy personal batch-processing approach is to loop over all documents in a folder. The loop is easily interrupted, so I suggest writing an error log and a command to move a document once it has been processed. import pandas as pd from collections import OrderedDict import json import re import os # Define the input and output folder paths # Define the input and output folder paths input_folder_path = \"C:/Users/PC/Desktop/hzp_project/二审和一审/数据/\" output_folder_path = \"C:/Users/PC/Desktop/hzp_project/二审和一审/清洗结果/\" # Create the output folder if it doesn't exist if not os.path.exists(output_folder_path): os.makedirs(output_folder_path) # Iterate over all .txt files in the input folder for filename in os.listdir(input_folder_path): if filename.endswith('.txt'): input_file_path = os.path.join(input_folder_path, filename) output_file_path = os.path.join(output_folder_path, filename) # Read the data data = pd.read_csv(input_file_path, delimiter='\\t') # Print the first 3 rows to check print(f\"Processing file: {filename}\") print(data.head(3)) # Parse the JSON field json_data = data['CourtInfo'] def parse_json(json_str): try: return json.loads(json_str) except json.JSONDecodeError: return None parsed_prac_c = json_data.apply(parse_json) # Convert the parsed JSON to a DataFrame json_df = pd.json_normalize(parsed_prac_c.dropna(how='all')) # Print the first 20 rows to check print(json_df.head(20)) # Define the matching pattern pattern = r\"[（(]\\d{4}[）)]\\s*.*?号\" # Find the matches matches = json_df['s23'].apply(lambda x: re.findall(pattern, x) if isinstance(x, str) else []) # Print the first 3 matches to check print(matches.head(3)) print(matches) # Convert the matches to a DataFrame matches_df = pd.DataFrame({'s23': matches}) # Print the first 10 rows of the matches DataFrame to check print(matches_df.head(10)) # Select the data columns to keep selected_data_columns = [] selected_json_df_columns = [] # Concatenate the original data, parsed JSON data, and match results combined_df = pd.concat([data[selected_data_columns], json_df[selected_json_df_columns], matches_df], axis=1) # Text cleaning function def clean_text(text): if isinstance(text, list): text = ', '.join(text) if isinstance(text, str): if text == \"[]\": return '' cleaned_text = text.replace('[', '').replace(']', '').strip() return cleaned_text return '' # Split and rename function def split_and_rename(content): content = clean_text(content) split_content = content.split(', ') result = {f'm{i+1}': split_content[i].strip() for i in range(len(split_content)) if split_content[i].strip()} return result # Expand the match results expanded_df = combined_df['s23'].apply(split_and_rename).apply(pd.Series) # Function to extract the year def extract_year(text): match = re.search(r'[（(](\\d{4})[）)]', text) return int(match.group(1)) if match else float('inf') # Cleaning and sorting function def clean_and_sort(row): filtered = [item for item in row if isinstance(item, str) and not any(keyword in item for keyword in exclusions)] unique_items = list(OrderedDict.fromkeys(filtered)) sorted_items = sorted(unique_items, key=lambda x: extract_year(x)) return sorted_items # List of exclusion keywords exclusions = ['X', 'x', 'Ｘ', '执', '不动产', '-', '第'] # Get the names of all columns starting with m m_columns = [col for col in expanded_df.columns if col.startswith('m')] # Process each row def process_row(row): row_values = [row[col] for col in m_columns] flattened = [item for sublist in row_values for item in (sublist if isinstance(sublist, list) else [sublist])] sorted_items = clean_and_sort(flattened) return sorted_items sorted_results = expanded_df.apply(process_row, axis=1) # Compute the maximum length and create a new sorted DataFrame max_length = max(sorted_results.apply(len)) sorted_df = pd.DataFrame(sorted_results.tolist(), columns=[f'm_sorted_{i+1}' for i in range(max_length)]) # Concatenate the data again combined_df2 = pd.concat([combined_df, sorted_df], axis=1) # Filter condition if","date":"2025-01-13","heading":"Batch Processing","objectID":"/en/posts/cpws_stata/:4:3","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#batch-processing"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Python Example: Extracting Legal Provisions and Moving Folders\rThe number of legal provisions can measure case complexity, and the provisions themselves also measure the case type. The s47 series of the txt documents corresponds to the legal provisions of the judgment, and inside it is a second-level JSON format: for clause in data: fgmc = clause.get('fgmc', '') tkx = clause.get('tkx', '') match = re.search(r'(第.*?条)', tkx)\rThe Chinese characters in ['s23', 's25', 's26', 's27'] summed up are the word count of the judgment\u0026rsquo;s main text. \u0026ldquo;s7\u0026rdquo;: \u0026ldquo;case number\u0026rdquo;, \u0026ldquo;s23\u0026rdquo;: \u0026ldquo;litigation records\u0026rdquo;, \u0026ldquo;s24\u0026rdquo;: \u0026ldquo;claims and defense\u0026rdquo;, \u0026ldquo;s25\u0026rdquo;: \u0026ldquo;facts\u0026rdquo;, \u0026ldquo;s26\u0026rdquo;: \u0026ldquo;reasoning\u0026rdquo;, \u0026ldquo;s27\u0026rdquo;: \u0026ldquo;judgment result\u0026rdquo;. ","date":"2025-01-13","heading":"Python Example: Extracting Legal Provisions and Moving Folders","objectID":"/en/posts/cpws_stata/:5:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#python-example-extracting-legal-provisions-and-moving-folders"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Multiple txt Files\rimport pandas as pd import json import re import os import glob import logging # Configure logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') # Explicitly specify the input and output folder paths input_folder_path = \"C:/Users/PC/Desktop/hzp_project/二审和一审/数据/\" output_folder_path = \"C:/Users/PC/Desktop/hzp_project/二审和一审/清洗结果/\" log_folder_path = \"C:/Users/PC/Desktop/hzp_project/二审和一审/日志/\" # Make sure the output and log folders exist os.makedirs(output_folder_path, exist_ok=True) os.makedirs(log_folder_path, exist_ok=True) # Parse JSON data def parse_json(json_str): try: if isinstance(json_str, str): return json.loads(json_str) elif isinstance(json_str, list): return json_str else: logging.warning(f\"未知数据类型: {type(json_str)}\") return None except json.JSONDecodeError: logging.warning(f\"JSON 解析失败: {json_str}\") return None # Count Chinese characters def count_chinese_chars(text): if pd.isnull(text): return 0 return len(re.findall(r'[\\u4e00-\\u9fff\\u0030-\\u0039\\u3000-\\u303f\\uff00-\\uffef]', str(text))) # Extract and format clauses def extract_clauses(s47_data): formatted_clauses = [] for item in s47_data.dropna(): data = parse_json(item) if data is not None: clauses = set() # Use a set to deduplicate for clause in data: fgmc = clause.get('fgmc', '') tkx = clause.get('tkx', '') match = re.search(r'(第.*?条)', tkx) if match: clauses.add(f\"{fgmc}{match.group(1)}\") formatted_clauses.append(list(clauses)) # Save the clauses extracted per row else: formatted_clauses.append([]) # If parsing fails, add an empty list return formatted_clauses # Process a single file def process_file(input_file, output_folder, log_folder, total_rows): # Initialize an empty list to store error info error_logs = [] def bad_line_handler(bad_line): error_logs.append((input_file, bad_line.line_num, bad_line.line)) # Read the data try: data = pd.read_csv(input_file, delimiter='\\t', on_bad_lines=bad_line_handler, engine='python') logging.info(f\"Read {len(data)} rows from file: {input_file}\") except Exception as e: logging.error(f\"Error reading file: {input_file}\") logging.error(f\"Error message: {e}\") return # Filter out rows where the CourtInfo column starts with \"DocInfoVo\" or cannot be parsed as JSON data = data[data['CourtInfo'].apply(lambda x: x.startswith('{\"s1\":') if pd.notnull(x) else False)] data = data[data['CourtInfo'].apply(lambda x: isinstance(parse_json(x), dict))] logging.info(f\"Filtered out invalid rows from file: {input_file}\") # Extract the JSON data json_data = data['CourtInfo'] # Apply the parsing function parsed_prac_c = json_data.apply(parse_json) logging.info(f\"Parsed JSON data from file: {input_file}\") # Convert the JSON dictionary to a DataFrame and handle missing values json_df = pd.json_normalize(parsed_prac_c.dropna(how='all')) logging.info(f\"Normalized JSON data from file: {input_file}\") # Select specific columns selected_columns = json_df[['s7', 's23', 's25', 's26', 's27', 's47']].copy() # Use .copy() to create a copy # Count occurrences of the character \"条\" in the s26 column selected_columns['count_tiao'] = selected_columns['s26'].apply(lambda x: x.count('条') if pd.notnull(x) else 0) logging.info(f\"Calculated 'count_tiao' from file: {input_file}\") # Compute the total character count of the s23, s25, s26, s27 columns selected_columns['total_chars'] = selected_columns[['s23', 's25', 's26', 's27']].apply( lambda row: sum(count_chinese_chars(x) for x in row), axis=1 ) logging.info(f\"Calculated 'total_chars' from file: {input_file}\") # Extract and format clauses unique_clauses = extract_clauses(selected_columns['s47']) selected_columns['unique_clauses'] = unique_clauses # Use .loc for safe assignment selected_columns['clause_count'] = [len(clauses) for clauses in unique_clauses] # Number of clauses per row logging.info(f\"Extracted and formatted clauses from file: {input_file}\") # Generate the output file name base_name = os.path.basename(input_file) output_file = os.path.join(outpu","date":"2025-01-13","heading":"Multiple txt Files","objectID":"/en/posts/cpws_stata/:5:1","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#multiple-txt-files"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Moving txt Files\rBecause the code loop is very easily interrupted, I recommend setting up three folders: The raw folder holds the raw data. The results folder holds the processed data, uniformly renamed to cleaned_* txt names. The cleaned folder: put the raw data that has finished cleaning here, so that after the loop is interrupted you can resume from where you left off. So the logic of this code is to compare the cleaned folder against the raw folder and move the txt documents whose names have a match. import os import shutil # Define the folder paths source_folder = r'F:/桌面/测试/清洗结果' data_folder = r'F:/桌面/测试/数据' cleaned_folder = r'F:/桌面/测试/完成提取' # Get all .txt file names in the source folder (without paths), remove the \"cleaned_\" prefix, strip all extra spaces, and convert to lowercase def standardize_filename(filename): return ''.join(filename.split()).lower() # Get the file names in the source folder source_files = [f for f in os.listdir(source_folder) if f.startswith('cleaned_') and f.endswith('.txt')] standardized_source_files = {standardize_filename(f[8:]): f for f in source_files} # Get the file names in the data folder data_files = [f for f in os.listdir(data_folder) if f.endswith('.txt')] standardized_data_files = set(standardize_filename(f) for f in data_files) # Find files in the data folder that also exist in the source folder common_files = standardized_source_files.keys() \u0026 standardized_data_files # Move the matching files to the cleaned folder for filename in common_files: original_filename = standardized_source_files[filename] source_path = os.path.join(data_folder, original_filename.replace('cleaned_', '')) destination_path = os.path.join(cleaned_folder, original_filename.replace('cleaned_', '')) # Make sure the destination folder exists os.makedirs(os.path.dirname(destination_path), exist_ok=True) shutil.move(source_path, destination_path) print(f\"Moved: {source_path} -\u003e {destination_path}\") print(\"Process completed.\")\r","date":"2025-01-13","heading":"Moving txt Files","objectID":"/en/posts/cpws_stata/:5:2","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#moving-txt-files"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Example: Re-sorting the Court Judgment Index\rThe earliest first-instance case number goes first (m_sorted_1) The latest final-instance case number goes last (m_sorted_3) Retrial cases are arranged as \u0026ldquo;earliest before final instance, latest after final instance\u0026rdquo; (m_sorted_2, m_sorted_4) The remaining case numbers fill the gaps in chronological order (m_sorted_5) import pandas as pd from datetime import datetime def parse_date(year_str, month_str): \"\"\"将年份、月份字符串转换为日期对象，若转换失败返回 None\"\"\" try: year = int(year_str) month = int(month_str) if month_str and month_str.strip() != \"\" else 1 return datetime(year, month, 1) except Exception: return None def reorder_row(row): # List of extra fields to move together (associated variables other than m_sorted_i) extra_fields = ['court', 'court_name', 'jud_year', 'jud_month', 'win', 'judge_am', 'judge_fin'] entries = [] # Iterate over the original 5 groups of data, constructing each group's entry (only when both m*_judge_am and m*_jud_year have values is the group considered valid) for i in range(1, 6): judge_am = row.get(f\"m{i}_judge_am\") jud_year = row.get(f\"m{i}_jud_year\") if pd.isna(judge_am) or pd.isna(jud_year) or judge_am == \"\" or jud_year == \"\": continue case_str = row.get(f\"m_sorted_{i}\") if not case_str or pd.isna(case_str): continue jud_month = row.get(f\"m{i}_jud_month\") dt = parse_date(jud_year, jud_month) # Judge the case-number type if \"初\" in case_str: typ = \"chu\" elif \"终\" in case_str: typ = \"zhong\" elif \"再\" in case_str: typ = \"zai\" else: typ = \"other\" # Collect other related fields fields_data = {} for field in extra_fields: col_name = f\"m{i}_{field}\" fields_data[field] = row.get(col_name, \"\") entry = { \"orig_index\": i, # Original group number \"case\": case_str, # Case-number string \"date\": dt, # Converted date (may be None) \"type\": typ, # Case-number type: chu / zhong / zai / other \"fields\": fields_data } entries.append(entry) # If there are no valid entries, return all new groups as empty if not entries: return pd.Series({f\"m_sorted_{i}\": \"\" for i in range(1, 6)}) # Locate \"初\": take the earliest date among all entries containing \"初\" chu_entries = [e for e in entries if e[\"type\"] == \"chu\" and e[\"date\"] is not None] initial_entry = min(chu_entries, key=lambda e: e[\"date\"]) if chu_entries else None # Locate \"终\": take the largest date among all entries containing \"终\" zhong_entries = [e for e in entries if e[\"type\"] == \"zhong\" and e[\"date\"] is not None] terminal_entry = max(zhong_entries, key=lambda e: e[\"date\"]) if zhong_entries else None # Get all \"再\" entries zai_entries = [e for e in entries if e[\"type\"] == \"zai\" and e[\"date\"] is not None] # Initialize the dictionary of new sorting positions, representing the entries finally placed in m_sorted_1 to m_sorted_5 new_positions = {1: None, 2: None, 3: None, 4: None, 5: None} # m_sorted_1 always holds the \"初\" case if initial_entry: new_positions[1] = initial_entry if terminal_entry: # If a final case exists, m_sorted_3 is fixed to hold the final case new_positions[3] = terminal_entry # Group: \"再\" before the final case re_before = [e for e in zai_entries if e[\"date\"] \u003c terminal_entry[\"date\"]] # Group: \"再\" after the final case re_after = [e for e in zai_entries if e[\"date\"] \u003e terminal_entry[\"date\"]] # Take the earliest \"再\" with a date before the final case into m_sorted_2 if re_before: new_positions[2] = min(re_before, key=lambda e: e[\"date\"]) # Take the latest \"再\" with a date after the final case into m_sorted_4 if re_after: new_positions[4] = max(re_after, key=lambda e: e[\"date\"]) else: # If no final case exists, i.e. only \"初\" and \"再\" zai_sorted = sorted(zai_entries, key=lambda e: e[\"date\"]) if len(zai_sorted) == 1: new_positions[2] = zai_sorted[0] elif len(zai_sorted) \u003e= 2: # Earliest into m_sorted_2, latest into m_sorted_4 new_positions[2] = zai_sorted[0] new_positions[4] = zai_sorted[-1] # Fill the remaining unassigned entries (including type other or unselected) into remaining gaps (e.g. m_sorted_5) after sorting by date as","date":"2025-01-13","heading":"Example: Re-sorting the Court Judgment Index","objectID":"/en/posts/cpws_stata/:6:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#example-re-sorting-the-court-judgment-index"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Matching the dta Data\r","date":"2025-01-13","heading":"Matching the dta Data","objectID":"/en/posts/cpws_stata/:7:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#matching-the-dta-data"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"About Case Numbers\rThe case numbers of court documents are divided into ruling documents, judgment documents, and other documents (supervision, enforcement, guarantee\u0026hellip;). Ruling documents concern procedural matters, for example this matter shouldn\u0026rsquo;t be handled by court xx and is transferred to court xx. Judgment documents concern substantive matters, i.e., the final result of the judgment. Note! Judgment documents and court documents may share the same case number! Here I\u0026rsquo;ll also share some bizarre court judgment case numbers I\u0026rsquo;ve seen personally; some of the strange symbols may be because someone else already used that number and added symbols to distinguish them. 2018（）皖02民终1098号 2016湘06民终2392号 （（2017）豫0481民再10号 一（2017）粤0605民初10499号 (2015)芙民初字第7479、7601号 （2015）芙民初字第7478.7603号 （2019）粤0305民初1382号-1429号 （2019）鲁1724民初195号- 018） 苏0509民初6820号 ｌｏｚ2016ｌｏｚ赣1030民初220号 一亿二千三百四十五万（2016）粤0605民初14359号 （2018）土地承包经营权转让浙0523民初2386号 2016闽0525民初3798号2016闽0525民初3798号 （空一行行距15磅）（2014）滨港民初字第307号\rBecause of the issue with Chinese vs. English parentheses, I recommend removing the parentheses. But I don\u0026rsquo;t recommend filtering by keeping only Chinese characters and digits, since in many cases the short dashes and mysterious characters also carry identifying information. My own matching filter is as follows: sort case_wid drop if case_wid ==\"\" foreach var of varlist case_wid { * Remove space variables, parentheses, and other symbols replace `var' = ustrregexra(`var',\"[^\\p{L}\\p{N}]\", \"\") } sort case_wid gen case_length = strlen(case_wid) summarize case_length drop if case_length \u003e 66 drop case_length\r","date":"2025-01-13","heading":"About Case Numbers","objectID":"/en/posts/cpws_stata/:7:1","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#about-case-numbers"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"De-duplicating the Identifier\rAfter the txt extraction is complete, it\u0026rsquo;s converted to .dta and matched into ans*.dta. The case number is the theoretical unique identifier, but in practice duplicates may occur. In this case I recommend the following logic: first iterate over all variables, generate the total number of non-missing values, de-duplicate, and among the duplicate rows of a case number keep the row with the most non-missing values: * Flag duplicate case_wid and count per group bysort case_wid: gen dup_count = _N replace dup_count = . if _n \u003e 1 // Optional: keep only the count at the first occurrence * Create a local macro containing all variables to check local varlist var1 var2 * Use a loop to create flag variables foreach var of local varlist { gen flag_`var' = cond(missing(`var'), 0, 1) } * Count the number of non-missing values per row egen non_missing = rowtotal(flag*) * Within each case_wid, sort by non-missing count descending and flag the observation to keep bysort case_wid (non_missing): gen keep = (_n == _N) * Clean up temporary variables capture drop flag* * Drop duplicates, keeping the row with the most non-missing variables drop if !keep * Clean up auxiliary variables drop dup_count non_missing keep * Save the processed file, overwriting the original save \"`input_file'\", replace }\r","date":"2025-01-13","heading":"De-duplicating the Identifier","objectID":"/en/posts/cpws_stata/:7:2","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#de-duplicating-the-identifier"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"De-duplicating the Index Values\r* For the second variable, clear it if it equals the first replace m_sorted_2 = \"\" if m_sorted_2 == m_sorted_1 * For the third variable, clear it if it equals any previous variable replace m_sorted_3 = \"\" if m_sorted_3 == m_sorted_2 | m_sorted_3 == m_sorted_1 * For the fourth variable, clear it if it equals any previous variable replace m_sorted_4 = \"\" if m_sorted_4 == m_sorted_3 | m_sorted_4 == m_sorted_2 | m_sorted_4 == m_sorted_1 * For the fifth variable, clear it if it equals any previous variable replace m_sorted_5 = \"\" if m_sorted_5 == m_sorted_4 | m_sorted_5 == m_sorted_3 | m_sorted_5 == m_sorted_2 | m_sorted_5 == m_sorted_1\r","date":"2025-01-13","heading":"De-duplicating the Index Values","objectID":"/en/posts/cpws_stata/:7:3","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#de-duplicating-the-index-values"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Format Conversion of the Text-Matching Identifier\rThe text format of the ans*.dta series is all strL, meaning long string. Stata string matching can only use string formats with a specific length, so we can change the variable format by truncating characters. 🔊 Important: Note that the placeholder widths of English characters and Chinese characters are different. For example, \u0026ldquo;民初 730 号\u0026rdquo; — although it\u0026rsquo;s only six characters, it may actually occupy 15 positions. If we only truncate to a length of 6, the variable becomes mojibake. The longest case-number placeholder I\u0026rsquo;ve observed is about 39 positions, and for robustness I simply chose to truncate to 88 characters. This also means: we need to convert after cleaning out the strange symbols in the text. For example, some court names are like \u0026ldquo;广西壮族自治区柳州市鱼峰区人民法院\u0026rdquo; # Truncate characters gen judge_fin2 = substr(judge_fin, 1, 45) gen court_name2 = substr(court_name, 1, 88) drop judge_fin court_name rename judge_fin2 judge_fin rename court_name2 court_name # Clean case numbers longer than a certain character count, e.g. 66, to empty foreach var of varlist s7 m_sorted_1 m_sorted_2 m_sorted_3 m_sorted_4 { gen case_length = strlen(`var') summarize case_length replace `var' = \"\" if case_length \u003e 66 drop case_length }\r","date":"2025-01-13","heading":"Format Conversion of the Text-Matching Identifier","objectID":"/en/posts/cpws_stata/:7:4","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#format-conversion-of-the-text-matching-identifier"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Choosing the Matching Command\rMany (base table) to one: use the merge command directly. One (base table) to many: for example, txt has some duplicate records, but the missing values differ across rows. We can use merge\u0026rsquo;s append matching update nogen force, which only matches variables onto missing values in that row; the non-missing parts are left unchanged. clear forvalues j = 1/83 { use \"D:\\数据合集\\原始数据\\ans`j'.dta\", clear merge 1:m case_wid_str using \"C:\\Users\\PC\\Desktop\\hzp_project_re\\一审二审数据匹配\\排序\\面板数据\\all.dta\", update nogen force drop if case_wid == \"\" duplicates drop case_wid_str , force save \"C:\\Users\\PC\\Desktop\\hzp_project_re\\一审二审数据匹配\\排序\\面板数据\\ans`j'.dta\", replace }\rFor many-to-many (base table) matching: merge is no longer suitable here; I recommend joinby. For details, see Stata command: joinby VS merge m:m common issues ","date":"2025-01-13","heading":"Choosing the Matching Command","objectID":"/en/posts/cpws_stata/:7:5","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#choosing-the-matching-command"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Loop Matching Commands\rWhen we write loop matching commands, the numbers may have gaps, e.g. data 1, data 3, data 5, data 7\u0026hellip; You could use Python to directly rename the files in order, but that easily destroys the meaning of the naming. Here I provide a Stata natural-number loop command I wrote: Of course, you could scan the folder for all file names, identify them, and loop over them. But if there are some files that need manual exclusion, you can refer to this code. * Define the exclusion list global exclude_list 22 50 54 58 105 * Initialize the valid_files variable global valid_files * Loop over the file number range and check whether each is in the exclusion list forvalues i = 1/119 { local is_excluded 0 foreach excl in $exclude_list { if `i' == `excl' { local is_excluded 1 break } } if !`is_excluded' { global valid_files $valid_files `i' } } * Display the valid file numbers display \"Valid file numbers: $valid_files\" * Loop over and process the valid file numbers foreach i of global valid_files { *Write your own loop matching code here }\rBut what if the file names are complete mojibake? If the file names have no spaces or special symbols, you can read the file names into a local and add them to the loop. This is also a more general-purpose piece of code. For example, the following mojibake: As shown\rWe can use Stata\u0026rsquo;s fs package to read all the names. Then use a local to store the names directly for the loop. During the loop we can nest another loop so that new files are named in order. * ============================== * Configure paths * ============================== local path \"F:\\数据合集\\刑事案件\" local outpath \"F:\\数据合集\\刑事案件简洁\" cd \"`path'\" fs \"*.csv\", all * ============================== * Manually generate the CSV file list into a local * ============================== local files \" 080hfjsviunvohos.csv 749baig9gvbblcn.csv 97sytdv97goushd.csv 08cdhas0hvihikd.csv 7839yhcudaboce.csv 98ya08chiahnicn.csv 0s87d0hvcinowbv.csv 788tgd9cayh0c-9.csv 9a7gtdc97g08a0a.csv 1368bcohucg970.csv 797fshonlsnlfu98.csv 9f79sghuvjksbklk.csv 236797rbvlsbvoo.csv 79d7goadbco9hki.csv 9s7fhosivnlsnlnffr.csv 2489ndsujbovbo.csv 79s7dhnofnvlbns.csv a97dyc8udv8+hds9.csv 28638bvbsa7f93.csv 80sdhv08uisnvoh.csv i7sdhvu9hbosdv8.csv 2937hvoushcv8h.csv 89hdoshvoinsnnlj.csv oa7gc7agbkd78ad.csv 4689578yhkjsbd.csv 89s0fjisn7vgiskub.csv oc8ahhc89ha98g.csv 4790r8hvobosh7.csv 8y08h0chaicnil8o.csv os8dvyh089shdvi.csv 4792794bvoshc8.csv 94573hvsoidhv9y.csv s8oyvf08s09vu08.csv 479hu5nnv89007.csv 9473hgnvov9h7s.csv u8ca0hc80ha00a.csv 4927bvogf92h011.csv 97atcg97ga0hc08.csv ughdso8h98989.csv 739g4foh8hv991.csv 97sgvc98dshv08.csv \" * ============================== * Loop over each file * ============================== * Initialize the counter local i = 1 * Loop over each file foreach f of local files { di \"Processing file `i': `f'\" * Import CSV import delimited \"`f'\", clear varnames(1) encoding(utf8) * Data cleaning * Processing section * Save as a numerically ordered DTA file save \"`outpath'/`i'.dta\", replace * Increment the counter local ++i }\r","date":"2025-01-13","heading":"Loop Matching Commands","objectID":"/en/posts/cpws_stata/:7:6","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#loop-matching-commands"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Optimizing Matching Speed\rNormal matching would be to match the dta files converted from the 119 txt files, nested-loop matching them onto ans 1–ans 83. If you match with direct nested loops, it might take 4 to 5 days. The reason the matching takes so long is that each nested loop\u0026rsquo;s file reading takes too long, and there are duplicate values across files. I recommend first using the append command to vertically stack the 119 dta files together, then loop-matching them onto ans 1 to ans 83. This way the entire match takes at most 2 days. 💬 Note: The office computer runs the Stata MP version, whose feature is that \"computation speed is allocated based on the computer's cores.\" The CPU currently has a full 16 cores, and the largest peak I've personally processed is 60 GB. It's basically fine — you just need patience while waiting through the occasional stalls. ","date":"2025-01-13","heading":"Optimizing Matching Speed","objectID":"/en/posts/cpws_stata/:7:7","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#optimizing-matching-speed"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Cleaning the dta Data\r","date":"2025-01-13","heading":"Cleaning the dta Data","objectID":"/en/posts/cpws_stata/:8:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#cleaning-the-dta-data"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Common Text-Processing Functions\rRemoving Spaces\rFor example, the chief judge (judge) variable can appear as 四川 大学, 四川大学, or 四 川 大 学. Different websites use different space characters, so I recommend the following function: Remove all special characters, including invisible characters, whitespace, and punctuation. replace judge_fin = ustrregexra(法官名字变量, \"[^\\p{L}\\p{N}]+\", \"\")\rFiltering Specific Characters\rKeep a row if the variable contains a specific character. keep if strpos(var, \"民初\") \u003e 0\rIf there are two variables, e.g. one is a standardized province variable a (四川省, 内蒙古自治区) and the other is a non-standardized province variable b (四川, 内蒙古), and you want to judge whether variable a contains variable b, you can use: gen localed = strpos(a, b) \u003e 0\rRemoving Special Characters\rThe text variables in Ans 1 through Ans 83 are mixed with various non-Chinese symbols; you can use the following function to remove them: Below are the mojibake symbols I\u0026rsquo;ve personally filtered out. 💬 Note: Why insist on the exclusion method rather than keeping only Chinese characters? Because when I tried it myself, I found some Chinese variables would turn into mojibake that way. # Define the list of symbols to remove (including spaces) local symbols \"ⅩⅩⅩ Ｘ ? ; ；， 《 》 ． ＋ （ ） ( ) \u0026 # 1 2 3 4 5 6 7 8 9 0 \u0026 A-Z a-z ；？ ＊ ︰ ++ . XX XXX ______ ` - + BRR H imestimes jzwjzwnjzwnjzwjzwnjzwnjzwnjzwjzwjzwjzwnjzwnjzwnjzwjzwnjzwnj jzwnjzwjzwjzwnjzwnjzwnjzwnjzwnjzwjzwjzwjzwnjzwjzwnjzwjzwj spemsp sp emsp ；； * XX XXX Ｘ ＸＸＸ\" * Iterate over the symbol list and remove each symbol and spaces foreach s of local symbols { replace judge_fin = subinstr(judge_fin, \"`s'\", \"\", .) }\rPaper Labels\rSometimes Stata data only has variable names, while a separate Excel sheet stores the label values. How do you read the Excel file and automatically batch-generate label variable commands? * Import the Excel lookup table clear import excel \"基本情况代码对照表.xlsx\", /// sheet(\"支出1编码对照\") rename B varname rename A varlabel * Generate the command (note the compound quotes) gen cmd = \"label variable \" + varname + \" `\" + `\"\"\"' + varlabel + `\"\"\"' + \"'\" outsheet cmd using \"变量标签命令.txt\", noquote replace\rThis will generate a file storing all the labeling commands for Stata. All code involves a tradeoff between automation and transparency; I personally prefer this kind of process with an intermediate artifact, which is easier to check and correct. ","date":"2025-01-13","heading":"Common Text-Processing Functions","objectID":"/en/posts/cpws_stata/:8:1","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#common-text-processing-functions"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Common Text-Processing Functions\rRemoving Spaces\rFor example, the chief judge (judge) variable can appear as 四川 大学, 四川大学, or 四 川 大 学. Different websites use different space characters, so I recommend the following function: Remove all special characters, including invisible characters, whitespace, and punctuation. replace judge_fin = ustrregexra(法官名字变量, \"[^\\p{L}\\p{N}]+\", \"\")\rFiltering Specific Characters\rKeep a row if the variable contains a specific character. keep if strpos(var, \"民初\") \u003e 0\rIf there are two variables, e.g. one is a standardized province variable a (四川省, 内蒙古自治区) and the other is a non-standardized province variable b (四川, 内蒙古), and you want to judge whether variable a contains variable b, you can use: gen localed = strpos(a, b) \u003e 0\rRemoving Special Characters\rThe text variables in Ans 1 through Ans 83 are mixed with various non-Chinese symbols; you can use the following function to remove them: Below are the mojibake symbols I\u0026rsquo;ve personally filtered out. 💬 Note: Why insist on the exclusion method rather than keeping only Chinese characters? Because when I tried it myself, I found some Chinese variables would turn into mojibake that way. # Define the list of symbols to remove (including spaces) local symbols \"ⅩⅩⅩ Ｘ ? ; ；， 《 》 ． ＋ （ ） ( ) \u0026 # 1 2 3 4 5 6 7 8 9 0 \u0026 A-Z a-z ；？ ＊ ︰ ++ . XX XXX ______ ` - + BRR H imestimes jzwjzwnjzwnjzwjzwnjzwnjzwnjzwjzwjzwjzwnjzwnjzwnjzwjzwnjzwnj jzwnjzwjzwjzwnjzwnjzwnjzwnjzwnjzwjzwjzwjzwnjzwjzwnjzwjzwj spemsp sp emsp ；； * XX XXX Ｘ ＸＸＸ\" * Iterate over the symbol list and remove each symbol and spaces foreach s of local symbols { replace judge_fin = subinstr(judge_fin, \"`s'\", \"\", .) }\rPaper Labels\rSometimes Stata data only has variable names, while a separate Excel sheet stores the label values. How do you read the Excel file and automatically batch-generate label variable commands? * Import the Excel lookup table clear import excel \"基本情况代码对照表.xlsx\", /// sheet(\"支出1编码对照\") rename B varname rename A varlabel * Generate the command (note the compound quotes) gen cmd = \"label variable \" + varname + \" `\" + `\"\"\"' + varlabel + `\"\"\"' + \"'\" outsheet cmd using \"变量标签命令.txt\", noquote replace\rThis will generate a file storing all the labeling commands for Stata. All code involves a tradeoff between automation and transparency; I personally prefer this kind of process with an intermediate artifact, which is easier to check and correct. ","date":"2025-01-13","heading":"Removing Spaces","objectID":"/en/posts/cpws_stata/:8:1","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#removing-spaces"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Common Text-Processing Functions\rRemoving Spaces\rFor example, the chief judge (judge) variable can appear as 四川 大学, 四川大学, or 四 川 大 学. Different websites use different space characters, so I recommend the following function: Remove all special characters, including invisible characters, whitespace, and punctuation. replace judge_fin = ustrregexra(法官名字变量, \"[^\\p{L}\\p{N}]+\", \"\")\rFiltering Specific Characters\rKeep a row if the variable contains a specific character. keep if strpos(var, \"民初\") \u003e 0\rIf there are two variables, e.g. one is a standardized province variable a (四川省, 内蒙古自治区) and the other is a non-standardized province variable b (四川, 内蒙古), and you want to judge whether variable a contains variable b, you can use: gen localed = strpos(a, b) \u003e 0\rRemoving Special Characters\rThe text variables in Ans 1 through Ans 83 are mixed with various non-Chinese symbols; you can use the following function to remove them: Below are the mojibake symbols I\u0026rsquo;ve personally filtered out. 💬 Note: Why insist on the exclusion method rather than keeping only Chinese characters? Because when I tried it myself, I found some Chinese variables would turn into mojibake that way. # Define the list of symbols to remove (including spaces) local symbols \"ⅩⅩⅩ Ｘ ? ; ；， 《 》 ． ＋ （ ） ( ) \u0026 # 1 2 3 4 5 6 7 8 9 0 \u0026 A-Z a-z ；？ ＊ ︰ ++ . XX XXX ______ ` - + BRR H imestimes jzwjzwnjzwnjzwjzwnjzwnjzwnjzwjzwjzwjzwnjzwnjzwnjzwjzwnjzwnj jzwnjzwjzwjzwnjzwnjzwnjzwnjzwnjzwjzwjzwjzwnjzwjzwnjzwjzwj spemsp sp emsp ；； * XX XXX Ｘ ＸＸＸ\" * Iterate over the symbol list and remove each symbol and spaces foreach s of local symbols { replace judge_fin = subinstr(judge_fin, \"`s'\", \"\", .) }\rPaper Labels\rSometimes Stata data only has variable names, while a separate Excel sheet stores the label values. How do you read the Excel file and automatically batch-generate label variable commands? * Import the Excel lookup table clear import excel \"基本情况代码对照表.xlsx\", /// sheet(\"支出1编码对照\") rename B varname rename A varlabel * Generate the command (note the compound quotes) gen cmd = \"label variable \" + varname + \" `\" + `\"\"\"' + varlabel + `\"\"\"' + \"'\" outsheet cmd using \"变量标签命令.txt\", noquote replace\rThis will generate a file storing all the labeling commands for Stata. All code involves a tradeoff between automation and transparency; I personally prefer this kind of process with an intermediate artifact, which is easier to check and correct. ","date":"2025-01-13","heading":"Filtering Specific Characters","objectID":"/en/posts/cpws_stata/:8:1","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#filtering-specific-characters"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Common Text-Processing Functions\rRemoving Spaces\rFor example, the chief judge (judge) variable can appear as 四川 大学, 四川大学, or 四 川 大 学. Different websites use different space characters, so I recommend the following function: Remove all special characters, including invisible characters, whitespace, and punctuation. replace judge_fin = ustrregexra(法官名字变量, \"[^\\p{L}\\p{N}]+\", \"\")\rFiltering Specific Characters\rKeep a row if the variable contains a specific character. keep if strpos(var, \"民初\") \u003e 0\rIf there are two variables, e.g. one is a standardized province variable a (四川省, 内蒙古自治区) and the other is a non-standardized province variable b (四川, 内蒙古), and you want to judge whether variable a contains variable b, you can use: gen localed = strpos(a, b) \u003e 0\rRemoving Special Characters\rThe text variables in Ans 1 through Ans 83 are mixed with various non-Chinese symbols; you can use the following function to remove them: Below are the mojibake symbols I\u0026rsquo;ve personally filtered out. 💬 Note: Why insist on the exclusion method rather than keeping only Chinese characters? Because when I tried it myself, I found some Chinese variables would turn into mojibake that way. # Define the list of symbols to remove (including spaces) local symbols \"ⅩⅩⅩ Ｘ ? ; ；， 《 》 ． ＋ （ ） ( ) \u0026 # 1 2 3 4 5 6 7 8 9 0 \u0026 A-Z a-z ；？ ＊ ︰ ++ . XX XXX ______ ` - + BRR H imestimes jzwjzwnjzwnjzwjzwnjzwnjzwnjzwjzwjzwjzwnjzwnjzwnjzwjzwnjzwnj jzwnjzwjzwjzwnjzwnjzwnjzwnjzwnjzwjzwjzwjzwnjzwjzwnjzwjzwj spemsp sp emsp ；； * XX XXX Ｘ ＸＸＸ\" * Iterate over the symbol list and remove each symbol and spaces foreach s of local symbols { replace judge_fin = subinstr(judge_fin, \"`s'\", \"\", .) }\rPaper Labels\rSometimes Stata data only has variable names, while a separate Excel sheet stores the label values. How do you read the Excel file and automatically batch-generate label variable commands? * Import the Excel lookup table clear import excel \"基本情况代码对照表.xlsx\", /// sheet(\"支出1编码对照\") rename B varname rename A varlabel * Generate the command (note the compound quotes) gen cmd = \"label variable \" + varname + \" `\" + `\"\"\"' + varlabel + `\"\"\"' + \"'\" outsheet cmd using \"变量标签命令.txt\", noquote replace\rThis will generate a file storing all the labeling commands for Stata. All code involves a tradeoff between automation and transparency; I personally prefer this kind of process with an intermediate artifact, which is easier to check and correct. ","date":"2025-01-13","heading":"Removing Special Characters","objectID":"/en/posts/cpws_stata/:8:1","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#removing-special-characters"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Common Text-Processing Functions\rRemoving Spaces\rFor example, the chief judge (judge) variable can appear as 四川 大学, 四川大学, or 四 川 大 学. Different websites use different space characters, so I recommend the following function: Remove all special characters, including invisible characters, whitespace, and punctuation. replace judge_fin = ustrregexra(法官名字变量, \"[^\\p{L}\\p{N}]+\", \"\")\rFiltering Specific Characters\rKeep a row if the variable contains a specific character. keep if strpos(var, \"民初\") \u003e 0\rIf there are two variables, e.g. one is a standardized province variable a (四川省, 内蒙古自治区) and the other is a non-standardized province variable b (四川, 内蒙古), and you want to judge whether variable a contains variable b, you can use: gen localed = strpos(a, b) \u003e 0\rRemoving Special Characters\rThe text variables in Ans 1 through Ans 83 are mixed with various non-Chinese symbols; you can use the following function to remove them: Below are the mojibake symbols I\u0026rsquo;ve personally filtered out. 💬 Note: Why insist on the exclusion method rather than keeping only Chinese characters? Because when I tried it myself, I found some Chinese variables would turn into mojibake that way. # Define the list of symbols to remove (including spaces) local symbols \"ⅩⅩⅩ Ｘ ? ; ；， 《 》 ． ＋ （ ） ( ) \u0026 # 1 2 3 4 5 6 7 8 9 0 \u0026 A-Z a-z ；？ ＊ ︰ ++ . XX XXX ______ ` - + BRR H imestimes jzwjzwnjzwnjzwjzwnjzwnjzwnjzwjzwjzwjzwnjzwnjzwnjzwjzwnjzwnj jzwnjzwjzwjzwnjzwnjzwnjzwnjzwnjzwjzwjzwjzwnjzwjzwnjzwjzwj spemsp sp emsp ；； * XX XXX Ｘ ＸＸＸ\" * Iterate over the symbol list and remove each symbol and spaces foreach s of local symbols { replace judge_fin = subinstr(judge_fin, \"`s'\", \"\", .) }\rPaper Labels\rSometimes Stata data only has variable names, while a separate Excel sheet stores the label values. How do you read the Excel file and automatically batch-generate label variable commands? * Import the Excel lookup table clear import excel \"基本情况代码对照表.xlsx\", /// sheet(\"支出1编码对照\") rename B varname rename A varlabel * Generate the command (note the compound quotes) gen cmd = \"label variable \" + varname + \" `\" + `\"\"\"' + varlabel + `\"\"\"' + \"'\" outsheet cmd using \"变量标签命令.txt\", noquote replace\rThis will generate a file storing all the labeling commands for Stata. All code involves a tradeoff between automation and transparency; I personally prefer this kind of process with an intermediate artifact, which is easier to check and correct. ","date":"2025-01-13","heading":"Paper Labels","objectID":"/en/posts/cpws_stata/:8:1","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#paper-labels"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Regular Expression Extraction\rCharacter Filtering\rTake the chief judge text variable as an example. The variable should clearly be a name, but instead a whole paragraph shows up. Zhang San people\u0026rsquo;s entrusted, Zhang San presided over the trial in 2014, Zhang San people\u0026rsquo;s assessor made the ruling, Zhang San acting chief judge conducted the hearing, Zhang San and Li Si clerks opened the session\u0026hellip;\u0026hellip; Another example — the court variable\rIn other words, the correct text characters should be the first few characters before a specific word. First use character-length filtering to look at the text format: *List the variable rows with character length greater than 14 list var if ustrlen(judge_fin) \u003e= 14\rThen, depending on the case, keep only specific characters. ⛔ Warning: mind the order! For example, there are these combinations: Zhang San held the trial in 2014 Zhang San, acting chief judge, held the trial in 2014 When the variable contains the two characters \u0026ldquo;庭审\u0026rdquo;, we should first keep the characters before \u0026ldquo;于\u0026rdquo;, and then keep the characters before \u0026ldquo;代理\u0026rdquo;. For condition-based filtering it\u0026rsquo;s best to look for two-character feature words, so that a judge name like \u0026ldquo;于庭审\u0026rdquo; is almost impossible to appear. The order I personally use, for reference only: replace judge_fin = ustrregexra(judge_fin, \"人民陪审员.*\", \"\") if strpos(judge_fin, \"人民陪审员\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"审判员.*\", \"\") if strpos(judge_fin, \"审判员\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"独任.*\", \"\") if strpos(judge_fin, \"独任\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"陪审员.*\", \"\") if strpos(judge_fin, \"陪审员\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"代理.*\", \"\") if strpos(judge_fin, \"代理\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"书记员.*\", \"\") if strpos(judge_fin, \"书记员\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"助理.*\", \"\") if strpos(judge_fin, \"助理\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"审判长.*\", \"\") if strpos(judge_fin, \"审判长\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"人民.*\", \"\") if strpos(judge_fin, \"人民\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"二.*\", \"\") if strpos(judge_fin, \"年\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"适用.*\", \"\") if strpos(judge_fin, \"适用\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"于.*\", \"\") if strpos(judge_fin, \"开庭\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"对.*\", \"\") if strpos(judge_fin, \"审理\") \u003e 0\rSince the crawler sometimes hits website encryption, the crawled result is 陈*, and after the above cleaning only 陈 remains. The function command to delete single-character rows is: *Delete rows with only one character, e.g. originally *陈 drop if ustrregexm(judge_fin, \"^[\\p{Han}]$\")\rExtracting Numbers\rFor example, the data shows 2.34435元 (needs to be a string variable), and we only want to extract the number; you can use the following code. gen num_var = . replace num_var = real(regexs(1)) if regexm(str_var, \"([0-9]+\\.[0-9]+|[0-9]+)\")\rBy the way, without the real(regexs(1)) argument it\u0026rsquo;s just a boolean test, returning only 0 and 1, indicating whether it matches the format or not. replace num_var = regexm(str_var, \"([0-9]+\\.[0-9]+|[0-9]+)\")\r","date":"2025-01-13","heading":"Regular Expression Extraction","objectID":"/en/posts/cpws_stata/:8:2","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#regular-expression-extraction"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Regular Expression Extraction\rCharacter Filtering\rTake the chief judge text variable as an example. The variable should clearly be a name, but instead a whole paragraph shows up. Zhang San people\u0026rsquo;s entrusted, Zhang San presided over the trial in 2014, Zhang San people\u0026rsquo;s assessor made the ruling, Zhang San acting chief judge conducted the hearing, Zhang San and Li Si clerks opened the session\u0026hellip;\u0026hellip; Another example — the court variable\rIn other words, the correct text characters should be the first few characters before a specific word. First use character-length filtering to look at the text format: *List the variable rows with character length greater than 14 list var if ustrlen(judge_fin) \u003e= 14\rThen, depending on the case, keep only specific characters. ⛔ Warning: mind the order! For example, there are these combinations: Zhang San held the trial in 2014 Zhang San, acting chief judge, held the trial in 2014 When the variable contains the two characters \u0026ldquo;庭审\u0026rdquo;, we should first keep the characters before \u0026ldquo;于\u0026rdquo;, and then keep the characters before \u0026ldquo;代理\u0026rdquo;. For condition-based filtering it\u0026rsquo;s best to look for two-character feature words, so that a judge name like \u0026ldquo;于庭审\u0026rdquo; is almost impossible to appear. The order I personally use, for reference only: replace judge_fin = ustrregexra(judge_fin, \"人民陪审员.*\", \"\") if strpos(judge_fin, \"人民陪审员\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"审判员.*\", \"\") if strpos(judge_fin, \"审判员\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"独任.*\", \"\") if strpos(judge_fin, \"独任\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"陪审员.*\", \"\") if strpos(judge_fin, \"陪审员\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"代理.*\", \"\") if strpos(judge_fin, \"代理\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"书记员.*\", \"\") if strpos(judge_fin, \"书记员\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"助理.*\", \"\") if strpos(judge_fin, \"助理\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"审判长.*\", \"\") if strpos(judge_fin, \"审判长\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"人民.*\", \"\") if strpos(judge_fin, \"人民\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"二.*\", \"\") if strpos(judge_fin, \"年\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"适用.*\", \"\") if strpos(judge_fin, \"适用\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"于.*\", \"\") if strpos(judge_fin, \"开庭\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"对.*\", \"\") if strpos(judge_fin, \"审理\") \u003e 0\rSince the crawler sometimes hits website encryption, the crawled result is 陈*, and after the above cleaning only 陈 remains. The function command to delete single-character rows is: *Delete rows with only one character, e.g. originally *陈 drop if ustrregexm(judge_fin, \"^[\\p{Han}]$\")\rExtracting Numbers\rFor example, the data shows 2.34435元 (needs to be a string variable), and we only want to extract the number; you can use the following code. gen num_var = . replace num_var = real(regexs(1)) if regexm(str_var, \"([0-9]+\\.[0-9]+|[0-9]+)\")\rBy the way, without the real(regexs(1)) argument it\u0026rsquo;s just a boolean test, returning only 0 and 1, indicating whether it matches the format or not. replace num_var = regexm(str_var, \"([0-9]+\\.[0-9]+|[0-9]+)\")\r","date":"2025-01-13","heading":"Character Filtering","objectID":"/en/posts/cpws_stata/:8:2","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#character-filtering"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Regular Expression Extraction\rCharacter Filtering\rTake the chief judge text variable as an example. The variable should clearly be a name, but instead a whole paragraph shows up. Zhang San people\u0026rsquo;s entrusted, Zhang San presided over the trial in 2014, Zhang San people\u0026rsquo;s assessor made the ruling, Zhang San acting chief judge conducted the hearing, Zhang San and Li Si clerks opened the session\u0026hellip;\u0026hellip; Another example — the court variable\rIn other words, the correct text characters should be the first few characters before a specific word. First use character-length filtering to look at the text format: *List the variable rows with character length greater than 14 list var if ustrlen(judge_fin) \u003e= 14\rThen, depending on the case, keep only specific characters. ⛔ Warning: mind the order! For example, there are these combinations: Zhang San held the trial in 2014 Zhang San, acting chief judge, held the trial in 2014 When the variable contains the two characters \u0026ldquo;庭审\u0026rdquo;, we should first keep the characters before \u0026ldquo;于\u0026rdquo;, and then keep the characters before \u0026ldquo;代理\u0026rdquo;. For condition-based filtering it\u0026rsquo;s best to look for two-character feature words, so that a judge name like \u0026ldquo;于庭审\u0026rdquo; is almost impossible to appear. The order I personally use, for reference only: replace judge_fin = ustrregexra(judge_fin, \"人民陪审员.*\", \"\") if strpos(judge_fin, \"人民陪审员\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"审判员.*\", \"\") if strpos(judge_fin, \"审判员\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"独任.*\", \"\") if strpos(judge_fin, \"独任\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"陪审员.*\", \"\") if strpos(judge_fin, \"陪审员\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"代理.*\", \"\") if strpos(judge_fin, \"代理\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"书记员.*\", \"\") if strpos(judge_fin, \"书记员\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"助理.*\", \"\") if strpos(judge_fin, \"助理\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"审判长.*\", \"\") if strpos(judge_fin, \"审判长\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"人民.*\", \"\") if strpos(judge_fin, \"人民\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"二.*\", \"\") if strpos(judge_fin, \"年\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"适用.*\", \"\") if strpos(judge_fin, \"适用\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"于.*\", \"\") if strpos(judge_fin, \"开庭\") \u003e 0 replace judge_fin = ustrregexra(judge_fin, \"对.*\", \"\") if strpos(judge_fin, \"审理\") \u003e 0\rSince the crawler sometimes hits website encryption, the crawled result is 陈*, and after the above cleaning only 陈 remains. The function command to delete single-character rows is: *Delete rows with only one character, e.g. originally *陈 drop if ustrregexm(judge_fin, \"^[\\p{Han}]$\")\rExtracting Numbers\rFor example, the data shows 2.34435元 (needs to be a string variable), and we only want to extract the number; you can use the following code. gen num_var = . replace num_var = real(regexs(1)) if regexm(str_var, \"([0-9]+\\.[0-9]+|[0-9]+)\")\rBy the way, without the real(regexs(1)) argument it\u0026rsquo;s just a boolean test, returning only 0 and 1, indicating whether it matches the format or not. replace num_var = regexm(str_var, \"([0-9]+\\.[0-9]+|[0-9]+)\")\r","date":"2025-01-13","heading":"Extracting Numbers","objectID":"/en/posts/cpws_stata/:8:2","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#extracting-numbers"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"dta Time Correction\rIn the bidding work in my research group, many time formats are messy. For example, two standard ones: 2019-12-31 09:00:00, 2019/12/30 09:30 But you\u0026rsquo;ll also see 20220516 09:30:00, 2022051609:30:00, 2022051609:30. For example, missing seconds, or the month position written as 4 instead of 04. As shown\rThe code below handles this set of time encodings in a unified way. Some preprocessing to convert Chinese symbols to English ones. When there\u0026rsquo;s no space between the date and time (e.g. 2022051609:30:00), if the value falls within the corresponding year/month range (e.g. 0-31), prefer taking two digits; if it exceeds the range, take the single digit before it. Finally, time extraction that is compatible with various formats. /*----------------------------------------- Date extraction and conversion scheme (compact-format enhanced version) Version: 2.6 Last updated: 2024-06-27 -----------------------------------------*/ version 17 clear all set more off use \"F:\\桌面\\test.dta\", clear keep time *=============================== * Preprocessing stage (enhanced) *=============================== // Basic cleaning replace time = ustrtrim(time) replace time = subinstr(time, char(92), \"-\", .) replace time = subinstr(time, \"：\", \":\", .) replace time = subinstr(time, \" \", \"\", .) *=============================== * New compact-format recognition module *=============================== // Recognize YYYYMMDD- format (core improvement) gen str8 compact_date = \"\" replace compact_date = substr(time, 1, 8) /// if ustrregexm(time, \"^\\d{8}-\") // Strictly match 8 digits + hyphen format // Separate the compact-format data preserve keep if compact_date != \"\" gen date_stata = date(compact_date, \"YMD\") format date_stata %tdCCYY-NN-DD tempfile compact save `compact' restore // Process the non-compact-format data keep if compact_date == \"\" drop compact_date *=============================== * Original processing flow (optimized) *=============================== // Unify the separator handling foreach s in \".\" \"_\" \"/\" { replace time = subinstr(time, \"`s'\", \"-\", .) } // Extract the date part gen str50 date_part = ustrregexs(1) if ustrregexm(time, \"(\\d{4}-\\d{1,2}-\\d{2,})[^\\d]\") replace date_part = time if missing(date_part) // Smart date handling gen str4 year = ustrregexs(1) if ustrregexm(date_part, \"^(\\d{4})-\\d+\") gen str2 month = ustrregexs(1) if ustrregexm(date_part, \"-(\\d{1,2})-\") gen str5 raw_day = ustrregexs(1) if ustrregexm(date_part, \"-(\\d+)$\") replace month = cond(strlen(month) == 1, \"0\" + month, month) replace month = \"12\" if real(month) \u003e 12 gen str2 day = substr(raw_day,1,2) replace day = substr(day,1,1) if real(day) \u003e 31 replace day = \"31\" if real(day) \u003e 31 replace day = \"0\" + day if real(day) \u003c 10 \u0026 strlen(day) == 1 replace date_part = year + \"-\" + month + \"-\" + day drop year month raw_day day gen date_stata = date(date_part, \"YMD\") replace date_stata = date(ustrregexra(time, \"[^0-9]\", \"\"), \"YMD\") if missing(date_stata) *=============================== * Merge the processing results *=============================== append using `compact' *=============================== * Post-processing and verification *=============================== format date_stata %tdCCYY-NN-DD\r","date":"2025-01-13","heading":"dta Time Correction","objectID":"/en/posts/cpws_stata/:9:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#dta-time-correction"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Case Number and Date\rIn court documents, the acc year-month represents the filing year-month; the jud year-month represents the judgment year-month. Since the case number is assigned when the case is filed and accepted, if the filing year-month is missing, we can try to interpolate based on the case number. Each year the case numbers run from number 1 to number n, so we can interpolate the date based on that. The case number （2019）沪0115民初1号 actually means: in 2019, the court with Shanghai code 0115 filed a case under the 民初 procedure, and it was the first filed case of the Shanghai–this court–民初 type that year. Likewise, we can estimate the annual publication rate of court judgments based on this. But under maximum likelihood estimation, with an optimal approximate distribution assumption, we need to use the \u0026ldquo;tank formula\u0026rdquo; to estimate it. **********Approach************* /* Since case numbers each year are 民初（2020）**号, where **号 is numbered in order. It's possible the sample only contains numbers 1, 3, 5, 7. The \"tank formula\" derived from maximum likelihood estimation is used to estimate the publication rate (originating from WWII estimation of tank capture rates). Finally, compute the publication rate for each court-year. Consider dropping courts with low publication rates (equivalent to dropping regions with low publication rates). */ **********Variable Descriptions************* /* case_num_str: court judgment case number court_name: court name jud_year: judgment year public_rate: publication rate */ **********References************* /* 1 Origin of the formula, and other methods for estimating the publication rate Augmenting serialized bureaucratic data: the case of Chinese courts (2022, working paper) 2 Application example Suing the government under weak rule of law: Evidence from administrative litigation reform in China (2023, jpube) */ gen case_num_str = ustrregexs(1) if ustrregexm(case_wid_str, \"民[^0-9]*([0-9]+)\") replace case_num_str = ustrregexra(case_num_str, \"^0+\", \"\") destring case_num_str, gen(case_num) drop case_num_str order case_wid_str case_num bysort court_name jud_year: egen max_case_num = max(case_num) bysort court_name jud_year: gen case_count = _N order max_case_N bysort court_name jud_year: egen max_case_N = max(case_count) gen case_count = max_case_num gen public_rate = max_case_N / (max_case_num * (1 + 1/max_case_N) - 1) sum public_rate keep court_name jud_year public_rate duplicates drop court_name jud_year, force duplicates report court_name jud_year\r","date":"2025-01-13","heading":"Case Number and Date","objectID":"/en/posts/cpws_stata/:10:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#case-number-and-date"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Reminder\rI recommend first exporting the Stata data to csv format. The biggest problem is mojibake. As shown\rThe csv is mojibake, because the extracted txt is not in utf-8 format. 😨 Note: Make sure the CSV file's default format is UTF-8 before processing. ","date":"2025-01-13","heading":"Reminder","objectID":"/en/posts/cpws_stata/:10:1","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#reminder"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Python Example: Extracting Past and Present Feature Means of Appealing Judges\rExample 3 matches row by row, but this is simply too slow. Now I want to process it like this: Extract the 20 cases the judge handled before the appeal and compute the fine mean; at the same time, extract the 20 cases the judge handled after the appeal and compute the fine mean. The algorithm logic I designed is as follows: Group the data by the court–judge combination. Each record has times from first instance to final instance, forming timestamps, and each row should identify the earliest and latest times in a series of times. When the earliest time differs from the latest time, this record is main data. Within each group, keep only the samples that satisfy the condition. Around the main data, when there are still 10 cases before the main data\u0026rsquo;s earliest record and 10 cases after it, keep only these 21 records in the end. If a group has multiple cases at the same time, keep all samples that satisfy the requirement. Generate variable a for the main data that has the corresponding number of surrounding cases, marking it as 1. Generate the before-appeal and after-appeal variables, and compute the mean of the corresponding number of cases. Breaking down the code\rTo make better use of AI, I actually split this algorithm into two steps. The first part filters out all samples that meet the requirement; the second part computes the means of the cases before and after at the main data (a=1). Finally, integrate the code from the two parts.\rIn the end I set one more parameter: how many surrounding cases the main case needs to have for it to be kept. import pandas as pd from tqdm import tqdm import numpy as np # Parameter configuration input_path = r'C:\\Users\\PC\\Desktop\\hzp_project_re\\re_论文开始\\最终面板数据\\去极端值交通民事上诉样本.csv' output_path = r'C:\\Users\\PC\\Desktop\\hzp_project_re\\re_论文开始\\最终面板数据\\去极端值交通民事上诉样本_论文去0_45_民诉样本.csv' before_n = 45 # Number of records to keep before after_n = 45 # Number of records to keep after # Time field configuration time_columns = [ 'jud_year', 'jud_month', 'm1_jud_year', 'm1_jud_month', 'm2_jud_year', 'm2_jud_month', 'm3_jud_year', 'm3_jud_month', 'm4_jud_year', 'm4_jud_month', ] def extract_timestamps(row): \"\"\"提取每行的时间戳（最早和最晚时间）\"\"\" timestamps = [] for i in range(0, len(time_columns), 2): year = row[time_columns[i]] month = row[time_columns[i + 1]] if pd.notna(year) and pd.notna(month): try: timestamps.append((int(year), int(month))) except: continue return min(timestamps, default=None), max(timestamps, default=None) def is_main_case(row): \"\"\"判断是否为主干数据\"\"\" conditions = [ (pd.notna(row['m1_judge_am']) \u0026 pd.notna(row['m2_judge_am'])), (pd.notna(row['m1_judge_am']) \u0026 pd.notna(row['m3_judge_am'])), (pd.notna(row['m1_judge_am']) \u0026 pd.notna(row['m4_judge_am'])), (pd.notna(row['m2_judge_am']) \u0026 pd.notna(row['m3_judge_am'])), (pd.notna(row['m2_judge_am']) \u0026 pd.notna(row['m4_judge_am'])), (pd.notna(row['m3_judge_am']) \u0026 pd.notna(row['m4_judge_am'])), ] return any(conditions) def filter_valid_judge(data): \"\"\"过滤有效金额（非0非空）\"\"\" return data[(data['judge_am'] != 0) \u0026 (data['judge_am'].notna())] def calculate_means(group, main_case_idx): \"\"\" 计算主干数据的 judge_sum, bf_judge_sum 和 af_judge_sum（均排除0值和空值） \"\"\" min_time, max_time = extract_timestamps(group.loc[main_case_idx]) if min_time is None or max_time is None: return group # Compute judge_sum judge_data = group[group.index != main_case_idx] valid_judge = filter_valid_judge(judge_data) group.loc[main_case_idx, 'judge_sum'] = valid_judge['judge_am'].mean() if not valid_judge.empty else np.nan # Compute bf_judge_sum bf_cond = ( (group['jud_year'] \u003c min_time[0]) | ((group['jud_year'] == min_time[0]) \u0026 (group['jud_month'] \u003c min_time[1])) ) \u0026 (group.index != main_case_idx) valid_bf = filter_valid_judge(group[bf_cond]) group.loc[main_case_idx, 'bf_judge_sum'] = valid_bf['judge_am'].mean() if not valid_bf.empty else np.nan # Compute af_judge_sum af_cond = ( (group['jud_year'] \u003e max_time[0]) | ((group['jud_year'] == m","date":"2025-01-13","heading":"Python Example: Extracting Past and Present Feature Means of Appealing Judges","objectID":"/en/posts/cpws_stata/:11:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#python-example-extracting-past-and-present-feature-means-of-appealing-judges"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Some Court Judgment Variables You Can Get Quickly\rWork experience: the time span from the first appearance to the last appearance. Shared cases: how many cases were handled in total in the sample. Cumulative cases: which case this is currently being handled. Since the sample is monthly, the cumulative count should be 1, 1, 3, 3, 5, 6\u0026hellip; * Generate a unique row id gen id = _n * Make sure the data is sorted by court, judge, year, month, case order sort court_name judge_fin jud_year jud_month id * Create a case count variable (each row defaults to 1) gen case_count = 1 * Group by court and judge, and cumulatively sum the case counts bysort court_name judge_fin (jud_year jud_month): gen cumulative_count = sum(case_count) * Correct so that the same month has the same cumulative count bysort court_name judge_fin jud_year jud_month (cumulative_count): replace cumulative_count = cumulative_count[_N] * Convert year and month into a single time point (in months) gen time = jud_year * 12 + jud_month * Compute the first time point (when each judge handled their first case at a court) bysort court_name judge_fin (jud_year jud_month): gen first_time = time[1] * Compute work experience (in months) gen work_experience_months = time - first_time + 1 * Drop unneeded temporary variables drop id case_count time first_time egen combo_count = count(court_name + judge_fin), by(court_name judge_fin)\r","date":"2025-01-13","heading":"Some Court Judgment Variables You Can Get Quickly","objectID":"/en/posts/cpws_stata/:12:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#some-court-judgment-variables-you-can-get-quickly"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Python Example: Case Backlog\rIn court documents there are two times: the case judgment time (starting with jud) and the case filing time (starting with acc). The case backlog is all cases whose filing time is earlier than the current year-month and whose judgment year is later than the current year. This kind of operation involving cross-row variable identification is exactly Stata\u0026rsquo;s weak point. import pandas as pd import numpy as np from tqdm import tqdm import time def calculate_backlog(df: pd.DataFrame) -\u003e pd.DataFrame: # Build the time fields (in months) df['acc_time'] = df['acc_year'] * 12 + df['acc_month'] df['jud_time'] = df['jud_year'] * 12 + df['jud_month'] # Initialize the backlog column df['backlog'] = 0 # Process grouped by court + judge grouped = df.groupby(['court_name', 'judge_fin']) print(f\"共有分组数量：{len(grouped)}\") start_time = time.time() # Iterate over each group for (court, judge), group_df in tqdm(grouped, desc=\"Processing court-judge groups\"): idx = group_df.index jud_times = group_df['jud_time'].to_numpy() acc_times = group_df['acc_time'].to_numpy() # Initialize the backlog result backlog_counts = np.zeros(len(group_df), dtype=int) for i in range(len(group_df)): jud_time_i = jud_times[i] # Backlog condition: filing time \u003c current judgment time, AND other cases' judgment time \u003e current judgment time backlog_mask = (acc_times \u003c jud_time_i) \u0026 (jud_times \u003e jud_time_i) backlog_counts[i] = backlog_mask.sum() # Update the result df.loc[idx, 'backlog'] = backlog_counts elapsed = time.time() - start_time print(f\"\\n处理完成，总耗时：{elapsed:.2f} 秒\") return df def main(input_path, output_path): print(\"读取数据中...\") df = pd.read_csv(input_path, encoding='utf-8', encoding_errors='replace') print(f\"数据读取完成，共有 {len(df)} 条记录。\") df_result = calculate_backlog(df) print(f\"保存结果到：{output_path}\") df_result.to_csv(output_path, index=False, encoding='utf-8-sig') print(\"保存完成。\") if __name__ == \"__main__\": # Change the input/output paths to match your environment input_path = r'C:\\Users\\PC\\Desktop\\hzp_project_re\\re_论文开始\\案件积压\\案件积压计算.csv' output_path = r'C:\\Users\\PC\\Desktop\\hzp_project_re\\re_论文开始\\案件积压\\论文_案件积压计算.csv' main(input_path, output_path)\r","date":"2025-01-13","heading":"Python Example: Case Backlog","objectID":"/en/posts/cpws_stata/:13:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#python-example-case-backlog"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Stata Example: Court-Year Case Publication Rate\r**********Approach************* /* Since case numbers each year are 民初（2020）**号, where **号 is numbered in order. It's possible the sample only contains numbers 1, 3, 5, 7. The \"tank formula\" derived from maximum likelihood estimation is used to estimate the publication rate (originating from WWII estimation of tank capture rates). Finally, compute the publication rate for each court. Consider dropping courts with low publication rates (equivalent to dropping regions with low publication rates). */ **********Variable Descriptions************* /* case_num_str: court judgment case number court_name: court name jud_year: judgment year public_rate: publication rate */ **********References************* /* 1 Origin of the formula, and other methods for estimating the publication rate Augmenting serialized bureaucratic data: the case of Chinese courts (2022, working paper) 2 Application example Suing the government under weak rule of law: Evidence from administrative litigation reform in China (2023, jpube) */ gen case_num_str = ustrregexs(1) if ustrregexm(case_wid_str, \"民[^0-9]*([0-9]+)\") replace case_num_str = ustrregexra(case_num_str, \"^0+\", \"\") destring case_num_str, gen(case_num) drop case_num_str order case_wid_str case_num bysort court_name jud_year: egen max_case_num = max(case_num) bysort court_name jud_year: gen case_count = _N order max_case_N bysort court_name jud_year: egen max_case_N = max(case_count) gen case_count = max_case_num gen public_rate = max_case_N / (max_case_num * (1 + 1/max_case_N) - 1) sum public_rate keep court_name jud_year public_rate duplicates drop court_name jud_year, force duplicates report court_name jud_year\rThe court names in court judgments are also all over the place. For example, some judgments write the court as \u0026ldquo;Heilongjiang Province xx District People\u0026rsquo;s Court\u0026rdquo;, while others omit the province and just write \u0026ldquo;xx District People\u0026rsquo;s Court\u0026rdquo;. In this case the best and most convenient approach is to directly fuzzy-match against a complete court directory. ","date":"2025-01-13","heading":"Stata Example: Court-Year Case Publication Rate","objectID":"/en/posts/cpws_stata/:14:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#stata-example-court-year-case-publication-rate"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Python Example: Matching Large-Scale Data\rMatching business registration data with other enterprise databases is quite popular nowadays, and it basically starts from 50 million valid records. Stata\u0026rsquo;s merge command consumes a lot of memory when matching, because its temporary copies easily double the memory cost. So I personally recommend exporting everything to .csv files and using Python\u0026rsquo;s duckdb (matching with pandas is only slightly better than Stata\u0026rsquo;s merge). The example below is a duckdb example. Its effect is the same as Stata\u0026rsquo;s merge m:1, but with better memory optimization: import duckdb import os con.execute(\"DROP TABLE IF EXISTS using_tbl\") con.execute(\"DROP TABLE IF EXISTS main_tbl\") con.execute(\"DROP TABLE IF EXISTS merged\") # ===================== # Paths (change to your actual paths) # ===================== MAIN_CSV = r\"C:\\Users\\PC\\Desktop\\中国招投标\\论文代码\\回归数据.csv\" USING_CSV = r\"C:\\Users\\PC\\Desktop\\中国招投标\\论文代码\\注册数据.csv\" OUT_CSV = r\"C:\\Users\\PC\\Desktop\\中国招投标\\论文代码\\merged.csv\" DB_FILE = r\"C:\\Users\\PC\\Desktop\\中国招投标\\论文代码\\merge.duckdb\" # ===================== # Connect to DuckDB (on disk, to prevent OOM) # ===================== con = duckdb.connect(DB_FILE) # (Optional) limit memory, more stable con.execute(\"PRAGMA memory_limit='16GB'\") con.execute(\"PRAGMA threads=8\") print(\"1️⃣ 读取 using 表（1.8 亿）\") con.execute(f\"\"\" CREATE TABLE using_tbl AS SELECT * FROM read_csv_auto( '{USING_CSV}', SAMPLE_SIZE=1000000, parallel=true ) \"\"\") print(\"2️⃣ 读取 main 表（2000 万）\") con.execute(f\"\"\" CREATE TABLE main_tbl AS SELECT * FROM read_csv_auto( '{MAIN_CSV}', SAMPLE_SIZE=500000, parallel=true ) \"\"\") print(\"3️⃣ LEFT JOIN（m:1）\") con.execute(\"\"\" CREATE TABLE merged AS SELECT m.*, u.* FROM main_tbl m LEFT JOIN using_tbl u ON m.credit_code = u.credit_code \"\"\") print(\"4️⃣ 导出结果\") con.execute(f\"\"\" COPY merged TO '{OUT_CSV}' (HEADER, DELIMITER ',') \"\"\") con.close() print(\"✅ 完成\")\r","date":"2025-01-13","heading":"Python Example: Matching Large-Scale Data","objectID":"/en/posts/cpws_stata/:15:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#python-example-matching-large-scale-data"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Python Example: Classifying Case Types\rReference: the paper Women in the Courtroom: Technology and Justice. What if there are too many case types in the court judgments? Cluster them into 50 case types using an LDA model. This code assumes you already have a case panel (.csv) of case-number–case-type-name. Next, machine learning classification can simplify it into 50 case types. For an application example, see LDA Topic Model and Gephi Visualization import ast import pandas as pd import jieba import logging from gensim import corpora, models from tqdm.auto import tqdm import warnings import os import re # ------------------------------- # 0. Global settings # ------------------------------- # Ignore warnings warnings.filterwarnings(\"ignore\") jieba.setLogLevel(logging.INFO) # Initialize jieba to avoid printing logs in the progress bar jieba.initialize() # ------------------------------- # User-configurable parameters (User Configurable Parameters) # ------------------------------- # Set the number of topics to generate. Change the topic count here, e.g. 20, 50, 100, etc. NUM_TOPICS = 50 # Set the minimum occurrence count for filtering low-frequency words. E.g. no_below=100 keeps only words appearing \u003e= 100 times. MIN_WORD_COUNT = 100 # Number of LDA training iterations (Passes) NUM_PASSES = 10 # ------------------------------- # File path settings (file names are generated dynamically, including the topic count) # ------------------------------- input_path = r\"/root/案件类型.csv\" output_path = r\"/root/案件类型_{}类别结果.csv\".format(NUM_TOPICS) topic_words_path = r\"/root/主题{}词汇.csv\".format(NUM_TOPICS) doc_topic_words_path = r\"/root/文档主题词_{}主题.csv\".format(NUM_TOPICS) # Define common, low-discriminative stopwords # The goal is to force the model to focus on the case's subject nouns (e.g. buying/selling, finance, trademarks, inheritance) CHINESE_STOPWORDS = { '纠纷', '责任', '案件', '争议', '纠纷案件', '追偿', '纠葛', '诉讼', '法律', '与', '及', '的', '是', '一', '二', '三', '四', '等', '其他', '之', '因', '中', # Newly added common legal words that may appear in all case types, reducing topic discrimination '权', '损害', '赔偿', '物', '行为', '权利', '民事', '确认' } print(f\"正在读取数据: {input_path} ...\") # ------------------------------- # 1. Read the data # ------------------------------- data = pd.read_csv(input_path, dtype=str) data = data.fillna(\"\") # ------------------------------- # 2. Clean the type field # ------------------------------- def clean_type(x): x = str(x).strip() try: val = ast.literal_eval(x) if isinstance(val, list): return \" \".join(val) except: pass # Remove all non-Chinese characters, keeping only the Chinese case cause names x = re.sub(r'[^\\u4e00-\\u9fa5\\s]', '', x) return x.replace(\"[\", \"\").replace(\"]\", \"\").replace(\"'\", \"\") tqdm.pandas(desc=\"清洗数据\", mininterval=0.5) data[\"type_clean\"] = data[\"type\"].progress_apply(clean_type) # ------------------------------- # 3. Chinese word segmentation and stopword filtering # ------------------------------- print(\"正在进行分词和停用词过滤...\") def cut_words_and_filter(text): # Segment words words = jieba.lcut(text) # Filter out empty words and stopwords filtered_words = [w for w in words if w.strip() and w not in CHINESE_STOPWORDS] return filtered_words tqdm.pandas(desc=\"分词处理\", mininterval=0.5) data[\"words\"] = data[\"type_clean\"].progress_apply(cut_words_and_filter) # Filter out empty text original_len = len(data) data = data[data[\"words\"].map(len) \u003e 0].reset_index(drop=True) print(f\"有效文本数量: {len(data)} / {original_len}\") texts = data[\"words\"].tolist() # ------------------------------- # 4. Build the dictionary and corpus # ------------------------------- print(\"构建字典和语料...\") dictionary = corpora.Dictionary(texts) # Filter out words appearing fewer than MIN_WORD_COUNT times dictionary.filter_extremes(no_below=MIN_WORD_COUNT) corpus = [dictionary.doc2bow(t) for t in tqdm(texts, desc=\"生成语料\", mininterval=0.5)] # ------------------------------- # 5. LDA training (accelerated with LdaMulticore) # ------------------------------- num_topics = NUM_TOP","date":"2025-01-13","heading":"Python Example: Classifying Case Types","objectID":"/en/posts/cpws_stata/:16:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#python-example-classifying-case-types"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Python Example: Predicting Gender from Names\rSince judges don\u0026rsquo;t publish their gender, we can predict gender from names by simply calling a Python package. Reference: the paper Women in the Courtroom: Technology and Justice. The example below uses the ngender package. This package has a flaw: it uses parameters trained by Bayesian estimation, so it assumes the characters in a name are independent. For example, 王胜男 (Wang Shengnan) — each character on its own looks masculine, but it\u0026rsquo;s a classic female name. Under Bayesian estimation, the package would still identify it as male. If you want to be more rigorous, I recommend checking out a GitHub repo: Predicting the gender of Chinese names import pandas as pd import ngender # Load the CSV file df = pd.read_csv('F:\\桌面\\性别预测测试\\测试.csv') # Replace with your actual CSV file name # Function to predict gender def predict_gender(name): try: result = ngender.guess(str(name)) # Returns (gender, probability) return result[0] # Extract gender ('male', 'female', or 'neutral') except: return 'unknown' # Handle invalid names # Add predicted gender column df['预测性别'] = df['name'].apply(predict_gender) # Save the updated CSV df.to_csv('output.csv', index=False, encoding='utf-8-sig') print(\"Gender predictions added to 'output.csv'\")\r","date":"2025-01-13","heading":"Python Example: Predicting Gender from Names","objectID":"/en/posts/cpws_stata/:17:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#python-example-predicting-gender-from-names"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Python Example: Case Reasoning\r","date":"2025-01-13","heading":"Python Example: Case Reasoning","objectID":"/en/posts/cpws_stata/:18:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#python-example-case-reasoning"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Memory Management\r","date":"2025-01-13","heading":"Memory Management","objectID":"/en/posts/cpws_stata/:19:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#memory-management"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Stata: Beware of Text Variable Inflation\rSince the strL format can\u0026rsquo;t be used for Stata matching, we usually convert it to a fixed text-length format, e.g. str9s: representing a length of 9 code characters — generally one Chinese character is 3 character placeholders. Court judgments inevitably involve processing text variables, such as court names, plaintiff and defendant names, and case types. Text inflation is a terrifying thing. For example, the longest judge name in dta1 is 5 characters, but dta2, because dirty data has mixed in the main text, has a maximum length of 100 characters. When we merge vertically, all text variables, to be compatible with the longest format, will uniformly become str100s, at which point the extra spaces also occupy memory. When you have tens of millions of court judgments, and n text variables all undergo this inflation, it\u0026rsquo;s a huge memory disaster. Some of my personal default handling: *Judge name gen judge_fin2 = strtrim(substr(judge_fin,1,20)) *Court gen court_name2 = strtrim(substr(court_name,1,50)) drop judge_fin court_name rename judge_fin2 judge_fin rename court_name2 court_name\r","date":"2025-01-13","heading":"Stata: Beware of Text Variable Inflation","objectID":"/en/posts/cpws_stata/:19:1","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#stata-beware-of-text-variable-inflation"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Python: Streaming Processing of Archives\rFully decompressing all the court judgments from 2013 to 2019 is roughly 1 TB of memory. To save memory, we can build a streaming-processing management process. There are n archives. Decompress one archive and extract the relevant variables. Delete the archive. Visualize the current progress and record which archives have been extracted so far (checkpointing, so that after a temporary power outage you can continue from where you left off). Below is my code example. Because some archives have passwords, I also added a step to read a password-description file to decompress with the password: #!/usr/bin/env python # -*- coding: utf-8 -*- \"\"\" 逐个解压裁判文书压缩包，并提取案号、法条数、字数和说理性指标。 \"\"\" from __future__ import annotations import argparse import csv import hashlib import json import logging import re import shutil import subprocess import sys import time from datetime import datetime from pathlib import Path from typing import Any from extract_case_reasoning_metrics import OUTPUT_FIELDS, parse_tsv_line, process_record ARCHIVE_EXTENSIONS = {\".rar\", \".zip\", \".7z\"} DEFAULT_ARCHIVE_DIR = r\"F:\\数据合集\\裁判文书压缩包\" DEFAULT_PASSWORD_FILE = Path(__file__).resolve().parent.parent / \"参考资料_裁判文书手册\" / \"文书密码.txt\" WORK_DIR = Path(\"pipeline_work\") EXTRACT_DIR = WORK_DIR / \"extracting\" PARTS_DIR = WORK_DIR / \"parts\" STATE_PATH = WORK_DIR / \"pipeline_state.json\" LOG_PATH = WORK_DIR / \"pipeline.log\" COMBINED_OUTPUT = Path(\"案号法条字数说理性指标_all.csv\") def setup_logging() -\u003e None: WORK_DIR.mkdir(exist_ok=True) logging.basicConfig( level=logging.INFO, format=\"%(asctime)s %(levelname)s %(message)s\", handlers=[logging.FileHandler(LOG_PATH, encoding=\"utf-8\"), logging.StreamHandler(sys.stderr)], ) def now() -\u003e str: return datetime.now().strftime(\"%Y-%m-%d %H:%M:%S\") def safe_name(text: str) -\u003e str: cleaned = re.sub(r\"[^\\w\\u4e00-\\u9fff.-]+\", \"_\", text, flags=re.UNICODE) digest = hashlib.md5(text.encode(\"utf-8\", errors=\"ignore\")).hexdigest()[:8] return f\"{cleaned[:80]}__{digest}\" def natural_key(text: str) -\u003e list[Any]: parts = re.split(r\"(\\d+)\", text) return [int(x) if x.isdigit() else x.lower() for x in parts] def load_state() -\u003e dict[str, Any]: if STATE_PATH.exists(): return json.loads(STATE_PATH.read_text(encoding=\"utf-8\")) return {\"created_at\": now(), \"archives\": {}} def save_state(state: dict[str, Any]) -\u003e None: WORK_DIR.mkdir(exist_ok=True) tmp = STATE_PATH.with_suffix(\".json.tmp\") tmp.write_text(json.dumps(state, ensure_ascii=False, indent=2), encoding=\"utf-8\") tmp.replace(STATE_PATH) def find_extractor(user_path: str | None) -\u003e tuple[str, str]: candidates: list[Path] = [] if user_path: candidates.append(Path(user_path)) candidates.extend( [ Path(r\"C:\\Program Files\\WinRAR\\UnRAR.exe\"), Path(r\"C:\\Program Files\\WinRAR\\WinRAR.exe\"), Path(r\"C:\\Program Files\\Bandizip\\bz.exe\"), Path(r\"C:\\Program Files\\Bandizip\\Bandizip.exe\"), ] ) for candidate in candidates: if candidate.exists(): name = candidate.name.lower() if name == \"unrar.exe\": return \"unrar\", str(candidate) if name == \"winrar.exe\": return \"winrar\", str(candidate) if name == \"bz.exe\": return \"bandizip_cli\", str(candidate) if name == \"bandizip.exe\": return \"bandizip_gui\", str(candidate) tar = shutil.which(\"tar\") if tar: return \"tar\", tar raise FileNotFoundError(\"找不到可用解压工具。可用 --extractor 指定 UnRAR.exe/WinRAR.exe/bz.exe。\") def list_archives(archive_dir: Path) -\u003e list[Path]: archives = [p for p in archive_dir.iterdir() if p.is_file() and p.suffix.lower() in ARCHIVE_EXTENSIONS] return sorted(archives, key=lambda p: natural_key(p.name)) def normalize_archive_key(text: str) -\u003e str: match = re.search(r\"data[_\\s-]*(\\d+)\", text, re.IGNORECASE) return f\"data_{int(match.group(1))}\" if match else text.lower() def read_passwords(path: Path) -\u003e dict[str, list[str]]: if not path.exists(): return {} raw = path.read_text(encoding=\"utf-8\", errors=\"ignore\") passwords: dict[str, list[str]] = {} for line in raw.splitlines(): key_match = re.search(r\"(data[_\\s-]*\\d+)\", line, re.IGNORECASE) if not key_match: c","date":"2025-01-13","heading":"Python: Streaming Processing of Archives","objectID":"/en/posts/cpws_stata/:19:2","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#python-streaming-processing-of-archives"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Descriptive Statistics\r","date":"2025-01-13","heading":"Descriptive Statistics","objectID":"/en/posts/cpws_stata/:20:0","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#descriptive-statistics"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Donut Chart\rimport pandas as pd import matplotlib.pyplot as plt from aquarel import load_theme # Load and apply the theme theme = load_theme(\"boxy_light\") theme.apply() # Set the Chinese font plt.rcParams['font.sans-serif'] = ['STZhongsong'] plt.rcParams['axes.unicode_minus'] = False # Data processing types = df['type'].explode().value_counts() top_types = types.head(10) # Color configuration colors = ['#FF6347', '#4682B4', '#008000', '#FFA500', '#8B0000', '#FFFF00', '#9400D3', '#FF1493', '#00FA9A', '#1E90FF'] # Create the canvas fig, ax = plt.subplots(figsize=(10, 8)) # Draw the donut chart wedges, texts, autotexts = ax.pie( top_types.values, autopct='%1.1f%%', startangle=90, pctdistance=0.85, wedgeprops=dict(width=0.3), colors=colors ) # Create a custom legend legend_labels = [f\"{label} ({value})\" for label, value in zip(top_types.index, top_types.values)] legend = ax.legend( wedges, legend_labels, title=\"案件类型\", loc=\"center left\", bbox_to_anchor=(1, 0, 0.5, 1), fontsize=9, title_fontsize=10, frameon=False ) # Add statistical info total = len(df['type']) plt.text(1.35, -1.35, f\"总样本数: {total}\\n前10类型覆盖率: {top_types.sum()/total:.1%}\", bbox=dict(facecolor='white', alpha=0.9)) # Adjust the layout plt.title('数量前10案件类型分布', pad=20) plt.tight_layout() plt.axis('equal') plt.show()\rAs shown\r","date":"2025-01-13","heading":"Donut Chart","objectID":"/en/posts/cpws_stata/:20:1","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#donut-chart"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Bar Chart\rOptimized the number arrangement so it doesn\u0026rsquo;t overlap. Specified the ordering of 民初, 再, and 终 case numbers. Used the Python package pip install aquarel to optimize the plot style. Aquarel import pandas as pd import matplotlib.pyplot as plt from pylab import mpl # Set the Chinese font and fix the minus-sign display mpl.rcParams['font.sans-serif'] = ['STZhongsong'] # Specify the default font: solve the problem of plot not displaying Chinese mpl.rcParams['axes.unicode_minus'] = False # Solve the problem of the minus sign '-' showing as a box when saving images # Load the data df = pd.read_csv(r'C:\\Users\\PC\\Desktop\\hzp_project_re\\re_论文开始\\最终面板数据\\民事上诉样本.csv', encoding='utf-8', low_memory=False) # Extract the case type from case_wid_str df['case_type'] = df['case_wid_str'].str.extract(r'(民初|民终|民再)') # Count the distribution of each case type across court levels distribution = df.groupby(['court', 'case_type']).size().unstack(fill_value=0) # Keep only specific court levels, but only those that actually exist desired_courts = [1, 3, 4, 5, 6] existing_courts = [court for court in desired_courts if court in distribution.index] distribution = distribution.loc[existing_courts] # Compute the total case count per court level total_cases_per_court = distribution.sum(axis=1) # Compute the proportions distribution_ratio = distribution.div(total_cases_per_court, axis=0) * 100 # Set the figure size plt.figure(figsize=(12, 8)) # Define an empty list for the bottom heights bottoms = [0] * len(distribution_ratio) # Stack in the order 民初, 民再, 民终 case_types_order = ['民初', '民再', '民终'] for case_type in case_types_order: # Use ascending order to ensure 民初 is at the bottom if case_type in distribution.columns: plt.bar(range(len(distribution_ratio.index)), distribution_ratio[case_type], bottom=bottoms, label=case_type) # Display the specific count above each bar for index, value in enumerate(distribution[case_type]): text_y_position = bottoms[index] + (distribution_ratio.loc[existing_courts[index], case_type] / 2) # Adjust text positions to avoid overlap if case_type == '民再': if index % 2 == 0: text_y_position += 2 # Move up else: text_y_position -= 2 # Move down plt.text(index, text_y_position, str(int(value)), ha='center', va='center', color='black', fontsize=9) # Update the bottom heights bottoms = [sum(x) for x in zip(bottoms, distribution_ratio[case_type])] # Modify the x-axis labels court_labels = {i: label for i, label in enumerate([\"最高\", \"高级\", \"中级\", \"基层\", \"专门\"][:len(existing_courts)])} plt.xticks(range(len(existing_courts)), list(court_labels.values())) # Add the title and labels plt.title('案件类型在不同法院级别的比例分布', fontsize=14, pad=20) plt.xlabel('法院级别', fontsize=12, labelpad=15) plt.ylabel('比例 (%)', fontsize=12, labelpad=15) plt.legend(title=\"案件类型\", bbox_to_anchor=(1.05, 1), loc='upper left') # Show the chart plt.tight_layout() plt.show()\rAs shown\r","date":"2025-01-13","heading":"Bar Chart","objectID":"/en/posts/cpws_stata/:20:2","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#bar-chart"},{"categories":["Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Mean and Median Distribution Plot\rIncludes the mean, median, and cumulative proportion. Uses parameter-name mapping. import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from pylab import mpl # Set the Chinese font and fix the minus-sign display mpl.rcParams['font.sans-serif'] = ['STZhongsong'] # Specify the default font: solve the problem of plot not displaying Chinese mpl.rcParams['axes.unicode_minus'] = False # Solve the problem of the minus sign '-' showing as a box when saving images # Assume this is the mapping from your data columns to their Chinese names var_names_zh = { 'work_experience_years': '工作年限（年）', 'work_experience_months': '工作经历（月）', 'average_cases_per_month': '平均处理案子数（月）' } # Load the data df = pd.read_csv(r'C:\\Users\\PC\\Desktop\\hzp_project_re\\re_论文开始\\最终面板数据\\民事上诉样本.csv', encoding='utf-8', low_memory=False) # Convert work experience to years df['work_experience_years'] = df['work_experience_months'] / 12 # Compute how many cases are handled per month on average df['average_cases_per_month'] = df['cumulative_count'] / (df['work_experience_months'] + 1) def add_statistics(ax, data): \"\"\"在给定的轴上添加平均数和中位数的标注\"\"\" mean_val = data.mean() median_val = data.median() ax.axvline(mean_val, color='red', linestyle='--') ax.axvline(median_val, color='blue', linestyle='--') # Add the legend to the lower right ax.legend([f'均值: {mean_val:.2f}', f'中位数: {median_val:.2f}'], loc='lower right') def add_percentage_axis(ax, data): \"\"\"在给定的轴上添加右侧的百分比轴\"\"\" values, base = np.histogram(data.dropna(), bins=30) cumulative = np.cumsum(values) percentage = cumulative / cumulative[-1] * 100 # Convert the cumulative values to percentages ax_percent = ax.twinx() ax_percent.plot(base[1:], percentage, c='green', label='累计百分比') ax_percent.set_ylabel('累计百分比 (%)') ax_percent.legend(loc='upper right') def trim_data(data, lower=0.5, upper=99.5): \"\"\"返回给定百分比范围内的数据\"\"\" lower_quantile = np.percentile(data, lower) upper_quantile = np.percentile(data, upper) return data[(data \u003e= lower_quantile) \u0026 (data \u003c= upper_quantile)] variables = ['work_experience_years', 'work_experience_months', 'average_cases_per_month'] fig, axes = plt.subplots(len(variables), 1, figsize=(15, len(variables)*5)) for idx, var in enumerate(variables): # Use the Chinese name var_zh = var_names_zh.get(var, var) if var == 'average_cases_per_month': data_to_plot = trim_data(df[var]) else: data_to_plot = df[var] # Raw data distribution sns.histplot(data_to_plot, kde=True, color=\"skyblue\", edgecolor=\"black\", ax=axes[idx]) axes[idx].set_title(f'{var_zh} 分布图', fontsize=14) add_statistics(axes[idx], data_to_plot) # Add the mean and median annotations # Add the cumulative percentage axis add_percentage_axis(axes[idx], data_to_plot) plt.tight_layout() plt.show()\rAs shown\r","date":"2025-01-13","heading":"Mean and Median Distribution Plot","objectID":"/en/posts/cpws_stata/:20:3","tags":["Court Judgments","Data Cleaning","Stata","Python"],"title":"Court Judgment Data Cleaning Guide","uri":"/en/posts/cpws_stata/#mean-and-median-distribution-plot"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":" If economics and mathematics continue to coexist for another century and a half, who can imagine what changes it will bring about. — Shi Shuzhong ","date":"2025-01-02","heading":"","objectID":"/en/posts/econ_math/:0:0","tags":["History of Economic Thought"],"title":"The Mathematical History of Economics","uri":"/en/posts/econ_math/#"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"Reasons for Recommendation\rPerspective: Shi Shuzhong has a pure mathematics background. This book is actually a popular science introduction to the mathematics of economics for mathematics students. The interesting disciplinary stance is that mathematicians generally try to avoid normative analysis in social sciences and non-mathematical explanations of terms. Reading Difficulty: Intermediate microeconomics level, but since it is aimed at mathematics students, some parts exceed intermediate level. For example, intermediate microeconomics usually introduces Arrow\u0026rsquo;s Impossibility Theorem using tables, while this book directly uses functional analysis. Disciplinary History: This book can be seen as a history of the development of mathematics in economics. Many people finish studying microeconomics without understanding the development of mathematical tools. For example, many only know a couple of example problems from textbooks about the contributions of Cournot, Walras, and Arrow. The history of the discipline fills in the gaps, helping to understand the inheritance process of these masters. As I mentioned in The Arrogance of Economics: Some Recent Thoughts, I believe that learning the history of a discipline is very important. Understanding the history of the integration of mathematics and economics is also crucial. If you haven\u0026rsquo;t experienced the beauty of intermediate level, it\u0026rsquo;s hard to go far by immersing yourself in advanced mathematical techniques. Because economic thought is already fully permeated at the intermediate level, the advanced level is just a precise expression and generalization of the intermediate models. Reviewing the biographies of economists is actually quite interesting. Just as people are obsessed with commenting on contemporary economists and gossiping about the career moves of academic stars, in the history of mathematical economics, you can also see many familiar names who were once obscure in their papers until their contributions were later recognized. Ideology: In that era, using mathematical tools to analyze economics was considered to have a capitalist flavor. The book is full of this era-specific characteristic, with the author having to emphasize that they are critically viewing it and inserting discussions on Soviet socialist mathematical economics. This historical atmosphere feels quite novel to me 😂. ","date":"2025-01-02","heading":"Reasons for Recommendation","objectID":"/en/posts/econ_math/:1:0","tags":["History of Economic Thought"],"title":"The Mathematical History of Economics","uri":"/en/posts/econ_math/#reasons-for-recommendation"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"Historical Review\rThe fusion of mathematics and economics was a tortuous process, with many geniuses not being recognized by their contemporaries because their mathematics was too advanced. 17th Century. William Petty (William Petty) \u0026ldquo;Political Arithmetic\u0026rdquo;. This was the beginning of using numbers. 19th Century. Use of Functions: Cournot (Charles-François Gounod)1 (student of Paris Normal School, student of Laplace and Poisson) \u0026ldquo;Mathematical Principles of the Theory of Wealth\u0026rdquo;. Many could not accept the mathematical expression of the price-demand function in the book, so Cournot wrote another version avoiding mathematics (but it still didn\u0026rsquo;t become popular). His contributions were only recognized 80 years after his death. Pioneers of Marginal Analysis: Gossen (Hermann Heinrich Gossen)2 was not accepted in his time because his mathematics was too advanced. The founder of the Austrian School, Menger (Carl Menger), who did not know calculus, described marginal analysis using intuition, which had a great influence. The Austrian School thereafter had few economists who actively used mathematics. Jevons (William Stanley Jevons) \u0026ldquo;A Brief Statement of a General Mathematical Theory of Political Economy\u0026rdquo; (1862), Walras (Léon Walras) (founder of the Lausanne School) \u0026ldquo;Elements of Pure Economics\u0026rdquo;. Both knew calculus, Walras was better at mathematics than Jevons. Menger, Jevons, and Walras all independently developed marginal analysis, but they later found that Gossen was the earliest, though he was not recognized. Expansion of Mathematical Models: Walras\u0026rsquo;s general equilibrium theory emerged. It proved the existence of prices that balance market supply and demand. However, Walras\u0026rsquo;s mathematics was not good enough; he thought that if the number of variables equals the number of equations, there would be a solution, without considering the rank of the equation system. Although the proof was not rigorous, the idea still had a profound impact. Von Neumann also thought about game theory based on general equilibrium. 80 years after Walras proposed the general equilibrium theory, Debreu (Gérard Debreu) \u0026ldquo;Theory of Value: An Axiomatic Analysis of Economic Equilibrium\u0026rdquo; (1959) strictly proved the existence of general equilibrium. It is a necessary and sufficient condition with the Brouwer fixed-point theorem. Second Generation of Marginal Utility School: Edgeworth \u0026ldquo;Mathematical Psychics\u0026rdquo;, Marshall \u0026ldquo;Principles of Economics\u0026rdquo; (Marshall (Alfred Marshall)3 also had a mathematics background, representing the Cambridge School). Keynes (John Maynard Keynes)4 was a student of Marshall. Second Generation of Lausanne School: Pareto (Vilfredo Federico Damaso Pareto) (worked as a railway mining engineer for 20 years). American Marginal School: Fisher5 (Irving Fisher) inspired Keynes. Austrian School Follow-up: Menger\u0026rsquo;s son became a mathematician and brought out two important figures, one being Gödel (Gödel) of the incompleteness theorem, and the other being the statistician Wald (wald)6 (Wald test in econometrics). Schumpeter (Joseph Alois Schumpeter), though born in the Austrian School, had theories that almost dominated the field. The protagonist of the 2018 National Volume 2 essay question is Wald. Unfortunately, Wald died in a plane crash.\rThe most famous mathematical method in macroeconomics is control theory, which was formed by a group of free-spirited scientists in Vienna, including von Neumann. The first to seriously introduce control theory into economics was Alan Blinder (Alan Stuart Blinder). Earlier introductions of control theory are more commonly known through Phillips (Phillips)7. ","date":"2025-01-02","heading":"Historical Review","objectID":"/en/posts/econ_math/:2:0","tags":["History of Economic Thought"],"title":"The Mathematical History of Economics","uri":"/en/posts/econ_math/#historical-review"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"Economics That Can Be Studied with Mathematics and Mathematics in Economic Research\rThere was once a fierce debate in domestic Marxist political economy about what the research object should be. Shi Shuzhong\u0026rsquo;s words are thought-provoking—the significance of choosing a research object is determined by the research results, not by arguing with others. You should study whatever object you want, and it\u0026rsquo;s best to accept the test, but the choice of research object should not be constrained. Do not be overly constrained by terms like xx-ism, xx school, xx needs, xx practice. The part of economics that frequently uses mathematics is empirical economics. But it is necessary to distinguish the goals of using mathematics, because many people hope that economics can achieve the same predictive power as physics through mathematics. But take physiology as an example, although we can dissect the heart, no one expects it to predict the heartbeat. The role of economics should be to cooperate with empirical analysis to form clear axiomatic expressions. ","date":"2025-01-02","heading":"Economics That Can Be Studied with Mathematics and Mathematics in Economic Research","objectID":"/en/posts/econ_math/:3:0","tags":["History of Economic Thought"],"title":"The Mathematical History of Economics","uri":"/en/posts/econ_math/#economics-that-can-be-studied-with-mathematics-and-mathematics-in-economic-research"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"Interesting Mathematical Economic Thinking\rHere I will only summarize some information that I think is worth extracting. Dual problem. Profit maximization and cost minimization are dual problems. Continuous iteration and calculus may lead to some more important transformations. Cardinal utility theory is difficult to generalize, while ordinal utility theory is easier and can prove that cardinal utility theory has a corresponding suitable ordinal utility theory. Prisoner\u0026rsquo;s dilemma inspiration: local optimum does not equal global optimum, the key is not to be too dispersed, otherwise it is easy to fight internally. Arrow\u0026rsquo;s Impossibility Theorem is a网红 theorem, many people like to hang a title—mathematics proves that democracy is impossible. Buchanan developed public choice theory based on this, criticizing the effectiveness of collective decision-making. However, the contributor Arrow himself was very cautious: The philosophical and distributive implications of social choice contradictions are not clear, and there is certainly no simple way to resolve them. — Arrow Edgeworth Box: The exchange process is not necessarily equal, this is an equal opportunity, at every Pareto optimal point, the distribution between the two parties can easily be unequal, but the opportunity to achieve any result is equal. This reflects that procedural justice may be more important than outcome justice. Uncertain environments can help us determine cardinal utility theory. Shi Shuzhong approaches the macro part from the perspective of engineering control. The blogger @Song\rrecommended \u0026ldquo;Cybernetics and Scientific Methodology\u0026rdquo; to me. In practice, some foreign universities in macroeconomics also require students to study control theory and dynamical systems. Walras and Pareto also received training in this area. Macro systems need to consider input, output, transfer, feedback, goal achievement, and optimal path (flowchart). Ordinary differential equations are closely related to control theory. If society is seen as a system, then the market is a regulator. For example, the following differential equations reflect the relationship between wage-product ratio and employment rate. $$ \\begin{cases} \\dot{\\varepsilon}=-{\\varepsilon }h\\left\\( \\theta \\right\\)\\\\\\\\ \\dot{\\theta}=-{\\theta }g\\left\\( \\varepsilon \\right\\) \\end{cases} $$ Mathematically, it is a nonlinear Volterra equation. Initially, it described the ecosystem at the bottom of a lake, where big fish eat small fish, but when the small fish are eaten up, the big fish also find it difficult to survive, eventually reaching an equilibrium. (Therefore, the New Cambridge School believes that this equation is like class struggle.) ","date":"2025-01-02","heading":"Interesting Mathematical Economic Thinking","objectID":"/en/posts/econ_math/:4:0","tags":["History of Economic Thought"],"title":"The Mathematical History of Economics","uri":"/en/posts/econ_math/#interesting-mathematical-economic-thinking"},{"categories":["Reading"],"collections":["Mathematics and Economics"],"content":"Conclusion\rRegarding the current relationship between economics and mathematics. I feel that the controversy lies in what is called economic intuition. For example, in this foreign exam question, you are first asked to calculate, then to think intuitively after calculating. Here, mathematics and economic reasoning complement each other. Question source: https://drive.google.com/file/d/1PycYJ6QKeRSYQl9jVeNexlqtKBFlwxpl/view\rWhat is economic intuition? Is there really so-called counter-intuitive research? My current feeling is that intuition is the grasp of the trend of factor changes. Roughly knowing the direction of influence and weight of a factor in the market system. I also agree with a sentence from \u0026ldquo;The Origin of Wealth\u0026rdquo;: The most wonderful part of science is that it seems incredible before analysis, but after analysis, it seems inevitable. Many people quote Marx\u0026rsquo;s saying—A science is only truly perfected when it successfully applies mathematics. Actually, this sentence appears in Lafargue\u0026rsquo;s memoirs, where Lafargue said that Marx said this. Marx did not express this view in his own works. However, Marx\u0026rsquo;s mathematics at least reached Taylor expansion. Interestingly, although Marx learned some calculus, he did not realize that his theory of differential rent had the idea of marginal analysis. Marx also believed that the mystification tendency of mathematics was one of the reasons for its development. This can be found in \u0026ldquo;Marx\u0026rsquo;s Mathematical Manuscripts.\u0026rdquo; The successful mathematics in economics is actually an abstraction of the essence of phenomena. Through scientific abstraction, the internal mechanism of things is revealed. Can we achieve qualitative analysis without quantitative analysis? Although Adam Smith directly conducted qualitative analysis, after mathematization, people understood Adam Smith\u0026rsquo;s qualitative analysis more clearly. The journey from vague text to rigorous mathematical description is a long one, measured in centuries. The classic Cournot model in microeconomics discusses a type of duopoly game. For example, why Coca-Cola and Pepsi can compete until now.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Gossen\u0026rsquo;s two laws: diminishing marginal utility and equal marginal utility at equilibrium.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Author of \u0026ldquo;Principles of Economics.\u0026rdquo;\u0026#160;\u0026#x21a9;\u0026#xfe0e; Keynes also wrote a book \u0026ldquo;A Treatise on Probability\u0026rdquo; in 1921. However, Keynes was not very optimistic about his models being mathematized.\u0026#160;\u0026#x21a9;\u0026#xfe0e; What you need to know in finance and monetary studies—Fisher equation. It contains the idea of dichotomy, nominal and real.\u0026#160;\u0026#x21a9;\u0026#xfe0e; His more famous story is the U.S. military survivor bias, which was also a multiple-choice question in the 2017 college entrance exam.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Phillips curve, the trade-off between inflation and unemployment.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2025-01-02","heading":"Conclusion","objectID":"/en/posts/econ_math/:5:0","tags":["History of Economic Thought"],"title":"The Mathematical History of Economics","uri":"/en/posts/econ_math/#conclusion"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":" This post introduces three papers on one-time government investment and long-run industrial development: AER, \u0026ldquo;Moonshot: Public R\u0026amp;D and Growth\u0026rdquo; QJE, \u0026ldquo;The Long-Run Impacts of Public Industrial Investment on Local Development and Economic Mobility: Evidence from World War II\u0026rdquo; AER, \u0026ldquo;America, Jump-Started: World War II R\u0026amp;D and the Takeoff of the US Innovation System\u0026rdquo; ","date":"2024-12-15","heading":"","objectID":"/en/posts/zftz/:0:0","tags":["Industrial Economics"],"title":"One-Time Government Investment and Long-Run Industrial Development","uri":"/en/posts/zftz/#"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Government and the market: learn to ask better questions\rIn debates over industrial policy, the answer depends a great deal on how the question is framed. In the past, we asked it rather crudely: should the government or the market take the lead? Now the question is more precise: between government and market, which one should lead in which domain, and how? Getting people to agree on a mixed economy was never easy. China and the Soviet Union both went through eras of comprehensive planning, and the United States had its own witch-hunt politics during institutional conflict1. That, I think, is one reason empiricism became the mainstream2. The world is no longer just an ideological fight between all-or-nothing positions. Societies pay a huge price for extreme paths. What we need are sharper boundaries and sharper questions. All three papers discussed here use World War II-era manufacturing investment as their historical setting. They study the long-run effects of one-time manufacturing investment on manufacturing development. A shared issue running through them is how to distinguish local effects from national effects. ","date":"2024-12-15","heading":"Government and the market: learn to ask better questions","objectID":"/en/posts/zftz/:1:0","tags":["Industrial Economics"],"title":"One-Time Government Investment and Long-Run Industrial Development","uri":"/en/posts/zftz/#government-and-the-market-learn-to-ask-better-questions"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"The moonshot shock: public R\u0026amp;D spending and growth\rMoonshot: Public R\u0026amp;D and Growth ","date":"2024-12-15","heading":"The moonshot shock: public R\u0026amp;D spending and growth","objectID":"/en/posts/zftz/:2:0","tags":["Industrial Economics"],"title":"One-Time Government Investment and Long-Run Industrial Development","uri":"/en/posts/zftz/#the-moonshot-shock-public-rd-spending-and-growth"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Introduction\rAfter the Soviet Union launched the first satellite during the Cold War, the United States began investing heavily in the manufacturing side of the space industry. NASA R\u0026amp;D spending: a sudden surge\rThat historical setting lets us think about several issues: How theories of technological progress and economic growth can be tested and extended The social return to innovation is larger than the private return, so firms may not have enough incentive to innovate on their own. Does that mean the government needs to provide an extra push? Does government stimulus actually work? Can government R\u0026amp;D, or public R\u0026amp;D, generate long-run growth? The exogeneity of the event. At the time, NASA investment accounted for 0.7% of US GDP. Geopolitical conflict was an exogenous shock. ","date":"2024-12-15","heading":"Introduction","objectID":"/en/posts/zftz/:2:1","tags":["Industrial Economics"],"title":"One-Time Government Investment and Long-Run Industrial Development","uri":"/en/posts/zftz/#introduction"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Identification strategy\rOne distinctive feature of Moonshot: Public R\u0026amp;D and Growth is that it makes full use of declassified US materials from the Cold War period. Special point 1: the paper uses declassified CIA intelligence files that describe Soviet space capabilities in detail, then matches them with US patents from before Sputnik. That lets the authors use textual similarity to locate where relevant patent technologies had been developing. Special point 2: NASA invested directly in firms that already had a patent base, rather than doing the R\u0026amp;D itself from scratch. That is why the paper can estimate the effects by comparing patent data through textual similarity. Triple difference: $$ \\begin{equation} \\begin{aligned} Y_{ijt} = \\beta\\_1 \u0026amp;\u0026#43; \\beta_2 High\\\\\\_Space\\\\\\_Capability_{ij\u0026lt;1958} \\times SpaceRace_t \\\\\\\\ \u0026amp; \u0026#43; \\beta_3 High\\\\\\_Space\\\\\\_Capability\\_{ij\u0026lt;1958} \\times Post\\\\\\_SpaceRace_t \\\\\\\\ \u0026amp; \u0026#43; {\\color{red}{\\beta_4}} High\\\\\\_Space\\\\\\_Capability\\_{ij\u0026lt;1958} \\times SpaceRace \\times Space\\\\\\_Industry\\_j \\\\\\\\ \u0026amp; \u0026#43; {\\color{red}{\\beta\\_5}} High\\\\\\_Space\\\\\\_Capability\\\\\\_{ij\u0026lt;1958} \\times Post\\\\\\_SpaceRace\\_t \\times Space\\\\\\_Industry_j \\\\\\\\ \u0026amp; \u0026#43; TotalPre\\\\\\_1958Patents\\_{ij} \\times \\gamma\\_t \\\\\\\\ \u0026amp; \u0026#43; \\delta\\_i \u0026#43; \\theta\\_j \u0026#43; \\gamma\\_t \u0026#43; v\\_{ijt} \\end{aligned} \\end{equation} $$ ${\\color{red}{\\beta_4}}$ captures the effect during the investment period. ${\\color{red}{\\beta_5}}$ captures the long-run effect after the investment ended. Y: NASA-related regional investment, patent, and industry outcomes (value added, TFP, employment, capital) HighSpaceCapability: patent-text similarity before the race began SpaceRace: dummy for the space-race period (1959-1972) SpaceIndustry: dummy for whether the industry was NASA-related PostSpaceRace: time dummy for the post-race period (after 1972) TotalPre_1958Patents: number of patents that already existed before 1958 To quantify the magnitude further, the paper estimates a multiplier effect: $$ \\text{Multiplier}=\\frac{\\beta_{\\text{output}}\\times\\text{output}}{\\beta_{\\text{investment}}\\times\\text{investment}} $$ Event-study results: even after the investment ended, the multiplier effect remained (after the red line)\rThe paper estimates a multiplier of 0.3, which is lower than both the model estimate and the 0.6-0.8 range reported in other papers. The dynamic increase is not especially large either. The authors explain that growth was very rapid in those years, so the multiplier is probably underestimated. The measure also does not really capture R\u0026amp;D done by universities or by NASA\u0026rsquo;s own research centers. In econometric work, we usually prefer identification strategies that are more likely to understate the effect. If the real-world effect ends up being larger than what we estimate, that only makes the conclusion more convincing. Research also shows that instrumental variables can easily magnify estimates, so IV is always a tradeoff between endogeneity and validity. ","date":"2024-12-15","heading":"Identification strategy","objectID":"/en/posts/zftz/:2:2","tags":["Industrial Economics"],"title":"One-Time Government Investment and Long-Run Industrial Development","uri":"/en/posts/zftz/#identification-strategy"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Robustness\rTighten the definition of the space industry and add more related industries Adjust industry-level standard errors based on NASA shares Drop one state or one industry at a time and check how the results change Use growth rates rather than productivity as the explained variable Instrumental variable: whether an industry-county pair received funding in year t Measure NASA spending more precisely and compare the US with non-US cases Use non-space samples for cross-industry analysis Match patent similarity using US policy documents Compare different text-similarity measures ","date":"2024-12-15","heading":"Robustness","objectID":"/en/posts/zftz/:2:3","tags":["Industrial Economics"],"title":"One-Time Government Investment and Long-Run Industrial Development","uri":"/en/posts/zftz/#robustness"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Mechanism tests\rThe main results ask whether time-specific investment persisted over time. The mechanism section turns to space-specific spillovers. Does industrial development spill over? Population channel: industrial development attracted in-migration. Using triple differences on panel data of population flows, the paper finds an in-migration effect. Goods channel: when industry develops, does demand for goods rise as well? The paper translates this into changes in comparative trade advantage, using the quantified comparative-advantage score from Railroads and American Economic Growth: A \u0026ldquo;Market Access\u0026rdquo; Approach as the explanatory variable in a triple-difference setup. The result is not significant. ","date":"2024-12-15","heading":"Mechanism tests","objectID":"/en/posts/zftz/:2:4","tags":["Industrial Economics"],"title":"One-Time Government Investment and Long-Run Industrial Development","uri":"/en/posts/zftz/#mechanism-tests"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Distinguishing local effects and national effects\rGovernment investment can be seen as a structured allocation of resources. When one region develops, is it creating new value, or is it simply piling up resources and producing distributive inequality? That is worth debating. A lot of Chinese work, for example, asks whether provincial capitals create a siphoning effect or a blood-making effect. That is the difference between local effects and national effects. The issue also comes up in Fu Peng\u0026rsquo;s recent talk, which mentions the illusion of government investment: When the government points resources somewhere, that place develops. It looks like capable government action, but once the government leaves, the investment leaves too. Prosperity of this point-and-shoot kind is structural redistribution, not the creation of wealth. (My paraphrase.) If we want to see through that illusion in research, we have to widen the lens and distinguish local effects from national effects across a longer span of time and space.. Xiangzhang Economics once discussed an earlier version from two years ago of Moonshot: Public R\u0026amp;D and Growth. That version originally used the arcsinh transformation and difference-in-differences to handle the variables, and it did not discuss the goods channel. The shift away from arcsinh and DiD was probably influenced by Logs with Zeros? Some Problems and Solutions, which seems to have pushed the paper toward a different estimation strategy. The goods channel was probably added because reviewers criticized the paper for not addressing the identification of local effects and national effects. ","date":"2024-12-15","heading":"Distinguishing local effects and national effects","objectID":"/en/posts/zftz/:2:5","tags":["Industrial Economics"],"title":"One-Time Government Investment and Long-Run Industrial Development","uri":"/en/posts/zftz/#distinguishing-local-effects-and-national-effects"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"The long-run economic payoff of wartime factory construction\rThe Long-Run Impacts of Public Industrial Investment on Local Development and Economic Mobility: Evidence from World War II ","date":"2024-12-15","heading":"The long-run economic payoff of wartime factory construction","objectID":"/en/posts/zftz/:3:0","tags":["Industrial Economics"],"title":"One-Time Government Investment and Long-Run Industrial Development","uri":"/en/posts/zftz/#the-long-run-economic-payoff-of-wartime-factory-construction"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Introduction\rThis paper studies the persistent effects of World War II manufacturing investment from the perspective of labor economics. Phenomenon: children born in places that received wartime plants earn higher wages later in life. Debate: what explains that wage gain? Possibilities: exposure effects: children grew up in a better environment; welfare effects: local jobs offered better compensation; human capital investment: children developed better skills. ","date":"2024-12-15","heading":"Introduction","objectID":"/en/posts/zftz/:3:1","tags":["Industrial Economics"],"title":"One-Time Government Investment and Long-Run Industrial Development","uri":"/en/posts/zftz/#introduction-1"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Identification strategy\rA few comparison exercises: Wages still rise even when skill levels are held constant. Children born locally do not see a clear wage gain if they move away, but they do if they stay. Children who move into the area see a clear wage gain relative to those who do not. When wage growth is decomposed using education as an explanatory variable, the explained effect is quite small. Some comparison exercises\rCounties with large public plants had 30% more manufacturing employment than control counties, 20% more population, and median household income 7-8% higher than the controls. Manufacturing employment in treated counties expanded sharply, far outpacing overall population growth. Manufacturing employment as a share of total employment increased and remained high throughout the 1970s. In the decades after the war, population growth in treated counties kept exceeding that of control areas, eventually stabilizing at a new permanent level roughly 20% above the controls. The number of firms did not increase. What increased was scale. The paper makes very good use of event-study analysis\rTaken together, the wage growth seems to come from welfare effects. ","date":"2024-12-15","heading":"Identification strategy","objectID":"/en/posts/zftz/:3:2","tags":["Industrial Economics"],"title":"One-Time Government Investment and Long-Run Industrial Development","uri":"/en/posts/zftz/#identification-strategy-1"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Distinguishing local effects and national effects\rWhat if World War II had never happened? Without the war, the country would obviously have built plants in economically developed areas. So wartime rear-area plant construction should have different effects from plants that would have been built endogenously in already-developed places. The paper checks this with contemporary Million Dollar Plants data and finds that this wage effect disappears for modern factories. That leads to the authors\u0026rsquo; final discussion: the way plant construction improved local transportation conditions may be the key to the effect. Because the modern transportation system is already well developed nationwide, the welfare effect has weakened. ","date":"2024-12-15","heading":"Distinguishing local effects and national effects","objectID":"/en/posts/zftz/:3:3","tags":["Industrial Economics"],"title":"One-Time Government Investment and Long-Run Industrial Development","uri":"/en/posts/zftz/#distinguishing-local-effects-and-national-effects-1"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"America jump-started: World War II R\u0026amp;D and the innovation system\rAmerica, Jump-Started: World War II R\u0026amp;D and the Takeoff of the US Innovation System ","date":"2024-12-15","heading":"America jump-started: World War II R\u0026amp;D and the innovation system","objectID":"/en/posts/zftz/:4:0","tags":["Industrial Economics"],"title":"One-Time Government Investment and Long-Run Industrial Development","uri":"/en/posts/zftz/#america-jump-started-world-war-ii-rd-and-the-innovation-system"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Introduction\rHow the US innovation network took shape is still an important question. As an aside, I personally lean toward the view that talent immigration was a major reason for US development. During World War II, the US Office of Scientific Research and Development (OSRD) supported one of the largest public investments in applied R\u0026amp;D in American history. Using data on all OSRD-funded inventions, this paper shows the far-reaching impact of that shock on the US innovation system. It generated technology clusters across the country and increased high-tech entrepreneurship and employment. Those effects lasted at least into the 1970s, driven mainly by agglomeration forces and endogenous growth. Beyond creating technology clusters, wartime R\u0026amp;D permanently changed the overall trajectory of US innovation, pushing it toward the technological directions funded by the OSRD. ","date":"2024-12-15","heading":"Introduction","objectID":"/en/posts/zftz/:4:1","tags":["Industrial Economics"],"title":"One-Time Government Investment and Long-Run Industrial Development","uri":"/en/posts/zftz/#introduction-2"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Identification strategy\r$$ \\ln(Patents)\\_{ict}=\\sum\\_{t=1931}^{1970}\\beta\\_t\\cdot\\ln(OSRDrate)\\_{ic}\\cdot Year\\_t\u0026#43;\\alpha_{ic}\u0026#43;\\delta\\_t\u0026#43;\\varepsilon\\_{ict} $$ i is county, c is patent class, and t is year. Standard errors are clustered at the county level. OSRDrate: the share of patent applications in a given class between 1941 and 1948 that were funded by the OSRD. Comparison figure\rQuantile regression and event-study analysis: Comparison between the top 5% and bottom 5% of OSRD investment: the gap in both short-run and long-run effects is large, and the strongest effects appear in electronics and electrical technologies, the patent classes most closely tied to the war\rThe gap between the top 5% and bottom 5% of OSRD investment is large in both the short run and the long run. The strongest effects appear in electronics and electrical technologies, which were also the patent classes most closely tied to the war. ","date":"2024-12-15","heading":"Identification strategy","objectID":"/en/posts/zftz/:4:2","tags":["Industrial Economics"],"title":"One-Time Government Investment and Long-Run Industrial Development","uri":"/en/posts/zftz/#identification-strategy-2"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Mechanism\rPatent data contain information on industry, location, citation relationships, and time. Industries can also be divided into different types and into upstream and downstream positions. By combining these variables, we can study the formation, expansion, and spillovers of patent networks. Spillover effects\rQuantile regressions within the same county. From left to right are investment-rate quantiles. From top to bottom, the patent classes become increasingly distant. Example\rThe paper has much more to discuss, but I will just sketch a few ideas here: whether the patent had government involvement citation direction: patents citing others and being cited, plus upstream-downstream industry relations geographic space: different industries within the same county; the same industry across different counties\u0026hellip;\u0026hellip; firms as a whole: all firm patents, firms with patents in the same county and technological field, firms with patents only in different counties and/or technological fields, and firms with no patents. ","date":"2024-12-15","heading":"Mechanism","objectID":"/en/posts/zftz/:4:3","tags":["Industrial Economics"],"title":"One-Time Government Investment and Long-Run Industrial Development","uri":"/en/posts/zftz/#mechanism"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Distinguishing national effects and local effects\rThe paper separates the two by comparing the United States, the United Kingdom, and France. $$ \\begin{aligned} \\ln(Patents)\\_{ict} = \u0026amp; \\sum\\_{q=1}^4 \\beta\\_q \\cdot 1\\\\{Country\\_i = US\\\\} \\cdot 1\\\\{Class\\_c \\in \\text{quartile } q\\\\} \\cdot 1 \\\\{t \u0026gt; 1945 \\\\} \\\\\\\\ \u0026amp; \u0026#43; Country\\_i \\times Class\\_c \\\\\\\\ \u0026amp; \u0026#43; Country\\_i \\times Post\\_t \\\\\\\\ \u0026amp; \u0026#43; Class\\_c \\times Post\\_t \\\\\\\\ \u0026amp; \u0026#43; \\varepsilon\\_{ict} \\end{aligned} $$ Cross-country comparison\r","date":"2024-12-15","heading":"Distinguishing national effects and local effects","objectID":"/en/posts/zftz/:4:4","tags":["Industrial Economics"],"title":"One-Time Government Investment and Long-Run Industrial Development","uri":"/en/posts/zftz/#distinguishing-national-effects-and-local-effects"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"How to present papers\rUnder my advisor\u0026rsquo;s guidance, I came to understand that a reading-group presentation should summarize multiple papers around a common theme. Using this post as an example: State the central theme clearly: the common thread across these three papers is one-time government investment and long-run development. In the end, the extra point to watch is the distinction between national effects and local effects. Do not present one paper after another like a running ledger. Choose the level of detail well: spend more time sharing the identification strategy, the innovations, and the logic behind the mechanism design. Robustness checks can be covered briefly. Keep a learner\u0026rsquo;s mindset: while presenting, think about what we as learners can actually do with the paper: where it falls short, what is worth learning from, and what is worth imitating\u0026hellip;\u0026hellip; Learn how to speak: if you find this line of papers interesting, think about how to structure the presentation so the interesting parts show up quickly. In collaborations, the part senior scholars abroad often write themselves is the introduction. That is exactly where this ability shows up. For example, when Samuelson\u0026rsquo;s Economics was published, its discussion of the \u0026ldquo;mixed economy\u0026rdquo; triggered major controversy.\u0026#160;\u0026#x21a9;\u0026#xfe0e; See Lu Ming: advice for scholars doing empirical research.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2024-12-15","heading":"How to present papers","objectID":"/en/posts/zftz/:5:0","tags":["Industrial Economics"],"title":"One-Time Government Investment and Long-Run Industrial Development","uri":"/en/posts/zftz/#how-to-present-papers"},{"categories":["Travel"],"collections":[],"content":" The world of dreams is indeed fascinating. Of course, the best society is not one where people dream physiologically, but one where everyone dares to dream of ideals. When society becomes oppressive, please do not blame others; it is the fading of societal dreams. Since childhood, I have had many types of dreams: Precognitive Dreams: Dreaming of the next day\u0026rsquo;s school poetry competition dictation questions. Lucid Dreams: Being in overlapping white staircases, realizing it\u0026rsquo;s a dream, but still unable to control it, just walking blindly. Recurring Dreams: From elementary to middle school, I repeatedly dreamed of walking on the ridges of southern water fields in my hometown. There was a chest-deep pit in the path, and falling into it, I could feel the slithering sensation of giant pythons around me. (I suspect it was because I was young and the blanket was too heavy, so I kept dreaming of it.) Today\u0026rsquo;s dream was the most complete and lengthy, with a strong sense of storytelling. Now that AI is available, why not compare AI interpretations? ","date":"2024-12-04","heading":"","objectID":"/en/posts/ai_m/:0:0","tags":["Dreams","Artificial Intelligence"],"title":"Recording a Dream and AI Dream Interpretation","uri":"/en/posts/ai_m/#"},{"categories":["Travel"],"collections":[],"content":"Dream Description\rLast night, I had a nested dream. A relative girl poured loaches into the basin where I had placed water. I suddenly became agitated, remembering that there was a small snake I had raised in it. I frantically reminded the relative not to squeeze out my pet snake. As the water filled up, the snake disappeared. I felt that this was the second time I had lost a pet snake, but I couldn\u0026rsquo;t recall the first time—only the painful feeling of loss. I kept trying to convince my family that such a snake had existed (I was using the past tense to describe it, which might be a key point). On a stone table in the classic neighborhood grove, I kept telling them all my memories, but could only recall some vague landmarks. I searched everywhere, retrieving memories from the trash bin, the police station, and the museum. Trash Bin Memory: On my way to school, I found a transparent small box inside a larger box, containing a talking snake! I also remembered that the trash bin was divided into recyclable and non-recyclable, a world that seemed omnipotent. She was actually a talking snake. The snake and I watched videos and吐槽 together. But I couldn\u0026rsquo;t remember how it came to be, only fragmented memories of life. Police Station: I was parentless, driving a second-hand Changan truck collecting garbage. The Changan\u0026rsquo;s window was broken, patched with yellow tape, and the trunk couldn\u0026rsquo;t lock, so I propped it open with a support to load junk and goods. The snake turned out to be a descendant of Bai Suzhen\u0026rsquo;s lineage, an experimental subject. I was caught in the pursuit of an evil force, and the police were helping me. Museum: The evil force was conducting biological experiments in pursuit of mythical power. The snake sacrificed itself to save me, incidentally erasing my memory. Her final words were—there should not be a talking snake in the world. Forgetting her would be better for both me and the world. I remembered everything and woke up. ","date":"2024-12-04","heading":"Dream Description","objectID":"/en/posts/ai_m/:1:0","tags":["Dreams","Artificial Intelligence"],"title":"Recording a Dream and AI Dream Interpretation","uri":"/en/posts/ai_m/#dream-description"},{"categories":["Travel"],"collections":[],"content":"AI Interpretations\r","date":"2024-12-04","heading":"AI Interpretations","objectID":"/en/posts/ai_m/:2:0","tags":["Dreams","Artificial Intelligence"],"title":"Recording a Dream and AI Dream Interpretation","uri":"/en/posts/ai_m/#ai-interpretations"},{"categories":["Travel"],"collections":[],"content":"Tongyi Qianwen\rYour dream is very complex and full of symbolic meanings, possibly reflecting some deep-seated emotions and unresolved issues in your subconscious. Dreams are usually expressions of our subconscious. Here are some possible interpretations: Loss and Retrieval: The recurring theme of losing the pet snake and the process of searching for it may express your fear of losing important relationships or things. You mentioned that this was the \u0026ldquo;second time\u0026rdquo; you lost the pet snake but couldn\u0026rsquo;t recall the first time, which might hint at a past experience of loss that was very painful for you. Trash Bin Memory: This part seems to suggest that you found something precious (the talking snake) in an unexpected place, symbolizing the value you find in ordinary or overlooked things. The \u0026ldquo;recyclable and non-recyclable\u0026rdquo; world might represent your views on resource utilization or your attempt to give new meaning to seemingly useless things in life. Police Station Scene: The image of driving a second-hand Changan truck collecting garbage might be a self-deprecating or humble reflection of your life status. The pursuit and police assistance could reflect the pressures or challenges you face in real life and your need for external help. Museum Memory: This involves mythological elements (like Bai Suzhen) and scientific experiments, as well as the act of choosing to forget to protect others. This might indicate that you are facing similar choices in real life—sometimes having to make sacrifices or give up something for the safety and happiness of yourself or others. Overall Dream Structure: The entire dream seems like a story about growth, responsibility, love, and sacrifice. It might be telling you that despite the many difficulties and uncertainties in life, you have the strength to face them, and sometimes you must accept certain events, even if it means enduring some loss. this is just a general analysis based on the dream content you provided. Everyone\u0026rsquo;s experiences are unique, so the most accurate understanding should come from yourself. If you feel that this dream has had a particular impact on you, consider whether it touches on certain aspects of your recent life or if there is anything specific that is troubling you. If necessary, you can also try exploring the meanings behind these dreams further through journaling or drawing. ","date":"2024-12-04","heading":"Tongyi Qianwen","objectID":"/en/posts/ai_m/:2:1","tags":["Dreams","Artificial Intelligence"],"title":"Recording a Dream and AI Dream Interpretation","uri":"/en/posts/ai_m/#tongyi-qianwen"},{"categories":["Travel"],"collections":[],"content":"Wenxin Yiyan\rThis nested dream is full of fantasy and emotional elements, very captivating. Here is a detailed analysis of the dream: Beginning of the Dream: The relative girl pouring loaches into the basin triggered your anxiety and worry, as you were concerned it would harm your pet snake. This reflects your deep care and sense of responsibility for your pet in real life. Your fear and pain of losing the snake might represent your deep anxiety about losing something important. Lost Memories and Search: You felt that this was the second time you lost the pet snake but couldn\u0026rsquo;t recall the first time. This vague memory might symbolize a sense of loss you experienced in real life, but the details are blurry. You kept trying to convince your family and searched everywhere for the snake, reflecting your determination and relentless effort to retrieve what was lost. Memories in Different Scenes: Trash Bin Memory: This scene is full of fantasy. You found a talking snake and watched videos and吐槽 together. This might represent your deep desire and imagination of forming a strong emotional bond with a pet. The trash bin classification also reflects the complexity and diversity of modern society. Police Station: In this scene, you became a garbage collector, caught in the pursuit of an evil force. This might symbolize some困境 or challenge you face in real life, while the snake, as a descendant of Bai Suzhen, represents some信仰 or hope. The police assistance symbolizes your desire for help and protection in困境. Museum: This scene reveals that the snake sacrificed itself to save you and erased your memory. This might represent your deep experience of sacrifice and遗忘, also hinting at some无奈 and compromise with the real world. End of the Dream: When you remembered everything, you woke up. This might mean that you experienced profound emotional and cognitive awakening in the dream, thus ending this complex nested dream. Overall, this nested dream is full of fantasy, emotion, and deep symbolic meanings. It might reflect your care for pets, fear of losing important things,应对困境 and challenges, and deep experience of sacrifice and遗忘. By analyzing this dream, you can better understand your inner world and emotional needs. ","date":"2024-12-04","heading":"Wenxin Yiyan","objectID":"/en/posts/ai_m/:2:2","tags":["Dreams","Artificial Intelligence"],"title":"Recording a Dream and AI Dream Interpretation","uri":"/en/posts/ai_m/#wenxin-yiyan"},{"categories":["Travel"],"collections":[],"content":"GPT (4-O)\rThis is a dream full of symbolic meanings, with layered plots and emotions that seem to explore deeply hidden secrets in the subconscious. Here are some possible interpretations: Symbolism of the Snake The snake might represent a part of your inner self—innocent, fragile, yet full of wisdom and power. This snake can talk, help you吐槽, solve problems, and even sacrifice itself to protect you, showing that it is not just a pet but also a spiritual companion or guide. Loss and Search In the dream, you keep losing and searching for the snake, which might hint at the loss of some important emotion or memory in reality. This repeated loss and retrieval might correspond to a process of losing and trying to regain yourself in a certain situation. Trash Bin, Police Station, and Museum These locations each have deep meanings: Trash Bin: Symbolizes parts of life that are neglected or discarded. Finding memories there suggests the need to revisit past experiences or emotions that have been forgotten. Police Station: Represents order and protection, but your experience in the dream is full of破碎 and pursuit, possibly reflecting your矛盾心理 towards authority or real-world rules. Museum: As a repository of memories, it reveals the truth about the snake, the evil force, and the sacrifice, seemingly reminding you that some truths from the past need to be accepted or let go. Sacrifice and Memory Erasure The snake\u0026rsquo;s sacrifice and erasure of your memory carry a strong tragic tone, perhaps reflecting your subconscious复杂情感 towards \u0026ldquo;forgetting.\u0026rdquo; On one hand, forgetting might be a form of self-protection; on the other, it comes with deep loss. Feeling After Waking Up You woke up after remembering everything in the dream, as if completing an internal integration in the subconscious. When memories, emotions, and truths converge, you achieve clarity—whether from the dream or some psychological困境. If this is a source of creative inspiration, the dream\u0026rsquo;s plot is very suitable as the mainline of a suspense story, especially regarding the symbolism of the snake, the conspiracy behind the experiments, and the protagonist\u0026rsquo;s growth. You could further expand it, adding more characters and background details to make it a fantastical and touching work. ","date":"2024-12-04","heading":"GPT (4-O)","objectID":"/en/posts/ai_m/:2:3","tags":["Dreams","Artificial Intelligence"],"title":"Recording a Dream and AI Dream Interpretation","uri":"/en/posts/ai_m/#gpt-4-o"},{"categories":["Travel"],"collections":[],"content":"Personal Interpretation\rI don\u0026rsquo;t understand the relationship between dream interpretation, desires, and the subconscious, but based on past dreams and my own experiences, I should be able to sense where the dream materials come from. The most amazing part of this nested dream is that the development of the dream corresponds to the foreshadowing earlier. But how can a dream have foreshadowing? How can it set up a呼应 framework in advance? This sense of design is astonishing. Snake: Since childhood, I\u0026rsquo;ve had many dreams about snakes. Although they are terrifying to me, I also find them somewhat positive because my zodiac sign is the snake. In The Lion King, Kung Fu Panda, and The Legend of the White Snake, snakes are portrayed positively, and there\u0026rsquo;s an ancient saying about snakes transforming into dragons. Talking Snake: Recently, I had a lot of discussions with classmates during a gathering, and writing my thesis also requires active communication with the team. Indeed, I have many thoughts on social interaction, communication, and barriers. I believe sincere communication is important, but sincere communication doesn\u0026rsquo;t mean others will believe you are sincere. This process is like the prisoner\u0026rsquo;s dilemma—the more it goes on, the higher others\u0026rsquo; defenses against sincerity become. Museum: My favorite city attraction has always been museums. I believe in the power of museums—human history, dignity, and monuments. It\u0026rsquo;s fitting to retrieve memories in a museum. The police station is just something we, as Chinese, fully trust. Recently visited Jinsha Museum and the Sun Bird Totem\rGarbage, Changan Truck: My family is very harmonious. The scavenging and parentless aspects are classic anime settings. In my hometown, Changan trucks are often used for transporting goods. Forgetting, Sacrifice: Classic scenes from films like Your Name. At this stage, my dreams still have such情节,看来我还是挺向往童真的😄. The most impressive part of this dream is the realism of失忆 and寻找, and finally remembering everything gave a sense of fate. Desire: In this dream, I could clearly sense that the snake\u0026rsquo;s gender was female. Could it really be a reflection of desire? But I know that such an image is an ideal embodiment, just like the me on the blog is only a partial me. Anyone in reality is diverse and complete. To comprehend the abstract and sacred aspects of human nature, but in the pursuit, one must embrace the whole and concrete person. ","date":"2024-12-04","heading":"Personal Interpretation","objectID":"/en/posts/ai_m/:2:4","tags":["Dreams","Artificial Intelligence"],"title":"Recording a Dream and AI Dream Interpretation","uri":"/en/posts/ai_m/#personal-interpretation"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics","Institutions, Choice, and Development"],"content":" Institutions are the fundamental cause of economic growth — Douglass North I have long wanted to document the profound impact of my first encounter with \u0026ldquo;New Political Economy\u0026rdquo; in a public finance course. I decided to organize my thoughts for the following reasons: After studying measure theory, I gained some foundational knowledge in functional analysis (though not strictly necessary) During a group meeting, the professor discussed the current state of policy implementation in China, mentioning that political economy indeed provides a crucial perspective. I strongly agree. Institutional incentives represent a fascinating research domain. The 2024 Nobel Prize was awarded for contributions to institutional economics and political economy The dramatic twists in the US presidential election Coming across related videos on Bilibili With busy times ahead, if I don\u0026rsquo;t write now, I won\u0026rsquo;t have time later ","date":"2024-11-17","heading":"","objectID":"/en/posts/shxz/:0:0","tags":["Institutional Economics"],"title":" Institutions, Politics, Democracy, and Arrow's Impossibility Theorem ","uri":"/en/posts/shxz/#"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics","Institutions, Choice, and Development"],"content":"From Institutions to Political Economy\rTwo questions: What is the origin of the state (what is the essence of public finance)? What determines the development path of a state? I often use this question as an example in my blog1 — what is the origin of government? One school of thought is classical political economy, represented by social contract theory, public goods theory2, and social welfare theory. The establishment of power collectives stems from the need for collective optimization. Of course, how to measure social welfare itself is a philosophical question: minimum (veil of ignorance thought experiment3)? maximum? mean? absolute value? marginal value? designing weighted convex functions? Beyond this, conceptions of justice are also philosophical issues, such as Amartya Sen\u0026rsquo;s concept of freedom of choice; outcome equality in planned economies; endowment equality in initial distributions\u0026hellip; Tax design resembles the trolley problem: one track has the poor, another the middle class, and another the wealthy — even considering that some might transform into Super Saiyans and overturn the table before being hit. Before introducing another school of thought, let\u0026rsquo;s look at the next question—what determines the development of a state. One major perspective is the resource endowment theory in international trade. Country A has 4 units of resource a and 2 units of resource b, but industry a is more profitable, so it naturally chooses industry a. Country B has only 0.5 units of resource a and 1 unit of resource b, making industry b more profitable, thus it develops industry b. Quantity of Resource A\rQuantity of Resource B\rMore Profitable Industry Choice\rCountry A\r4\r2\rA\rCountry B\r0.5\r1\rB\rTherefore, even though Country A is superior in all resources compared to Country B, since it internally focuses on developing the most profitable industry A, it chooses industry A; similarly, Country B chooses industry B. This model (H-O comparative advantage) vividly explains why weaker countries with absolute disadvantages can still export goods to stronger countries. Professor Justin Yifu Lin proposed \u0026ldquo;New Structural Economics\u0026rdquo; based on this idea. The Origin of International Trade\rFirst stage view: Absolute advantage Second stage view: Comparative advantage Third stage view: Scale effect Fourth stage view: Heterogeneous firms In other words, this school of thought assumes that national development is determined by regional resources. The following distinctions about institutional economics are based on \u0026ldquo;Institutions and Economic Growth\u0026rdquo; (Yao Yang), a book about the dialogue between Professor Yao Yang and institutional economics master North. (Haven\u0026rsquo;t finished reading it yet, will supplement later.) Institutional economics disagrees. For instance, North argues that factors like investment, education, and capital accumulation are not causes of economic growth but manifestations of growth. If merely accumulating production factors could achieve development, theoretically all countries could imitate this, but reality proves otherwise. In practice, efficient organizations are the primary drivers of development. Meanwhile, resource endowment theory always assumes people rationally maximize their resource advantages. A simple counterexample is the partial emergence of deglobalization trends globally. Example 1. Coase used transaction costs to explain the origin of firms — explaining corporate emergence from an institutional perspective. This demonstrates that institutional emergence shares commonalities rather than being uniquely generated by resource endowments. Example 2. I prefer to explain institutional economics using an anthropological perspective — our cultural behaviors can be viewed as excessive rituals4. For example, cured meat: historically, cured meat served as preserved food for the New Year due to resource constraints, but now with abundant resources, its significance has transformed into an e","date":"2024-11-17","heading":"From Institutions to Political Economy","objectID":"/en/posts/shxz/:1:0","tags":["Institutional Economics"],"title":" Institutions, Politics, Democracy, and Arrow's Impossibility Theorem ","uri":"/en/posts/shxz/#from-institutions-to-political-economy"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics","Institutions, Choice, and Development"],"content":"Social Choice Theory\rThis section is based on Chapter 18 of \u0026ldquo;Advanced Microeconomics (Second Edition)\u0026rdquo; (Jiang Chundian). I basically just selectively copied and pasted. For more accessible explanations of Arrow\u0026rsquo;s impossibility theorem, refer to this video: ","date":"2024-11-17","heading":"Social Choice Theory","objectID":"/en/posts/shxz/:2:0","tags":["Institutional Economics"],"title":" Institutions, Politics, Democracy, and Arrow's Impossibility Theorem ","uri":"/en/posts/shxz/#social-choice-theory"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics","Institutions, Choice, and Development"],"content":"Social Welfare Functional\rIn probability theory, we used sets to represent event outcome ranges. The term \u0026ldquo;functional\u0026rdquo; is \u0026ldquo;general\u0026rdquo; because it studies mappings from set spaces to set spaces; we study a class of mapping functions, or in other words, \u0026ldquo;general\u0026rdquo; refers to studying functions of functions; nonlinear functionals represent path optimization, refer to another blog post \u0026ldquo;Calculus of Variations Study Notes.\u0026rdquo; Some advanced microeconomic reasoning relies on sets as the space for decision elements: Let the set of social individuals be $I=\\\\{ 1,2,\\ldots, n \\\\}, n\\geqslant2$. $x, y \\in X$ are resource sets, allocated to individuals $a_i$, i.e., $\\sum_i^n a_i=X_i$. Preferences are as follows: $x\\succeq_{i}y$: individual $i$ considers $x$ no worse than $y$. $x\\sim_{i}y$: individual $i$ considers $x$ and $y$ indifferent. $x\\succ_{i}y$: individual $i$ considers $x$ better than $y$. As mentioned earlier, a functional is a mapping from space to space. A social welfare functional is a mapping from the space of individual joint preferences to the space of social preferences, denoted as $$ \\succeq^{F}=F(\\succeq_{1},\\succeq_{2},\\ldots,\\succeq_{n}) $$ Note, this is a mapping from the preference space of all individuals to social preferences, not necessarily a one-dimensional space ($R^1$). The joint preference space of individuals can be understood as the set of all individuals\u0026rsquo; preference outcomes, and the social preference space can be understood as the final overall preference outcome space we should acknowledge. Next, let\u0026rsquo;s illustrate with examples: For a dictatorial society, social preferences are forced to conform to the preferences of one individual. $$ x\\succ_{h}y\\quad\\Rightarrow\\quad x\\succ y $$ Majority voting is a mapping where the minority follows the majority, comparing based on the aggregation of similar individual preferences. $$ N(x\\succ_{i}y)\u0026gt;N(y\\succ_{i}x)\\Rightarrow\\quad x\\succ y $$$$ N(x\\succ_{i}y)=N(y\\succ_{i}x)\\Rightarrow\\quad x\\sim y $$ May\u0026rsquo;s Theorem: The necessary and sufficient conditions for a social welfare functional to be majority voting are these three properties: Anonymity of majority voting means sequence identifiers $i$ within the same preference can be interchanged; Neutrality manifests as equal weight for each person\u0026rsquo;s vote; Positive responsiveness manifests as social preference changing direction aligning with some individuals\u0026rsquo; preference direction changes. Majority voting seems ideal, but real-world voting encounters various problems; details can be found in the \u0026ldquo;voting paradox\u0026rdquo; (also called Condorcet paradox). Since preferences are based on ordinal utility theory (comparative), infinite comparison cycles might occur. Real voting is more complex; for example, swing states are crucial in US elections, and bandwagon effects or retaliatory mindsets also influence voting outcomes. Source: Wikipedia\rTherefore, we need to establish axiomatic conditions for social welfare functionals: Unrestricted domain: Every individual preference yields social preferences (social preferences must at least satisfy transitivity and completeness) Non-dictatorship: Supplement: anonymity imposes stronger constraints than non-dictatorship. Pareto principle: $\\forall i\\in A, x\\succ_{i}y \\rightarrow x\\succ y$ Independence: $\\forall x, y\\in X$ when $x\\succ y$ holds, any $i\\in I$\u0026rsquo;s preferences outside $\\\\{x, y\\\\}$ do not affect the social preference outcome $x\\succ y$. Independence actually simplifies the model, limiting voters\u0026rsquo; considered information to current choices; this constraint is weaker than neutrality. Now we can introduce a voting scheme — Borda count. The core is ranking: each person ranks every option from 1 to n $c_i(x)$, with better options ranked higher, then summing each option\u0026rsquo;s ranks. $$ c(x)=\\sum_{i=1}^{n}c_{i}(x) $$ Smaller totals indicate stronger social preference. $$ c(x)\u0026lt;c(y)\\quad\\Leftrightarr","date":"2024-11-17","heading":"Social Welfare Functional","objectID":"/en/posts/shxz/:2:1","tags":["Institutional Economics"],"title":" Institutions, Politics, Democracy, and Arrow's Impossibility Theorem ","uri":"/en/posts/shxz/#social-welfare-functional"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics","Institutions, Choice, and Development"],"content":"Arrow\u0026rsquo;s Impossibility Theorem\r","date":"2024-11-17","heading":"Arrow\u0026rsquo;s Impossibility Theorem","objectID":"/en/posts/shxz/:3:0","tags":["Institutional Economics"],"title":" Institutions, Politics, Democracy, and Arrow's Impossibility Theorem ","uri":"/en/posts/shxz/#arrows-impossibility-theorem"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics","Institutions, Choice, and Development"],"content":"Decisive Coalition\rWe have many expectations for collective decision-making, so we wonder if there is a voting method that can satisfy all our demands. Arrow\u0026rsquo;s Impossibility Theorem proves that—when there are three or more options, this expectation is impossible. Decisive preference refers to situations where a specific group has the power to influence social preferences. Coalition $K \\in I$ $$ \\forall i\\in K, x\\succ_iy;\\quad\\forall j\\in I\\cap K^c, y\\succ_jx\\quad\\Rightarrow x\\succ y $$ That is, $I$ is divided into two preference positions, $K$ and $I\\cap K^c$, and even if their views are opposite, the final social preference may reflect the preference of $K$. Swing states in U.S. elections. The moment when votes are tied, the last vote becomes the tipping point. Celebrities taking a stance and their fans following. When the preference of coalition $K$ directly determines the social preference for options $(x,y) \\subset X$, then $K$ is a decisive coalition under the social welfare functional, denoted as $D_K(x,y)$. Again, note that the functional here is a mapping from space to space. Since $K$ determines social preferences, the preference of this coalition is the mapping from the joint preference space of individuals to social preferences. Naturally, when $K$ consists of only one person, it is a dictatorship. When unrestricted domain, Pareto principle, and independence are satisfied, the decisive coalition has the following properties: $(x,y) \\subset X$, there is a decisive coalition $D_K(x,y)$, then for $(u,v) \\subset X$, there is also $D_K(u,v)$. $K\\subseteq I,J\\subseteq I$ (the symbol means subset or equal) are both decisive coalitions, then $K\\cap J$ is also a decisive coalition. For any $K\\subset I$, either $K$ or $I\\cap K^c$ is a decisive coalition8. $K\\subset I$ is decisive, $J\\subset I$ is any coalition containing $K$, $J\\subset K$, then $J$ is also decisive. $K\\subseteq I$ is decisive, and the number of members is greater than 1, then there exists a proper subset $J\\subset K$ that is decisive. The proofs of these properties are not recorded here. ","date":"2024-11-17","heading":"Decisive Coalition","objectID":"/en/posts/shxz/:3:1","tags":["Institutional Economics"],"title":" Institutions, Politics, Democracy, and Arrow's Impossibility Theorem ","uri":"/en/posts/shxz/#decisive-coalition"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics","Institutions, Choice, and Development"],"content":"Arrow\u0026rsquo;s Impossibility Theorem\rThis is Arrow\u0026rsquo;s doctoral thesis\u0026hellip;\u0026hellip; Definition: When the number of choices is no less than 3 (e.g., the U.S. election is essentially a two-party system, so it doesn\u0026rsquo;t apply), there is no social welfare functional that simultaneously satisfies unrestricted domain, non-dictatorship, Pareto principle, and independence. The proof essentially uses the following properties: $(x,y) \\subset X$, there is a decisive coalition $D_K(x,y)$, then for $(u,v) \\subset X$, there is also $D_K(u,v)$. $K\\subseteq I,J\\subseteq I$ (the symbol means subset or equal) are both decisive coalitions, then $K\\cap J$ is also a decisive coalition. For any $K\\subset I$, either $K$ or $I\\cap K^c$ is a decisive coalition8. $K\\subset I$ is decisive, $J\\subset I$ is any coalition containing $K$, $J\\subset K$, then $J$ is also decisive. $K\\subseteq I$ is decisive, and the number of members is greater than 1, then there exists a proper subset $J\\subset K$ that is decisive. For example, proving that a social welfare functional satisfying unrestricted domain, Pareto principle, and independence must be dictatorial: The entire society $I$ can be seen as a decisive coalition, and based on property 5, it can be infinitely decomposed into one. Then, using property 2, preferences are classified, verifying that this individual is indeed a dictator relative to other options. Recommended references: When Democracy Meets Logic—Arrow\u0026rsquo;s Impossibility Theorem - A Distant Star\u0026rsquo;s Article - Zhihu Why is Arrow\u0026rsquo;s Impossibility Theorem Counterintuitive? Given Arrow\u0026rsquo;s Impossibility Theorem, Why Does Microeconomics Still Study Social Welfare Functions? Personal understanding: You can think of the dictatorship proof in Arrow\u0026rsquo;s Impossibility Theorem as the \u0026ldquo;last vote\u0026rdquo; that tips the scale. But the understanding needs to go deeper: Remember: Arrow\u0026rsquo;s Impossibility Theorem studies the mapping from individual preference space to social preference space. Because Arrow wants to solve the best mapping from individual preference space to social preference space, the most ideal democracy is one where there is no \u0026ldquo;tipping vote.\u0026rdquo; Absolute equality, where participation is through ranking rather than cardinal utility aggregation. Of course, there are already theorems proving the existence of transformations between ordinal and cardinal preferences. Assuming everyone votes once under unknown circumstances, there will always be one person whose preference determines (even if they don\u0026rsquo;t know they are the dictator of this game) the entire society\u0026rsquo;s preference, making the vote dictatorial. In other words, the mapping is not ideal and does not truly reflect the preferences of the majority. Assuming multi-stage games, people may change their votes based on retaliation, altering their preferences, which violates the independence assumption. If everyone changes their initial preferences to win, the mapping no longer reflects the best outcome. Ultimately, Arrow\u0026rsquo;s Impossibility Theorem aims to prove this point—mapping individual preferences to social preferences is fraught with difficulties. ","date":"2024-11-17","heading":"Arrow\u0026rsquo;s Impossibility Theorem","objectID":"/en/posts/shxz/:3:2","tags":["Institutional Economics"],"title":" Institutions, Politics, Democracy, and Arrow's Impossibility Theorem ","uri":"/en/posts/shxz/#arrows-impossibility-theorem-1"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics","Institutions, Choice, and Development"],"content":"Relaxing Assumptions\rOne proof is that when the number of participants approaches infinity, Arrow\u0026rsquo;s Impossibility Theorem has a solution, but it doesn\u0026rsquo;t seem to allow for asymptotic properties like in econometrics. Relaxing the unrestricted domain assumption, limiting preferences to single-peaked, without multi-peaked preferences. Single-peaked preferences: If voters deviate from their most preferred outcome, regardless of the direction, their utility decreases. Double-peaked preferences: If voters deviate from their most preferred outcome, their utility first decreases and then increases. Essentially, this excludes the voting paradox (Condorcet paradox) scenario. Single-peaked preferences need to be convex in a closed continuous interval. Single-peaked preferences (Source: \u0026ldquo;Advanced Microeconomics (Second Edition)\u0026rdquo; (Jiang Chundian)), multi-peaked is the triangle inverted\r","date":"2024-11-17","heading":"Relaxing Assumptions","objectID":"/en/posts/shxz/:3:3","tags":["Institutional Economics"],"title":" Institutions, Politics, Democracy, and Arrow's Impossibility Theorem ","uri":"/en/posts/shxz/#relaxing-assumptions"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics","Institutions, Choice, and Development"],"content":"Terence Tao\u0026rsquo;s Proof\rProof Idea\rThere are many ways to prove Arrow\u0026rsquo;s Impossibility Theorem. Intermediate microeconomics usually introduces it through table ranking. Another common method is to simplify it to a two-dimensional coordinate graph to study preference blocks. Advanced methods usually choose functional and set-theoretic proofs, which is the proof in this article. Terence Tao also provided his own proof: Terence Tao\u0026rsquo;s Proof Analysis can be referenced: Proof of Arrow\u0026rsquo;s Impossibility Theorem (via Terence Tao) A professor of advanced probability theory once commented—he felt sorry that Terence Tao spent part of his energy on non-world-class problems😂. I find discussions about first principles very interesting.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Public goods like squares and national defense security are available to everyone (non-excludable), and one more person does not affect the quality (non-rivalrous), so they require government support.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Assuming we don\u0026rsquo;t know which society we will be reincarnated into, we often assume we will always be reincarnated into the worst society. In this case, the best standard for social welfare is the minimum.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Others I know include theatrical stage theory and self-mapping theory.\u0026#160;\u0026#x21a9;\u0026#xfe0e; The proposer of social choice theory, Nobel laureate Buchanan, admired Yang Xiaokai, which is why Yang Xiaokai is considered the Chinese economist closest to the Nobel Prize in Economics.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Intersecting with game theory and information asymmetry. The representatives we elect are in a position of information asymmetry with us, so we cannot use power contracts to describe this situation. Using agents is more objective.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Officials formulate local development policies for their own promotions, so they focus on tangible investments like infrastructure rather than intangible capital like human resources, while also taking on large debts and competing with rivals. Proposed by Professor Zhou Li\u0026rsquo;an of Peking University.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Assuming ties and cycles are excluded, naturally no matter how you divide, one side\u0026rsquo;s collective preference will determine the social preference.\u0026#160;\u0026#x21a9;\u0026#xfe0e;\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2024-11-17","heading":"Terence Tao\u0026rsquo;s Proof","objectID":"/en/posts/shxz/:3:4","tags":["Institutional Economics"],"title":" Institutions, Politics, Democracy, and Arrow's Impossibility Theorem ","uri":"/en/posts/shxz/#terence-taos-proof"},{"categories":["Economic Studies"],"collections":["Reflections on Learning Economics","Academic Rhetoric"],"content":" Some recent reflections from my studies. They come from classes, the internet, and conversations with teachers, classmates, and senior students. I am especially grateful for my recent conversations with lw; they made me feel, somehow, like I was back in middle school 😀. Although what follows draws on classes, teachers, senior students, and things I have read online, it has all been filtered, trimmed, reorganized, and commented on according to my own preferences. It does not fully represent anyone else\u0026rsquo;s real view. If there are mistakes, they are mine. One thing I want to stress: data, methods, and ideas support each other. There is no real contradiction among them. The problem is simply that it is rare to do all three well at once. ","date":"2024-11-14","heading":"","objectID":"/en/posts/fs3/:0:0","tags":["Economic Methodology"],"title":"The conceit of economics: some recent thoughts","uri":"/en/posts/fs3/#"},{"categories":["Economic Studies"],"collections":["Reflections on Learning Economics","Academic Rhetoric"],"content":"The conceit of economics\rI very much agree with what my elementary-school classmate cj once said: for any discipline, we do not choose it because we already love it; we study it deeply, begin to see what is remarkable about it, and only then fall in love with it 1. There is something subtle buried deep in every field. It is not that a discipline naturally attracts us from the start. Study simply gives us a firmer basis for judgment, and the world begins to look a little different. Still, I am glad I chose economics. Among the humanities and social sciences, economics offers relatively complete academic training. Analytically, an economics paper is a three-part hybrid: social-theory analysis + mathematical simulation and modeling + statistical empirical testing. Its insights try to move toward politics and history, its rigor appears as equations, and its arguments are polished through statistics. Even if someone started out in the humanities, economics still makes it possible to engage, in a relatively coherent way, with knowledge such as: Mathematics: measure theory, functional analysis, real analysis\u0026hellip; Computer science: text processing, image recognition\u0026hellip; Statistics: econometrics and causal inference Other humanities fields: philosophy, history, literature, sociology, political science\u0026hellip; Today, positivism has become the dominant scientific fashion. Leaving aside the hegemony of theory, economics has used econometric methodology to build an even sturdier empire: quantitative history, quantitative sociology (above all in demographic questions), economic anthropology\u0026hellip; That has also brought many problems: the overuse of mathematics, a relative lack of theoretical ideas, blurred disciplinary boundaries, uneven training programs, and a shortage of practical usefulness\u0026hellip; There are also some awkward trends right now: ","date":"2024-11-14","heading":"","objectID":"/en/posts/fs3/:0:0","tags":["Economic Methodology"],"title":"The conceit of economics: some recent thoughts","uri":"/en/posts/fs3/#the-conceit-of-economics"},{"categories":["Economic Studies"],"collections":["Reflections on Learning Economics","Academic Rhetoric"],"content":"❓Prediction or parable?❓\rEconomics once treated prediction as its mission, but the causal-inference paradigm in econometrics is built on conditional expectations and on using exogenous events to test causal relationships. That makes genuine prediction very hard. Can religion predict? Can experience predict? Both existed before economics. Their job was explanation, not prediction. Stepping back, what people really want is to sort out causal relationships among variables and then combine them with reality to make predictions. But because reality is complicated and models are abstract, or simply too neat, empirical econometrics cannot truly settle theoretical disputes. I have also heard another view: all of econometrics is preparing for a giant world model. Each empirical paper analyzes only one tiny variable, but if you stack enough papers together, they begin to describe the whole world. Even when a theory is provisionally falsified, we can always say it was due to the limits of the data, the limits of statistical methods, or the limits of the historical setting. And so the theme of causal analysis in economics moves to another level: parable. Once nobody really knows whether a theory is right or wrong, the criterion becomes suggestiveness. What is the origin of government? Social contract, collective evolutionary trends, agents, providers of public goods\u0026hellip; The theories are countless, and many contradict each other, yet each can still be influential because each is suggestive enough. A teacher in the history of economic thought once stressed in class that economics is a chaos, and right versus wrong is not the most important thing. On the idea that economics may be, at bottom, a discipline of persuasion, see my notes on another post: The Rhetoric of Economics. ","date":"2024-11-14","heading":"","objectID":"/en/posts/fs3/:0:1","tags":["Economic Methodology"],"title":"The conceit of economics: some recent thoughts","uri":"/en/posts/fs3/#prediction-or-parable"},{"categories":["Economic Studies"],"collections":["Reflections on Learning Economics","Academic Rhetoric"],"content":"❓Mathematical methods or intellectual insight?❓\rMost people write economics papers that are empirical econometrics papers. One awkward fact about lower-level empirical work is this: code manipulation and mathematical understanding can be separated. We can call code directly without knowing the deeper mathematics at all (as long as we at least know what kind of model is appropriate in what context). That leads to an awkward problem. If we do not push our study of mathematical statistics to the limit, the difference in output may be tiny. A graduate student who has learned 60% of the underlying logic of mathematical statistics and an undergraduate who has learned only 30% may end up with almost no technical difference in their papers. That is why many people question the value of the graduate core trio. The path from learning to actual use is simply too long. So people often joke that they are just reg monkeys. A professor in advanced econometrics once said that the frontier is no longer reduced-form work, but structural work and machine learning (the discipline\u0026rsquo;s pursuit of predictive regression)2. At conferences, he found that most papers hardly differed from one another. The spread of OLS is already a little frightening. In the 2023 Yau High School Science Awards, many students were already doing DID, and some high school students were even using OLG models. So if we do not compete on mathematical statistics, do we compete on insight instead? Of course, many people have written brilliant papers with nothing more than OLS, but that is nowhere near enough now. Take Daron\u0026rsquo;s representative work, The Colonial Origins of Comparative Development: An Empirical Investigation, which helped define his 2024 Nobel recognition. It uses a relatively simple OLS+IV strategy to argue for the role of colonization. The idea is deep and highly suggestive, yet it is also heavily questioned today. At the same time, papers that combine simple methods with astonishing results usually require a gift for topic selection.3 By talent here I mean that there is too much contingency involved. We still do not have a systematic, repeatable path for it. That is why economics has produced so much mixed Chinese-English jargon around topic selection and positioning, what people casually call idea. Technical terms are fine, but then there is the broader academic slang: developing academic taste, maybe you can argue a bit here, emphasize the intuition, not novel enough, where is the contribution, the work is not clean enough, your question is getting a bit toxic, telling the story is what matters most\u0026hellip; My own view is that too much code-switching between Chinese and English (aside from standard abbreviations like GPT, EVA, and DID) does not make conversation clearer. Label-like words often make things less readable and less concrete. So there are basically three roads: Compete on insight: almost mystical. If someone finishes the whole evaluation with one word like taste, there is no room left for real discussion. Compete on mathematical methods: stay quiet for a long time, then amaze everyone, but it is easy to collapse halfway through. Compete on data: everyone hides their own data and loses the spirit of open sharing. Behind that lies endless blood and sweat in data collection and cleaning. But for now, this is the most practical road. I once saw a wonderful metaphor: Mathematical methods + intellectual insight: the path of internal cultivation, years of bitter practice, a high threshold, and no guarantee about the outcome. Fast-track data work + coding ability: the sword school, quicker to learn, lower threshold, and more dependent on luck. ","date":"2024-11-14","heading":"","objectID":"/en/posts/fs3/:0:2","tags":["Economic Methodology"],"title":"The conceit of economics: some recent thoughts","uri":"/en/posts/fs3/#mathematical-methods-or-intellectual-insight"},{"categories":["Economic Studies"],"collections":["Reflections on Learning Economics","Academic Rhetoric"],"content":"❓How much math?❓\rA few questions follow naturally. What mathematics does economics need? How should one study mathematics? What place does mathematics occupy in economics? I have asked many senior students and teachers these questions, and their answers have been surprisingly similar. How much should you study? Let me draw a very broad boundary first. I do not mean everyone must study all of it. I mean the union of the mathematical backgrounds possessed by the very best scholars in the world. It depends on your field, so it is best to decide on a direction as early as possible. The mainstream tracks are roughly micro, econometrics, and macro, and each requires a different depth of mathematics (leaving aside history of thought and classical Marxist political economy). No matter the direction, the basic undergraduate math trio needs a solid foundation. Going deeper can include measure theory, real analysis, partial differential equations, convex optimization, dynamical systems, discrete mathematics\u0026hellip; A more detailed ranking4: Micro theory = econometric theory \u0026gt; macro theory \u0026gt; trade \u0026gt; labor = development \u0026gt;= other applied fields, such as health and environment\u0026hellip; How should you study? Many people try to patch an entire mathematical system just to understand one small concept. That is not realistic.5 Given the growing pressure of PhD applications, publishing, and the academic job market, the most practical approach is: Learn by doing. Learn econometrics through code; learn models through papers. Patch as you go. Do not try to chew through the whole mathematical edifice systematically. Read, and fill gaps along the way. Understand through comparison. Whether in software, code, or mathematics, many things overlap. Learn to compare and connect them, draw inferences, and speed up the pace of learning. The advice from teachers and senior students is sincere, but I think it suffers from selection bias. All of those seniors had already gone through strong and demanding classroom training before they concluded that learning by doing and self-study were enough. In the language of causal inference, can their counterfactual really measure our own situation? What if a school does not offer that kind of training at all? My own feeling is that even when the quality is poor, a school\u0026rsquo;s systematic courses still serve as the first spark for self-study. Here is my own view: Do not ignore the history of the discipline or the table of contents of textbooks! From my own experience, systematic patching is still the best route. When knowledge points are too scattered, they never form a real system. Even if you fill gaps by learning through use, you still may not be able to connect them. It is like having weak mathematical foundations: even after studying the graduate core trio, you end up mechanically memorizing problems and solutions. You can finish the exercises, but you do not grasp the underlying ideas, let alone use them to analyze reality. That gets the order backwards. The trouble is that life is short, and filling everything in systematically is terribly inefficient. My current view is this: the history of the discipline is the spine of knowledge. We really need a solid understanding of the history of the field, both the history of theory and the history of methods, if we want any chance of connecting the scattered points we pick up while learning by doing. Only then do we know what we have learned, what we have not, and what we still need to tackle. Take econometrics. If we go to the library and look at well-classified textbooks, the first thing we should try to understand is not just the textbook itself, but its preface and table of contents. Why did the author organize the material in this order? Greene organizes econometrics by the strictness of model assumptions. Wooldridge organizes it by data structure. Angrist organizes it by the sequence in which counterfactual inference is introduced. Hayashi unifies econome","date":"2024-11-14","heading":"","objectID":"/en/posts/fs3/:0:3","tags":["Economic Methodology"],"title":"The conceit of economics: some recent thoughts","uri":"/en/posts/fs3/#how-much-math"},{"categories":["Economic Studies"],"collections":["Reflections on Learning Economics","Academic Rhetoric"],"content":"❓On innovation in papers❓\rFrom the Nobel Prizes of recent years, not only in economics but in the natural sciences too, it seems that there are basically no great masters left who found entirely new schools of thought.9 Everyone is making marginal contributions. It really is as my econometrics teacher said: when nobody is enlarging the circle, survival only gets harder.10 So what about the graduate core trio? In truth, it is only the entry ticket to research. Real theory still requires catching up with the field on top of that training. Why bring up the graduate core trio again? Because I once saw a heated discussion on Zhihu: Do you need to understand all the mathematical principles in advanced econometrics to do research? - Zhihu In strong field journals, difficult as it is, people can still publish by relying mainly on data and topic selection. In the top five journals, though, publishing without deep theory is impossible.11 Where does the marginal innovation of a paper mainly come from? My own answer is that marginal contribution can be roughly divided into: Econometric theory (reduced-form models) Mathematical models (structural models) Data organization and mining Expansion of the research object: my teacher has repeatedly stressed to me that papers that only address one case on its own terms are relatively low-level topics, because the paper merely clarifies a single case. I would place that under a lower-level form of expanding the research object. But expansions also have levels. Labor economics expanded from the individual to the family. Interdisciplinary work, such as complexity economics on disequilibrium, behavioral economics on non-rationality, and digital economics on non-material economic activity, can also be seen as expansions of the research object. And if you can discover a phenomenon at all, that is already impressive. People argue endlessly about it, but concepts like the digital economy have undoubtedly kept many people employed. Staying alive matters. Explaining phenomena (theory of regularities): First, discovering regularities. In a lecture, an editor from World Economy stressed the importance of explaining phenomena, and my teacher also emphasized that what matters in a paper is the distillation of regularities. See What makes a good paper? Criterion one: reasoning from a case vs. talking only about the case. Another way people put it is that everyone\u0026rsquo;s topics are equally bad, but good professors know how to package a topic and elevate the angle, which really means having the eye to spot the regularity behind the phenomenon. The more you can see the larger pattern in something small, the rarer the talent. Second, testing regularities. Use data to test two mutually contradictory theories. This helps highlight the real-world significance and interest of the paper. Social science and science\rA scientific question: is theoretical science invented, or discovered? At the level of theory, both natural science and social science seem to begin with the recognition of regularities. The key is what regularity we recognize from what phenomenon. I can derive different regularities from the same phenomenon, and I can also extract the same regularity from different phenomena. Identification strategy (the logic of regression design): this means designing clever regressions and comparison experiments that identify otherwise unobservable elements and offer more people new ideas for research design. Examples include linking patent data to innovation, nighttime-light data to development, and using distant historical factors as instrumental variables. I am especially fond of the paper God\u0026rsquo;s Audit: Home-Town Connections and Building Damage in the Sichuan Earthquake. Using earthquake data, it finds that when local officials had hometown ties to their superiors, the buildings they oversaw were 75% more likely to collapse than buildings without such ties.12 That suggests we can use natural disasters to measure co","date":"2024-11-14","heading":"","objectID":"/en/posts/fs3/:0:4","tags":["Economic Methodology"],"title":"The conceit of economics: some recent thoughts","uri":"/en/posts/fs3/#on-innovation-in-papers"},{"categories":["Economic Studies"],"collections":["Reflections on Learning Economics","Academic Rhetoric"],"content":"❓On project management❓\rThese days everyone talks about team play. Several of my teachers have advised students to socialize more and look for collaborators. But teams come in different sizes. What I want to say is that even your own small projects need project management. There is an industry riddle here: how did Frant Gwo go from My Old Classmate to The Wandering Earth? The mainstream answer is project management. China has had plenty of money, so why did it fail for so long to produce a true AAA game? The mainstream answer is market size and project management. Think about how to optimize your own code so that your data-cleaning scripts become more reusable. Once you know commands like program, local, global, and forvalues, there are actually plenty of fancy things you can do in Stata. When working with big data, the whole cycle of splitting, merging, and passing files around is full of project-management traps. If a team lacks mature management experience and process control, communication and information transfer can be terribly inefficient. If a team has already handled large-data projects, that experience is genuinely valuable. I suppose that is what industry standards look like. ","date":"2024-11-14","heading":"","objectID":"/en/posts/fs3/:0:5","tags":["Economic Methodology"],"title":"The conceit of economics: some recent thoughts","uri":"/en/posts/fs3/#on-project-management"},{"categories":["Economic Studies"],"collections":["Reflections on Learning Economics","Academic Rhetoric"],"content":"❓Personal reflections❓\rI look up to the high mountain and the open road. I may never reach them, but my heart is still drawn in that direction. In the current environment, the higher you look, the easier it is to fall into despair. Stratification is getting sharper, age limits harsher, and people our age abroad are growing faster and faster. The internet helps, but many ideas still cannot really be understood without face-to-face conversation. Experience outside knowledge also needs to be passed on seriously, or the gap will only widen. Finally, as a committed existentialist, Huaxiangshan has this to say: Stay alive. That matters more than anything else. I believe that anyone who is seriously drawn to academia today is already an expert at self-pressure and overwork. The internet only heightens that atmosphere. We all know how tense things feel, so in this environment we need to lighten our anxiety. Anyway, no one really has a chance to found a new school anymore 😆 (the Nobel Prizes already make that clear). Better to enjoy the process of learning, for example, the flash of joy when causal analysis suddenly changes the way you see the world. I had neck problems before, and only then did I realize how fragile the human body is\u0026hellip; I have also seen senior students and classmates with injured knees or bad backs. Please, really, treasure your health. My personal suggestion is to place the sense of achievement that comes from understanding the world above the sense of achievement that comes from producing value. That way you will not become too anxious when you do not get enough positive feedback from visible results. Huaxiangshan has this to say: You should know that most innovation today is driven by necessity rather than inner conviction. It is worth asking whether you have built your standard of happiness in the shadow of the rule-makers. If you are struggling for survival, the price can never be your own life itself. That would be self-contradictory. One regrettable truth is that the desire to innovate is not the same as the ability to innovate. I often want to force out one huge breakthrough all at once, but that is impossible. A good paper is very likely revised from a bad paper. If the most important thing is to uncover the regularity behind a phenomenon, then the quality of the first phenomenon you think of does not determine the quality of the final theory. Action and experimentation come first. Active communication13 comes second. Third comes optimism and the work of cultivating a broad, upright spirit. If those ever come into conflict, we have no reason not to follow the third🥰. Social science should preserve a moral vision that stays ahead of its time. Curiosity about the world is where all research begins. Do not stake 100% of life on a narrow sheet of paper. Curiosity about the world is the motive force of science. Beyond that, it is also a form of love and affirmation toward the world. Because we love it, we want to understand it. Because we understand it, we love it even more. Most people make their choice before they really understand the discipline.\u0026#160;\u0026#x21a9;\u0026#xfe0e; I still believe economics needs interpretability more than it needs the black box of machine learning. I also agree more with the view that economics tries to analyze phenomena rather than predict events. Prediction is only a by-product of analyzing phenomena.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Is not pulling off a clever stunt its own kind of talent? Think about viral Bilibili videos: everybody knows the meme, but some people can combine simple material in a way that makes you stop and look.\u0026#160;\u0026#x21a9;\u0026#xfe0e; This ranking comes from a Zhihu answer by Professor Shi Zhentao.\u0026#160;\u0026#x21a9;\u0026#xfe0e; I only mean that it is unrealistic in the domestic context.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Personally, I think prediction is too complicated a task for economics to shoulder on its own.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Here I mean socialist theory.\u0026#160;\u0026#x21a9;\u0026#xfe0e; In my own","date":"2024-11-14","heading":"","objectID":"/en/posts/fs3/:0:6","tags":["Economic Methodology"],"title":"The conceit of economics: some recent thoughts","uri":"/en/posts/fs3/#personal-reflections"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":" Econometrics: Event Studies 1 Econometrics: Event Studies 2 Econometrics: Event Studies 3 This post is a record of learning the code from An Introductory Guide to Event Study Models. The third part tackles the Stata code. This post introduces the plotting code for the coefplot, eventplot, eventdd, and cnreg commands in event studies. Some sharp commentary to start\r","date":"2024-10-24","heading":"","objectID":"/en/posts/event3/:0:0","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 3","uri":"/en/posts/event3/#"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"A quick review of the event study concept\rOperationally: a regression usually estimates an average treatment effect, while an event study slices that average effect over time. Statistically: each dummy time period gets a coefficient, and stringing them together shows the dynamic evolution of the average treatment effect. The average estimate: $$ y_{ij}=\\beta X_i\u0026#43;\\underbrace{\\alpha_{i}\u0026#43;\\delta_{i}}\\_{\\text{面板固定效应}}\u0026#43;\\underbrace{\\beta\\cdot X_{ij}}\\_{\\text{ 控制变量}}\u0026#43;\\epsilon_{ij}. $$ After time-slicing: $$ y_{ij}=\\underbrace{\\left(\\sum\\_{j\\in\\{-m,\\ldots,0,\\ldots,n\\}}\\gamma_{j}\\cdot D_{i,t-j}\\right)}\\_{\\text{事件时间虚拟变量}}\u0026#43;\\underbrace{\\alpha_{i}\u0026#43;\\delta_{i}}\\_{\\text{面板固定效应}}\u0026#43;\\underbrace{\\beta\\cdot X_{ij}}\\_{\\text{ 控制变量}}\u0026#43;\\epsilon_{ij}. $$ A parallel-trends test is just a special case of an event study. Say there are two counties, A and B. County A implemented rural revitalization and B didn\u0026rsquo;t, and then A got rich. We can\u0026rsquo;t casually say rural revitalization caused A to get rich — A might have been blessed to begin with: beautiful scenery, fertile soil, rich mineral resources\u0026hellip;\u0026hellip; A and B have always had a development gap. To verify that A and B\u0026rsquo;s data were nearly identical before rural revitalization, that way the DID event is exogenous to both counties. In short, the parallel-trends test argues that the treated and control groups had almost no difference before the event. Omitted variables before the event in villages can cause endogeneity\rBy the way — panel data generally defaults to two-way fixed effects, and the coefficient bias in parallel-trends tests with three or more periods has long been a hot research topic. The core sticking point is decomposing heterogeneity: some variables have time trends and some don\u0026rsquo;t; different pre-trend shapes call for different constraints. But in practice, nobody actually knows these population-level facts. ","date":"2024-10-24","heading":"A quick review of the event study concept","objectID":"/en/posts/event3/:1:0","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 3","uri":"/en/posts/event3/#a-quick-review-of-the-event-study-concept"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Event studies in top journals\rIn the top-5 papers I\u0026rsquo;ve read, there\u0026rsquo;s already a trend — anything that can be shown in a figure gets a figure. So event studies are being used more and more often. For example, see the post One-Time Government Investment and Long-Run Manufacturing Growth. Here I\u0026rsquo;ll give examples from papers I like that use event studies flexibly. JDE\u0026rsquo;s English language requirement and educational inequality: Evidence from 16 million college applicants in China uses event studies to argue that the English listening exam widened urban-rural educational inequality. It uses event studies to show the heterogeneity in how gaokao students stratify — from 985 universities down to first-tier admission rates, the effect keeps growing. JDE\u0026rsquo;s English language requirement and educational inequality: Evidence from 16 million college applicants in China\rQJE\u0026rsquo;s The Long-Run Impacts of Public Industrial Investment on Local Development and Economic Mobility: Evidence from World War II uses event studies to argue that during the Cold War, the US dispersing factories raised the future wages of local children. Through dynamic comparisons swapping in different variables, you can see that the number of local firms barely changed, but employment grew markedly — so the job growth came from scale effects rather than a rise in the number of firms. QJE\u0026rsquo;s The Long-Run Impacts of Public Industrial Investment on Local Development and Economic Mobility: Evidence from World War II\rLater it also uses a population-flow panel to argue that the wage gains came from better local job pay rather than human-capital gains or in-migration. ","date":"2024-10-24","heading":"Event studies in top journals","objectID":"/en/posts/event3/:2:0","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 3","uri":"/en/posts/event3/#event-studies-in-top-journals"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Stata code\rThe example data below is from China Industrial Economics\u0026rsquo; Does Innovation-Driven Policy Boost Urban Entrepreneurship Activity — Evidence from the National Innovative City Pilot Policy. Honestly I wanted to use data I collected myself as an example, but not a single coefficient was significant! 🤧 The data are all in the journal\u0026rsquo;s online appendix; just go in and download them. This paper should also be one of the earlier domestic papers to publicly release the full difference-in-differences code. City-level panel data is handy for learning any kind of code. ","date":"2024-10-24","heading":"Stata code","objectID":"/en/posts/event3/:3:0","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 3","uri":"/en/posts/event3/#stata-code"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Two ways to do the parallel-trends test\rThe coefplot command\rThe coefplot command can extract regression coefficients. We just need to generate time dummies, run the regression, and then store the coefficients via the command and plot them. Steps summarized: Define the panel data Set the event time — year minus the event time — then generate the dummies for each time slice in turn Regress Store the coefficients and plot clear all use \"F:\\桌面\\事件研究法发学习代码\\数据.dta\", clear xtset city year *generate the relative time variable di = current year - reform year gen di = year - branch_reform sum di //currently ranges from -14 to 10 periods, too long; the window can be shortened, merged, or trimmed *trim or merge the data on both ends replace di = -10 if di \u003c -10 replace di = 10 if di \u003e 10 *generate the lead dummies d_1 through d_10 forvalues i = 1/10{ gen d_`i'=(di==-`i') } *generate the lead dummies d1 through d10 forvalues i = 1/10{ gen d`i'=(di==`i') } *regress xtreg entre_activation d_2-d_10 d1-d9 di i.year lnagdp indust_stru finance ainternet market i.city#c.di , fe r xtreg entre_activation d_2-d_10 d1-d9 di i.year lnagdp indust_stru finance ainternet market i.city#c.di , fe r #delimit; //set a custom line-break symbol, i.e. ; is the line break. this makes the plotting command easier. ; coefplot, baselevels keep(dd_10 d_9 d_8 d_7 d_6 d_5 d_4 d_3 d_2 d1 d2 d3 d4 d5 d6 d7 d8 d9) order(d_10 d_9 d_8 d_7 d_6 d_5 d_4 d_3 d_2 d1 d2 d3 d4 d5 d6 d7 d8 d9 ) vertical // transpose the graph coeflabels( d_10=-10 d_9=-9 d_8=-8 d_7=-7 d_6=-6 d_5=-5 d_4=-4 d_3=-3 d_2=-2 d_1=-1 d1=1 d2=2 d3=3 d4=4 d5=5 d6=6 d7=7 d8=8 d9=9 d10=10 ) yline(0, lwidth(vthin) lpattern(dash) lcolor(teal)) xline(8.5, lwidth(vthin) lpattern(dash) lcolor(teal)) ylabel(, labsize(*0.85) angle(0)) xlabel(, labsize(*0.75)) ytitle(\"coefficients\") xtitle(\"Time\") msymbol(O) msize(small) mcolor(gs1) // marker style addplot(line @b @at ,lcolor(gs1) lwidth(medthick)) //connect the points ciopts(recast(rline) lwidth(thin) lpattern(dash) lcolor(gs2)) // confidence-interval style: rarea rline rcap graphregion(color(white)); // background color #delimit cr //restore the line-break symbol\rThe coefplot command\rThe Eventdd command\rThe Eventdd command can draw the plot in one step; just enter the corresponding parameters following the code below. Whatever variable follows Eventdd is the regression to run. clear all use \"F:\\桌面\\事件研究法发学习代码\\数据.dta\", clear set scheme white_tableau xtset city year #delimit; ; gen di = year - branch_reform; eventdd entre_activation i.year lnagdp indust_stru finance ainternet market, timevar(di) //define the time dummy ci(rcap) //error bars noline //do not plot the confidence-interval bar for period -1 method(fe) //to add an autocorrelation cluster -- method(fe,cluster(autocorrelation cluster)) baseline(0) //the base year is 0 level(95) graph_op(ytitle(\"coefficients\") xtitle(\"Time\") xlabel(-10(2)14)); // cancel the custom line break #delimit cr\rEventdd\r","date":"2024-10-24","heading":"Two ways to do the parallel-trends test","objectID":"/en/posts/event3/:3:1","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 3","uri":"/en/posts/event3/#two-ways-to-do-the-parallel-trends-test"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Two ways to do the parallel-trends test\rThe coefplot command\rThe coefplot command can extract regression coefficients. We just need to generate time dummies, run the regression, and then store the coefficients via the command and plot them. Steps summarized: Define the panel data Set the event time — year minus the event time — then generate the dummies for each time slice in turn Regress Store the coefficients and plot clear all use \"F:\\桌面\\事件研究法发学习代码\\数据.dta\", clear xtset city year *generate the relative time variable di = current year - reform year gen di = year - branch_reform sum di //currently ranges from -14 to 10 periods, too long; the window can be shortened, merged, or trimmed *trim or merge the data on both ends replace di = -10 if di \u003c -10 replace di = 10 if di \u003e 10 *generate the lead dummies d_1 through d_10 forvalues i = 1/10{ gen d_`i'=(di==-`i') } *generate the lead dummies d1 through d10 forvalues i = 1/10{ gen d`i'=(di==`i') } *regress xtreg entre_activation d_2-d_10 d1-d9 di i.year lnagdp indust_stru finance ainternet market i.city#c.di , fe r xtreg entre_activation d_2-d_10 d1-d9 di i.year lnagdp indust_stru finance ainternet market i.city#c.di , fe r #delimit; //set a custom line-break symbol, i.e. ; is the line break. this makes the plotting command easier. ; coefplot, baselevels keep(dd_10 d_9 d_8 d_7 d_6 d_5 d_4 d_3 d_2 d1 d2 d3 d4 d5 d6 d7 d8 d9) order(d_10 d_9 d_8 d_7 d_6 d_5 d_4 d_3 d_2 d1 d2 d3 d4 d5 d6 d7 d8 d9 ) vertical // transpose the graph coeflabels( d_10=-10 d_9=-9 d_8=-8 d_7=-7 d_6=-6 d_5=-5 d_4=-4 d_3=-3 d_2=-2 d_1=-1 d1=1 d2=2 d3=3 d4=4 d5=5 d6=6 d7=7 d8=8 d9=9 d10=10 ) yline(0, lwidth(vthin) lpattern(dash) lcolor(teal)) xline(8.5, lwidth(vthin) lpattern(dash) lcolor(teal)) ylabel(, labsize(*0.85) angle(0)) xlabel(, labsize(*0.75)) ytitle(\"coefficients\") xtitle(\"Time\") msymbol(O) msize(small) mcolor(gs1) // marker style addplot(line @b @at ,lcolor(gs1) lwidth(medthick)) //connect the points ciopts(recast(rline) lwidth(thin) lpattern(dash) lcolor(gs2)) // confidence-interval style: rarea rline rcap graphregion(color(white)); // background color #delimit cr //restore the line-break symbol\rThe coefplot command\rThe Eventdd command\rThe Eventdd command can draw the plot in one step; just enter the corresponding parameters following the code below. Whatever variable follows Eventdd is the regression to run. clear all use \"F:\\桌面\\事件研究法发学习代码\\数据.dta\", clear set scheme white_tableau xtset city year #delimit; ; gen di = year - branch_reform; eventdd entre_activation i.year lnagdp indust_stru finance ainternet market, timevar(di) //define the time dummy ci(rcap) //error bars noline //do not plot the confidence-interval bar for period -1 method(fe) //to add an autocorrelation cluster -- method(fe,cluster(autocorrelation cluster)) baseline(0) //the base year is 0 level(95) graph_op(ytitle(\"coefficients\") xtitle(\"Time\") xlabel(-10(2)14)); // cancel the custom line break #delimit cr\rEventdd\r","date":"2024-10-24","heading":"The coefplot command","objectID":"/en/posts/event3/:3:1","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 3","uri":"/en/posts/event3/#the-coefplot-command"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Two ways to do the parallel-trends test\rThe coefplot command\rThe coefplot command can extract regression coefficients. We just need to generate time dummies, run the regression, and then store the coefficients via the command and plot them. Steps summarized: Define the panel data Set the event time — year minus the event time — then generate the dummies for each time slice in turn Regress Store the coefficients and plot clear all use \"F:\\桌面\\事件研究法发学习代码\\数据.dta\", clear xtset city year *generate the relative time variable di = current year - reform year gen di = year - branch_reform sum di //currently ranges from -14 to 10 periods, too long; the window can be shortened, merged, or trimmed *trim or merge the data on both ends replace di = -10 if di \u003c -10 replace di = 10 if di \u003e 10 *generate the lead dummies d_1 through d_10 forvalues i = 1/10{ gen d_`i'=(di==-`i') } *generate the lead dummies d1 through d10 forvalues i = 1/10{ gen d`i'=(di==`i') } *regress xtreg entre_activation d_2-d_10 d1-d9 di i.year lnagdp indust_stru finance ainternet market i.city#c.di , fe r xtreg entre_activation d_2-d_10 d1-d9 di i.year lnagdp indust_stru finance ainternet market i.city#c.di , fe r #delimit; //set a custom line-break symbol, i.e. ; is the line break. this makes the plotting command easier. ; coefplot, baselevels keep(dd_10 d_9 d_8 d_7 d_6 d_5 d_4 d_3 d_2 d1 d2 d3 d4 d5 d6 d7 d8 d9) order(d_10 d_9 d_8 d_7 d_6 d_5 d_4 d_3 d_2 d1 d2 d3 d4 d5 d6 d7 d8 d9 ) vertical // transpose the graph coeflabels( d_10=-10 d_9=-9 d_8=-8 d_7=-7 d_6=-6 d_5=-5 d_4=-4 d_3=-3 d_2=-2 d_1=-1 d1=1 d2=2 d3=3 d4=4 d5=5 d6=6 d7=7 d8=8 d9=9 d10=10 ) yline(0, lwidth(vthin) lpattern(dash) lcolor(teal)) xline(8.5, lwidth(vthin) lpattern(dash) lcolor(teal)) ylabel(, labsize(*0.85) angle(0)) xlabel(, labsize(*0.75)) ytitle(\"coefficients\") xtitle(\"Time\") msymbol(O) msize(small) mcolor(gs1) // marker style addplot(line @b @at ,lcolor(gs1) lwidth(medthick)) //connect the points ciopts(recast(rline) lwidth(thin) lpattern(dash) lcolor(gs2)) // confidence-interval style: rarea rline rcap graphregion(color(white)); // background color #delimit cr //restore the line-break symbol\rThe coefplot command\rThe Eventdd command\rThe Eventdd command can draw the plot in one step; just enter the corresponding parameters following the code below. Whatever variable follows Eventdd is the regression to run. clear all use \"F:\\桌面\\事件研究法发学习代码\\数据.dta\", clear set scheme white_tableau xtset city year #delimit; ; gen di = year - branch_reform; eventdd entre_activation i.year lnagdp indust_stru finance ainternet market, timevar(di) //define the time dummy ci(rcap) //error bars noline //do not plot the confidence-interval bar for period -1 method(fe) //to add an autocorrelation cluster -- method(fe,cluster(autocorrelation cluster)) baseline(0) //the base year is 0 level(95) graph_op(ytitle(\"coefficients\") xtitle(\"Time\") xlabel(-10(2)14)); // cancel the custom line break #delimit cr\rEventdd\r","date":"2024-10-24","heading":"The Eventdd command","objectID":"/en/posts/event3/:3:1","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 3","uri":"/en/posts/event3/#the-eventdd-command"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Regression tips for parallel trends\rThe specification I chose is: xtreg entre_activation d_2-d_10 d1-d9 di i.year lnagdp indust_stru finance ainternet market i.city#c.di , fe r\rHere i.city#c.di additionally controls for each unit\u0026rsquo;s time trend (the time effect decomposes the intercept, while this decomposes the slope). The d_1 period is dropped: on one hand to serve as the baseline, on the other to avoid collinearity. Some papers subtract the coefficient mean to make the plot prettier, but it\u0026rsquo;s not necessary. The parallel-trends test has plenty of bias controversy, but nobody really scrutinizes these points; doing them is just better. ","date":"2024-10-24","heading":"Regression tips for parallel trends","objectID":"/en/posts/event3/:3:2","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 3","uri":"/en/posts/event3/#regression-tips-for-parallel-trends"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Constrained regression\rFollowing the code in An Introductory Guide to Event Study Models, we can add constraints to the regression. Just use the cnsreg command. I already explained it in Econometrics: Event Studies 2. In the coefplot command, just swap the regression for the constrained one. The constaint command sets the constraints; adding c (1-5) in the regression adds all five constraints. Got it? 😉 constraint 1 d_1=d_2 //corresponding coefficients are equal constraint 2 d_2-d_1=d_4-d_3 //corresponding slopes are equal constraint 3 d_1=d_2*0.5 constraint 4 d_1=d_2+d_2 cnsreg entre_activation d_2-d_10 d1-d9 di i.year lnagdp indust_stru finance ainternet market i.city#c.di , c(2) r\r","date":"2024-10-24","heading":"Constrained regression","objectID":"/en/posts/event3/:3:3","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 3","uri":"/en/posts/event3/#constrained-regression"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Showing multiple regression coefficients on one plot\rThe twoway command can also do it, but it\u0026rsquo;s too much trouble, so I won\u0026rsquo;t cover it here. The Coefplot command\rStill use the coefplot command; other parameters can still be added — but you can\u0026rsquo;t set line parameters (addplot). // run the first regression model xtreg entre_activation d_2-d_10 d1-d9 di i.year lnagdp indust_stru finance ainternet market i.city#c.di, fe r estimates store model1 // save the first model // run the second regression model (which can be a different variable or specification) xtreg produserv d_2-d_10 d1-d9 di i.year lnagdp indust_stru finance ainternet market i.city#c.di, fe r estimates store model2 // save the second model // draw the parallel-trends plot set scheme white_tableau #delimit; ; coefplot model1 model2, // coefplot model1 || model2 baselevels keep(d_10 d_9 d_8 d_7 d_6 d_5 d_4 d_3 d_2 d1 d2 d3 d4 d5 d6 d7 d8 d9) order(d_10 d_9 d_8 d_7 d_6 d_5 d_4 d_3 d_2 d1 d2 d3 d4 d5 d6 d7 d8 d9) vertical coeflabels( d_10=-10 d_9=-9 d_8=-8 d_7=-7 d_6=-6 d_5=-5 d_4=-4 d_3=-3 d_2=-2 d_1=-1 d1=1 d2=2 d3=3 d4=4 d5=5 d6=6 d7=7 d8=8 d9=9 d10=10 ); yline(0, lwidth(vthin) lpattern(dash) lcolor(teal)) xline(8.5, lwidth(vthin) lpattern(dash) lcolor(teal)) ylabel(, labsize(*0.85) angle(0)) xlabel(, labsize(*0.75)) ytitle(\"coefficients\") xtitle(\"Time\") msymbol(O) msize(small) mcolor(gs1) ciopts(recast(rcap) lwidth(thin) lpattern(dash) lcolor(gs2)) //rarea rline rcap legend(order(1 \"entre_activation\" 2 \"produserv\") region(lstyle(none)) position(6)) graphregion(color(white)); Multiple plots\rIf you don\u0026rsquo;t want to show them on one plot, just add a separator like the other commands. coefplot model1 || model2,\rNot on the same plot\rThe Event plot command\rI\u0026rsquo;d guess most publications with connected-line plots, if they aren\u0026rsquo;t using R, drew them with the event plot command. The nice thing about this command is that you can set different reform years for comparison, and it supports connected scatter plots. It also seems to have many good subcommands aimed at difference-in-differences. I\u0026rsquo;d bet the QJE paper mentioned above drew its figure with this command. clear all use \"F:\\桌面\\事件研究法发学习代码\\数据.dta\", clear set scheme white_tableau xtset city year //generate the relative time: current year - reform year gen di = year - branch_reform sum di //currently ranges from -11 to 12 periods, too long; the window can be shortened, merged, or trimmed *trim or merge the data on both ends replace di = -10 if di \u003c -10 replace di = 10 if di \u003e 10 *generate the lead dummies d_1 through d_10 forvalues i = 1/10{ gen pre_`i'=(di==-`i') } *generate the lead dummies d1 through d10 forvalues i = 1/10{ gen post`i'=(di==`i') } gen testi=di+1 *generate the lead dummies d_1 through d_10 forvalues i = 1/10{ gen fpre_`i'=(testi==-`i') } *generate the lead dummies d1 through d10 forvalues i = 1/10{ gen fpost`i'=(testi==`i') } // run the first regression model xtreg entre_activation pre_2-pre_10 post1-post9 di i.year lnagdp indust_stru finance ainternet market i.city#c.di, fe r estimates store model1 // save the first model // run the second regression model (which can be a different variable or specification) xtreg produserv pre_2-pre_10 post1-post9 di i.year lnagdp indust_stru finance ainternet market i.city#c.di, fe r estimates store model2 // save the second model // run the second regression model (which can be a different variable or specification) xtreg produserv fpre_2-fpre_10 fpost1-fpost9 di i.year i.city#c.di, fe r estimates store model3 // save the second model #delimit; ; event_plot model1 model2 model3, stub_lag(post# post# fpost#) stub_lead(pre_# pre_# fpre_#) plottype(connected ) ciplottype(rcap) together noautolegend graph_opt(xtitle(\"Period\", size(middle))ytitle(\"Average Treatment Effect\", size(middle)) xlabel(-7(1)7,)legend(order( 1 \"entre_activation\" 2 \"produserv\" 3 \"produserv_test\" ) rows(1) position(6) region(style(noe))) xline(-1,lcolor(gs8) lpattern(da","date":"2024-10-24","heading":"Showing multiple regression coefficients on one plot","objectID":"/en/posts/event3/:3:4","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 3","uri":"/en/posts/event3/#showing-multiple-regression-coefficients-on-one-plot"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Showing multiple regression coefficients on one plot\rThe twoway command can also do it, but it\u0026rsquo;s too much trouble, so I won\u0026rsquo;t cover it here. The Coefplot command\rStill use the coefplot command; other parameters can still be added — but you can\u0026rsquo;t set line parameters (addplot). // run the first regression model xtreg entre_activation d_2-d_10 d1-d9 di i.year lnagdp indust_stru finance ainternet market i.city#c.di, fe r estimates store model1 // save the first model // run the second regression model (which can be a different variable or specification) xtreg produserv d_2-d_10 d1-d9 di i.year lnagdp indust_stru finance ainternet market i.city#c.di, fe r estimates store model2 // save the second model // draw the parallel-trends plot set scheme white_tableau #delimit; ; coefplot model1 model2, // coefplot model1 || model2 baselevels keep(d_10 d_9 d_8 d_7 d_6 d_5 d_4 d_3 d_2 d1 d2 d3 d4 d5 d6 d7 d8 d9) order(d_10 d_9 d_8 d_7 d_6 d_5 d_4 d_3 d_2 d1 d2 d3 d4 d5 d6 d7 d8 d9) vertical coeflabels( d_10=-10 d_9=-9 d_8=-8 d_7=-7 d_6=-6 d_5=-5 d_4=-4 d_3=-3 d_2=-2 d_1=-1 d1=1 d2=2 d3=3 d4=4 d5=5 d6=6 d7=7 d8=8 d9=9 d10=10 ); yline(0, lwidth(vthin) lpattern(dash) lcolor(teal)) xline(8.5, lwidth(vthin) lpattern(dash) lcolor(teal)) ylabel(, labsize(*0.85) angle(0)) xlabel(, labsize(*0.75)) ytitle(\"coefficients\") xtitle(\"Time\") msymbol(O) msize(small) mcolor(gs1) ciopts(recast(rcap) lwidth(thin) lpattern(dash) lcolor(gs2)) //rarea rline rcap legend(order(1 \"entre_activation\" 2 \"produserv\") region(lstyle(none)) position(6)) graphregion(color(white)); Multiple plots\rIf you don\u0026rsquo;t want to show them on one plot, just add a separator like the other commands. coefplot model1 || model2,\rNot on the same plot\rThe Event plot command\rI\u0026rsquo;d guess most publications with connected-line plots, if they aren\u0026rsquo;t using R, drew them with the event plot command. The nice thing about this command is that you can set different reform years for comparison, and it supports connected scatter plots. It also seems to have many good subcommands aimed at difference-in-differences. I\u0026rsquo;d bet the QJE paper mentioned above drew its figure with this command. clear all use \"F:\\桌面\\事件研究法发学习代码\\数据.dta\", clear set scheme white_tableau xtset city year //generate the relative time: current year - reform year gen di = year - branch_reform sum di //currently ranges from -11 to 12 periods, too long; the window can be shortened, merged, or trimmed *trim or merge the data on both ends replace di = -10 if di \u003c -10 replace di = 10 if di \u003e 10 *generate the lead dummies d_1 through d_10 forvalues i = 1/10{ gen pre_`i'=(di==-`i') } *generate the lead dummies d1 through d10 forvalues i = 1/10{ gen post`i'=(di==`i') } gen testi=di+1 *generate the lead dummies d_1 through d_10 forvalues i = 1/10{ gen fpre_`i'=(testi==-`i') } *generate the lead dummies d1 through d10 forvalues i = 1/10{ gen fpost`i'=(testi==`i') } // run the first regression model xtreg entre_activation pre_2-pre_10 post1-post9 di i.year lnagdp indust_stru finance ainternet market i.city#c.di, fe r estimates store model1 // save the first model // run the second regression model (which can be a different variable or specification) xtreg produserv pre_2-pre_10 post1-post9 di i.year lnagdp indust_stru finance ainternet market i.city#c.di, fe r estimates store model2 // save the second model // run the second regression model (which can be a different variable or specification) xtreg produserv fpre_2-fpre_10 fpost1-fpost9 di i.year i.city#c.di, fe r estimates store model3 // save the second model #delimit; ; event_plot model1 model2 model3, stub_lag(post# post# fpost#) stub_lead(pre_# pre_# fpre_#) plottype(connected ) ciplottype(rcap) together noautolegend graph_opt(xtitle(\"Period\", size(middle))ytitle(\"Average Treatment Effect\", size(middle)) xlabel(-7(1)7,)legend(order( 1 \"entre_activation\" 2 \"produserv\" 3 \"produserv_test\" ) rows(1) position(6) region(style(noe))) xline(-1,lcolor(gs8) lpattern(da","date":"2024-10-24","heading":"The Coefplot command","objectID":"/en/posts/event3/:3:4","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 3","uri":"/en/posts/event3/#the-coefplot-command-1"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Showing multiple regression coefficients on one plot\rThe twoway command can also do it, but it\u0026rsquo;s too much trouble, so I won\u0026rsquo;t cover it here. The Coefplot command\rStill use the coefplot command; other parameters can still be added — but you can\u0026rsquo;t set line parameters (addplot). // run the first regression model xtreg entre_activation d_2-d_10 d1-d9 di i.year lnagdp indust_stru finance ainternet market i.city#c.di, fe r estimates store model1 // save the first model // run the second regression model (which can be a different variable or specification) xtreg produserv d_2-d_10 d1-d9 di i.year lnagdp indust_stru finance ainternet market i.city#c.di, fe r estimates store model2 // save the second model // draw the parallel-trends plot set scheme white_tableau #delimit; ; coefplot model1 model2, // coefplot model1 || model2 baselevels keep(d_10 d_9 d_8 d_7 d_6 d_5 d_4 d_3 d_2 d1 d2 d3 d4 d5 d6 d7 d8 d9) order(d_10 d_9 d_8 d_7 d_6 d_5 d_4 d_3 d_2 d1 d2 d3 d4 d5 d6 d7 d8 d9) vertical coeflabels( d_10=-10 d_9=-9 d_8=-8 d_7=-7 d_6=-6 d_5=-5 d_4=-4 d_3=-3 d_2=-2 d_1=-1 d1=1 d2=2 d3=3 d4=4 d5=5 d6=6 d7=7 d8=8 d9=9 d10=10 ); yline(0, lwidth(vthin) lpattern(dash) lcolor(teal)) xline(8.5, lwidth(vthin) lpattern(dash) lcolor(teal)) ylabel(, labsize(*0.85) angle(0)) xlabel(, labsize(*0.75)) ytitle(\"coefficients\") xtitle(\"Time\") msymbol(O) msize(small) mcolor(gs1) ciopts(recast(rcap) lwidth(thin) lpattern(dash) lcolor(gs2)) //rarea rline rcap legend(order(1 \"entre_activation\" 2 \"produserv\") region(lstyle(none)) position(6)) graphregion(color(white)); Multiple plots\rIf you don\u0026rsquo;t want to show them on one plot, just add a separator like the other commands. coefplot model1 || model2,\rNot on the same plot\rThe Event plot command\rI\u0026rsquo;d guess most publications with connected-line plots, if they aren\u0026rsquo;t using R, drew them with the event plot command. The nice thing about this command is that you can set different reform years for comparison, and it supports connected scatter plots. It also seems to have many good subcommands aimed at difference-in-differences. I\u0026rsquo;d bet the QJE paper mentioned above drew its figure with this command. clear all use \"F:\\桌面\\事件研究法发学习代码\\数据.dta\", clear set scheme white_tableau xtset city year //generate the relative time: current year - reform year gen di = year - branch_reform sum di //currently ranges from -11 to 12 periods, too long; the window can be shortened, merged, or trimmed *trim or merge the data on both ends replace di = -10 if di \u003c -10 replace di = 10 if di \u003e 10 *generate the lead dummies d_1 through d_10 forvalues i = 1/10{ gen pre_`i'=(di==-`i') } *generate the lead dummies d1 through d10 forvalues i = 1/10{ gen post`i'=(di==`i') } gen testi=di+1 *generate the lead dummies d_1 through d_10 forvalues i = 1/10{ gen fpre_`i'=(testi==-`i') } *generate the lead dummies d1 through d10 forvalues i = 1/10{ gen fpost`i'=(testi==`i') } // run the first regression model xtreg entre_activation pre_2-pre_10 post1-post9 di i.year lnagdp indust_stru finance ainternet market i.city#c.di, fe r estimates store model1 // save the first model // run the second regression model (which can be a different variable or specification) xtreg produserv pre_2-pre_10 post1-post9 di i.year lnagdp indust_stru finance ainternet market i.city#c.di, fe r estimates store model2 // save the second model // run the second regression model (which can be a different variable or specification) xtreg produserv fpre_2-fpre_10 fpost1-fpost9 di i.year i.city#c.di, fe r estimates store model3 // save the second model #delimit; ; event_plot model1 model2 model3, stub_lag(post# post# fpost#) stub_lead(pre_# pre_# fpre_#) plottype(connected ) ciplottype(rcap) together noautolegend graph_opt(xtitle(\"Period\", size(middle))ytitle(\"Average Treatment Effect\", size(middle)) xlabel(-7(1)7,)legend(order( 1 \"entre_activation\" 2 \"produserv\" 3 \"produserv_test\" ) rows(1) position(6) region(style(noe))) xline(-1,lcolor(gs8) lpattern(da","date":"2024-10-24","heading":"The Event plot command","objectID":"/en/posts/event3/:3:4","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 3","uri":"/en/posts/event3/#the-event-plot-command"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Summary\rEconometrics is like this figure: it looks complicated, but the core idea can always be stated in one sentence. In terms of operation — an event study is just coefficient visualization, but putting the pieces together can vividly show a lot more — heterogeneity, structural comparison, parallel trends, between-group differences, long-run effects\u0026hellip;\u0026hellip; What matters even more is the design thinking behind the group regression and the analysis of economic meaning. ","date":"2024-10-24","heading":"Summary","objectID":"/en/posts/event3/:4:0","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 3","uri":"/en/posts/event3/#summary"},{"categories":["Reading"],"collections":["Academic Rhetoric"],"content":" McCloskey\u0026rsquo;s trilogy on the rhetoric of economics — \u0026ldquo;If You\u0026rsquo;re So Smart,\u0026rdquo; \u0026ldquo;The Rhetoric of Economics,\u0026rdquo; and \u0026ldquo;The Vices of Economists\u0026rdquo; — treats economics as a subject for literary criticism throughout. I really would not recommend the first volume. Its fragmentary, notebook-like criticism quickly becomes tiresome, and the ornate language cannot hide how weak the overall structure is. The second book is much better. This post is a summary of that second volume. Rhetoric, put simply, is persuasion with a purpose. In ancient Greece, rhetoric was framed around argument, structure, and style. In contemporary economics, that repertoire becomes richer: facts, stories, logic, and metaphor. Unlike abstract natural language built only to describe, a social science essay is really \u0026ldquo;writing with intent,\u0026rdquo; and that gives economics a distinctly human, rhetorical character. In this post, \u0026ldquo;the author\u0026rdquo; always refers to the author of The Rhetoric of Economics, Deirdre N. McCloskey. A table for the structure of rhetorical analysis: Four rhetorical angles: fact, story, logic, metaphor. Impersonal\rAxis\rFact\rStory\rParticular\rParticularity\rLogic\rMetaphor\rUniversal\rAxes\rImpersonal\rPersonal\r","date":"2024-10-16","heading":"","objectID":"/en/posts/jjxxc/:0:0","tags":["Paper Writing"],"title":"The Rhetoric of Economics","uri":"/en/posts/jjxxc/#"},{"categories":["Reading"],"collections":["Academic Rhetoric"],"content":"What is rhetoric, and how do you do it?\r","date":"2024-10-16","heading":"What is rhetoric, and how do you do it?","objectID":"/en/posts/jjxxc/:1:0","tags":["Paper Writing"],"title":"The Rhetoric of Economics","uri":"/en/posts/jjxxc/#what-is-rhetoric-and-how-do-you-do-it"},{"categories":["Reading"],"collections":["Academic Rhetoric"],"content":"The anonymous voice of authority.\rEconomics is not the voice of God. It is people using language to persuade other people to believe a certain claim. Yet although it is human language, it still has to pretend that it speaks for the laws of history, anonymously casting itself as science itself. No need to applaud me, audience. Today, history is the one speaking. That is why economics so often describes factory production and profit formulas in an eternal present tense, even though these forms of organization really ought to be analyzed within a historical setting. ","date":"2024-10-16","heading":"The anonymous voice of authority.","objectID":"/en/posts/jjxxc/:1:1","tags":["Paper Writing"],"title":"The Rhetoric of Economics","uri":"/en/posts/jjxxc/#the-anonymous-voice-of-authority"},{"categories":["Reading"],"collections":["Academic Rhetoric"],"content":"Techniques of creation.\rFirst, the poet and metaphor. Extend game theory to nations, and the market becomes an arena of competition. Economists then address their own country as if saying, \u0026ldquo;We are going to lose the game because we have problem X.\u0026rdquo; Metaphor makes the model feel more necessary, and more persuasive. Networks become webs, families become small firms, children become durable goods\u0026hellip; Second, the novelist. Economics needs to learn how to build stories. X was poor at first, but then embraced capitalism, and so X became rich. Building a story means arranging related events through descriptions of states, actions, and internal connections: causation, temporal sequence, and both positive and negative turns. Each ending of a story marks a new state. In economics, a perfect or imperfect ending becomes equilibrium or disequilibrium. A good story needs a curtain call, not just a summary of the past, but a forecast of the ending state. The line can always be extended further. A text without action or state is not a story. Economists place so much emphasis on beginning with exogenous variables because, within a story system, that works as a beginning. If you start with endogenous variables, the story feels as if it begins halfway through. That also reflects a more speculative concern. If you pin all of history\u0026rsquo;s bad debts on the most obvious character, the ending is not very illuminating. ","date":"2024-10-16","heading":"Techniques of creation.","objectID":"/en/posts/jjxxc/:1:2","tags":["Paper Writing"],"title":"The Rhetoric of Economics","uri":"/en/posts/jjxxc/#techniques-of-creation"},{"categories":["Reading"],"collections":["Academic Rhetoric"],"content":"Performance.\rA novel does not imitate reality. A novel creates reality. The economics papers that leave the deepest mark are often the ones written in difficult, knotted sentences. Keynes\u0026rsquo;s The General Theory of Employment, Interest and Money is an example. When writing a paper, try to create both the \u0026ldquo;authorial audience\u0026rdquo; (which knows the story is fictional) and the \u0026ldquo;narrative audience\u0026rdquo; (which does not know it is fictional)1. Economists themselves need to realize that they are not always stating facts. Sometimes they are creating an audience. Every article contains an implied author, an implied reader, a piece of history, and a form. ","date":"2024-10-16","heading":"Performance.","objectID":"/en/posts/jjxxc/:1:3","tags":["Paper Writing"],"title":"The Rhetoric of Economics","uri":"/en/posts/jjxxc/#performance"},{"categories":["Reading"],"collections":["Academic Rhetoric"],"content":"The literary side of economics: science, literature, art\rThe author\u0026rsquo;s goal in writing this book is to probe the boundaries between economics, science, and text. In her view, science is only one way of speaking, not a separate domain of truth. Science needs text in order to be expressed. Scientific resources for experimentation are limited, so people often judge the value of testing a theory by the beauty of the theory itself. Text persuades in ways that are not so different from literature and public speaking. So science, literature, and art overlap rather than standing in simple opposition, as they often do in more traditional ways of talking. I still have reservations about that myself. Economics relies on the following methods of argument: The first three come from British scientific argument. From a literary angle, the author expands that list much further. Statistical tests, analysis of specific markets, experiments on theory, introspection (if X happened, what would I do?), thought experiments (based on experience, what would someone else do in situation X?), case studies, folk wisdom (merchants), the traditional knowledge of the academy, the symmetry of laws (for example, defining both a glorious age and a garbage age), pure definition, analogy\u0026hellip; For example, an economics paper cannot simply describe the motion of objects. It has to portray human behavior, and that has something in common with literature. Even when the author is portraying a type of person rather than a particular person, what the reader imagines while reading is still a concrete human being, not an abstract movement of objects. That kind of characterization overlaps with literature. Naming is part of rhetoric, and it is also part of shaping an image. The word \u0026ldquo;preference,\u0026rdquo; for example, carries a strong literary sense of desire. Most economic terms have a similar shade to them, Hayek\u0026rsquo;s endogenous order, Adam Smith\u0026rsquo;s animal spirits\u0026hellip; ","date":"2024-10-16","heading":"The literary side of economics: science, literature, art","objectID":"/en/posts/jjxxc/:2:0","tags":["Paper Writing"],"title":"The Rhetoric of Economics","uri":"/en/posts/jjxxc/#the-literary-side-of-economics-science-literature-art"},{"categories":["Reading"],"collections":["Academic Rhetoric"],"content":"Rhetorical devices in economics\rTake Samuelson\u0026rsquo;s use of mathematics as an example. When he uses statistics and mathematical models, he says we; when he discusses economic propositions, he says I. Because Samuelson says in the preface that \u0026ldquo;economic propositions are open to discussion and open to refutation,\u0026rdquo; \u0026ldquo;I\u0026rdquo; better shows a posture of discussion, while \u0026ldquo;we\u0026rdquo; conveys authority (as if what is being said here is already consensus). If we actually ran an experiment, we would find that most people do not care about mathematical proofs or statistical detail, but the mere presence of mathematics strengthens persuasion. John Stuart Mill\u0026rsquo;s paper on expectations stresses the position of the economics professor: criticizing people\u0026rsquo;s sluggish response to market expectations from the standpoint of an economic researcher. The author\u0026rsquo;s criticism of economics as prediction is interesting. Economic predictions are always conditional predictions, and conditional predictions are always consistent with experience in what they mean. So how could they ever produce something genuinely beyond expectation? I\u0026rsquo;ve heard similar views from others too. Econometrics identifies causality through exogeneity, so how could we expect econometrics to predict exogenous events? Fogel uses a strategy of sacrificing the small to attack the large, because he is rebutting the mainstream conclusion that \u0026ldquo;railroad construction promoted American economic growth.\u0026rdquo; For x, y, and the coefficient, maybe y is small; maybe x is large; maybe we overestimated the coefficient, and that is what produced the conclusion we have today. His paper uses those hints of uncertainty to cast doubt on the theory. Fogel\rFogel was the first to compare rail transport with river transport when estimating the railroad\u0026rsquo;s contribution. He used quantitative historical calculation and counterfactual reasoning, which later helped inspire counterfactual causal inference. His point was that earlier views had overstated the railroad\u0026rsquo;s contribution. After his report, economics also began using quantitative history to reshape the paradigm of economic history. Dave Donaldson was inspired by this work and measured market access through railway expansion. He then built a general equilibrium framework around railways and market accessibility, making comparative advantage empirically measurable, and won the 2017 Clark Medal. Fogel\rCoase2\u0026rsquo;s paper speaks in the voice of a lawyer, laying out theoretical possibilities and then rebutting them one by one. It reads like the structure of ancient Greek oratory: introduction, narration (facts), classified exposition (disputed claims and undisputed claims), proof, refutation, conclusion. That is why the classic paper \u0026ldquo;The Nature of the Firm\u0026rdquo; is full of adversarial phrasing. Other rhetorical techniques include appeals to authority, verbal suggestion (using language to imply a competitive relationship), metaphor3 (zero-sum games, children as durable goods), and parable (metaphor + story)\u0026hellip; Literary interpretation can really stretch very far\u0026hellip; ","date":"2024-10-16","heading":"Rhetorical devices in economics","objectID":"/en/posts/jjxxc/:3:0","tags":["Paper Writing"],"title":"The Rhetoric of Economics","uri":"/en/posts/jjxxc/#rhetorical-devices-in-economics"},{"categories":["Reading"],"collections":["Academic Rhetoric"],"content":"Does quantification need rhetoric?\rTwo questions: how big is big? And so what? ","date":"2024-10-16","heading":"Does quantification need rhetoric?","objectID":"/en/posts/jjxxc/:4:0","tags":["Paper Writing"],"title":"The Rhetoric of Economics","uri":"/en/posts/jjxxc/#does-quantification-need-rhetoric"},{"categories":["Reading"],"collections":["Academic Rhetoric"],"content":"On \u0026ldquo;how big is big\u0026rdquo;\rSome people believe that once economics turns a problem into mathematics, purely mathematical thinking can separate it from the range of ordinary human judgment. But is that really true? How big is big? How big counts as big, and how small counts as small, is still a process of trying to persuade other people. You still need people to compare and judge before reaching a conclusion. So the process still contains rhetoric. Of course, if you have studied advanced econometrics4, you realize that the logic of hypothesis testing is to construct low-probability events, \u0026ldquo;Type I error\u0026rdquo; and \u0026ldquo;Type II error,\u0026rdquo; in order to test significance. That approach is widely treated as basic practice, but it is still only a relative standard. I agree with Professor Zhentao Shi\u0026rsquo;s view of econometrics teaching: \u0026ldquo;How large is large enough to be credible\u0026rdquo; is not only a statistical question, but also a philosophical one. Advanced econometrics mainly forces people to start thinking about this. Professor Zhentao Shi\u0026rsquo;s Zhihu answer\rFor example, Bayesians and frequentists have argued over this for years, and Bayesians themselves split into subjective and objective camps. It all looks like mathematical deduction, but the construction of the basic unit of credibility never escapes a worldview. The old saying that everything can turn into philosophy really is true. For example, the classic point is that statistical significance and economic significance should be distinguished. ","date":"2024-10-16","heading":"On \u0026ldquo;how big is big\u0026rdquo;","objectID":"/en/posts/jjxxc/:4:1","tags":["Paper Writing"],"title":"The Rhetoric of Economics","uri":"/en/posts/jjxxc/#on-how-big-is-big"},{"categories":["Reading"],"collections":["Academic Rhetoric"],"content":"On \u0026ldquo;so what?\u0026rdquo;\rAn economics paper has to speak to a particular audience, and the society it describes is itself a fictional construction. Different groups see the world differently. If you want their recognition, you have to respond to the part they already treat as \u0026ldquo;common sense.\u0026rdquo; Those are the topics more likely to draw attention. ","date":"2024-10-16","heading":"On \u0026ldquo;so what?\u0026rdquo;","objectID":"/en/posts/jjxxc/:4:2","tags":["Paper Writing"],"title":"The Rhetoric of Economics","uri":"/en/posts/jjxxc/#on-so-what"},{"categories":["Reading"],"collections":["Academic Rhetoric"],"content":"What econometric work should watch out for\rDistinguish statistical significance from economic significance. Put simply, a paper\u0026rsquo;s argument cannot rely on statistical significance alone. You need to spell out assumptions about the sample distribution, the real-world meaning and functional form of coefficients (for example, whether they are elasticities), analysis grounded in shared real-world understanding, a strict definition of significance, and a sufficiently natural transition from statistical significance to real-world impact. Statistical meaning, policy meaning, scientific meaning, and economic meaning are different things. (This part comes from records in the AER from the 1980s on mistaken uses of statistical significance.) The author\u0026rsquo;s later attacks on the modernism represented by mathematical statistics go on and on, but in the end the principle is simple: Many people treat falsification as science, but falsification also involves arbitrariness. Even a great deal of evidence cannot guarantee that everything has been covered. And when a theory is tested in economics, what that usually means is simply that many people are interested in it. So in the end, the author argues that any rule-bound methodology may be wrong5. We should therefore turn against anti-rhetoric and against modernism. ","date":"2024-10-16","heading":"What econometric work should watch out for","objectID":"/en/posts/jjxxc/:4:3","tags":["Paper Writing"],"title":"The Rhetoric of Economics","uri":"/en/posts/jjxxc/#what-econometric-work-should-watch-out-for"},{"categories":["Reading"],"collections":["Academic Rhetoric"],"content":"Could rhetoric become a discipline of the future?\rTwo trends in economics are obvious right now. Basic mathematical statistics is increasingly prized. In my advanced econometrics course, I have seen students from the history department taking it as an elective, while older generations of economists keep moving further toward mathematics courses. The deeper crossover between math and economics is becoming normal. More scholars of mathematical economics keep entering the field, and the bar keeps rising. On the other hand, once mathematical statistics is used widely enough, its legitimacy starts being questioned. The tool-like role of mathematics really does seem to be giving some ground back to rhetoric. A paper\u0026rsquo;s central idea, its story, and how illuminating it is are becoming the things people care more about. This trade-off is as hard to choose between as the difference between \u0026ldquo;arriving at a conclusion correctly\u0026rdquo; and \u0026ldquo;arriving at the correct conclusion.\u0026rdquo; I genuinely do not know which direction will become the mainstream in the end. If we examine science from the single standpoint of \u0026ldquo;persuasion,\u0026rdquo; then every methodological rule stops mattering. Under the author\u0026rsquo;s extremely loose definition, worldview may turn into a kind of function-oriented utilitarian thinking. But rhetoric stands on the opposite side of modernism, and it unquestionably offers a fresh way to examine science. Innovation needs room for wild thinking, and a lack of restraint can provide exactly that springboard. That is why I think The Rhetoric of Economics is absolutely worth reading. Honestly, a lot of people cannot even write a clear notice, because they are bad at imagining their own readers. I personally recommend blogging as a way to train that ability.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Coase was trained in law\u0026#160;\u0026#x21a9;\u0026#xfe0e; The author even argues that objectivity is itself a metaphor, and that metaphor works by using vocabulary and construction to shape people\u0026rsquo;s judgment. Personally, though, I think that definition is so broad that it almost collapses into rhetoric itself.\u0026#160;\u0026#x21a9;\u0026#xfe0e; In undergraduate study, probability and mathematical statistics already hint at this, but I think most economics majors only really feel the force of the idea once they reach advanced econometrics.\u0026#160;\u0026#x21a9;\u0026#xfe0e; This view is a little too freewheeling for my taste.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2024-10-16","heading":"Could rhetoric become a discipline of the future?","objectID":"/en/posts/jjxxc/:5:0","tags":["Paper Writing"],"title":"The Rhetoric of Economics","uri":"/en/posts/jjxxc/#could-rhetoric-become-a-discipline-of-the-future"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":" This post records the detailed steps so I can look them up again later. Though after speedrunning it, I realized the era seems to have already shifted from ArcMap to Pro\u0026hellip;\u0026hellip; The great wind of life blows forth the world\u0026rsquo;s spirit; only the old can see the destruction within\u0026hellip;\u0026hellip; In Drawing GIS Colored Maps in Stata I introduced the shp-type files commonly used in GIS. In short, GIS\u0026rsquo;s basic data structure needs three elements: coordinates, a unique identifier, and a measured value. Here I\u0026rsquo;ll explain how to extract a cross-sectional Excel data file for administrative divisions from an administrative-division map file and a TIF map file. Diagram\rCode\rgraph TD; 0(Get map file)==\u003e1(Map main file .Shp); 0(Get map file)==\u003e11(Line main file .Shp); 0(Get map file)==\u003e3(Table file .dbf); 1(Map main file .Shp)==translate==\u003e2(Map outline data); 11(Line main file .Shp)==translate==\u003e9(Map line data); 3(Table file .dbf)==translate==\u003e4(Label file); 5(Data analysis file)==\u003e6(Matching file); 4(Label data)==\u003e6(Matching file); 6(Matching file)==id identifier==\u003e7(Plotting); 2(Map outline data)==id identifier==\u003e7(Plotting); 9(Map line data)==id identifier==\u003e7(Plotting)\rgraph TD; 0(Get map file)==\u003e1(Map main file .Shp); 0(Get map file)==\u003e11(Line main file .Shp); 0(Get map file)==\u003e3(Table file .dbf); 1(Map main file .Shp)==translate==\u003e2(Map outline data); 11(Line main file .Shp)==translate==\u003e9(Map line data); 3(Table file .dbf)==translate==\u003e4(Label file); 5(Data analysis file)==\u003e6(Matching file); 4(Label data)==\u003e6(Matching file); 6(Matching file)==id identifier==\u003e7(Plotting); 2(Map outline data)==id identifier==\u003e7(Plotting); 9(Map line data)==id identifier==\u003e7(Plotting)\rgraph TD; 0(Get map file)==\u003e1(Map main file .Shp); 0(Get map file)==\u003e11(Line main file .Shp); 0(Get map file)==\u003e3(Table file .dbf); 1(Map main file .Shp)==translate==\u003e2(Map outline data); 11(Line main file .Shp)==translate==\u003e9(Map line data); 3(Table file .dbf)==translate==\u003e4(Label file); 5(Data analysis file)==\u003e6(Matching file); 4(Label data)==\u003e6(Matching file); 6(Matching file)==id identifier==\u003e7(Plotting); 2(Map outline data)==id identifier==\u003e7(Plotting); 9(Map line data)==id identifier==\u003e7(Plotting)\rgraph TD; 0(Get map file)==\u003e1(Map main file .Shp); 0(Get map file)==\u003e11(Line main file .Shp); 0(Get map file)==\u003e3(Table file .dbf); 1(Map main file .Shp)==translate==\u003e2(Map outline data); 11(Line main file .Shp)==translate==\u003e9(Map line data); 3(Table file .dbf)==translate==\u003e4(Label file); 5(Data analysis file)==\u003e6(Matching file); 4(Label data)==\u003e6(Matching file); 6(Matching file)==id identifier==\u003e7(Plotting); 2(Map outline data)==id identifier==\u003e7(Plotting); 9(Map line data)==id identifier==\u003e7(Plotting)\r","date":"2024-09-25","heading":"","objectID":"/en/posts/gis/:0:0","tags":["GIS"],"title":" ArcGIS: Batch Converting TIF to Excel","uri":"/en/posts/gis/#"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"A quick guide to GIS\rOfficial tutorial: ArcGIS help ArcGIS, as commercial software, is actually very easy to pick up. Like Excel, once you understand the layout you can grasp the basic usage. Software diagram\rAs shown, the far left is the file area, for viewing working files. To its right is the tool list, with various tool functions to help process data files, so just follow the prompts. Further right is layer management. The far right is the drawing preview area; drop a GIS file in and you can see the image. ","date":"2024-09-25","heading":"A quick guide to GIS","objectID":"/en/posts/gis/:0:0","tags":["GIS"],"title":" ArcGIS: Batch Converting TIF to Excel","uri":"/en/posts/gis/#a-quick-guide-to-gis"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"GIS batch processing\r","date":"2024-09-25","heading":"GIS batch processing","objectID":"/en/posts/gis/:0:0","tags":["GIS"],"title":" ArcGIS: Batch Converting TIF to Excel","uri":"/en/posts/gis/#gis-batch-processing"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"From point data to polygon data\rEconomics data analysis is generally province-, city-, and county-level panel data. GIS files are image files, which can be seen as point-set data, while administrative panels are block-shaped, i.e. polygon data. So our processing approach is to compute the average of the point data within each administrative area, then export. Partition by the administrative-division shp. Use the function Spatial Analyst - Zonal - Zonal Statistics as Table to connect the data map with the administrative-division map and compute the mean within each administrative area. img\r","date":"2024-09-25","heading":"From point data to polygon data","objectID":"/en/posts/gis/:1:0","tags":["GIS"],"title":" ArcGIS: Batch Converting TIF to Excel","uri":"/en/posts/gis/#from-point-data-to-polygon-data"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"The fake batch processing\rFor each method/function, right-click - Batch will pop up an Excel table of custom actions. It seems like you could set your repeated actions via Excel rows to batch-process quickly, but if you actually use it, you\u0026rsquo;ll find the problem. After defining n repeated actions this way, only the last-defined action is kept. Batch processing\r","date":"2024-09-25","heading":"The fake batch processing","objectID":"/en/posts/gis/:2:0","tags":["GIS"],"title":" ArcGIS: Batch Converting TIF to Excel","uri":"/en/posts/gis/#the-fake-batch-processing"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"The real batch processing\r","date":"2024-09-25","heading":"The real batch processing","objectID":"/en/posts/gis/:3:0","tags":["GIS"],"title":" ArcGIS: Batch Converting TIF to Excel","uri":"/en/posts/gis/#the-real-batch-processing"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"Import the TIF files\rReal batch processing means designing a flowchart by hand! Take the TIF data provided in the 2024 Huawei Mathematical Contest in Modeling as an example; put the TIFs in one folder (preferably named in English and with the .tif extension, to make the later connections easier). Population-data TIF files\r","date":"2024-09-25","heading":"Import the TIF files","objectID":"/en/posts/gis/:3:1","tags":["GIS"],"title":" ArcGIS: Batch Converting TIF to Excel","uri":"/en/posts/gis/#import-the-tif-files"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"Find the shp file\rThe principle was mentioned earlier — we want to convert the GIS point dataset into administrative-division panel data, for which we need the administrative-division shp map. There are many resources on GitHub; you can also look in \u0026ldquo;Drawing GIS Colored Maps in Stata\u0026rdquo;. ","date":"2024-09-25","heading":"Find the shp file","objectID":"/en/posts/gis/:3:2","tags":["GIS"],"title":" ArcGIS: Batch Converting TIF to Excel","uri":"/en/posts/gis/#find-the-shp-file"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"Design the flowchart\rArcGIS\u0026rsquo;s real batch processing is drawing the flowchart yourself. ","date":"2024-09-25","heading":"Design the flowchart","objectID":"/en/posts/gis/:3:3","tags":["GIS"],"title":" ArcGIS: Batch Converting TIF to Excel","uri":"/en/posts/gis/#design-the-flowchart"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"Batch-converting TIF to table\rFirst, right-click under the connected folder and create a new toolbox. Create a new toolbox\rThen right-click under the toolbox to create a new model. Create a new model\rOpen the model to edit it, and drag the functions you want from the toolbar. Drag into the toolbox\rTIF is raster data; Insert - Iterators - Raster Insert - Iterators - Raster\rDouble-click \u0026ldquo;Iterate Rasters\u0026rdquo;. For workspace or raster catalog, choose the tif folder in the data folder; for raster format, choose TIF. Choose TIF as the raster data format\rInsert - Model Only Tools - Parse Path Parse Path\rDrag the shp folder you found into the model frame. This post uses the district.shp file of the county-level administrative-division map. County-level administrative divisions\rSwitch to the connect tool Connect tool\rConnect from \u0026ldquo;Name\u0026rdquo; to \u0026ldquo;Parse Path\u0026rdquo;, choosing \u0026ldquo;Input data element\u0026rdquo;. Connect to\rDouble-click \u0026ldquo;Parse Path\u0026rdquo;, and choose NAME as the parse type. So note: it\u0026rsquo;s best for the tif filenames to be in the form variable + number, to make the pattern easy to recognize. Best to name all looped files with this kind of structure. Parse Path\rNext is the operation of connecting parameters. Connect from \u0026ldquo;Value\u0026rdquo; to \u0026ldquo;Zonal Statistics as Table\u0026rdquo;, choosing \u0026ldquo;Environments\u0026rdquo; - \u0026ldquo;Output config keyword\u0026rdquo;. Connect from \u0026ldquo;the first recognized tif data (in this example pop1990.tif)\u0026rdquo; to \u0026ldquo;Zonal Statistics as Table\u0026rdquo;, choosing \u0026ldquo;Input value raster\u0026rdquo;. Connect from \u0026ldquo;the first recognized tif data (in this example pop1990.tif)\u0026rdquo; to \u0026ldquo;Zonal Statistics as Table\u0026rdquo;, choosing \u0026ldquo;Input value raster\u0026rdquo;. Connect from \u0026ldquo;the shp file (in this example district.shp)\u0026rdquo; to \u0026ldquo;Zonal Statistics as Table\u0026rdquo;, choosing \u0026ldquo;Input raster or feature zone data\u0026rdquo;. img\rDouble-click ZonalSt_shp5. Change \u0026ldquo;Look in\u0026rdquo; to the result folder inside the folder (if there isn\u0026rsquo;t one, you can create one on the fly in the dialog), and change \u0026ldquo;Name\u0026rdquo; to %value%. Name\rRight-click the tif module and choose Model Parameter. Don\u0026rsquo;t forget at this point to switch from connect mode to select mode in the top toolbar, so that right-clicking selects. Model Parameter\rRight-click the zone-division module (in this post, district.shp), and choose Model Parameter. Model Parameter\rThe Auto Layout button at the top can help us tidy up the layout. Auto Layout\r","date":"2024-09-25","heading":"Batch-converting TIF to table","objectID":"/en/posts/gis/:3:4","tags":["GIS"],"title":" ArcGIS: Batch Converting TIF to Excel","uri":"/en/posts/gis/#batch-converting-tif-to-table"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"Batch-converting tables to Excel\rContinue adding on top of the previous flowchart. Drag the \u0026ldquo;Table to Excel\u0026rdquo; tool from \u0026ldquo;Toolbox - Conversion Tools - Excel\u0026rdquo; into the model frame. Table to Excel\rConnect \u0026ldquo;%value%\u0026rdquo; to \u0026ldquo;Table to Excel\u0026rdquo;, choosing Input table. Table to Excel\rDouble-click %value%\\_TableToExcel.xls, choose the folder for the save path, and set the filename to %value%\\_TableToExcel.xls. The path folder\rAfter drawing the flowchart, click the model\u0026rsquo;s OK to run it. Click the model\u0026rsquo;s OK to run\r","date":"2024-09-25","heading":"Batch-converting tables to Excel","objectID":"/en/posts/gis/:3:5","tags":["GIS"],"title":" ArcGIS: Batch Converting TIF to Excel","uri":"/en/posts/gis/#batch-converting-tables-to-excel"},{"categories":["Software Tools"],"collections":["GIS Practice"],"content":"Other tips\rIf the operations are all correct, but reading stops partway and says there\u0026rsquo;s a reading problem, the most likely causes are: The GIS file isn\u0026rsquo;t in .tif format. The folder name is in Chinese. The data filenames aren\u0026rsquo;t structured — for example, both 1990pop.tif and pop1998.tif appear at the same time. It\u0026rsquo;s best to keep the Result folder and the tif folder in the same-level directory. ","date":"2024-09-25","heading":"Other tips","objectID":"/en/posts/gis/:4:0","tags":["GIS"],"title":" ArcGIS: Batch Converting TIF to Excel","uri":"/en/posts/gis/#other-tips"},{"categories":["Reading"],"collections":[],"content":" \u0026ldquo;Indeed,\u0026rdquo; he lit a cigarette, stretching comfortably against the armchair, replying, \u0026ldquo;You are looking, not observing. There is a clear distinction between these two.\u0026rdquo; ————《Adventures of Sherlock Holmes: A Scandal in Bohemia》 Although we live in a well-defined world today, our reflections on past behaviors never cease. From the origins of the universe to nations, whether in natural or social sciences, the quest is to trace a starting point to prove if everything we experience is inevitable or accidental. 《Crossing Boundaries of Community》delves into the formation of a Zhejiang Village, interspersing discussions on research methodology and theoretical construction, aiming to trace the origin of a community based on the concept of \u0026ldquo;relations.\u0026rdquo; For me, the ethnographic exploration in the book1 resembles a steady stream shaping rocks—each personal account may seem transparent and insignificant, but the intellectual rock will shine beautifully with time. ","date":"2024-09-16","heading":"","objectID":"/en/posts/sqzl/:0:0","tags":["Sociology"],"title":"《Crossing Boundaries of Community》: Fluid Relations and the Origins of Communities","uri":"/en/posts/sqzl/#"},{"categories":["Reading"],"collections":[],"content":"Theoretical Context\rThe book offers a comprehensive theoretical framework with engaging problem introductions. To make research questions engaging, the book emphasizes both contemporary issues and contradictions arising from existing theories. Rather than innovation, I appreciate the way the ideas are presented. The book examines Beijing\u0026rsquo;s \u0026ldquo;Zhejiang Village.\u0026rdquo; Despite being a cosmopolitan city, Beijing has a self-organized Zhejiang Village. This village is not a natural settlement or administrative entity, but a gathering point for Zhejiang immigrants. Xiang Biao\u0026rsquo;s theoretical framework is outlined as follows: Here is a note for studying the narrative logic of literature reviews. Phenomenon Characteristic: The village is a self-organized gathering point for Zhejiang immigrants in Beijing. This belongs to the issue of population movement. Theoretical Summarization: Existing theories suggest that population movement tends towards modernity from tradition. Xiang Biao summarizes various theories2 into a \u0026ldquo;tradition-modernity\u0026rdquo; framework, where these theories perceive tradition and modernity as being in a contradictory relationship. Theoretical Review: Coexistence, dependence, and embedding are three relations that can explain phenomena where backward and developed areas appear simultaneously due to population movement. However, coexistence theory lacks depth, dependency theory only touches on division of labor, and embedding theory addresses social structure without detailing its formation. Theoretical Contradiction: The process of community embedding has not been fully researched. Therefore, the paper focuses on social networks under population movement, studying the interplay of social networks, trust, and community formation as key to understanding Zhejiang Village\u0026rsquo;s emergence. New Theory Proposed: Emphasizing social network analysis, a series of theories already carry this idea3. Indeed, Xiang Biao’s theoretical views are quite similar to Yang Xiaokai’s Neoclassical Economics, though one explains communities and the other markets. The core logic revolves around these two points: A person appears independent, but when many connect, a market emerges, and individuals are influenced by social networks rather than acting independently. This logic chain—unseen hand-market economy-web model-general equilibrium-community formation—is summarized by Xiang Biao as \u0026ldquo;the fracture between the whole and the particular,\u0026rdquo; which may seem abstract, but essentially illustrates the internal contradiction of individual independence versus the collective\u0026rsquo;s dominance. Since social networks are always composed of people, we can analyze the entire social network through individual decision-making. This viewpoint is shared by Yang Xiaokai, Xiang Biao, and classical Bayesian network models, all emphasizing their theories that open the black box of the formation process while completing retrospective and unit analysis tasks 🤪. Yang Xiaokai’s marginal analysis focuses on consumer-producer individual general equilibrium, while Xiang Biao centers on relationships between individuals. In the \u0026ldquo;Thirteen Invitations,\u0026rdquo; Xiang Biao discusses the \u0026ldquo;disappearance of proximity\u0026rdquo; because he consistently advocates this market theory of individuals and social networks. The key difference lies in the fact that Yang Xiaokai builds upon Adam Smith’s division of labor creating wealth theory, starting from decision-making in labor division; Xiang Biao focuses on relationships forming a general equilibrium. Xiang Biao\u0026rsquo;s approach is more inclusive4, integrating ethics into analysis, providing ample room for exploring the ethical values, family structures, and collective ventures that shape Zhejiang Village. ","date":"2024-09-16","heading":"Theoretical Context","objectID":"/en/posts/sqzl/:1:0","tags":["Sociology"],"title":"《Crossing Boundaries of Community》: Fluid Relations and the Origins of Communities","uri":"/en/posts/sqzl/#theoretical-context"},{"categories":["Reading"],"collections":[],"content":"Narrative Method\rEconomics emphasizes evidence-based analysis and persuasion, often abstracting theories to establish frictionless frameworks. However, social sciences, as seen in 《Crossing Boundaries of Community》, involve a more comprehensive scanning of scenarios, aiming for a richer depiction of human experiences, leading to a more encompassing understanding of the world5. I recall a classmate being astonished upon seeing a social science dissertation filled with everyday records—how could such mundane, unfiltered observations be considered academic work? Yet, sociology transforms self-awareness into consciousness. As Sherlock Holmes\u0026rsquo; adventures highlight, it\u0026rsquo;s about observing, not just looking. When we review each chapter of 《Crossing Boundaries of Community》 individually, everyday trivialities might seem mundane. Everyone understands that post-reform entrepreneurship, institutional execution can be chaotic, and markets are driven by relationships. However, stitching together all chapters, Xiang Biao subtly constructs his \u0026ldquo;protruding facts.\u0026rdquo; Individual Traits: Zhejiang merchants prioritize relationships over kinship, valuing movement and entrepreneurship. Clothing technology spreads outward through kinship relationships. These ethical traits contribute to Zhejiang Village’s expanding social network and cultural characteristics. This process transforms individual characteristics into entrepreneurial, sales, industrial, market, and ultimately community relations6, from isolated individual action to collective movement. State Interaction: Why can\u0026rsquo;t states or eras alone explain Zhejiang Village\u0026rsquo;s formation? Zhejiang Village has its own framework, gradually marketizing, where many merchants accumulated wealth independently, rather than directly benefiting from reform. Zhejiang Village repeatedly clashed with Beijing\u0026rsquo;s administration, expanding through institutional reform, demonstrating its autonomous order. Through this relational perspective, more can be explained—systemic interactions, policy versus counteractions, class and tiered divisions, top-down interventions versus grassroots responses. This goes beyond mere mechanical opposition, delving into complex interactions driven by identity, rendering simplistic labels of advanced or backward meaningless, focusing instead on internal behavior and decision-making processes. This theory leans heavily towards liberalism—spontaneous order7 is disrupted by excessive intervention, and rather than control, understanding and acceptance are essential8. Entry Point: Xiang Biao didn’t begin with the intricate relationships shaping communities; his research initially focused on Zhejiang Village’s garment industry development. Over time, his studies unearthed relationships influencing community formation. Even discovering relationships was straightforward. China has traditionally been considered a society of interpersonal networks, but articulating community origins through relationships and population movement provides a mature narrative perspective. ","date":"2024-09-16","heading":"Narrative Method","objectID":"/en/posts/sqzl/:2:0","tags":["Sociology"],"title":"《Crossing Boundaries of Community》: Fluid Relations and the Origins of Communities","uri":"/en/posts/sqzl/#narrative-method"},{"categories":["Reading"],"collections":[],"content":"Alienation and Moral Perspectives\rSociology amazes me because alienating the everyday makes everything seem extraordinary. Zhejiang Village, in its resistance to state governance, lacks a corporate enterprise model but thrives with unconventional vitality. Imagine if we were residents of Zhejiang Village, could we easily identify these traits? Alienation is a powerful analytical tool! However, this raises methodological debates—what role should researchers take when entering research subjects? How should they alienate the environment? Xiang Biao opposes abstract generalization, instead aiming to provide rational explanations through daily phenomena, crafting a self-organized order for Zhejiang Village. His inclusiveness and willingness to rationalize are admirable, but it reflects a moral choice—accepting phenomena and attempting to rationalize them. Constructing forward-thinking moral frameworks is difficult. Is there truly rational absurdity? Who decides which phenomena are absurd? These questions remain elusive, possibly contributing to why social sciences are not universally recognized as scientific. ","date":"2024-09-16","heading":"Alienation and Moral Perspectives","objectID":"/en/posts/sqzl/:3:0","tags":["Sociology"],"title":"《Crossing Boundaries of Community》: Fluid Relations and the Origins of Communities","uri":"/en/posts/sqzl/#alienation-and-moral-perspectives"},{"categories":["Reading"],"collections":[],"content":"Footnotes\rScholars like Malinowski, Pan Suiming, and Xiang Biao have shown remarkable dedication to ethnographic research. Tönnies (community and society), Durkheim (mechanical solidarity and organic solidarity), Weber (substantive rationality and formal rationality), Pareto (traditional and legitimate domination), Lewis (industrial and agricultural sectors), Parsons (pattern variables)\u0026hellip; Emergent fact. This theory is quite intriguing as the addition of relations brings qualitative change. For instance, three separate lines are meaningless individually, but when connected, they form a triangle with significance. I resonate with a critique that economics often quantifies social networks and social capital, overlooking the influence of ethical values. Among those I’ve encountered, sociology students tend to be the most well-read. There are many fascinating details in these descriptions, proving Zhejiang merchants’ cultural and relational expansion, which are too extensive to detail here. I now understand why many recommend Hayek’s works, as his emphasis on spontaneous order and knowledge systems provides profound insights. However, Beijing’s Zhejiang Village has been dismantled by strong administrative measures, which long-term impacts might undermine the credibility of individual social networks. ","date":"2024-09-16","heading":"Footnotes","objectID":"/en/posts/sqzl/:4:0","tags":["Sociology"],"title":"《Crossing Boundaries of Community》: Fluid Relations and the Origins of Communities","uri":"/en/posts/sqzl/#footnotes"},{"categories":["Economic Studies"],"collections":["Academic Rhetoric"],"content":" Disclaimer: To preserve the principle of anonymous review, the specific situations cited here are all made up by me and differ from the actual reviews I\u0026rsquo;ve written. Any resemblance is pure coincidence. Although review is anonymous, reviewers and authors often work in the same subfield, so it\u0026rsquo;s easy to spot who recommended citing their own paper. Still, that\u0026rsquo;s just part of the experience — no harm in it. I recently took part in a bit of review work as training, and I noticed there isn\u0026rsquo;t much about the experience shared online, so here\u0026rsquo;s a record. Recently teacher Liu Xichuan shared a good example: An external review report (Zhang Chuanchuan, Fu Mingwei) and the revision notes (Jin Weidong et al.) The biggest impression is that empirical economics papers are getting more and more competitive. These journals used to focus on pure econometric empirical analysis; now they use both reduced-form and structural inference, and robustness checks add yet another econometric model. The pace of innovation in the field keeps accelerating. Reviewing really trains you; coming up with comments is also a process of reflecting on how you\u0026rsquo;d construct a paper\u0026rsquo;s framework yourself. Each time before I reviewed, my advisor would give me a few pointers — short, but always right on target. My review comments before and after reading those pointers were worlds apart. Below I\u0026rsquo;ll summarize some general perspectives I\u0026rsquo;ve picked up. The better a review report, the more it should show advice specific to the paper — for example, the lineage of the theory, the usual data handling, variable choice and entry point, and the endogeneity problems arising from economic significance1\u0026hellip; Most comments are best aimed at the paper\u0026rsquo;s novelty, econometric design, and model handling; typos and formatting should just be mentioned in passing2. ","date":"2024-09-10","heading":"","objectID":"/en/posts/sg/:0:0","tags":["Empirical Research"],"title":"Empirical Economics: Notes from Reviewing","uri":"/en/posts/sg/#"},{"categories":["Economic Studies"],"collections":["Academic Rhetoric"],"content":"The Reviewer\u0026rsquo;s Stance\rI think the \u0026ldquo;scholars despise each other\u0026rdquo; mentality is still fairly strong in academia; reviewing actually requires a more generous mindset. I\u0026rsquo;d strongly recommend reading teacher Lu Ming\u0026rsquo;s views on reviewing: Lu Ming: On Reviewing The best review isn\u0026rsquo;t freewheeling fault-finding; it\u0026rsquo;s spotting the paper\u0026rsquo;s feasible strengths that the author hasn\u0026rsquo;t yet noticed — the places that could be analyzed further. Reviewers have their own standards, and journals have theirs. Be careful not to let your standards casually exceed the journal\u0026rsquo;s. At the same time, I think the healthiest academic market is one with less of the personally biased thinking of \u0026ldquo;this problem is uninteresting, boring, not worth studying.\u0026rdquo; The best reviewing stance isn\u0026rsquo;t \u0026ldquo;this is worth studying, that isn\u0026rsquo;t,\u0026rdquo; but \u0026ldquo;under current conditions, this or that aspect hasn\u0026rsquo;t been explored enough.\u0026rdquo; Finding faults — once you know the concept of empirical endogeneity, anyone can do that. What truly tests a reviewer\u0026rsquo;s ability is offering constructive suggestions that can extend the research. ","date":"2024-09-10","heading":"The Reviewer\u0026rsquo;s Stance","objectID":"/en/posts/sg/:1:0","tags":["Empirical Research"],"title":"Empirical Economics: Notes from Reviewing","uri":"/en/posts/sg/#the-reviewers-stance"},{"categories":["Economic Studies"],"collections":["Academic Rhetoric"],"content":"My Own Process\rFirst I do a quick search of Chinese and English journals on the paper\u0026rsquo;s topic, focusing on relevant survey articles to get a rough sense of the current state of the field. Then I look at the paper\u0026rsquo;s econometric design as a whole, read it through carefully, and dig into some of the references it cites (especially those in the literature review, the theoretical citations, and the instrumental variables). ","date":"2024-09-10","heading":"My Own Process","objectID":"/en/posts/sg/:2:0","tags":["Empirical Research"],"title":"Empirical Economics: Notes from Reviewing","uri":"/en/posts/sg/#my-own-process"},{"categories":["Economic Studies"],"collections":["Academic Rhetoric"],"content":"The Opening and the Body\rA review report usually consists of: an opening summary + major issues (research design, novelty, theoretical contribution\u0026hellip;) + minor issues (typos, figure and table descriptions, clarity of figures\u0026hellip;). I like the following opening format: This paper studies the problem of xx from the perspective of xx (the relationship between xx and xx). Positive comments: The treatment of xx and xx is impressive. The paper contributes an xx perspective to xx. Under xx circumstances, studying xx is indeed very necessary. Negative comments: Although the treatment or idea of xx is excellent, in reality xxxxx, so the questions around xx and xx still raise concerns about the reliability of the econometric design and empirical results. After the opening comes the body: list the comments in sections, one point per paragraph. On the topic choice. The paper\u0026hellip; On the literature review. The paper\u0026hellip; On the reliability of the conclusions. The paper\u0026rsquo;s endogeneity\u0026hellip; On some minor formatting errors. In\u0026hellip; Nobody likes pure criticism without suggestions. We have to remember that all research is done under constraints. We can\u0026rsquo;t ask authors to solve problems that can\u0026rsquo;t be solved (say, missing data or variables). So it\u0026rsquo;s best, after raising a problem, to offer a solution you think is workable and worth considering. For example, on the xx problem, the author might consider xx\u0026hellip; ","date":"2024-09-10","heading":"The Opening and the Body","objectID":"/en/posts/sg/:3:0","tags":["Empirical Research"],"title":"Empirical Economics: Notes from Reviewing","uri":"/en/posts/sg/#the-opening-and-the-body"},{"categories":["Economic Studies"],"collections":["Academic Rhetoric"],"content":"Topic Choice and Novelty\rAlthough I don\u0026rsquo;t believe in judging a paper by its cover, in practice many people look at the x and y in a title and the research subject and conclude the study is unreliable, that there\u0026rsquo;s no causal relationship, or that the subject isn\u0026rsquo;t worth studying. Isn\u0026rsquo;t that assuming your own economic intuition overrides a paper\u0026rsquo;s empirical results? Anyway, this tendency surely reflects some problems behind academia and empirical methods 😅. It also shows how important the title and abstract are3. Evaluate the size and number of elements in the topic. For example, a topic that studies three elements A, B, and C at once: the relationships among three variables are just too complicated to analyze fully. You\u0026rsquo;d have to answer why these three, and what hierarchical relationship the three have. Once, at a journal seminar run by The Journal of World Economy, an audience member asked the editor what kind of topic could make it into the journal. The editor answered: \u0026ldquo;Economic research that can discover or explain a phenomenon is the kind our editorial office likes best\u0026rdquo;4. Indeed, whether a phenomenon has various theories around it — progressive or contradictory — is both a way to organize the literature review and a key part of highlighting novelty: whether the paper has, through econometrics, proven or falsified a theory and explained a corresponding phenomenon. A side note: as theories develop further, more and more papers focus on the heterogeneity of some specific effect. But this kind of marginal innovation seems far from enough in my advisor\u0026rsquo;s eyes — yet genuinely discovering a phenomenon and giving it a theoretical account is really hard! ","date":"2024-09-10","heading":"Topic Choice and Novelty","objectID":"/en/posts/sg/:4:0","tags":["Empirical Research"],"title":"Empirical Economics: Notes from Reviewing","uri":"/en/posts/sg/#topic-choice-and-novelty"},{"categories":["Economic Studies"],"collections":["Academic Rhetoric"],"content":"Literature Review\rAs mentioned above, the literature review should discuss the layers and relationships of the theories around the topic. This can be criticized on grounds of language and logic. At the same time, we can note the quantity, quality, and share of top-journal and English-language references. Generally, a literature review highlights what previous studies have done, which literatures the paper is in dialogue with, and what newer results it obtains. Consider whether the author has really engaged with the cited literature, or whether some overlooked literature was actually already in dialogue with the author without the author realizing it. In a review report, we can also cite references to strengthen our case or give examples. ","date":"2024-09-10","heading":"Literature Review","objectID":"/en/posts/sg/:5:0","tags":["Empirical Research"],"title":"Empirical Economics: Notes from Reviewing","uri":"/en/posts/sg/#literature-review"},{"categories":["Economic Studies"],"collections":["Academic Rhetoric"],"content":"Theory\rIn an excellent econometrics paper, the interplay between theory and econometric design runs through the whole text. Do the theories mentioned in the literature review have internal relationships and logical exposition? Are the conflicts among multiple theories tested in the econometrics? If not, then the theories are just being listed mechanically. Is the theory in the literature review consistent with the theory in the later empirical work? For example, if the earlier theory is about the official promotion tournament, but the later empirical evidence has no government-competition variable, or starts discussing the life cycle. Does the heterogeneity/robustness mechanism design have theoretical support, or is it used to test theory? Is the social context described adequately? In current research, is this variable really distinctive? Does the study really have a novel perspective? For example, high savings and low consumption driven by housing prices have already been discussed a lot. ","date":"2024-09-10","heading":"Theory","objectID":"/en/posts/sg/:6:0","tags":["Empirical Research"],"title":"Empirical Economics: Notes from Reviewing","uri":"/en/posts/sg/#theory"},{"categories":["Economic Studies"],"collections":["Academic Rhetoric"],"content":"Descriptive Statistics\rIs the distribution reasonable? For example, does a long-tailed distribution affect the paper? Are the values reasonable? For example, descriptive statistics below 0 but then log-transformed? Is the index construction reasonable? Are positive/negative indicators explained? Is standardization done? When using principal component analysis, scores may be negative; then you should carefully check how the paper handles negative scores, while always keeping in mind the actual meaning of the indicator, which affects its range and sign. Are the max, min, mean, and units all shown? Is the data source stated? Are there omitted data-processing steps that aren\u0026rsquo;t explained? ","date":"2024-09-10","heading":"Descriptive Statistics","objectID":"/en/posts/sg/:7:0","tags":["Empirical Research"],"title":"Empirical Economics: Notes from Reviewing","uri":"/en/posts/sg/#descriptive-statistics"},{"categories":["Economic Studies"],"collections":["Academic Rhetoric"],"content":"Empirical Results\rRecheck the significance. Are the effect estimates exaggerated? For example, a measured parameter for work efficiency that turns out to be a 200% decrease! That clearly contradicts reality. Some results that can only be positive somehow come out negative! In subsample regressions, do the signs conflict with the conclusions? The scaling of Ln(1+my) can affect significance. Is the model used appropriately? DID should have sufficiently exogenous shock assumptions, RDD needs a suitable cutoff, and the weights of a spatial matrix need a reasonable theoretical justification\u0026hellip; ","date":"2024-09-10","heading":"Empirical Results","objectID":"/en/posts/sg/:8:0","tags":["Empirical Research"],"title":"Empirical Economics: Notes from Reviewing","uri":"/en/posts/sg/#empirical-results"},{"categories":["Economic Studies"],"collections":["Academic Rhetoric"],"content":"Heterogeneity, Robustness, Mechanisms\rThis part mainly looks at the design of the econometric scheme. Is the econometric analysis designed around the theory? Does the econometric method fit the paper\u0026rsquo;s elements or data structure? Is the instrumental variable credible? IVs are an important tool for causal inference; here you need to examine them closely against the elements themselves. Most people use IVs from references, so compare carefully. An IV might be suitable in paper A but not in paper B. Are the \u0026ldquo;what\u0026rdquo; and \u0026ldquo;why\u0026rdquo; fully explained? Some papers only prove that a phenomenon exists without discussing why. Some checks that can add substance: Add interaction-term analysis, add subsample regressions, add between-group difference tests, add pre-trends, test exogenous shocks, swap in other relevant variables, robust clustering suggestions\u0026hellip; ","date":"2024-09-10","heading":"Heterogeneity, Robustness, Mechanisms","objectID":"/en/posts/sg/:9:0","tags":["Empirical Research"],"title":"Empirical Economics: Notes from Reviewing","uri":"/en/posts/sg/#heterogeneity-robustness-mechanisms"},{"categories":["Economic Studies"],"collections":["Academic Rhetoric"],"content":"Conclusion\rDoes the conclusion match the empirical results — each empirical result produces a conclusion, no more and no less? The conclusion should be relatively specific, not freewheeling. Since the econometric design tests theories layer by layer based on the phenomenon, the conclusion should show the same structure and thinking. A higher-level requirement is policy recommendations. Conclusions and implications need to weigh costs and benefits. A paper may find that x affects y — that\u0026rsquo;s an economic regularity — but how to turn that regularity into recommendations requires considering the larger policy cost-benefit. This is a higher bar, but actually it\u0026rsquo;s the angle that better fits a realistic, holistic view: For example, if you suggest that relaxing credit constraints through government investment can promote the development of small and micro enterprises, that policy suggestion carries at least several premises to consider. 1. Why small and micro enterprises — what is the inherent trade-off between investing in large enterprises versus small and micro ones? 2. If the essence is investment and the key is credit constraints, is investment the only channel for relaxing credit constraints? 3. Cost-benefit — citing relevant policy grounds would make it stand out. So a policy\u0026rsquo;s unexpected and spillover effects are easier to write about, because \u0026ldquo;unexpected effects\u0026rdquo; are really just additional benefits. ","date":"2024-09-10","heading":"Conclusion","objectID":"/en/posts/sg/:10:0","tags":["Empirical Research"],"title":"Empirical Economics: Notes from Reviewing","uri":"/en/posts/sg/#conclusion"},{"categories":["Economic Studies"],"collections":["Academic Rhetoric"],"content":"Recommended References\r[Eight Lectures on Writing Empirical Papers (Liu Xichuan)] Reviewing for Economic Research Journal — Pang Ruizhi As a reviewer, when would you choose to reject a paper? The Initiative and Guidelines for External Expert Review at the Journal of Finance and Economics Lu Ming: On Reviewing Yue Cha | Zhang Chuanchuan: Some Thoughts on Reviewing for Economics Journals Writing and Publishing | Shi Xinzheng: Some Views on Reviewing On Reviewing | Value Judgment and Balance in Journal Review On Reviewing | Yu Xinliang: In Reviewing, Help Others and Yourself, Together in Beauty Suggestions and thinking at the level of novelty and endogeneity from economic significance demand the highest skill and best reflect a reviewer\u0026rsquo;s caliber.\u0026#160;\u0026#x21a9;\u0026#xfe0e; These minor issues prove that the reviewer has read carefully.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Actually, if you analyze the role of each structural element of a paper\u0026rsquo;s format, you\u0026rsquo;ll find every one of them matters.\u0026#160;\u0026#x21a9;\u0026#xfe0e; There was also a question about how to title a paper. The editor answered that the title isn\u0026rsquo;t the most important thing; you can see that the more formidable researchers have shorter paper titles, because they care about brevity and quickly foregrounding the topic.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2024-09-10","heading":"Recommended References","objectID":"/en/posts/sg/:11:0","tags":["Empirical Research"],"title":"Empirical Economics: Notes from Reviewing","uri":"/en/posts/sg/#recommended-references"},{"categories":["Commentary"],"collections":[],"content":" Based on the shadow images, \u0026ldquo;Black Myth: Wukong\u0026rdquo; has already hinted that the old monkey is Jin Chanzi (Tang Sanzang, reincarnation, Buddha, etc.). Currently, the only reason online for opposing Jin Chanzi is that the old monkey is lying, which do not align with Jin Chanzi\u0026rsquo;s identity. In practice, although Jin Chanzi does not appear, his character is consistently portrayed throughout the game. First, this is \u0026ldquo;Black Myth: Wukong.\u0026rdquo; Black Myth implies a subversion of character settings. Game Science does respect the original work, but only in terms of story events, interpersonal relationships, and magical artifact settings. The character settings in the game have been altered. Huangfeng Great King has a righteous side, and Lingji Bodhisattva has a selfish side. Why should we assume that Jin Chanzi cannot say the words at the end? Next, I will present evidence from the shadow images. The following shadow images are from Black Myth Wiki. Thank you to the contributors for their selfless dedication! Long live the spirit of open sharing on the internet! ","date":"2024-09-07","heading":"","objectID":"/en/posts/wk/:0:0","tags":["Games"],"title":"Who is the Old Monkey in Black Myth Wukong","uri":"/en/posts/wk/#"},{"categories":["Commentary"],"collections":[],"content":"Why It Must Be Jin Chanzi or a Related Identity\r","date":"2024-09-07","heading":"Why It Must Be Jin Chanzi or a Related Identity","objectID":"/en/posts/wk/:1:0","tags":["Games"],"title":"Who is the Old Monkey in Black Myth Wukong","uri":"/en/posts/wk/#why-it-must-be-jin-chanzi-or-a-related-identity"},{"categories":["Commentary"],"collections":[],"content":"Evidence 1: The Pursuit of Truth\rThe poem on the old monkey\u0026rsquo;s shadow image mentions: The path to immortality is walked by countless people. Seeking the Dao without seeking truth, saving others but unable to save oneself. Old Monkey Shadow Image\rThis suggests that the old monkey\u0026rsquo;s pursuit is truth. Next, look at Huang Mei\u0026rsquo;s shadow image—Huang Mei debates with Jin Chanzi. Huang Mei asks, \u0026ldquo;Junior brother, what is the meaning of life?\u0026rdquo; The young monk replies, \u0026ldquo;Seeking truth.\u0026rdquo; Huang Mei counters, \u0026ldquo;What is truth?\u0026rdquo; The young monk answers, \u0026ldquo;The way all things operate, the law of the universe\u0026rsquo;s origin.\u0026rdquo; Huang Mei seeks victory, while Jin Chanzi seeks truth. Huang Mei Shadow Image\r","date":"2024-09-07","heading":"Evidence 1: The Pursuit of Truth","objectID":"/en/posts/wk/:1:1","tags":["Games"],"title":"Who is the Old Monkey in Black Myth Wukong","uri":"/en/posts/wk/#evidence-1-the-pursuit-of-truth"},{"categories":["Commentary"],"collections":[],"content":"Evidence 2: Attitude Towards the Chosen One\rIn the second CG animation, Huang Mei is obsessed with winning, while Jin Chanzi believes that winning or losing should not matter, aligning with the pursuit of truth. Second CG Animation\rThe celestial beings of Heaven say he is gambling. The Buddha of Ling Mountain says that gambling inevitably leads to loss. He says he is not gambling, nor has he lost. Similarly, the old monkey does not care about winning or losing. What matters more is seeking truth. The old monkey believes he is not a gambler but a waiter, waiting for the Chosen One who can inherit Sun Wukong\u0026rsquo;s legacy. Who is the old monkey gambling against? Ling Mountain, and coincidentally, Jin Chanzi also comes from Ling Mountain. Old Monkey Shadow Image\r","date":"2024-09-07","heading":"Evidence 2: Attitude Towards the Chosen One","objectID":"/en/posts/wk/:1:2","tags":["Games"],"title":"Who is the Old Monkey in Black Myth Wukong","uri":"/en/posts/wk/#evidence-2-attitude-towards-the-chosen-one"},{"categories":["Commentary"],"collections":[],"content":"Evidence 3: Buddhist Decorations and Gestures\rWearing Buddhist prayer beads A ribbon behind him, similar to Lingji Bodhisattva The ending gesture is a Buddhist prayer gesture Ending Animation, the old monkey and the Chosen One perform a Buddhist prayer gesture\r","date":"2024-09-07","heading":"Evidence 3: Buddhist Decorations and Gestures","objectID":"/en/posts/wk/:1:3","tags":["Games"],"title":"Who is the Old Monkey in Black Myth Wukong","uri":"/en/posts/wk/#evidence-3-buddhist-decorations-and-gestures"},{"categories":["Commentary"],"collections":[],"content":"Why It\u0026rsquo;s Not a Bodhisattva or Patriarch Bodhi\rThe old monkey\u0026rsquo;s shadow image has already helped us eliminate these possibilities. Some say he is Guanyin Bodhisattva. Some say he is Patriarch Bodhi. Others say he is Sun Wukong himself. ","date":"2024-09-07","heading":"Why It\u0026rsquo;s Not a Bodhisattva or Patriarch Bodhi","objectID":"/en/posts/wk/:2:0","tags":["Games"],"title":"Who is the Old Monkey in Black Myth Wukong","uri":"/en/posts/wk/#why-its-not-a-bodhisattva-or-patriarch-bodhi"},{"categories":["Commentary"],"collections":[],"content":"Why It\u0026rsquo;s Not Patriarch Bodhi\rThe immobilization technique used by the Black Wind Mountain land god was taught by an immortal, who instructed him to pass it on to the Chosen One. Black Wind Mountain Land God Shadow Image\rThe image hints at leaves—long and slender with a faint fragrance. These are the characteristics of Bodhi leaves. Bodhi Leaves\r","date":"2024-09-07","heading":"Why It\u0026rsquo;s Not Patriarch Bodhi","objectID":"/en/posts/wk/:2:1","tags":["Games"],"title":"Who is the Old Monkey in Black Myth Wukong","uri":"/en/posts/wk/#why-its-not-patriarch-bodhi"},{"categories":["Commentary"],"collections":[],"content":"Why It\u0026rsquo;s Not Guanyin\rWhen the Chosen One sets off, he will personally make a willow stick for them. Breaking a willow branch to bid farewell, he feels a sense of reluctance. Many people speculate that the old monkey is Guanyin based on the willow stick. The primary function here is clearly the poetic symbolism of breaking a willow branch to bid farewell. Additionally, this is a willow stick, not a willow branch, and there is no hint of the jade vase. What relates to Guanyin is the item used for brewing (unlocked in the second playthrough)—the jade vase and willow leaf. This is a reference to the jade vase and willow leaf. A single willow stick certainly cannot represent Guanyin. Jade Vase and Willow Leaf\rWhat relates to Guanyin is the BOSS Black Bear Spirit, who, after being defeated, says he will return to the South Sea to apologize. If the old monkey were Guanyin, staying in the Flower-Fruit Mountain all along, who would the Black Bear Spirit go back to apologize to??? Black Bear Spirit Defeat CG Animation\r","date":"2024-09-07","heading":"Why It\u0026rsquo;s Not Guanyin","objectID":"/en/posts/wk/:2:2","tags":["Games"],"title":"Who is the Old Monkey in Black Myth Wukong","uri":"/en/posts/wk/#why-its-not-guanyin"},{"categories":["Commentary"],"collections":[],"content":"Why It\u0026rsquo;s Not Yuan Hong\rFirst, let\u0026rsquo;s take a step back and assume that Game Science really defaults to Meishan being the Seven Sages, and even follows the \u0026ldquo;Investiture of the Gods\u0026rdquo; setting! The old monkey is Buddhist, while Yuan Hong is Taoist, which directly contradicts. Throughout the journey, the Meishan brothers, as a subplot, each mention their elder brother in their dialogue. Why doesn\u0026rsquo;t the old monkey mention him? The old monkey\u0026rsquo;s encyclopedia entry is only unlocked in the second playthrough. As a character from \u0026ldquo;Investiture of the Gods,\u0026rdquo; is Yuan Hong worthy of such a grand reveal? White-robed scholar, Yellow-robed official, Green-hatted martial artist, Black-handed Taoist, White-axed warrior. Each name has a color, and white is already taken by the white-robed scholar. If it were the White Ape, it wouldn\u0026rsquo;t fit the naming pattern. (White and white are both white, but they are deliberately distinguished here. The White Ape\u0026rsquo;s original name is white, so including it would violate the naming rules.) ","date":"2024-09-07","heading":"Why It\u0026rsquo;s Not Yuan Hong","objectID":"/en/posts/wk/:2:3","tags":["Games"],"title":"Who is the Old Monkey in Black Myth Wukong","uri":"/en/posts/wk/#why-its-not-yuan-hong"},{"categories":["Commentary"],"collections":[],"content":"Is the Old Monkey Lying?\rMany people argue the old monkey is lying, but is he really lying? Look at what the old monkey comments on at the end—the six roots. Chapter 1—Eye: Seeing what one likes and wanting to possess it. Elder Jinchi covets the kasaya, desiring material wealth. Chapter 2—Ear: Listening to one-sided words, where good intentions may lead to evil deeds. Lingji, as a Buddha, and Huangfeng, as a demon, each only see their own perspectives, leading to the destruction of Huangfeng Ridge. The scholar, due to a dream, kills an innocent white fox. The side quest involves killing the kind-hearted Shi Zi family. Chapter 3—Nose: Obsessed with emotions, unable to extricate oneself. Kang Jinlong becomes infatuated and falls into depravity, while Huang Mei becomes obsessed with winning and strays from the path. Chapter 4—Tongue: Treating others as mere tools, harming others for personal gain. The world is a furnace, and the fourth sister becomes a pill. The demons of the mortal world are merely materials for the gods. Chapter 5—Body: Fear of disasters, fearing everything, and thus losing everything. The Bull Demon King faces a midlife crisis, losing his wife and children. The Bull Demon King fears everything, and thus loses everything. The old monkey is commenting on the themes and messages of the first five chapters! The conflict between Buddhism and Taoism turns the world into a furnace. The gods are obsessed with spiritual essence, causing all living beings to struggle in the world. Are these thematic lines really lies? Or are they meant to provoke thought? Are Sun Wukong\u0026rsquo;s desires seen as wrong by Buddhism and Taoism, but are they truly wrong? Was Sun Wukong born mischievous, or is the world inherently unjust? Thus—Chapter 6—in a place unknown to the old monkey, the Great Sage\u0026rsquo;s will is born—the will to desire. Will to Desire\rPlease look again at Jin Chanzi\u0026rsquo;s attitude—non-interventionist pursuit of truth. If he believes the world is unjust, how can he prove it? If he intervenes, wouldn\u0026rsquo;t he be like Huang Mei, reversing cause and effect? He appears to criticize Sun Wukong, but in reality, he is anticipating Sun Wukong\u0026rsquo;s own will. The true will to desire does not require external intervention. Like in \u0026ldquo;Elden Ring,\u0026rdquo; only by experiencing the suffering and desires of all beings can one forge their own law. In practice, the old monkey is the one who believes in Sun Wukong the most. That\u0026rsquo;s why he believes he is not gambling, because he trusts that Sun Wukong\u0026rsquo;s will to desire will be inherited. This process should not and cannot be interfered with. The traces of the journey to the West cannot be erased. Thus, although the old monkey does not know about the will to desire, he knows that Sun Wukong\u0026rsquo;s essence will be passed down. Experiencing everything, feeling everything, reflecting on everything—this is the Great Sage\u0026rsquo;s will to desire. What are the Buddhist will clones, the Golden Headband clones? They are all externally imposed and must be rejected! ","date":"2024-09-07","heading":"Is the Old Monkey Lying?","objectID":"/en/posts/wk/:3:0","tags":["Games"],"title":"Who is the Old Monkey in Black Myth Wukong","uri":"/en/posts/wk/#is-the-old-monkey-lying"},{"categories":["Commentary"],"collections":[],"content":"Will? Enlightenment!\rTrue will emerges from reflecting on what one has seen and done. This is why some interpretations frustrate me. Many answers try to prove their own version of the Great Sage, their own version of Jin Chanzi, over-interpreting the ending dialogue. The official shadow images make it clear, but people refuse to connect or believe them. It seems that interpretations always aim to be grander, more unique. Well, let me say this: all those theories about Buddhist will, Yuan Hong, Guanyin, Taibai Jinxing, Six-Eared Macaque, and Sun Wukong are nonsense! The Jin Chanzi theory is lofty enough. Unity of knowledge and action, unbound by Buddhism, unbound by Taoism, transcending the three realms, existing beyond the five elements. —Only such a will is worthy of the Great Sage and the journey to the West. ","date":"2024-09-07","heading":"Will? Enlightenment!","objectID":"/en/posts/wk/:4:0","tags":["Games"],"title":"Who is the Old Monkey in Black Myth Wukong","uri":"/en/posts/wk/#will-enlightenment"},{"categories":["Economic Studies"],"collections":["Reflections on Learning Economics","Academic Rhetoric"],"content":" A passing thought, still unfinished. If I have gotten something wrong, feel free to correct me. Clever ideas often look especially simple, so simple that people start to think they were obvious all along. But don\u0026rsquo;t assume those ideas are obvious, because they absolutely are not. Clever ideas seem too simple only because we see the final result. The mess in the middle has been cleaned away. The false starts go unmentioned. The beginning of the problem gets brushed past. All the paths that once seemed possible disappear with it. The irony is that ideas that end up shaping how later generations think are eventually treated by the young as plain and unremarkable. ——3Blue1Brown People often say empirical economics papers are obvious in hindsight: either post hoc, or just confirming what everyone already intuits. In that view, only papers with predictive power or counterintuitive conclusions really count as valuable. Here I want to push back from a few angles and explain why an intuitive result is not necessarily an obvious one. ","date":"2024-08-20","heading":"","objectID":"/en/posts/fs2/:0:0","tags":["Economic Methodology"],"title":"Empirical economics: intuitive does not mean obvious","uri":"/en/posts/fs2/#"},{"categories":["Economic Studies"],"collections":["Reflections on Learning Economics","Academic Rhetoric"],"content":"Intuitive conclusions can contradict each other\rSome people think social welfare helps fertility. That feels intuitive, because it lowers the cost of raising children. Some people think social welfare hurts fertility. That also feels intuitive, because children can function as old-age support, and social welfare lowers the need for that support. Some people think housing creates a wealth effect. This one needs a bit more explanation. Disposable income obviously affects consumption, but Friedman also argued that a key factor behind consumption is permanent income. Assets such as housing fit into that picture and can encourage spending. Others argue for a house-poor effect instead: housing mortgages squeeze consumption. Beyond rational consumption decisions, behavioral economics is full of contradictions too when it comes to \u0026ldquo;irrational\u0026rdquo; consumption. Peer effects suggest that seeing others spend more will push up one\u0026rsquo;s own spending. Prospect theory suggests that people make decisions relative to reference points, so expected income shapes consumption. Mental accounting, meanwhile, says people experience different kinds of spending differently; for example, people are often more willing to spend on education and healthcare. So what empirical papers need to do is sort out the boundary conditions of intuitive conclusions. Which institution is causing the effect? Which effect is actually operating? Under what social conditions does it hold? ","date":"2024-08-20","heading":"Intuitive conclusions can contradict each other","objectID":"/en/posts/fs2/:1:0","tags":["Economic Methodology"],"title":"Empirical economics: intuitive does not mean obvious","uri":"/en/posts/fs2/#intuitive-conclusions-can-contradict-each-other"},{"categories":["Economic Studies"],"collections":["Reflections on Learning Economics","Academic Rhetoric"],"content":"Intuitive conclusions are not easy to arrive at\rWith the explosion in popularity of Black Myth: Wukong, Chinese gamers have been arguing online about the size of the domestic single-player market. A lot of people directly use Palworld sales as a benchmark. That is obviously not right. At the very least, the structure should look something like this: $$黑神话销量 \\times 黑神话价格 = 帕鲁价格 \\times 帕鲁销量$$ A more careful estimate would also have to consider income levels, population structure, game quality, marketing, genre, and so on. But let us assume all of those are the same, and let us even assume that the utility from spending x yuan on a game is simply x. Now add one more seemingly obvious proposition - the higher the price, the lower the demand - and something interesting happens. Even within the same single-player market, different prices change the realized market size. The aggregate may look identical in some abstract sense, but the actual market scale still moves with pricing. ","date":"2024-08-20","heading":"Intuitive conclusions are not easy to arrive at","objectID":"/en/posts/fs2/:2:0","tags":["Economic Methodology"],"title":"Empirical economics: intuitive does not mean obvious","uri":"/en/posts/fs2/#intuitive-conclusions-are-not-easy-to-arrive-at"},{"categories":["Economic Studies"],"collections":["Reflections on Learning Economics","Academic Rhetoric"],"content":"Counterintuition hides behind intuition\rI want to use one of Feynman\u0026rsquo;s examples. You ask why someone slipped on the ice. Why did he slip? Because he was on ice. Why is ice slippery? Because under pressure, ice melts into water? Why does ice melt into water under pressure? Because that is how matter behaves under force. And just like that, we arrive at mechanics, then particles, then the place where things stop feeling intuitive. Here is another example. Students in physics, mathematics, and economics are all familiar with the brachistochrone problem. The starting point is simple enough: light refracts. Put a chopstick into water and it looks bent. The high-school explanation is that light travels at different speeds in different media, so the angle of refraction depends on those speeds. But a deeper question follows: why should light - why should nature - pursue this kind of optimization in time? Does saving time matter to light? That is where quantum mechanics later gives us the idea of \u0026ldquo;action.\u0026rdquo; Put simply, light tries every path, but the inefficient ones are canceled out by interference, leaving only the most efficient path in the end. Social science and science\rA scientific question: is theoretical science invented, or discovered. At the theoretical level, both natural science and social science seem to begin by recognizing patterns. The key is what pattern we recognize in what phenomenon. I can recognize different patterns in the same phenomenon, and I can also extract the same pattern from different phenomena. Simple questions can also rise into a perspective: Common sense may be widely shared, but the principles behind common sense are not themselves common sense. A paper in China Economic Quarterly titled \u0026ldquo;Climate change increases household electricity consumption: from the perspective of adaptive behavior\u0026rdquo; uses air-conditioning data. The argument is that earlier work mostly studied climate improvement itself, whereas air-conditioner consumption is a form of human adaptation to climate change, so AC data can be studied from an adaptation perspective. A Nature sub-journal paper does something similar with food delivery under extreme heat: Urban food delivery services as extreme heat adaptation. The financial crisis had long-lasting effects, and so did the Great Famine. So people began studying how those who lived through particular historical periods make decisions later in life, shaped by those experiences. That is where economics gets cohort effects: people who went through the same historical environment tend to share certain traits. Dragon years tend to bring baby booms, because in China the dragon is a favored zodiac sign. At the same time, research finds that Dragon-year babies often perform better later on. One explanation is that if parents deliberately choose a Dragon year, that signals high expectations, and they also invest more care and effort. The pattern researchers uncover, then, is the self-fulfilling power of a superstition. It is exactly the old idea of believing in belief itself. US data show that transgender people smoke more frequently. At first glance that sounds pretty dull, but the perspective drawn from it is minority status and stress consumption. From primary school onward, we are taught to move from the small to the large. Elegant mathematical models and good analysis of social phenomena work the same way: they generalize from the particular. ","date":"2024-08-20","heading":"Counterintuition hides behind intuition","objectID":"/en/posts/fs2/:3:0","tags":["Economic Methodology"],"title":"Empirical economics: intuitive does not mean obvious","uri":"/en/posts/fs2/#counterintuition-hides-behind-intuition"},{"categories":["Economic Studies"],"collections":["Reflections on Learning Economics","Academic Rhetoric"],"content":"On intuition\rA lot of people like to use the term \u0026ldquo;research taste.\u0026rdquo; Some even start mixing Chinese and English at this point and say taste in English. I dislike this tendency to mystify research design. Research is not mysterious, and it does not need to be genuinely counterintuitive. Every study moves forward by standing on the shoulders of earlier work. Just because each small innovation fits intuition does not mean it contributes nothing. What matters is summarizing what earlier work has taught us and refining a genuinely fresh perspective. ","date":"2024-08-20","heading":"On intuition","objectID":"/en/posts/fs2/:4:0","tags":["Economic Methodology"],"title":"Empirical economics: intuitive does not mean obvious","uri":"/en/posts/fs2/#on-intuition"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Custom fonts\rSee Hugo Custom Fonts ","date":"2024-08-10","heading":"Custom fonts","objectID":"/en/posts/runtime/:1:0","tags":["Hugo"],"title":"Hugo Customization 2","uri":"/en/posts/runtime/#custom-fonts"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Site runtime with multilingual support\rAdd the site runtime and total blog word count to the footer, with automatic multilingual switching: The effect looks like this: Chinese and English comparison\rA typical multilingual Hugo blog has an i18n file, whose purpose is to read the page language parameter and then replace the corresponding text. ","date":"2024-08-10","heading":"Site runtime with multilingual support","objectID":"/en/posts/runtime/:2:0","tags":["Hugo"],"title":"Hugo Customization 2","uri":"/en/posts/runtime/#site-runtime-with-multilingual-support"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Total word count\rAdding a total blog word count\rFind \u0026lt;your blog folder\u0026gt;\\layouts\\partials\\footer.html, and add the following code inside it: {{ $articleCount := len .Site.RegularPages }} {{ $totalWordCount := 0 }} {{ range .Site.Pages }} {{ $totalWordCount = add $totalWordCount .WordCount }} {{ end }} {{ i18n \"articleCount\" (dict \"Count\" $articleCount) }}，{{ i18n \"totalWordCount\" (dict \"WordCount\" $totalWordCount) }}。\rThen find \u0026lt;your blog folder\u0026gt;\\i18n and add the following in zh-CN.toml: # === footer/wordcount === [articleCount] other = \"发布了 {{ .Count }} 篇文章\" [totalWordCount] other = \"共 {{ .WordCount }} 字\"\rand add the following in en.toml: # === footer/wordcount === [articleCount] other = \"published {{ .Count }} posts\" [totalWordCount] other = \"total {{ .WordCount }} words\"\rMultilingual switching is clearly a one-to-one character match. So in the i18n file, each [call name] can only have one other=, and [call names] must not be duplicated, so that characters can be switched one-to-one automatically. A bug\rIf, like me, you added a music player to every blog post page via aplayer, you\u0026rsquo;ll hit a bug. Hugo\u0026rsquo;s built-in word count conflicts with aplayer. A pure-music player will disappear, while a player with lyrics might stick around. The reason is unknown. When rendering locally, updating the blog content and triggering a refresh makes the music player reappear, but after uploading to GitHub for rendering it doesn\u0026rsquo;t work. Updated February 21, 2026\rRecently I used Claude Code with the DeepSeek v3.2 model to test this bug. I found the music plugin\u0026rsquo;s failure is roughly due to this: The LoveIt theme uses Hugo\u0026rsquo;s Scratch system as a \u0026ldquo;feature flag\u0026rdquo; mechanism: The music shortcode sets this when it executes: {{- .Page.Scratch.SetInMap \u0026quot;this\u0026quot; \u0026quot;music\u0026quot; true -}} assets.html checks: {{- if (.Scratch.Get \u0026quot;this\u0026quot;).music -}} to load the music assets. wordcount.html introduces a change: {{- $posts := where .Site.RegularPages \"Type\" \"posts\" -}} {{- range $posts -}} {{- $totalWords = add $totalWords .WordCount -}} {{- $totalPosts = add $totalPosts 1 -}} {{- end -}}\rWhen Hugo executes .Site.RegularPages: To get the WordCount, Hugo needs to compute each post\u0026rsquo;s content, which resets the page\u0026rsquo;s Scratch state. In the process, the Scratch state that was maintained within a single rendering pass gets disturbed. My personal observation is that whether a comment plugin is installed also affects this bug, seemingly for the same reason — the Scratch state value appears to be cleared. In the comment section, layouts/partials/comment.html has code like this: {{- dict \"comment\" $commentConfig | dict \"config\" | merge (.Scratch.Get \"this\") | .Scratch.Set \"this\" -}}\rLocal rendering can reload the this map in scratch by updating the site, but after uploading to GitHub it tends to get mapped to empty. The modified flow: Previous flow: music shortcode → Scratch set → theme conditional check → load assets Modified flow: directly detect the DOM → dynamically load assets → self-initialize\rLooking back, this bug is quite similar to the one in Chinese blog TOC navigation failure. ","date":"2024-08-10","heading":"Total word count","objectID":"/en/posts/runtime/:2:1","tags":["Hugo"],"title":"Hugo Customization 2","uri":"/en/posts/runtime/#total-word-count"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Total word count\rAdding a total blog word count\rFind \u0026lt;your blog folder\u0026gt;\\layouts\\partials\\footer.html, and add the following code inside it: {{ $articleCount := len .Site.RegularPages }} {{ $totalWordCount := 0 }} {{ range .Site.Pages }} {{ $totalWordCount = add $totalWordCount .WordCount }} {{ end }} {{ i18n \"articleCount\" (dict \"Count\" $articleCount) }}，{{ i18n \"totalWordCount\" (dict \"WordCount\" $totalWordCount) }}。\rThen find \u0026lt;your blog folder\u0026gt;\\i18n and add the following in zh-CN.toml: # === footer/wordcount === [articleCount] other = \"发布了 {{ .Count }} 篇文章\" [totalWordCount] other = \"共 {{ .WordCount }} 字\"\rand add the following in en.toml: # === footer/wordcount === [articleCount] other = \"published {{ .Count }} posts\" [totalWordCount] other = \"total {{ .WordCount }} words\"\rMultilingual switching is clearly a one-to-one character match. So in the i18n file, each [call name] can only have one other=, and [call names] must not be duplicated, so that characters can be switched one-to-one automatically. A bug\rIf, like me, you added a music player to every blog post page via aplayer, you\u0026rsquo;ll hit a bug. Hugo\u0026rsquo;s built-in word count conflicts with aplayer. A pure-music player will disappear, while a player with lyrics might stick around. The reason is unknown. When rendering locally, updating the blog content and triggering a refresh makes the music player reappear, but after uploading to GitHub for rendering it doesn\u0026rsquo;t work. Updated February 21, 2026\rRecently I used Claude Code with the DeepSeek v3.2 model to test this bug. I found the music plugin\u0026rsquo;s failure is roughly due to this: The LoveIt theme uses Hugo\u0026rsquo;s Scratch system as a \u0026ldquo;feature flag\u0026rdquo; mechanism: The music shortcode sets this when it executes: {{- .Page.Scratch.SetInMap \u0026quot;this\u0026quot; \u0026quot;music\u0026quot; true -}} assets.html checks: {{- if (.Scratch.Get \u0026quot;this\u0026quot;).music -}} to load the music assets. wordcount.html introduces a change: {{- $posts := where .Site.RegularPages \"Type\" \"posts\" -}} {{- range $posts -}} {{- $totalWords = add $totalWords .WordCount -}} {{- $totalPosts = add $totalPosts 1 -}} {{- end -}}\rWhen Hugo executes .Site.RegularPages: To get the WordCount, Hugo needs to compute each post\u0026rsquo;s content, which resets the page\u0026rsquo;s Scratch state. In the process, the Scratch state that was maintained within a single rendering pass gets disturbed. My personal observation is that whether a comment plugin is installed also affects this bug, seemingly for the same reason — the Scratch state value appears to be cleared. In the comment section, layouts/partials/comment.html has code like this: {{- dict \"comment\" $commentConfig | dict \"config\" | merge (.Scratch.Get \"this\") | .Scratch.Set \"this\" -}}\rLocal rendering can reload the this map in scratch by updating the site, but after uploading to GitHub it tends to get mapped to empty. The modified flow: Previous flow: music shortcode → Scratch set → theme conditional check → load assets Modified flow: directly detect the DOM → dynamically load assets → self-initialize\rLooking back, this bug is quite similar to the one in Chinese blog TOC navigation failure. ","date":"2024-08-10","heading":"Adding a total blog word count","objectID":"/en/posts/runtime/:2:1","tags":["Hugo"],"title":"Hugo Customization 2","uri":"/en/posts/runtime/#adding-a-total-blog-word-count"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Total word count\rAdding a total blog word count\rFind \u0026lt;your blog folder\u0026gt;\\layouts\\partials\\footer.html, and add the following code inside it: {{ $articleCount := len .Site.RegularPages }} {{ $totalWordCount := 0 }} {{ range .Site.Pages }} {{ $totalWordCount = add $totalWordCount .WordCount }} {{ end }} {{ i18n \"articleCount\" (dict \"Count\" $articleCount) }}，{{ i18n \"totalWordCount\" (dict \"WordCount\" $totalWordCount) }}。\rThen find \u0026lt;your blog folder\u0026gt;\\i18n and add the following in zh-CN.toml: # === footer/wordcount === [articleCount] other = \"发布了 {{ .Count }} 篇文章\" [totalWordCount] other = \"共 {{ .WordCount }} 字\"\rand add the following in en.toml: # === footer/wordcount === [articleCount] other = \"published {{ .Count }} posts\" [totalWordCount] other = \"total {{ .WordCount }} words\"\rMultilingual switching is clearly a one-to-one character match. So in the i18n file, each [call name] can only have one other=, and [call names] must not be duplicated, so that characters can be switched one-to-one automatically. A bug\rIf, like me, you added a music player to every blog post page via aplayer, you\u0026rsquo;ll hit a bug. Hugo\u0026rsquo;s built-in word count conflicts with aplayer. A pure-music player will disappear, while a player with lyrics might stick around. The reason is unknown. When rendering locally, updating the blog content and triggering a refresh makes the music player reappear, but after uploading to GitHub for rendering it doesn\u0026rsquo;t work. Updated February 21, 2026\rRecently I used Claude Code with the DeepSeek v3.2 model to test this bug. I found the music plugin\u0026rsquo;s failure is roughly due to this: The LoveIt theme uses Hugo\u0026rsquo;s Scratch system as a \u0026ldquo;feature flag\u0026rdquo; mechanism: The music shortcode sets this when it executes: {{- .Page.Scratch.SetInMap \u0026quot;this\u0026quot; \u0026quot;music\u0026quot; true -}} assets.html checks: {{- if (.Scratch.Get \u0026quot;this\u0026quot;).music -}} to load the music assets. wordcount.html introduces a change: {{- $posts := where .Site.RegularPages \"Type\" \"posts\" -}} {{- range $posts -}} {{- $totalWords = add $totalWords .WordCount -}} {{- $totalPosts = add $totalPosts 1 -}} {{- end -}}\rWhen Hugo executes .Site.RegularPages: To get the WordCount, Hugo needs to compute each post\u0026rsquo;s content, which resets the page\u0026rsquo;s Scratch state. In the process, the Scratch state that was maintained within a single rendering pass gets disturbed. My personal observation is that whether a comment plugin is installed also affects this bug, seemingly for the same reason — the Scratch state value appears to be cleared. In the comment section, layouts/partials/comment.html has code like this: {{- dict \"comment\" $commentConfig | dict \"config\" | merge (.Scratch.Get \"this\") | .Scratch.Set \"this\" -}}\rLocal rendering can reload the this map in scratch by updating the site, but after uploading to GitHub it tends to get mapped to empty. The modified flow: Previous flow: music shortcode → Scratch set → theme conditional check → load assets Modified flow: directly detect the DOM → dynamically load assets → self-initialize\rLooking back, this bug is quite similar to the one in Chinese blog TOC navigation failure. ","date":"2024-08-10","heading":"A bug","objectID":"/en/posts/runtime/:2:1","tags":["Hugo"],"title":"Hugo Customization 2","uri":"/en/posts/runtime/#a-bug"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Site runtime\rAdding a custom custom.js\rCreate a custom JavaScript file \\static\\js\\custom.js in the site root directory. Write the following code into it: /* Site runtime */ // Get the current language setting function getCurrentLanguage() { // Assume you have a global variable or method to get the current language return document.documentElement.lang || 'zh'; // Defaults to Chinese } // Update the site runtime function runtime() { window.setTimeout(runtime, 1000); let startTime = new Date('02/18/2024 15:00:00'); //Write your own site launch time here let endTime = new Date(); let usedTime = endTime - startTime; let days = Math.floor(usedTime / (24 * 3600 * 1000)); let leavel = usedTime % (24 * 3600 * 1000); let hours = Math.floor(leavel / (3600 * 1000)); let leavel2 = leavel % (3600 * 1000); let minutes = Math.floor(leavel2 / (60 * 1000)); let leavel3 = leavel2 % (60 * 1000); let seconds = Math.floor(leavel3 / (1000)); // Select the corresponding text based on the language setting let language = getCurrentLanguage(); let runtimeText; if (language === 'zh') { runtimeText = '本站已运行 ' + ((days \u003c 10) ? '0' : '') + days + ' 天 ' + ((hours \u003c 10) ? '0' : '') + hours + ' 时 ' + ((minutes \u003c 10) ? '0' : '') + minutes + ' 分 ' + ((seconds \u003c 10) ? '0' : '') + seconds + ' 秒 '; } else if (language === 'en') { runtimeText = 'Running for ' + ((days \u003c 10) ? '0' : '') + days + ' d ' + ((hours \u003c 10) ? '0' : '') + hours + ' h ' + ((minutes \u003c 10) ? '0' : '') + minutes + ' m ' + ((seconds \u003c 10) ? '0' : '') + seconds + ' s '; } else { // Default text (you can choose another language or keep Chinese/English) runtimeText = '本站已运行 ' + ((days \u003c 10) ? '0' : '') + days + ' 天 ' + ((hours \u003c 10) ? '0' : '') + hours + ' 时 ' + ((minutes \u003c 10) ? '0' : '') + minutes + ' 分 ' + ((seconds \u003c 10) ? '0' : '') + seconds + ' 秒 '; } // Update the content on the page document.getElementById('run-time').innerHTML = runtimeText; } runtime();\rThose who are interested can also check out this site\u0026rsquo;s complete custom.js. Find \u0026lt;your blog folder\u0026gt;\\layouts\\partials\\assets.html, and add the following code on the line above the {{- partial \u0026quot;plugin/analytics.html\u0026quot; . -}} at the very end: {{- /* custom js file */ -}} This way the blog can call the custom js file. Other js files can be written here too. Modifying i18n\rFind \u0026lt;your blog folder\u0026gt;\\i18n Add the following in zh-CN.toml: [runtime] other = \"本站已运行{{ .Days }}天 {{ .Hours }}小时 {{ .Minutes }}分钟 {{ .Seconds }}秒\"\rAdd the following in en.toml: [runtime] other = \"The site has been running for {{ .Days }} days {{ .Hours }} hours {{ .Minutes }} minutes {{ .Seconds }} seconds\"\r","date":"2024-08-10","heading":"Site runtime","objectID":"/en/posts/runtime/:2:2","tags":["Hugo"],"title":"Hugo Customization 2","uri":"/en/posts/runtime/#site-runtime"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Site runtime\rAdding a custom custom.js\rCreate a custom JavaScript file \\static\\js\\custom.js in the site root directory. Write the following code into it: /* Site runtime */ // Get the current language setting function getCurrentLanguage() { // Assume you have a global variable or method to get the current language return document.documentElement.lang || 'zh'; // Defaults to Chinese } // Update the site runtime function runtime() { window.setTimeout(runtime, 1000); let startTime = new Date('02/18/2024 15:00:00'); //Write your own site launch time here let endTime = new Date(); let usedTime = endTime - startTime; let days = Math.floor(usedTime / (24 * 3600 * 1000)); let leavel = usedTime % (24 * 3600 * 1000); let hours = Math.floor(leavel / (3600 * 1000)); let leavel2 = leavel % (3600 * 1000); let minutes = Math.floor(leavel2 / (60 * 1000)); let leavel3 = leavel2 % (60 * 1000); let seconds = Math.floor(leavel3 / (1000)); // Select the corresponding text based on the language setting let language = getCurrentLanguage(); let runtimeText; if (language === 'zh') { runtimeText = '本站已运行 ' + ((days \u003c 10) ? '0' : '') + days + ' 天 ' + ((hours \u003c 10) ? '0' : '') + hours + ' 时 ' + ((minutes \u003c 10) ? '0' : '') + minutes + ' 分 ' + ((seconds \u003c 10) ? '0' : '') + seconds + ' 秒 '; } else if (language === 'en') { runtimeText = 'Running for ' + ((days \u003c 10) ? '0' : '') + days + ' d ' + ((hours \u003c 10) ? '0' : '') + hours + ' h ' + ((minutes \u003c 10) ? '0' : '') + minutes + ' m ' + ((seconds \u003c 10) ? '0' : '') + seconds + ' s '; } else { // Default text (you can choose another language or keep Chinese/English) runtimeText = '本站已运行 ' + ((days \u003c 10) ? '0' : '') + days + ' 天 ' + ((hours \u003c 10) ? '0' : '') + hours + ' 时 ' + ((minutes \u003c 10) ? '0' : '') + minutes + ' 分 ' + ((seconds \u003c 10) ? '0' : '') + seconds + ' 秒 '; } // Update the content on the page document.getElementById('run-time').innerHTML = runtimeText; } runtime();\rThose who are interested can also check out this site\u0026rsquo;s complete custom.js. Find \u0026lt;your blog folder\u0026gt;\\layouts\\partials\\assets.html, and add the following code on the line above the {{- partial \u0026quot;plugin/analytics.html\u0026quot; . -}} at the very end: {{- /* custom js file */ -}} This way the blog can call the custom js file. Other js files can be written here too. Modifying i18n\rFind \u0026lt;your blog folder\u0026gt;\\i18n Add the following in zh-CN.toml: [runtime] other = \"本站已运行{{ .Days }}天 {{ .Hours }}小时 {{ .Minutes }}分钟 {{ .Seconds }}秒\"\rAdd the following in en.toml: [runtime] other = \"The site has been running for {{ .Days }} days {{ .Hours }} hours {{ .Minutes }} minutes {{ .Seconds }} seconds\"\r","date":"2024-08-10","heading":"Adding a custom","objectID":"/en/posts/runtime/:2:2","tags":["Hugo"],"title":"Hugo Customization 2","uri":"/en/posts/runtime/#adding-a-custom-customjs"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Site runtime\rAdding a custom custom.js\rCreate a custom JavaScript file \\static\\js\\custom.js in the site root directory. Write the following code into it: /* Site runtime */ // Get the current language setting function getCurrentLanguage() { // Assume you have a global variable or method to get the current language return document.documentElement.lang || 'zh'; // Defaults to Chinese } // Update the site runtime function runtime() { window.setTimeout(runtime, 1000); let startTime = new Date('02/18/2024 15:00:00'); //Write your own site launch time here let endTime = new Date(); let usedTime = endTime - startTime; let days = Math.floor(usedTime / (24 * 3600 * 1000)); let leavel = usedTime % (24 * 3600 * 1000); let hours = Math.floor(leavel / (3600 * 1000)); let leavel2 = leavel % (3600 * 1000); let minutes = Math.floor(leavel2 / (60 * 1000)); let leavel3 = leavel2 % (60 * 1000); let seconds = Math.floor(leavel3 / (1000)); // Select the corresponding text based on the language setting let language = getCurrentLanguage(); let runtimeText; if (language === 'zh') { runtimeText = '本站已运行 ' + ((days \u003c 10) ? '0' : '') + days + ' 天 ' + ((hours \u003c 10) ? '0' : '') + hours + ' 时 ' + ((minutes \u003c 10) ? '0' : '') + minutes + ' 分 ' + ((seconds \u003c 10) ? '0' : '') + seconds + ' 秒 '; } else if (language === 'en') { runtimeText = 'Running for ' + ((days \u003c 10) ? '0' : '') + days + ' d ' + ((hours \u003c 10) ? '0' : '') + hours + ' h ' + ((minutes \u003c 10) ? '0' : '') + minutes + ' m ' + ((seconds \u003c 10) ? '0' : '') + seconds + ' s '; } else { // Default text (you can choose another language or keep Chinese/English) runtimeText = '本站已运行 ' + ((days \u003c 10) ? '0' : '') + days + ' 天 ' + ((hours \u003c 10) ? '0' : '') + hours + ' 时 ' + ((minutes \u003c 10) ? '0' : '') + minutes + ' 分 ' + ((seconds \u003c 10) ? '0' : '') + seconds + ' 秒 '; } // Update the content on the page document.getElementById('run-time').innerHTML = runtimeText; } runtime();\rThose who are interested can also check out this site\u0026rsquo;s complete custom.js. Find \u0026lt;your blog folder\u0026gt;\\layouts\\partials\\assets.html, and add the following code on the line above the {{- partial \u0026quot;plugin/analytics.html\u0026quot; . -}} at the very end: {{- /* custom js file */ -}} This way the blog can call the custom js file. Other js files can be written here too. Modifying i18n\rFind \u0026lt;your blog folder\u0026gt;\\i18n Add the following in zh-CN.toml: [runtime] other = \"本站已运行{{ .Days }}天 {{ .Hours }}小时 {{ .Minutes }}分钟 {{ .Seconds }}秒\"\rAdd the following in en.toml: [runtime] other = \"The site has been running for {{ .Days }} days {{ .Hours }} hours {{ .Minutes }} minutes {{ .Seconds }} seconds\"\r","date":"2024-08-10","heading":"Modifying","objectID":"/en/posts/runtime/:2:2","tags":["Hugo"],"title":"Hugo Customization 2","uri":"/en/posts/runtime/#modifying-i18n"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Background\r","date":"2024-08-10","heading":"Background","objectID":"/en/posts/runtime/:3:0","tags":["Hugo"],"title":"Hugo Customization 2","uri":"/en/posts/runtime/#background"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Blog background\rWe can set the blog background by directly adding a js file in footer.html. This post uses the honeycomb striped network. There are other js options too, like grid, sphere, wave, ribbon\u0026hellip; For a reference, see: Some recommended clean and pretty blog background effects Ribbon: Wave: Honeycomb: Random dots: Light sphere: ","date":"2024-08-10","heading":"Blog background","objectID":"/en/posts/runtime/:3:1","tags":["Hugo"],"title":"Hugo Customization 2","uri":"/en/posts/runtime/#blog-background"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Notes\rIntroducing a js background needs to limit its scope. For example, if you introduce it in the footer without defining a scope, the footer links will be covered and become unclickable. As shown\rIt\u0026rsquo;s best to define an environment block at the start of the footer for layering: Finally, set the introduced js to the bottom layer: data-zIndex=\u0026quot;-1\u0026quot; ","date":"2024-08-10","heading":"Notes","objectID":"/en/posts/runtime/:3:2","tags":["Hugo"],"title":"Hugo Customization 2","uri":"/en/posts/runtime/#notes"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Mascot\rI added it in header.html: Sakana widget integration ","date":"2024-08-10","heading":"Mascot","objectID":"/en/posts/runtime/:4:0","tags":["Hugo"],"title":"Hugo Customization 2","uri":"/en/posts/runtime/#mascot"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Heading styles\r","date":"2024-08-10","heading":"Heading styles","objectID":"/en/posts/runtime/:5:0","tags":["Hugo"],"title":"Hugo Customization 2","uri":"/en/posts/runtime/#heading-styles"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"What I changed\rThe heading styles I changed: H2 to H6 headings: Font size shrinks step by step from 30. Added interactivity — hover to enlarge. Keeps each heading on its own line. H2: shadow effect, gradient blue box + surrounded by #, centered H3 to H6: The lower the level, the more vertical lines. For example, the H4 heading (#### h4) in the image has two vertical lines on the left, while H3 has only one. Headings are wrapped in a transparent box with a shadow effect. Compatible with day/night mode switching. H4 to H6: added an equilateral triangle as decoration. The effect looks like this: Result\r","date":"2024-08-10","heading":"What I changed","objectID":"/en/posts/runtime/:5:1","tags":["Hugo"],"title":"Hugo Customization 2","uri":"/en/posts/runtime/#what-i-changed"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"How to change\rIn \u0026lt;your blog\u0026gt;\\assets\\css\\_custom.scss, add the following: If you previously customized heading styles, remember to delete them. /* Headings **************************/ /* ====================================================================== */ /* H2 heading: centered + gradient + left/right # decoration */ /* ====================================================================== */ .page.single h2 { position: relative !important; display: block !important; /* Make sure the heading is a block-level element occupying its own line */ width: max-content !important; /* Let width adapt to content so margin: auto can center it */ margin: 2.5rem auto !important; /* Center the block-level element */ font-weight: bold !important; font-size: 30px !important; line-height: 1.4 !important; color: #fff !important; background: linear-gradient(90deg, #4a90e2, #50c9c3) !important; border-radius: 8px !important; padding: 10px 24px !important; text-align: center !important; /* --- Enhanced Shadow --- */ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important; transition: all 0.3s ease !important; /* Keep transition for smooth hover */ } /* --- H2 Interactive Hover Effect --- */ .page.single h2:hover { box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25) !important; /* Deeper shadow on hover */ transform: scale(1.02) !important; /* Keep only the enlargement effect */ cursor: pointer !important; } /* H2 Dark Mode Shadow */ [data-theme=\"dark\"] .page.single h2 { box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3) !important; } /* H2 Dark Mode Hover */ [data-theme=\"dark\"] .page.single h2:hover { box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6) !important; } /* Hide the theme's auto-generated anchor */ .page.single h2 .headerlink, .page.single h2 a.headerlink { display: none !important; } /* H2 left/right # decoration */ .page.single h2::before { content: \"#\" !important; position: absolute !important; left: -32px !important; top: 50% !important; transform: translateY(-50%) !important; color: #4a90e2 !important; font-weight: bold !important; font-size: 1.4rem !important; } .page.single h2::after { content: \"#\" !important; position: absolute !important; right: -32px !important; top: 50% !important; transform: translateY(-50%) !important; color: #50c9c3 !important; font-weight: bold !important; font-size: 1.4rem !important; } /* ====================================================================== */ /* H3-H6: left-aligned + multiple vertical lines for levels + light background + shadow + triangle symbol */ /* ====================================================================== */ /* Hide built-in anchor */ .page.single h3 a.headerlink, .page.single h4 a.headerlink, .page.single h5 a.headerlink, .page.single h6 a.headerlink { display: none !important; } /* Common base styles */ .page.single h3, .page.single h4, .page.single h5, .page.single h6 { position: relative !important; display: block !important; margin: 20px 0 12px !important; line-height: 1.5 !important; font-weight: bold !important; border-radius: 0 6px 6px 0 !important; /* --- Transparent background for light mode --- */ background: rgba(74, 144, 226, 0.05) !important; /* --- Enhanced shadow for light mode --- */ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08) !important; transition: all 0.3s ease !important; /* Keep transition for smooth hover */ } /* --- H3-H5 Interactive Hover Effect --- */ .page.single h3:hover, .page.single h4:hover, .page.single h5:hover { transform: translateX(4px) !important; /* Move slightly to the right */ background: rgba(74, 144, 226, 0.1) !important; /* Increase opacity */ box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12) !important; /* Slightly stronger shadow */ cursor: pointer !important; } /* Dark Mode General Styles */ [data-theme=\"dark\"] .page.single h3, [data-theme=\"dark\"] .page.single h4, [data-theme=\"dark\"] .page.single h5, [data-theme=\"dark\"] .page.single h6 { /* --- Lighter, transparent background for dark mode --- */ background: rgba(255, 255, 255, 0.08) !important; /* -","date":"2024-08-10","heading":"How to change","objectID":"/en/posts/runtime/:5:2","tags":["Hugo"],"title":"Hugo Customization 2","uri":"/en/posts/runtime/#how-to-change"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Rendering math formulas in the blog\rAlthough the LoveIt theme provides math formula support via KaTeX, I personally think the experience is not as good as MathJax. To use MathJax, first create mathjax.html in \u0026lt;your blog\u0026gt;\\layouts\\partials. mathjax.html: right-click on the site\u0026rsquo;s formulas to support copying the formula code. As shown\r{{ if .Params.math }} {{ end }}\rThen add the call in \u0026lt;your blog\u0026gt;\\layouts\\partials\\header.html: {{ partial \"mathjax.html\" . }}\rIn each post, to enable math formula rendering, put this at the top: Math = true\rSince Hugo, when rendering Markdown documents, generates HTML based on syntax like _/*/\u0026gt;\u0026gt;, and some escaped-character text (like \\(/\\)/\\[/\\]/\\\\) gets escaped automatically, you need extra escape-character expressions in these places to enable automatic rendering: _ -\u0026gt; \\_ * -\u0026gt; \\* \u0026gt;\u0026gt; -\u0026gt; \\\u0026gt;\u0026gt; \\( -\u0026gt; \\\\( \\) -\u0026gt; \\\\) \\[ -\u0026gt; \\\\[ \\] -\u0026gt; \\\\] \\\\ -\u0026gt; \\\\\\\\ For example, if I render the following formula: \\[ V(\\varepsilon)=\\int_{0}^{T}F[t,\\underbrace{y^{*}\\left(t\\right)+\\varepsilon p\\left(t\\right)}_{y(t)},\\underbrace{y^{*}\\left(t\\right)+\\varepsilon p^{\\prime}\\left(t\\right)}_{y^{’}\\left(t\\right)}]dt \\]\rIt will actually become: $$ V （\\varepsilon）=\\int_{0}^{T}F[t,\\underbrace{y^{*}\\left （t\\right）\u0026#43;\\varepsilon p\\left （t\\right）}_{y （t）},\\underbrace{y^{*}\\left （t\\right）\u0026#43;\\varepsilon p^{\\prime}\\left （t\\right）}_{y^{’}\\left （t\\right）}]dt $$ Only by converting to \\_ ^\\* \\\\[ \\\\] is it correct: \\\\[ V(\\varepsilon)=\\int\\_{0}^{T}F[t,\\underbrace{y^{\\*}\\left(t\\right)+\\varepsilon p\\left(t\\right)}\\_{y(t)},\\underbrace{y^{\\*}\\left(t\\right)+\\varepsilon p^{\\prime}\\left(t\\right)}\\_{y^{'}\\left(t\\right)}]dt \\\\]\r\\[ V （\\varepsilon）=\\int_{0}^{T}F[t,\\underbrace{y^{*}\\left （t\\right）+\\varepsilon p\\left （t\\right）}_{y （t）},\\underbrace{y^{*}\\left （t\\right）+\\varepsilon p^{\\prime}\\left （t\\right）}_{y^{\u0026rsquo;}\\left （t\\right）}]dt \\] But in my own experience, sometimes converting only half the commands in a formula is enough for it to render — how many commands to convert seems related to rendering complexity. For example, I render $2\\_i^\\*-2_j^*$ — $2_i^\\*-2_j^*$, and since the formula is simple, it renders the same whether or not I convert the commands. ","date":"2024-08-10","heading":"Rendering math formulas in the blog","objectID":"/en/posts/runtime/:6:0","tags":["Hugo"],"title":"Hugo Customization 2","uri":"/en/posts/runtime/#rendering-math-formulas-in-the-blog"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"References\rTotal word count Adding site runtime Some Hugo template syntax Hugo total post count and total word count ","date":"2024-08-10","heading":"References","objectID":"/en/posts/runtime/:7:0","tags":["Hugo"],"title":"Hugo Customization 2","uri":"/en/posts/runtime/#references"},{"categories":["Software Tools"],"collections":["Python Environment Setup"],"content":"After anaconda crashed for the second time, I understood why people so highly recommend vscode and pycharm as practical ides for python. But I still quite like the idea of using the browser as an ide. Compared to notebook, I prefer jupyter, so I\u0026rsquo;ve decided to redo the whole installation process here. ","date":"2024-08-09","heading":"","objectID":"/en/posts/pytorch2/:0:0","tags":["Anaconda","Python","PyTorch","Jupyter"],"title":"Uninstalling and Installing Anaconda","uri":"/en/posts/pytorch2/#"},{"categories":["Software Tools"],"collections":["Python Environment Setup"],"content":"Uninstalling anaconda\rOpen anaconda prompt , download and run the uninstall command. Its purpose is to clean up Anaconda\u0026rsquo;s config files and environment settings. conda install anaconda-clean anaconda-clean --yes\rNext, open the folder where you previously installed anaconda and run the uninstaller Uninstall-Anaconda3.exe. For example, mine is at D:\\anaconda\\anaconda. As shown\r","date":"2024-08-09","heading":"Uninstalling anaconda","objectID":"/en/posts/pytorch2/:1:0","tags":["Anaconda","Python","PyTorch","Jupyter"],"title":"Uninstalling and Installing Anaconda","uri":"/en/posts/pytorch2/#uninstalling-anaconda"},{"categories":["Software Tools"],"collections":["Python Environment Setup"],"content":"Installation\rDownload one from the official site and install it all the way through. After installing, add path in the computer\u0026rsquo;s advanced environment settings: the first one is your own install path. D:\\anaconda\\anaconda D:\\anaconda\\anaconda\\Scripts D:\\anaconda\\anaconda\\Library\\bin\rAs shown\r","date":"2024-08-09","heading":"Installation","objectID":"/en/posts/pytorch2/:2:0","tags":["Anaconda","Python","PyTorch","Jupyter"],"title":"Uninstalling and Installing Anaconda","uri":"/en/posts/pytorch2/#installation"},{"categories":["Software Tools"],"collections":["Python Environment Setup"],"content":"Jupyter shortcuts and working directory\rTo make it easier to launch, first create a shortcut pointing to jupyter. Type where jupyter-lab in anaconda prompt to find the location. Then search online for a matching .ico icon. I recommend downloading from this site. As shown\rNext, set the working directory, which is the folder jupyter opens by default. Enter the following command in anaconda prompt to create the settings: jupyter notebook --generate-config\rNext, find the generated config file C:\\Users\\\u0026lt;your username\u0026gt;\\.jupyter\\jupyter_notebook_config.py. Search for notebook_dir inside it and change it to the directory you want: c.ServerApp.notebook_dir = 'D:\\PyTorch_practice'. ","date":"2024-08-09","heading":"Jupyter shortcuts and working directory","objectID":"/en/posts/pytorch2/:3:0","tags":["Anaconda","Python","PyTorch","Jupyter"],"title":"Uninstalling and Installing Anaconda","uri":"/en/posts/pytorch2/#jupyter-shortcuts-and-working-directory"},{"categories":["Software Tools"],"collections":["Python Environment Setup"],"content":"Pytorch environment setup\rFor deep learning, you need to first download cuda, then set up an environment where pytorch can run. See CUDA download. The key point is to match the corresponding cuda version with the pytorch version when downloading. For example, I downloaded cuda 12.4, but since the latest pytorch hadn\u0026rsquo;t adapted to cuda 12.4 yet, I chose to download a pytorch environment suited for cuda 12.1. Next, open anaconda prompt to set up the environment. Although the latest python is 3.13, the most compatible version is 3.11. Now let\u0026rsquo;s create the jupyter environment: ","date":"2024-08-09","heading":"Pytorch environment setup","objectID":"/en/posts/pytorch2/:4:0","tags":["Anaconda","Python","PyTorch","Jupyter"],"title":"Uninstalling and Installing Anaconda","uri":"/en/posts/pytorch2/#pytorch-environment-setup"},{"categories":["Software Tools"],"collections":["Python Environment Setup"],"content":"Specify the python version and manage environments uniformly on the D drive.\rconda config --remove pinned_packages python\rconda create -p D:\\anaconda_envs\\MLGPU python=3.11 -y\r","date":"2024-08-09","heading":"Specify the python version and manage environments uniformly on the D drive.","objectID":"/en/posts/pytorch2/:4:1","tags":["Anaconda","Python","PyTorch","Jupyter"],"title":"Uninstalling and Installing Anaconda","uri":"/en/posts/pytorch2/#specify-the-python-version-and-manage-environments-uniformly-on-the-d-drive"},{"categories":["Software Tools"],"collections":["Python Environment Setup"],"content":"Switch to the corresponding environment and install pytorch-related packages:\rconda activate MLGPU\rconda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia -y\r","date":"2024-08-09","heading":"Switch to the corresponding environment and install pytorch-related packages:","objectID":"/en/posts/pytorch2/:4:2","tags":["Anaconda","Python","PyTorch","Jupyter"],"title":"Uninstalling and Installing Anaconda","uri":"/en/posts/pytorch2/#switch-to-the-corresponding-environment-and-install-pytorch-related-packages"},{"categories":["Software Tools"],"collections":["Python Environment Setup"],"content":"Some python packages I commonly use:\rInstall in batches, otherwise it\u0026rsquo;s easy to hit conflicts and freezes. (The symptom is that in Task Manager, python\u0026rsquo;s disk usage stays at 0 for a long time but the download doesn\u0026rsquo;t finish.) In the future, also be careful to reduce mixing pip and conda. Mixing itself doesn\u0026rsquo;t hurt, but when there are many packages it can crash the environment. When downloading python, you can reasonably turn off security software like Huorong, as these programs slow disk write speed. conda install -y scikit-learn statsmodels networkx igraph -c conda-forge --verbose conda install -y matplotlib seaborn plotly -c conda-forge --verbose conda install -y openpyxl xlrd xlwt python-dateutil -c conda-forge --verbose conda install -y tqdm -c conda-forge --verbose pip install aquarel pip install jieba\r","date":"2024-08-09","heading":"Some python packages I commonly use:","objectID":"/en/posts/pytorch2/:4:3","tags":["Anaconda","Python","PyTorch","Jupyter"],"title":"Uninstalling and Installing Anaconda","uri":"/en/posts/pytorch2/#some-python-packages-i-commonly-use"},{"categories":["Software Tools"],"collections":["Python Environment Setup"],"content":"Register the jupyterlab kernel\rconda install -y jupyterlab -c conda-forge jupyter lab pip install ipykernel python -m ipykernel install --user --name=MLGPU --display-name \"Python (MLGPU)\"\r","date":"2024-08-09","heading":"Register the jupyterlab kernel","objectID":"/en/posts/pytorch2/:4:4","tags":["Anaconda","Python","PyTorch","Jupyter"],"title":"Uninstalling and Installing Anaconda","uri":"/en/posts/pytorch2/#register-the-jupyterlab-kernel"},{"categories":["Software Tools"],"collections":["Python Environment Setup"],"content":"Jupyter plugins and appearance\rChinese language pack download (needs to run in the base environment) pip install jupyterlab-language-pack-zh-CN\rPlugins I personally recommend: variableInspector: you can click to view the data attributes of the current code. execute-time: view the runtime record of the current code. upyterlab-lsp: code auto-completion. Theme plugins I quite like: Of course, dark mode is a must. jupyterlab_stellars_sublime_theme As shown\rjupyterlab_stellars_sublime_theme As shown\rjupyterlab_ariakedark_theme As shown\r","date":"2024-08-09","heading":"Jupyter plugins and appearance","objectID":"/en/posts/pytorch2/:5:0","tags":["Anaconda","Python","PyTorch","Jupyter"],"title":"Uninstalling and Installing Anaconda","uri":"/en/posts/pytorch2/#jupyter-plugins-and-appearance"},{"categories":["Software Tools"],"collections":["Python Environment Setup"],"content":"People generally use pytorch to build neural networks these days. Building them needs the CUDA + python + pytorch trio. Here are some installation details. Image source: Wikipedia\rRecommended installation tutorial: This post supplements the parts the videos after 2024 didn\u0026rsquo;t emphasize. The Chinese pdf in the video is more detailed than the official download instructions, so I recommend it. ","date":"2024-07-26","heading":"","objectID":"/en/posts/pytorch/:0:0","tags":["PyTorch","CUDA","Anaconda"],"title":"PyTorch Setup Error: [WinError 126] The specified module could not be found.","uri":"/en/posts/pytorch/#"},{"categories":["Software Tools"],"collections":["Python Environment Setup"],"content":"Installing CUDA\r","date":"2024-07-26","heading":"Installing CUDA","objectID":"/en/posts/pytorch/:1:0","tags":["PyTorch","CUDA","Anaconda"],"title":"PyTorch Setup Error: [WinError 126] The specified module could not be found.","uri":"/en/posts/pytorch/#installing-cuda"},{"categories":["Software Tools"],"collections":["Python Environment Setup"],"content":"Version matching\rNote: CUDA and pytorch versions correspond one-to-one, it\u0026rsquo;s not a matter of downloading the latest. For example, as of July 26, 2024 — the latest CUDA version is 12.7, but pytorch has no matching version for it. Version matching can be checked on the pytorch official site. ","date":"2024-07-26","heading":"Version matching","objectID":"/en/posts/pytorch/:1:1","tags":["PyTorch","CUDA","Anaconda"],"title":"PyTorch Setup Error: [WinError 126] The specified module could not be found.","uri":"/en/posts/pytorch/#version-matching"},{"categories":["Software Tools"],"collections":["Python Environment Setup"],"content":"Downloading CUDA\rAfter downloading from the CUDA official site, the first time you choose a download location. At this point the download location is temporary installer storage — the folder is deleted after downloading. First location choice\rThe second custom install location is the real CUDA install location. If the second location is the same as the first, the files will be deleted. Second location choice\r","date":"2024-07-26","heading":"Downloading CUDA","objectID":"/en/posts/pytorch/:1:2","tags":["PyTorch","CUDA","Anaconda"],"title":"PyTorch Setup Error: [WinError 126] The specified module could not be found.","uri":"/en/posts/pytorch/#downloading-cuda"},{"categories":["Software Tools"],"collections":["Python Environment Setup"],"content":"Installing Pytorch\rAfter installing according to the tutorial, running it in python gives the following error: [WinError 126] The specified module could not be found.\rYou followed the tutorial exactly, but still get an error?\rThe real cause is that the WIN11 environment conflicts with Pytorch. Many python-related component errors are the same issue. The solution is to download visual studio and download MSVC v143-VS 2022 C++x64/x86 生成工具(最新) inside it. The English name is MSVC v143 -VS 2022 C++ x64/x86 build tools (Latest) Downloading components\r","date":"2024-07-26","heading":"Installing Pytorch","objectID":"/en/posts/pytorch/:2:0","tags":["PyTorch","CUDA","Anaconda"],"title":"PyTorch Setup Error: [WinError 126] The specified module could not be found.","uri":"/en/posts/pytorch/#installing-pytorch"},{"categories":["Software Tools"],"collections":["Python Environment Setup"],"content":"References\r[OSError: [WinError 126] The specified module could not be found]（ https://github.com/pytorch/pytorch/issues/131662 ） LeNet study notes ","date":"2024-07-26","heading":"References","objectID":"/en/posts/pytorch/:3:0","tags":["PyTorch","CUDA","Anaconda"],"title":"PyTorch Setup Error: [WinError 126] The specified module could not be found.","uri":"/en/posts/pytorch/#references"},{"categories":["Commentary"],"collections":[],"content":"Two of my favorite BGM tracks ","date":"2024-07-25","heading":"","objectID":"/en/posts/nzcp/:0:0","tags":["Games"],"title":"Ace Attorney review: the path to a turnabout lies within","uri":"/en/posts/nzcp/#"},{"categories":["Commentary"],"collections":[],"content":"Philosophy matters more than logic\rThink about the kind of turnabout philosophy you can find in other games: 《Death Stranding》: ropes meant for protection and sticks meant for attack switch places. 《Red Dead Redemption 2》: instead of showing the glory days of the West, it shows an era and a protagonist already in decline. 《Elden Ring》: it is not that the enemies and levels keep getting harder; it is that the player keeps getting stronger. 《Honkai Impact 3rd》: it is not Fu Hua turning into a Herrscher, but the Herrscher turning into Fu Hua. 《In/Spectre》: the protagonist has to fabricate the truth instead of exposing it. These examples are not meant to say that every design above is \u0026ldquo;turnabout thinking.\u0026rdquo; I only want to say— \u0026ldquo;if you look at a problem through a framework that flips one of its key elements, you can end up with a surprisingly interesting perspective.\u0026rdquo; In a familiar detective setup where clues are used to catch the criminal, how do you reverse it? You make a game where evidence is used to defend the suspect\r! Do not think about what evidence can prove the criminal did. Think instead about what consequences must follow once the criminal has done it\r. Do not ask why the culprit wanted to do it. Ask instead about the reason the culprit had no choice but to do it\r. To me, the elegance of Ace Attorney lies in the way it brings in a turnabout-like philosophical perspective rather than airtight logical deduction. (If you want to pick apart the cases, you definitely can.) ","date":"2024-07-25","heading":"Philosophy matters more than logic","objectID":"/en/posts/nzcp/:1:0","tags":["Games"],"title":"Ace Attorney review: the path to a turnabout lies within","uri":"/en/posts/nzcp/#philosophy-matters-more-than-logic"},{"categories":["Commentary"],"collections":[],"content":"Rhythmic expression\rUsing courtroom debate as its core mechanic, Ace Attorney attacks by finding holes in testimony and presenting evidence. Paired with the \u0026ldquo;Hold it! Objection! Take that!\u0026rdquo; voice clips, the trials give you the thrill of trading moves in a turn-based battle. The unbeatable speech bubble\rEvery character has a distinct animation set, and the controller rumbles a lot, too. As for the way each case builds, the way the characters perform, and the way the BGM rises at exactly the right time, there is not much more I need to add. The one weak point is that when several pieces of evidence relate to several statements, the game often expects a strict one-to-one match, and that can be misleading. The story works more as suspense than deduction. In other words, the pleasure comes from seeing earlier setup pay off, not from predicting the big reversal in advance. When the ending suddenly runs through everything that came before it, that is the moment when even the toughest player starts tearing up. The true ending is always written for the people who stay with the whole story. That is where Shu Takumi is strongest. What I like even more is the rhythm of thematic escalation across the cases in games 1 through 3. First layer: the lawyer\u0026rsquo;s stance, the pursuit of innocence. At this stage, the core idea is to let the evidence speak, fight to the very end, and never give up on the defense. Second layer: the prosecution enters, and the focus shifts to truth and trust After the first game lays the groundwork, the defense attorney feels almost heroic. But then what about the prosecution, the side responsible for securing a conviction? The defense pursues innocence, and the prosecution pursues guilt. When the same piece of evidence is pulled back and forth by both sides, it becomes possible to see it from a more objective angle. Truth is born from that struggle between guilt and innocence. What matters in a courtroom system is that both sides can trust it. If each side fully carries through its own convictions, truth has a chance to emerge from the collision. Third layer: the player\u0026rsquo;s own sense of ethics The setting may be fictional, but ethical philosophy always shines in thought experiments. In the game, innocence is the result the player chases, and it usually lines up with a happy ending. But what if innocence leads to the bad ending instead? That is the contradiction the defense has to face. An innocent verdict that hurts people, and a guilty verdict that comforts them: the game throws out the question and refuses to hand over an answer. (Still, when the friendship-and-bonds energy kicks in, it absolutely works.) ","date":"2024-07-25","heading":"Rhythmic expression","objectID":"/en/posts/nzcp/:2:0","tags":["Games"],"title":"Ace Attorney review: the path to a turnabout lies within","uri":"/en/posts/nzcp/#rhythmic-expression"},{"categories":["Commentary"],"collections":[],"content":"Visual novels never really end\rEven though Ace Attorney is not a galgame, its pixel look and looping BGM always remind me of 16bit Sensation. Even rough technology can still produce a great story. Even if the story has already drawn to a close, a brief moment of persistence might still spark a miracle. A lawyer should smile more when things get dangerous. Maybe that is the final turnabout spirit. Trust in your client, trust in your opponent, digging into contradictions, pursuing the truth, the will to never give up\u0026hellip;\u0026hellip; It can all begin with a single line— \u0026ldquo;異議あり!\u0026rdquo; Objection!\r","date":"2024-07-25","heading":"Visual novels never really end","objectID":"/en/posts/nzcp/:3:0","tags":["Games"],"title":"Ace Attorney review: the path to a turnabout lies within","uri":"/en/posts/nzcp/#visual-novels-never-really-end"},{"categories":["Commentary"],"collections":[],"content":"Related links\rAce Attorney Simulator Ace Attorney assets ","date":"2024-07-25","heading":"Related links","objectID":"/en/posts/nzcp/:4:0","tags":["Games"],"title":"Ace Attorney review: the path to a turnabout lies within","uri":"/en/posts/nzcp/#related-links"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"The essentials\rThe paper Pensions and Fertility: Microeconomic Evidence uses Brazilian microdata to study the relationship between pension provision and fertility. Conclusion: Viewed through economic circulation and factor substitution, one traditional role of raising children is old-age support. Naturally, the provision of pensions eases that worry, so fertility falls. Contribution: Historical experience shows that fertility fell around the time many high- and middle-income countries introduced or expanded their social security systems1🤯. On the mechanism side of how fiscal public policy affects fertility, there\u0026rsquo;s relatively little research, and most of it uses OLG macro models; this paper uses micro analysis. Econometric design: I quite like this paper\u0026rsquo;s econometric design. It studies how a pension reform affects women\u0026rsquo;s fertility decisions, and since women in different states should react differently, it adds event-study analysis across different women\u0026rsquo;s groups to strengthen the argument. ","date":"2024-07-13","heading":"The essentials","objectID":"/en/posts/paf/:1:0","tags":["Fertility","Causal Inference"],"title":" Pensions and Fertility","uri":"/en/posts/paf/#the-essentials"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Theoretical and real-world background\r","date":"2024-07-13","heading":"Theoretical and real-world background","objectID":"/en/posts/paf/:2:0","tags":["Fertility","Causal Inference"],"title":" Pensions and Fertility","uri":"/en/posts/paf/#theoretical-and-real-world-background"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Theory\rPeople say Chinese papers love to coin terms, but doesn\u0026rsquo;t this AER paper coin a bunch of its own terms in its theoretical explanations? It even goes out of its way to phrase things convolutedly to highlight a made-up effect. But correspondingly, the interesting part of this paper is how it decomposes fertility decisions and summarizes them into quantifiable constraints. Women\u0026rsquo;s age\rSurvival effect: Before and after the pension reform, there are both new and old women; old women already have two children and face lower fertility risk. Information effect: older women are more familiar with childrearing and so won\u0026rsquo;t hoard children. Saturation effect: mothers who have already reached their desired number of children, or are in the late stage of childbearing, will reduce their likelihood of having children. Pension wealth effect: mothers near retirement and young mothers get different discounted pension streams from the reform, so their decisions react differently. Salience effect: the more obvious the pension reform\u0026rsquo;s outcome, the more salient people\u0026rsquo;s reaction2. Consider a woman\u0026rsquo;s decision to have a child. Her decision basis includes her own physical suitability for pregnancy and the number and gender composition of children she already has. Young mothers will react more readily to the pension reform, while older mothers react less; comparing the two groups\u0026rsquo; data makes the paper\u0026rsquo;s analysis more credible. Number and structure of children\rThe more children before the reform, the less likely to add another birth. The more sons a family has before the reform3, the less likely to add another birth. ","date":"2024-07-13","heading":"Theory","objectID":"/en/posts/paf/:2:1","tags":["Fertility","Causal Inference"],"title":" Pensions and Fertility","uri":"/en/posts/paf/#theory"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Theory\rPeople say Chinese papers love to coin terms, but doesn\u0026rsquo;t this AER paper coin a bunch of its own terms in its theoretical explanations? It even goes out of its way to phrase things convolutedly to highlight a made-up effect. But correspondingly, the interesting part of this paper is how it decomposes fertility decisions and summarizes them into quantifiable constraints. Women\u0026rsquo;s age\rSurvival effect: Before and after the pension reform, there are both new and old women; old women already have two children and face lower fertility risk. Information effect: older women are more familiar with childrearing and so won\u0026rsquo;t hoard children. Saturation effect: mothers who have already reached their desired number of children, or are in the late stage of childbearing, will reduce their likelihood of having children. Pension wealth effect: mothers near retirement and young mothers get different discounted pension streams from the reform, so their decisions react differently. Salience effect: the more obvious the pension reform\u0026rsquo;s outcome, the more salient people\u0026rsquo;s reaction2. Consider a woman\u0026rsquo;s decision to have a child. Her decision basis includes her own physical suitability for pregnancy and the number and gender composition of children she already has. Young mothers will react more readily to the pension reform, while older mothers react less; comparing the two groups\u0026rsquo; data makes the paper\u0026rsquo;s analysis more credible. Number and structure of children\rThe more children before the reform, the less likely to add another birth. The more sons a family has before the reform3, the less likely to add another birth. ","date":"2024-07-13","heading":"Women\u0026rsquo;s age","objectID":"/en/posts/paf/:2:1","tags":["Fertility","Causal Inference"],"title":" Pensions and Fertility","uri":"/en/posts/paf/#womens-age"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Theory\rPeople say Chinese papers love to coin terms, but doesn\u0026rsquo;t this AER paper coin a bunch of its own terms in its theoretical explanations? It even goes out of its way to phrase things convolutedly to highlight a made-up effect. But correspondingly, the interesting part of this paper is how it decomposes fertility decisions and summarizes them into quantifiable constraints. Women\u0026rsquo;s age\rSurvival effect: Before and after the pension reform, there are both new and old women; old women already have two children and face lower fertility risk. Information effect: older women are more familiar with childrearing and so won\u0026rsquo;t hoard children. Saturation effect: mothers who have already reached their desired number of children, or are in the late stage of childbearing, will reduce their likelihood of having children. Pension wealth effect: mothers near retirement and young mothers get different discounted pension streams from the reform, so their decisions react differently. Salience effect: the more obvious the pension reform\u0026rsquo;s outcome, the more salient people\u0026rsquo;s reaction2. Consider a woman\u0026rsquo;s decision to have a child. Her decision basis includes her own physical suitability for pregnancy and the number and gender composition of children she already has. Young mothers will react more readily to the pension reform, while older mothers react less; comparing the two groups\u0026rsquo; data makes the paper\u0026rsquo;s analysis more credible. Number and structure of children\rThe more children before the reform, the less likely to add another birth. The more sons a family has before the reform3, the less likely to add another birth. ","date":"2024-07-13","heading":"Number and structure of children","objectID":"/en/posts/paf/:2:1","tags":["Fertility","Causal Inference"],"title":" Pensions and Fertility","uri":"/en/posts/paf/#number-and-structure-of-children"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Reality\rSince the mid-twentieth century, under the influence of urbanization, medical care, education, and other expansions, Brazil\u0026rsquo;s fertility fell sharply. Against this backdrop, Brazil carried out a comprehensive pension reform. Before the 1970s, only urban workers with formal jobs were entitled to scattered, occupation-specific pensions, but the reform in the October 1988 constitution of the Federative Republic of Brazil significantly expanded pension coverage, giving rural workers pension benefits for the first time in Brazilian history. The pension reform took effect after being legally approved in July 1991. For urban workers, the pension rules and benefits barely changed. But for rural workers, regardless of whether they had formal employment or paid any social security contributions, women (men) became eligible for a pension from age 55 (60). It is precisely against this historical background that, in the paper\u0026rsquo;s event study, 1988 became the event check contrasting with 1991. ","date":"2024-07-13","heading":"Reality","objectID":"/en/posts/paf/:2:2","tags":["Fertility","Causal Inference"],"title":" Pensions and Fertility","uri":"/en/posts/paf/#reality"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Data and methods\r","date":"2024-07-13","heading":"Data and methods","objectID":"/en/posts/paf/:3:0","tags":["Fertility","Causal Inference"],"title":" Pensions and Fertility","uri":"/en/posts/paf/#data-and-methods"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"APC panel\rThe paper uses multiple cross-sections from the Brazilian National Household Sample Survey (PNAD), covering the years 1981-1990, 1992-1993, 1995-1999, 2001-2009, and 2011-2014. On APC panels — see my earlier note: HLT: Lifecycle and Wage Decomposition, section one. Although the paper uses an APC panel, it doesn\u0026rsquo;t actually decompose the relevant effects; instead it restricts the age cohorts and then uses event-study analysis to compare how differently people react to the policy. A supplement on APC panels and the three effects\rPanel data tracking the same individuals is always hard to obtain, so people turned to long cross-sections, matching multiple cross-sections together. This kind of panel data is common in epidemiological and demographic statistics and is called APC (age-period-cohort) data. Obviously, an APC panel contains three data dimensions. Age: age, i.e. the influence of biological characteristics. For example, age\u0026rsquo;s biological characteristics can divide fertility suitability, labor-force quality\u0026hellip;\u0026hellip; Period: the time when the cross-section was collected, e.g. the technology level and infrastructure level at the time of each year\u0026rsquo;s census\u0026hellip;\u0026hellip; Cohort: the birth year/month of each cross-section, generally seen as a group that jointly experienced certain social environments or historical events, and hence is similar. Since age+cohort=period, these variables are often confounded, and collinearity arises in practice. In econometrics, one often first estimates one of the effects through some means (a clever difference based on the object\u0026rsquo;s characteristics) and then regresses the remainder; or imposes additional linear constraints on the regression; or uses high-order differences (like individual-effect estimation) to estimate the three effects separately. Demography often uses APC panels to draw Lexis diagrams: The horizontal and vertical axes are period time and age time, and the lines in between are grouped by cohort; analysis and prediction unfold by comparing the trends and differences of the lines. Lexis diagram (image from Wikipedia)\r","date":"2024-07-13","heading":"APC panel","objectID":"/en/posts/paf/:3:1","tags":["Fertility","Causal Inference"],"title":" Pensions and Fertility","uri":"/en/posts/paf/#apc-panel"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Variables and the econometric specification\rDependent variables\rShort-run effect: equals 1 if the woman gave birth within one year of the data-collection year, and 0 otherwise (based on the household roster and birth data). The sample includes female respondents of childbearing age (15 to 44) from 1981 to 1999. Long-run effect: the total number of children of a woman at age 45 (including surviving and deceased children). The sample includes female respondents born between 1930 and 1969, who were aged 45 to 69 in the given survey year. The authors trace the total births of respondents older than 45 in the survey year (1984-2014) back to their fertility at age 45 (1975-2014). The treated group is urban workers; the control group is rural workers. The econometric regression\rDifference-in-differences\r$$ \\begin{aligned}y \\_{igtr}^{SR}\u0026amp;= \\alpha^{SR}\u0026#43;\\beta\\big(RURAL \\_{g}^{SR}\\times POST \\_{t}^{SR}\\big)\\\\\\\\\u0026amp;\u0026#43; \\gamma RURAL \\_{g}^{SR}\u0026#43;\\lambda_{t}^{SR}\u0026#43;\\phi \\_{r}^{SR}\u0026#43;\\psi^{\\prime}\\mathbf{X} \\_{igtr}^{SR}\u0026#43;\\epsilon_{igtr}^{SR} \\end{aligned} $$ Subscripts: r region, g rural-urban group, i individual, t year, r state. $y_{igtr}^{SR}$: the short-run effect. Gave birth within one year of the survey year. $RURAL_{g}^{SR}$: dummy for rural-worker women. $POST_{t}^{SR}$: dummy for the July 1991 rural pension policy reform. $\\mathbf{X}\\_{igtr}^{SR}$: controls for individual, job, family, and region-level characteristics. Effects: time effects $\\lambda_{t}^{SR}$, individual effects $\\phi_{r}^{SR}$, robust clustering at the federal-state level. The pension reform lowered fertility in the short run; In the group regression, the young group (15-29) is insignificant, while the older group (30-44) shows a significant fertility decline; the more children there are, and the higher the proportion of sons, the lower the desire for more children. Instrumental variables\rTreat the DID (differences in the pension-reform policy implementation) as an instrument for pensions ($\\ln(pensionwealth)_{igtr}$). First stage: $$ \\begin{aligned}\\ln(pensionwealth)\\_{igtr}\u0026amp;= \\sigma^{SR}\u0026#43;\\theta\\big(RURAL\\_{g}^{SR}\\times POST\\_{t}^{SR}\\big)\\\\\\\\\u0026amp;\u0026#43;\\eta RURAL\\_{g}^{SR}\u0026#43;\\delta\\_{t}^{SR}\u0026#43;\\tau\\_{r}^{SR}\u0026#43;\\kappa^{\\prime}\\mathbf{X}\\_{igtr}^{SR}\u0026#43;\\mu\\_{igtr}^{SR}\\end{aligned} $$ Second stage: $$ \\begin{aligned}y\\_{igtr}^{SR}\u0026amp;=\\alpha^{SR}\u0026#43;\\beta\\ln\\left(\\widehat{pensionwealth}\\right)\\_{igrt}\\\\\\\\\u0026amp;\u0026#43;\\gamma RURAL\\_g^{SR}\u0026#43;\\lambda\\_t^{SR}\u0026#43;\\phi\\_r^{SR}\u0026#43;\\psi^{\\prime}\\mathbf{X}\\_{igtr}^{SR}\u0026#43;\\epsilon\\_{igtr}^{SR}\\end{aligned} $$ Event study\rOn event studies, see Econometrics: Event Studies 1. In short, an event study can be viewed as the dynamic treatment effect of difference-in-differences. In terms of the equation, this means time-slicing the policy variable $POST_{t}^{SR}$ and expanding it into $\\sum YEAR_T^{LR}$. $$ \\begin{aligned}y\\_{igtr}^{LR}\u0026amp;=\\alpha^{LR}\u0026#43;\\sum_{t=-16}^{23}\\beta_t\\big(RURAL\\_g^{LR}\\times YEAR_t^{LR}\\big)\\\\\\\\\u0026amp;\u0026#43;\\gamma RURAL_g^{LR}\u0026#43;\\lambda\\_t^{LR}\u0026#43;\\phi\\_r^{LR}\u0026#43;\\psi^{\\prime}\\mathbf{X}\\_{iglr}^{LR}\u0026#43;\\epsilon\\_{iglr}^{LR},\\end{aligned} $$ Subscripts: r region, g rural-urban group, i individual, t year, r state. $y_{igtr}^{LR}$: the long-run effect. Total number of children at age 45. $RURAL_{g}^{LR}$: dummy for rural-worker women. $YEAR_{t}^{LR}$: policy-time dummy. $\\mathbf{X}\\_{igtr}^{SR}$: controls for years of education, marriage dummy, and lifetime labor supply. Effects: cohort effects $\\lambda_{t}^{LR}$, individual effects $\\phi_{r}^{LR}$, robust clustering at the federal-state level. In the difference-in-differences part, $\\lambda_{t}$ is the survey-year time dummy, a time effect representing the technology level, medical level, and infrastructure at the time the data were collected; In the event-study part, $\\lambda_{t}$ is the birth-year time dummy, used to flag that a particular group experienced a particular historical social environment. On thi","date":"2024-07-13","heading":"Variables and the econometric specification","objectID":"/en/posts/paf/:3:2","tags":["Fertility","Causal Inference"],"title":" Pensions and Fertility","uri":"/en/posts/paf/#variables-and-the-econometric-specification"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Variables and the econometric specification\rDependent variables\rShort-run effect: equals 1 if the woman gave birth within one year of the data-collection year, and 0 otherwise (based on the household roster and birth data). The sample includes female respondents of childbearing age (15 to 44) from 1981 to 1999. Long-run effect: the total number of children of a woman at age 45 (including surviving and deceased children). The sample includes female respondents born between 1930 and 1969, who were aged 45 to 69 in the given survey year. The authors trace the total births of respondents older than 45 in the survey year (1984-2014) back to their fertility at age 45 (1975-2014). The treated group is urban workers; the control group is rural workers. The econometric regression\rDifference-in-differences\r$$ \\begin{aligned}y \\_{igtr}^{SR}\u0026amp;= \\alpha^{SR}\u0026#43;\\beta\\big(RURAL \\_{g}^{SR}\\times POST \\_{t}^{SR}\\big)\\\\\\\\\u0026amp;\u0026#43; \\gamma RURAL \\_{g}^{SR}\u0026#43;\\lambda_{t}^{SR}\u0026#43;\\phi \\_{r}^{SR}\u0026#43;\\psi^{\\prime}\\mathbf{X} \\_{igtr}^{SR}\u0026#43;\\epsilon_{igtr}^{SR} \\end{aligned} $$ Subscripts: r region, g rural-urban group, i individual, t year, r state. $y_{igtr}^{SR}$: the short-run effect. Gave birth within one year of the survey year. $RURAL_{g}^{SR}$: dummy for rural-worker women. $POST_{t}^{SR}$: dummy for the July 1991 rural pension policy reform. $\\mathbf{X}\\_{igtr}^{SR}$: controls for individual, job, family, and region-level characteristics. Effects: time effects $\\lambda_{t}^{SR}$, individual effects $\\phi_{r}^{SR}$, robust clustering at the federal-state level. The pension reform lowered fertility in the short run; In the group regression, the young group (15-29) is insignificant, while the older group (30-44) shows a significant fertility decline; the more children there are, and the higher the proportion of sons, the lower the desire for more children. Instrumental variables\rTreat the DID (differences in the pension-reform policy implementation) as an instrument for pensions ($\\ln(pensionwealth)_{igtr}$). First stage: $$ \\begin{aligned}\\ln(pensionwealth)\\_{igtr}\u0026amp;= \\sigma^{SR}\u0026#43;\\theta\\big(RURAL\\_{g}^{SR}\\times POST\\_{t}^{SR}\\big)\\\\\\\\\u0026amp;\u0026#43;\\eta RURAL\\_{g}^{SR}\u0026#43;\\delta\\_{t}^{SR}\u0026#43;\\tau\\_{r}^{SR}\u0026#43;\\kappa^{\\prime}\\mathbf{X}\\_{igtr}^{SR}\u0026#43;\\mu\\_{igtr}^{SR}\\end{aligned} $$ Second stage: $$ \\begin{aligned}y\\_{igtr}^{SR}\u0026amp;=\\alpha^{SR}\u0026#43;\\beta\\ln\\left(\\widehat{pensionwealth}\\right)\\_{igrt}\\\\\\\\\u0026amp;\u0026#43;\\gamma RURAL\\_g^{SR}\u0026#43;\\lambda\\_t^{SR}\u0026#43;\\phi\\_r^{SR}\u0026#43;\\psi^{\\prime}\\mathbf{X}\\_{igtr}^{SR}\u0026#43;\\epsilon\\_{igtr}^{SR}\\end{aligned} $$ Event study\rOn event studies, see Econometrics: Event Studies 1. In short, an event study can be viewed as the dynamic treatment effect of difference-in-differences. In terms of the equation, this means time-slicing the policy variable $POST_{t}^{SR}$ and expanding it into $\\sum YEAR_T^{LR}$. $$ \\begin{aligned}y\\_{igtr}^{LR}\u0026amp;=\\alpha^{LR}\u0026#43;\\sum_{t=-16}^{23}\\beta_t\\big(RURAL\\_g^{LR}\\times YEAR_t^{LR}\\big)\\\\\\\\\u0026amp;\u0026#43;\\gamma RURAL_g^{LR}\u0026#43;\\lambda\\_t^{LR}\u0026#43;\\phi\\_r^{LR}\u0026#43;\\psi^{\\prime}\\mathbf{X}\\_{iglr}^{LR}\u0026#43;\\epsilon\\_{iglr}^{LR},\\end{aligned} $$ Subscripts: r region, g rural-urban group, i individual, t year, r state. $y_{igtr}^{LR}$: the long-run effect. Total number of children at age 45. $RURAL_{g}^{LR}$: dummy for rural-worker women. $YEAR_{t}^{LR}$: policy-time dummy. $\\mathbf{X}\\_{igtr}^{SR}$: controls for years of education, marriage dummy, and lifetime labor supply. Effects: cohort effects $\\lambda_{t}^{LR}$, individual effects $\\phi_{r}^{LR}$, robust clustering at the federal-state level. In the difference-in-differences part, $\\lambda_{t}$ is the survey-year time dummy, a time effect representing the technology level, medical level, and infrastructure at the time the data were collected; In the event-study part, $\\lambda_{t}$ is the birth-year time dummy, used to flag that a particular group experienced a particular historical social environment. On thi","date":"2024-07-13","heading":"Dependent variables","objectID":"/en/posts/paf/:3:2","tags":["Fertility","Causal Inference"],"title":" Pensions and Fertility","uri":"/en/posts/paf/#dependent-variables"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Variables and the econometric specification\rDependent variables\rShort-run effect: equals 1 if the woman gave birth within one year of the data-collection year, and 0 otherwise (based on the household roster and birth data). The sample includes female respondents of childbearing age (15 to 44) from 1981 to 1999. Long-run effect: the total number of children of a woman at age 45 (including surviving and deceased children). The sample includes female respondents born between 1930 and 1969, who were aged 45 to 69 in the given survey year. The authors trace the total births of respondents older than 45 in the survey year (1984-2014) back to their fertility at age 45 (1975-2014). The treated group is urban workers; the control group is rural workers. The econometric regression\rDifference-in-differences\r$$ \\begin{aligned}y \\_{igtr}^{SR}\u0026amp;= \\alpha^{SR}\u0026#43;\\beta\\big(RURAL \\_{g}^{SR}\\times POST \\_{t}^{SR}\\big)\\\\\\\\\u0026amp;\u0026#43; \\gamma RURAL \\_{g}^{SR}\u0026#43;\\lambda_{t}^{SR}\u0026#43;\\phi \\_{r}^{SR}\u0026#43;\\psi^{\\prime}\\mathbf{X} \\_{igtr}^{SR}\u0026#43;\\epsilon_{igtr}^{SR} \\end{aligned} $$ Subscripts: r region, g rural-urban group, i individual, t year, r state. $y_{igtr}^{SR}$: the short-run effect. Gave birth within one year of the survey year. $RURAL_{g}^{SR}$: dummy for rural-worker women. $POST_{t}^{SR}$: dummy for the July 1991 rural pension policy reform. $\\mathbf{X}\\_{igtr}^{SR}$: controls for individual, job, family, and region-level characteristics. Effects: time effects $\\lambda_{t}^{SR}$, individual effects $\\phi_{r}^{SR}$, robust clustering at the federal-state level. The pension reform lowered fertility in the short run; In the group regression, the young group (15-29) is insignificant, while the older group (30-44) shows a significant fertility decline; the more children there are, and the higher the proportion of sons, the lower the desire for more children. Instrumental variables\rTreat the DID (differences in the pension-reform policy implementation) as an instrument for pensions ($\\ln(pensionwealth)_{igtr}$). First stage: $$ \\begin{aligned}\\ln(pensionwealth)\\_{igtr}\u0026amp;= \\sigma^{SR}\u0026#43;\\theta\\big(RURAL\\_{g}^{SR}\\times POST\\_{t}^{SR}\\big)\\\\\\\\\u0026amp;\u0026#43;\\eta RURAL\\_{g}^{SR}\u0026#43;\\delta\\_{t}^{SR}\u0026#43;\\tau\\_{r}^{SR}\u0026#43;\\kappa^{\\prime}\\mathbf{X}\\_{igtr}^{SR}\u0026#43;\\mu\\_{igtr}^{SR}\\end{aligned} $$ Second stage: $$ \\begin{aligned}y\\_{igtr}^{SR}\u0026amp;=\\alpha^{SR}\u0026#43;\\beta\\ln\\left(\\widehat{pensionwealth}\\right)\\_{igrt}\\\\\\\\\u0026amp;\u0026#43;\\gamma RURAL\\_g^{SR}\u0026#43;\\lambda\\_t^{SR}\u0026#43;\\phi\\_r^{SR}\u0026#43;\\psi^{\\prime}\\mathbf{X}\\_{igtr}^{SR}\u0026#43;\\epsilon\\_{igtr}^{SR}\\end{aligned} $$ Event study\rOn event studies, see Econometrics: Event Studies 1. In short, an event study can be viewed as the dynamic treatment effect of difference-in-differences. In terms of the equation, this means time-slicing the policy variable $POST_{t}^{SR}$ and expanding it into $\\sum YEAR_T^{LR}$. $$ \\begin{aligned}y\\_{igtr}^{LR}\u0026amp;=\\alpha^{LR}\u0026#43;\\sum_{t=-16}^{23}\\beta_t\\big(RURAL\\_g^{LR}\\times YEAR_t^{LR}\\big)\\\\\\\\\u0026amp;\u0026#43;\\gamma RURAL_g^{LR}\u0026#43;\\lambda\\_t^{LR}\u0026#43;\\phi\\_r^{LR}\u0026#43;\\psi^{\\prime}\\mathbf{X}\\_{iglr}^{LR}\u0026#43;\\epsilon\\_{iglr}^{LR},\\end{aligned} $$ Subscripts: r region, g rural-urban group, i individual, t year, r state. $y_{igtr}^{LR}$: the long-run effect. Total number of children at age 45. $RURAL_{g}^{LR}$: dummy for rural-worker women. $YEAR_{t}^{LR}$: policy-time dummy. $\\mathbf{X}\\_{igtr}^{SR}$: controls for years of education, marriage dummy, and lifetime labor supply. Effects: cohort effects $\\lambda_{t}^{LR}$, individual effects $\\phi_{r}^{LR}$, robust clustering at the federal-state level. In the difference-in-differences part, $\\lambda_{t}$ is the survey-year time dummy, a time effect representing the technology level, medical level, and infrastructure at the time the data were collected; In the event-study part, $\\lambda_{t}$ is the birth-year time dummy, used to flag that a particular group experienced a particular historical social environment. On thi","date":"2024-07-13","heading":"The econometric regression","objectID":"/en/posts/paf/:3:2","tags":["Fertility","Causal Inference"],"title":" Pensions and Fertility","uri":"/en/posts/paf/#the-econometric-regression"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Variables and the econometric specification\rDependent variables\rShort-run effect: equals 1 if the woman gave birth within one year of the data-collection year, and 0 otherwise (based on the household roster and birth data). The sample includes female respondents of childbearing age (15 to 44) from 1981 to 1999. Long-run effect: the total number of children of a woman at age 45 (including surviving and deceased children). The sample includes female respondents born between 1930 and 1969, who were aged 45 to 69 in the given survey year. The authors trace the total births of respondents older than 45 in the survey year (1984-2014) back to their fertility at age 45 (1975-2014). The treated group is urban workers; the control group is rural workers. The econometric regression\rDifference-in-differences\r$$ \\begin{aligned}y \\_{igtr}^{SR}\u0026amp;= \\alpha^{SR}\u0026#43;\\beta\\big(RURAL \\_{g}^{SR}\\times POST \\_{t}^{SR}\\big)\\\\\\\\\u0026amp;\u0026#43; \\gamma RURAL \\_{g}^{SR}\u0026#43;\\lambda_{t}^{SR}\u0026#43;\\phi \\_{r}^{SR}\u0026#43;\\psi^{\\prime}\\mathbf{X} \\_{igtr}^{SR}\u0026#43;\\epsilon_{igtr}^{SR} \\end{aligned} $$ Subscripts: r region, g rural-urban group, i individual, t year, r state. $y_{igtr}^{SR}$: the short-run effect. Gave birth within one year of the survey year. $RURAL_{g}^{SR}$: dummy for rural-worker women. $POST_{t}^{SR}$: dummy for the July 1991 rural pension policy reform. $\\mathbf{X}\\_{igtr}^{SR}$: controls for individual, job, family, and region-level characteristics. Effects: time effects $\\lambda_{t}^{SR}$, individual effects $\\phi_{r}^{SR}$, robust clustering at the federal-state level. The pension reform lowered fertility in the short run; In the group regression, the young group (15-29) is insignificant, while the older group (30-44) shows a significant fertility decline; the more children there are, and the higher the proportion of sons, the lower the desire for more children. Instrumental variables\rTreat the DID (differences in the pension-reform policy implementation) as an instrument for pensions ($\\ln(pensionwealth)_{igtr}$). First stage: $$ \\begin{aligned}\\ln(pensionwealth)\\_{igtr}\u0026amp;= \\sigma^{SR}\u0026#43;\\theta\\big(RURAL\\_{g}^{SR}\\times POST\\_{t}^{SR}\\big)\\\\\\\\\u0026amp;\u0026#43;\\eta RURAL\\_{g}^{SR}\u0026#43;\\delta\\_{t}^{SR}\u0026#43;\\tau\\_{r}^{SR}\u0026#43;\\kappa^{\\prime}\\mathbf{X}\\_{igtr}^{SR}\u0026#43;\\mu\\_{igtr}^{SR}\\end{aligned} $$ Second stage: $$ \\begin{aligned}y\\_{igtr}^{SR}\u0026amp;=\\alpha^{SR}\u0026#43;\\beta\\ln\\left(\\widehat{pensionwealth}\\right)\\_{igrt}\\\\\\\\\u0026amp;\u0026#43;\\gamma RURAL\\_g^{SR}\u0026#43;\\lambda\\_t^{SR}\u0026#43;\\phi\\_r^{SR}\u0026#43;\\psi^{\\prime}\\mathbf{X}\\_{igtr}^{SR}\u0026#43;\\epsilon\\_{igtr}^{SR}\\end{aligned} $$ Event study\rOn event studies, see Econometrics: Event Studies 1. In short, an event study can be viewed as the dynamic treatment effect of difference-in-differences. In terms of the equation, this means time-slicing the policy variable $POST_{t}^{SR}$ and expanding it into $\\sum YEAR_T^{LR}$. $$ \\begin{aligned}y\\_{igtr}^{LR}\u0026amp;=\\alpha^{LR}\u0026#43;\\sum_{t=-16}^{23}\\beta_t\\big(RURAL\\_g^{LR}\\times YEAR_t^{LR}\\big)\\\\\\\\\u0026amp;\u0026#43;\\gamma RURAL_g^{LR}\u0026#43;\\lambda\\_t^{LR}\u0026#43;\\phi\\_r^{LR}\u0026#43;\\psi^{\\prime}\\mathbf{X}\\_{iglr}^{LR}\u0026#43;\\epsilon\\_{iglr}^{LR},\\end{aligned} $$ Subscripts: r region, g rural-urban group, i individual, t year, r state. $y_{igtr}^{LR}$: the long-run effect. Total number of children at age 45. $RURAL_{g}^{LR}$: dummy for rural-worker women. $YEAR_{t}^{LR}$: policy-time dummy. $\\mathbf{X}\\_{igtr}^{SR}$: controls for years of education, marriage dummy, and lifetime labor supply. Effects: cohort effects $\\lambda_{t}^{LR}$, individual effects $\\phi_{r}^{LR}$, robust clustering at the federal-state level. In the difference-in-differences part, $\\lambda_{t}$ is the survey-year time dummy, a time effect representing the technology level, medical level, and infrastructure at the time the data were collected; In the event-study part, $\\lambda_{t}$ is the birth-year time dummy, used to flag that a particular group experienced a particular historical social environment. On thi","date":"2024-07-13","heading":"Difference-in-differences","objectID":"/en/posts/paf/:3:2","tags":["Fertility","Causal Inference"],"title":" Pensions and Fertility","uri":"/en/posts/paf/#difference-in-differences"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Variables and the econometric specification\rDependent variables\rShort-run effect: equals 1 if the woman gave birth within one year of the data-collection year, and 0 otherwise (based on the household roster and birth data). The sample includes female respondents of childbearing age (15 to 44) from 1981 to 1999. Long-run effect: the total number of children of a woman at age 45 (including surviving and deceased children). The sample includes female respondents born between 1930 and 1969, who were aged 45 to 69 in the given survey year. The authors trace the total births of respondents older than 45 in the survey year (1984-2014) back to their fertility at age 45 (1975-2014). The treated group is urban workers; the control group is rural workers. The econometric regression\rDifference-in-differences\r$$ \\begin{aligned}y \\_{igtr}^{SR}\u0026amp;= \\alpha^{SR}\u0026#43;\\beta\\big(RURAL \\_{g}^{SR}\\times POST \\_{t}^{SR}\\big)\\\\\\\\\u0026amp;\u0026#43; \\gamma RURAL \\_{g}^{SR}\u0026#43;\\lambda_{t}^{SR}\u0026#43;\\phi \\_{r}^{SR}\u0026#43;\\psi^{\\prime}\\mathbf{X} \\_{igtr}^{SR}\u0026#43;\\epsilon_{igtr}^{SR} \\end{aligned} $$ Subscripts: r region, g rural-urban group, i individual, t year, r state. $y_{igtr}^{SR}$: the short-run effect. Gave birth within one year of the survey year. $RURAL_{g}^{SR}$: dummy for rural-worker women. $POST_{t}^{SR}$: dummy for the July 1991 rural pension policy reform. $\\mathbf{X}\\_{igtr}^{SR}$: controls for individual, job, family, and region-level characteristics. Effects: time effects $\\lambda_{t}^{SR}$, individual effects $\\phi_{r}^{SR}$, robust clustering at the federal-state level. The pension reform lowered fertility in the short run; In the group regression, the young group (15-29) is insignificant, while the older group (30-44) shows a significant fertility decline; the more children there are, and the higher the proportion of sons, the lower the desire for more children. Instrumental variables\rTreat the DID (differences in the pension-reform policy implementation) as an instrument for pensions ($\\ln(pensionwealth)_{igtr}$). First stage: $$ \\begin{aligned}\\ln(pensionwealth)\\_{igtr}\u0026amp;= \\sigma^{SR}\u0026#43;\\theta\\big(RURAL\\_{g}^{SR}\\times POST\\_{t}^{SR}\\big)\\\\\\\\\u0026amp;\u0026#43;\\eta RURAL\\_{g}^{SR}\u0026#43;\\delta\\_{t}^{SR}\u0026#43;\\tau\\_{r}^{SR}\u0026#43;\\kappa^{\\prime}\\mathbf{X}\\_{igtr}^{SR}\u0026#43;\\mu\\_{igtr}^{SR}\\end{aligned} $$ Second stage: $$ \\begin{aligned}y\\_{igtr}^{SR}\u0026amp;=\\alpha^{SR}\u0026#43;\\beta\\ln\\left(\\widehat{pensionwealth}\\right)\\_{igrt}\\\\\\\\\u0026amp;\u0026#43;\\gamma RURAL\\_g^{SR}\u0026#43;\\lambda\\_t^{SR}\u0026#43;\\phi\\_r^{SR}\u0026#43;\\psi^{\\prime}\\mathbf{X}\\_{igtr}^{SR}\u0026#43;\\epsilon\\_{igtr}^{SR}\\end{aligned} $$ Event study\rOn event studies, see Econometrics: Event Studies 1. In short, an event study can be viewed as the dynamic treatment effect of difference-in-differences. In terms of the equation, this means time-slicing the policy variable $POST_{t}^{SR}$ and expanding it into $\\sum YEAR_T^{LR}$. $$ \\begin{aligned}y\\_{igtr}^{LR}\u0026amp;=\\alpha^{LR}\u0026#43;\\sum_{t=-16}^{23}\\beta_t\\big(RURAL\\_g^{LR}\\times YEAR_t^{LR}\\big)\\\\\\\\\u0026amp;\u0026#43;\\gamma RURAL_g^{LR}\u0026#43;\\lambda\\_t^{LR}\u0026#43;\\phi\\_r^{LR}\u0026#43;\\psi^{\\prime}\\mathbf{X}\\_{iglr}^{LR}\u0026#43;\\epsilon\\_{iglr}^{LR},\\end{aligned} $$ Subscripts: r region, g rural-urban group, i individual, t year, r state. $y_{igtr}^{LR}$: the long-run effect. Total number of children at age 45. $RURAL_{g}^{LR}$: dummy for rural-worker women. $YEAR_{t}^{LR}$: policy-time dummy. $\\mathbf{X}\\_{igtr}^{SR}$: controls for years of education, marriage dummy, and lifetime labor supply. Effects: cohort effects $\\lambda_{t}^{LR}$, individual effects $\\phi_{r}^{LR}$, robust clustering at the federal-state level. In the difference-in-differences part, $\\lambda_{t}$ is the survey-year time dummy, a time effect representing the technology level, medical level, and infrastructure at the time the data were collected; In the event-study part, $\\lambda_{t}$ is the birth-year time dummy, used to flag that a particular group experienced a particular historical social environment. On thi","date":"2024-07-13","heading":"Instrumental variables","objectID":"/en/posts/paf/:3:2","tags":["Fertility","Causal Inference"],"title":" Pensions and Fertility","uri":"/en/posts/paf/#instrumental-variables"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Variables and the econometric specification\rDependent variables\rShort-run effect: equals 1 if the woman gave birth within one year of the data-collection year, and 0 otherwise (based on the household roster and birth data). The sample includes female respondents of childbearing age (15 to 44) from 1981 to 1999. Long-run effect: the total number of children of a woman at age 45 (including surviving and deceased children). The sample includes female respondents born between 1930 and 1969, who were aged 45 to 69 in the given survey year. The authors trace the total births of respondents older than 45 in the survey year (1984-2014) back to their fertility at age 45 (1975-2014). The treated group is urban workers; the control group is rural workers. The econometric regression\rDifference-in-differences\r$$ \\begin{aligned}y \\_{igtr}^{SR}\u0026amp;= \\alpha^{SR}\u0026#43;\\beta\\big(RURAL \\_{g}^{SR}\\times POST \\_{t}^{SR}\\big)\\\\\\\\\u0026amp;\u0026#43; \\gamma RURAL \\_{g}^{SR}\u0026#43;\\lambda_{t}^{SR}\u0026#43;\\phi \\_{r}^{SR}\u0026#43;\\psi^{\\prime}\\mathbf{X} \\_{igtr}^{SR}\u0026#43;\\epsilon_{igtr}^{SR} \\end{aligned} $$ Subscripts: r region, g rural-urban group, i individual, t year, r state. $y_{igtr}^{SR}$: the short-run effect. Gave birth within one year of the survey year. $RURAL_{g}^{SR}$: dummy for rural-worker women. $POST_{t}^{SR}$: dummy for the July 1991 rural pension policy reform. $\\mathbf{X}\\_{igtr}^{SR}$: controls for individual, job, family, and region-level characteristics. Effects: time effects $\\lambda_{t}^{SR}$, individual effects $\\phi_{r}^{SR}$, robust clustering at the federal-state level. The pension reform lowered fertility in the short run; In the group regression, the young group (15-29) is insignificant, while the older group (30-44) shows a significant fertility decline; the more children there are, and the higher the proportion of sons, the lower the desire for more children. Instrumental variables\rTreat the DID (differences in the pension-reform policy implementation) as an instrument for pensions ($\\ln(pensionwealth)_{igtr}$). First stage: $$ \\begin{aligned}\\ln(pensionwealth)\\_{igtr}\u0026amp;= \\sigma^{SR}\u0026#43;\\theta\\big(RURAL\\_{g}^{SR}\\times POST\\_{t}^{SR}\\big)\\\\\\\\\u0026amp;\u0026#43;\\eta RURAL\\_{g}^{SR}\u0026#43;\\delta\\_{t}^{SR}\u0026#43;\\tau\\_{r}^{SR}\u0026#43;\\kappa^{\\prime}\\mathbf{X}\\_{igtr}^{SR}\u0026#43;\\mu\\_{igtr}^{SR}\\end{aligned} $$ Second stage: $$ \\begin{aligned}y\\_{igtr}^{SR}\u0026amp;=\\alpha^{SR}\u0026#43;\\beta\\ln\\left(\\widehat{pensionwealth}\\right)\\_{igrt}\\\\\\\\\u0026amp;\u0026#43;\\gamma RURAL\\_g^{SR}\u0026#43;\\lambda\\_t^{SR}\u0026#43;\\phi\\_r^{SR}\u0026#43;\\psi^{\\prime}\\mathbf{X}\\_{igtr}^{SR}\u0026#43;\\epsilon\\_{igtr}^{SR}\\end{aligned} $$ Event study\rOn event studies, see Econometrics: Event Studies 1. In short, an event study can be viewed as the dynamic treatment effect of difference-in-differences. In terms of the equation, this means time-slicing the policy variable $POST_{t}^{SR}$ and expanding it into $\\sum YEAR_T^{LR}$. $$ \\begin{aligned}y\\_{igtr}^{LR}\u0026amp;=\\alpha^{LR}\u0026#43;\\sum_{t=-16}^{23}\\beta_t\\big(RURAL\\_g^{LR}\\times YEAR_t^{LR}\\big)\\\\\\\\\u0026amp;\u0026#43;\\gamma RURAL_g^{LR}\u0026#43;\\lambda\\_t^{LR}\u0026#43;\\phi\\_r^{LR}\u0026#43;\\psi^{\\prime}\\mathbf{X}\\_{iglr}^{LR}\u0026#43;\\epsilon\\_{iglr}^{LR},\\end{aligned} $$ Subscripts: r region, g rural-urban group, i individual, t year, r state. $y_{igtr}^{LR}$: the long-run effect. Total number of children at age 45. $RURAL_{g}^{LR}$: dummy for rural-worker women. $YEAR_{t}^{LR}$: policy-time dummy. $\\mathbf{X}\\_{igtr}^{SR}$: controls for years of education, marriage dummy, and lifetime labor supply. Effects: cohort effects $\\lambda_{t}^{LR}$, individual effects $\\phi_{r}^{LR}$, robust clustering at the federal-state level. In the difference-in-differences part, $\\lambda_{t}$ is the survey-year time dummy, a time effect representing the technology level, medical level, and infrastructure at the time the data were collected; In the event-study part, $\\lambda_{t}$ is the birth-year time dummy, used to flag that a particular group experienced a particular historical social environment. On thi","date":"2024-07-13","heading":"Event study","objectID":"/en/posts/paf/:3:2","tags":["Fertility","Causal Inference"],"title":" Pensions and Fertility","uri":"/en/posts/paf/#event-study"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Variables and the econometric specification\rDependent variables\rShort-run effect: equals 1 if the woman gave birth within one year of the data-collection year, and 0 otherwise (based on the household roster and birth data). The sample includes female respondents of childbearing age (15 to 44) from 1981 to 1999. Long-run effect: the total number of children of a woman at age 45 (including surviving and deceased children). The sample includes female respondents born between 1930 and 1969, who were aged 45 to 69 in the given survey year. The authors trace the total births of respondents older than 45 in the survey year (1984-2014) back to their fertility at age 45 (1975-2014). The treated group is urban workers; the control group is rural workers. The econometric regression\rDifference-in-differences\r$$ \\begin{aligned}y \\_{igtr}^{SR}\u0026amp;= \\alpha^{SR}\u0026#43;\\beta\\big(RURAL \\_{g}^{SR}\\times POST \\_{t}^{SR}\\big)\\\\\\\\\u0026amp;\u0026#43; \\gamma RURAL \\_{g}^{SR}\u0026#43;\\lambda_{t}^{SR}\u0026#43;\\phi \\_{r}^{SR}\u0026#43;\\psi^{\\prime}\\mathbf{X} \\_{igtr}^{SR}\u0026#43;\\epsilon_{igtr}^{SR} \\end{aligned} $$ Subscripts: r region, g rural-urban group, i individual, t year, r state. $y_{igtr}^{SR}$: the short-run effect. Gave birth within one year of the survey year. $RURAL_{g}^{SR}$: dummy for rural-worker women. $POST_{t}^{SR}$: dummy for the July 1991 rural pension policy reform. $\\mathbf{X}\\_{igtr}^{SR}$: controls for individual, job, family, and region-level characteristics. Effects: time effects $\\lambda_{t}^{SR}$, individual effects $\\phi_{r}^{SR}$, robust clustering at the federal-state level. The pension reform lowered fertility in the short run; In the group regression, the young group (15-29) is insignificant, while the older group (30-44) shows a significant fertility decline; the more children there are, and the higher the proportion of sons, the lower the desire for more children. Instrumental variables\rTreat the DID (differences in the pension-reform policy implementation) as an instrument for pensions ($\\ln(pensionwealth)_{igtr}$). First stage: $$ \\begin{aligned}\\ln(pensionwealth)\\_{igtr}\u0026amp;= \\sigma^{SR}\u0026#43;\\theta\\big(RURAL\\_{g}^{SR}\\times POST\\_{t}^{SR}\\big)\\\\\\\\\u0026amp;\u0026#43;\\eta RURAL\\_{g}^{SR}\u0026#43;\\delta\\_{t}^{SR}\u0026#43;\\tau\\_{r}^{SR}\u0026#43;\\kappa^{\\prime}\\mathbf{X}\\_{igtr}^{SR}\u0026#43;\\mu\\_{igtr}^{SR}\\end{aligned} $$ Second stage: $$ \\begin{aligned}y\\_{igtr}^{SR}\u0026amp;=\\alpha^{SR}\u0026#43;\\beta\\ln\\left(\\widehat{pensionwealth}\\right)\\_{igrt}\\\\\\\\\u0026amp;\u0026#43;\\gamma RURAL\\_g^{SR}\u0026#43;\\lambda\\_t^{SR}\u0026#43;\\phi\\_r^{SR}\u0026#43;\\psi^{\\prime}\\mathbf{X}\\_{igtr}^{SR}\u0026#43;\\epsilon\\_{igtr}^{SR}\\end{aligned} $$ Event study\rOn event studies, see Econometrics: Event Studies 1. In short, an event study can be viewed as the dynamic treatment effect of difference-in-differences. In terms of the equation, this means time-slicing the policy variable $POST_{t}^{SR}$ and expanding it into $\\sum YEAR_T^{LR}$. $$ \\begin{aligned}y\\_{igtr}^{LR}\u0026amp;=\\alpha^{LR}\u0026#43;\\sum_{t=-16}^{23}\\beta_t\\big(RURAL\\_g^{LR}\\times YEAR_t^{LR}\\big)\\\\\\\\\u0026amp;\u0026#43;\\gamma RURAL_g^{LR}\u0026#43;\\lambda\\_t^{LR}\u0026#43;\\phi\\_r^{LR}\u0026#43;\\psi^{\\prime}\\mathbf{X}\\_{iglr}^{LR}\u0026#43;\\epsilon\\_{iglr}^{LR},\\end{aligned} $$ Subscripts: r region, g rural-urban group, i individual, t year, r state. $y_{igtr}^{LR}$: the long-run effect. Total number of children at age 45. $RURAL_{g}^{LR}$: dummy for rural-worker women. $YEAR_{t}^{LR}$: policy-time dummy. $\\mathbf{X}\\_{igtr}^{SR}$: controls for years of education, marriage dummy, and lifetime labor supply. Effects: cohort effects $\\lambda_{t}^{LR}$, individual effects $\\phi_{r}^{LR}$, robust clustering at the federal-state level. In the difference-in-differences part, $\\lambda_{t}$ is the survey-year time dummy, a time effect representing the technology level, medical level, and infrastructure at the time the data were collected; In the event-study part, $\\lambda_{t}$ is the birth-year time dummy, used to flag that a particular group experienced a particular historical social environment. On thi","date":"2024-07-13","heading":"Confounders","objectID":"/en/posts/paf/:3:2","tags":["Fertility","Causal Inference"],"title":" Pensions and Fertility","uri":"/en/posts/paf/#confounders"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Robustness\rAlternative age-band group regressions for comparison: use new age bands to compare the fertility responses of different cohorts of women to the pension policy. Alternative econometric specifications: add education level as a control; linear time trends, linear time-region; distinguish whether the respondent lives with a pension recipient. Sample selection: (1) three types of sample draws: the non-self-representative municipality sample frame; self-representative areas; metropolitan areas. (2) Tighten the definition and scope of the treated and control groups based on individual occupation, home address, and parents\u0026rsquo; occupation. (3) Add rural-urban samples where husband and wife work in different occupational fields. (4) Exclude women under 15 and over 44. (5) Exclude women who gave birth past 45. Standard errors: in addition to state-level clustering, add clustering at the settlement level. To address autocorrelation, subtract the pre- and post-treatment result means respectively. ","date":"2024-07-13","heading":"Robustness","objectID":"/en/posts/paf/:4:0","tags":["Fertility","Causal Inference"],"title":" Pensions and Fertility","uri":"/en/posts/paf/#robustness"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Conclusion\rI want to summarize this paper\u0026rsquo;s conclusion from the angles of elevation and detail. It verifies the historical experience — pension expansion may lower fertility. Elevation: public welfare spending may carry a certain policy cost; there is a mechanism linking social welfare and population change. Detail: as mentioned above. This paper\u0026rsquo;s highlight is combining the context of Brazil\u0026rsquo;s 1981 and 1991 reforms, and strengthening the rural-urban and women\u0026rsquo;s-age-group comparisons, so the event study is also used well. Some personal doubts. Why don\u0026rsquo;t most people think to link pension services to fertility? Because everyone assumes pension recipients have already lost the ability to become pregnant. So this is an expectations problem: women expect future pension income, so their fertility decisions change. The paper never proves this logic chain with econometric data; it\u0026rsquo;s mainly argued through social and historical background analysis. Framed this way, the question instantly becomes interesting.\u0026#160;\u0026#x21a9;\u0026#xfe0e; My understanding here is to emphasize that people did form expectations about the pension reform, thereby changing their fertility decisions.\u0026#160;\u0026#x21a9;\u0026#xfe0e; The paper uses Brazilian land-inheritance data as evidence of son preference; most Brazilian land is inherited by men.\u0026#160;\u0026#x21a9;\u0026#xfe0e; The paper adds event-study analysis based on historical background; I think the fit is perfect.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2024-07-13","heading":"Conclusion","objectID":"/en/posts/paf/:5:0","tags":["Fertility","Causal Inference"],"title":" Pensions and Fertility","uri":"/en/posts/paf/#conclusion"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":" Econometrics: Event Studies 1 Econometrics: Event Studies 2 Econometrics: Event Studies 3 Picking up from last time, this post is a record of learning the code from An Introductory Guide to Event Study Models. ","date":"2024-06-24","heading":"","objectID":"/en/posts/event2/:0:0","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 2","uri":"/en/posts/event2/#"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Appendix A: Distinguishing DID and Timing-based\rThis code is descriptive statistics, describing the sample distribution (or serving as the background for policy implementation). DID type: has both a treated group and a control group (which never received the policy) Timing-based: only a treated group, but the event shock times differ within it. Code output: the top row is a Hybrid data structure; the bottom row is a Timing-based data structure\rThe code below generates data, then draws a frequency plot and a cumulative plot. In the original, the cumulative plot first uses cumul to compute cumulative proportions and then uses twoway to draw a line chart. That\u0026rsquo;s too complicated, so here I\u0026rsquo;ve replaced it with the cdfplot command, which does it in one step. Don\u0026rsquo;t be surprised if the result differs from the original — the original code also interpolates endpoint values on both sides, and I removed that part. clear *-generate random panel data for difference-in-differences set seed 2024 set obs 100 gen i = _n gen treated = i \u003e 50 gen E_i = 11 if treated == 1 expand 20 sort i qui by i: gen t = _n xtset i t *-set the treatment effect gen D = (t == E_i) gen etime = (t - E_i) label var i \"个体编号\" label var t \"日期\" label var D \"did变量=time*post\" label var E_i \"事件冲击时间\" *-plot the distribution of the treated and control groups replace E_i=16 if treated==0 replace E_i=5 if treated==1 \u0026 i\u003e=51 \u0026 i\u003c=61 replace E_i=6 if treated==1 \u0026 i\u003e=62 \u0026 i\u003c=68 replace E_i=7 if treated==1 \u0026 i\u003e=69 \u0026 i\u003c=70 replace E_i=10 if treated==1 \u0026 i\u003e=71 \u0026 i\u003c=75 replace E_i=11 if treated==1 \u0026 i\u003e=76 \u0026 i\u003c=90 replace E_i=12 if treated==1 \u0026 i\u003e=91 #delimit ; /* delimiter setting: change the semicolon to the line-break symbol for commands. this way, unless a semicolon is added at the end, commands written across lines are read as one line. this makes graphing commands much more convenient. */ twoway (histogram E_i if treated==1, discrete frequency start(4) barwidth(0.8) xscale(range(0 17)) yscale(range(0 1200)) color(cranberry%100)) (histogram E_i if treated==0, discrete frequency start(4) barwidth(0.8) xscale(range(0 17)) yscale(range(0 1200)) color(navy%40)), title(\"实验组和对照组事件冲击分布图\", color(black) size(v.small)) legend(off) xlabel( 5 \"5\" 6 \"6\" 7 \"7\" 8 \"8\" 9 \"9\" 10 \"10\" 11 \"11\" 12 \"12\" 16 \"NA\") text(1100 15.5 \"从来没接受干预\", size(small)) name(histogram4 , replace); #delimit cr *-plot the distribution of the treated and control groups preserve //save the current dataset #delimit ; cdfplot E_i, title(\"事件时间的累计分布图\", color(black) size(v.small)) legend(off) ytitle(百分比) name(CDF4, replace) note(Hybrid事件数据类型，实验组事件时间不同，同时对照组从未受到事件冲击) ; #delimit cr restore //reload the saved dataset *-distribution of the treated and control groups replace treated=1 replace E_i=5 if treated==1 \u0026 i\u003e=1 \u0026 i\u003c=20 replace E_i=6 if treated==1 \u0026 i\u003e=21 \u0026 i\u003c=32 replace E_i=7 if treated==1 \u0026 i\u003e=33 \u0026 i\u003c=37 replace E_i=10 if treated==1 \u0026 i\u003e=38 \u0026 i\u003c=58 replace E_i=11 if treated==1 \u0026 i\u003e=59 \u0026 i\u003c=64 replace E_i=12 if treated==1 \u0026 i\u003e=65 \u0026 i\u003c=90 replace E_i=15 if treated==1 \u0026 i\u003e90 #delimit ; twoway (histogram E_i if treated==1, discrete frequency start(4) barwidth(0.8) xscale(range(0 17)) yscale(range(0 800)) color(cranberry%100)), title(\"实验组和对照组事件冲击分布图\", color(black) size(v.small)) legend(off) ylabel(0(100)800) name(histogram5 , replace) ; #delimit cr *-plot the cumulative distribution of the treated and control groups #delimit ; cdfplot E_i, title(\"事件时间的累计分布图\", color(black) size(v.small)) legend(off) ytitle(百分比) note(Timing-based事件数据类型，由于实验组事件时间不同，内部也能形成比较) name(CDF5, replace) ; #delimit cr *-combine and display the above plots graph combine histogram4 CDF4 histogram5 CDF5 iscale 0.25 //scale the image down to a quarter\r","date":"2024-06-24","heading":"Appendix A: Distinguishing DID and Timing-based","objectID":"/en/posts/event2/:1:0","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 2","uri":"/en/posts/event2/#appendix-a-distinguishing-did-and-timing-based"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Appendix B: Parameter restrictions for Timing-based\rWhen estimating event effects in DID, you generally don\u0026rsquo;t add a time trend, but you do add individual fixed effects and time fixed effects, whose role is to decompose the intercept. The usual ways to handle collinearity are to default $t_{-1}$ to 0, merge or drop some variables, impose other constraints, or make it nonlinear\u0026hellip;\u0026hellip; For the Timing-based data form, since there is no control group, we can only compare within the treated group. More parameter restrictions are needed. The variation in event timing is itself part of the information. The larger the minimum difference in event timing across treated groups, the more information is lost. The more individuals there are, the more information there is. So what Appendix B\u0026rsquo;s code studies is — When studying a Timing-based data structure, for different timing and individual distributions, how many additional parameters are needed to solve the problem? My understanding: this may be a matter of building a system of equations through a series of regressions, forming a matrix from the system, and then judging via the matrix\u0026rsquo;s rank how many more parameter constraints are needed before it can be solved. Appendix B code output: a figure the authors say is very strange\rLet me explain what Appendix B\u0026rsquo;s output figure means. First, take a dataset where everyone receives the event shock, but the event timing differs. In the initially generated dataset, the event shock times are 4 and 16. At this point the additional constraint parameters needed to solve are 12 (which can be understood as how many degrees of freedom are still missing). Here\u0026rsquo;s what the figure means: First look at the first column of blue dots. When you add other samples whose event shock time is 4 (the x-axis), no extra information is added. The whole dataset is still two types of samples — event shock time 4 or 16 — so the additional parameters needed to solve are still 12 (the y-axis). Similarly, the second column of blue dots means that when you add a third group of samples with shock time 5, the difference in event timing shrinks and information increases, so the additional parameters needed drop to 1. The red triangles mean: on top of the dots in each column, what happens to the parameters needed when you add the samples the triangles represent. I originally expected that, given a fixed timing difference, the more individual groups there are, the fewer additional parameters would be needed. It turns out only the fifth column behaves that way, which is why the paper says this is strange and worth studying — though the author doesn\u0026rsquo;t know why either. The following code has comments added via GPT: #delimit ; cap log close ; set trace off ; set more off ; clear all ; set seed 101 ; cap prog drop runme ; prog def runme ; args list ctrl trends ; qui gendata \"`list'\" `ctrl' `trends' ; qui forvalues i = 0/20 { ; gen D_p`i' = (etime == `i') ; // generate the positive treated-group dummy gen D_m`i' = (etime == -1 * `i') ; // generate the negative treated-group dummy summ D_p`i' ; // summarize the positive treated-group dummy local dropme = (r(mean) == 0) ; if `dropme' == 1 { ; drop D_p`i' ; // if the mean is 0, drop the positive treated-group dummy } ; summ D_m`i' ; // summarize the negative treated-group dummy local dropme = (r(mean) == 0) ; if `dropme' == 1 { ; drop D_m`i' ; // if the mean is 0, drop the negative treated-group dummy } ; } ; drop D_m0 ; // drop the baseline case of the negative treated-group dummy egen unittype = group(E_i) , miss ; // generate a unit-type variable from E_i, handling missing values qui tab unittype , gen(udum) ; // summarize the unit-type variable and generate the corresponding dummies qui tab t , gen(tdum) ; // summarize the time variable and generate the corresponding dummies unab vars : D_* udum* tdum* ; // generate the variable list for everything related to D_*, udum*, and tdum* mata: count() ;","date":"2024-06-24","heading":"Appendix B: Parameter restrictions for Timing-based","objectID":"/en/posts/event2/:2:0","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 2","uri":"/en/posts/event2/#appendix-b-parameter-restrictions-for-timing-based"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Appendix C: Choosing the estimator\rThere are currently two kinds of estimator choices: Constrain the coefficient of the pre-event period variable to 0 Constrain the sum of the pre-event dummy variable coefficients to 0 Estimation under different constraints; both estimators use individual fixed effects summing to 0\rThe code in this part is a simulation experiment. First, generate the treatment effect according to the conditions, with the treatment effect fixed at 1 (the red line in the figure is the actually generated treatment effect). Then add a random noise term, and finally run the regression. The constraint on the left normalizes the pre-event period; the constraint on the right constrains the pre-event dummies. You can see the right one is closer to the actual treatment effect (the red line). The following code has comments by GPT, with some corrections by me. Code structure: define the data-structure generation function and the constraint-selection function, then plot. #delimit ; cap log close ; set trace off ; set more off ; clear ; set seed 2024202431 ; cap prog drop runme ; prog def runme ; gendata ; /* create the estimation variables */ /* event-time dummies */ forvalues i = 0/20 { ; gen D_p`i' = (etime == `i') ; gen D_m`i' = (etime == -1 * `i') ; summ D_p`i' ; local dropme = (r(mean) == 0) ; if `dropme' == 1 { ; drop D_p`i' ; } ; summ D_m`i' ; local dropme = (r(mean) == 0) ; if `dropme' == 1 { ; drop D_m`i' ; } ; } ; drop D_m0 ; gen byte group2 = E_i == 11 ; gen trend_group2 = t * group2 ; summ ; /* 1 normalize the event-time dummy at -1 to 0 */ constraint define 1 D_m1 = 0 ; /* 2, the fixed effects of all groups sum to 0 */ constraint define 2 1.i + 2.i + 3.i + 4.i + 5.i + 6.i + 7.i + 8.i + 9.i + 10.i = 0 ; /* 7 set the average of the pre-treatment event-time dummies to zero*/ constraint define 7 D_m10 + D_m9 + D_m8 + D_m7 + D_m6 + D_m5 + D_m4 + D_m3 + D_m2 + D_m1 = 0 ; cnsreg y D_m* D_p* ibn.t ibn.i , cluster(i) nocons constraints(2 1 ) collinear ; matrix myb_ES1 = e(b) ; matrix myV_ES1 = e(V) ; cnsreg y D_m* D_p* ibn.t ibn.i , cluster(i) nocons constraints(2 7 ) collinear ; matrix myb_ES2 = e(b) ; matrix myV_ES2 = e(V) ; tempfile main ; save `main' ; /* plot */ *start debugging; tempfile pooled ; forvalues i = 0/10 { ; drop _all ; set obs 2 ; gen label = \"m`i'\" in 1 ; replace label = \"p`i'\" in 2 ; gen etime = -1 * `i' in 1 ; replace etime = `i' in 2 ; foreach j in 1 2 { ; gen cf_m`j' = . ; /* set the estimation equation for the treatment effect */ gen truth_m`j' = (0) in 1 ; replace truth_m`j' = (1) in 2 ; local myb = 0 ; cap local myb = myb_ES`j'[1,\"D_m`i'\"] ; gen ES_b_m`j' = `myb' in 1 ; local myv = . ; cap local myv = myV_ES`j'[\"D_m`i'\",\"D_m`i'\"] ; local myse = sqrt(`myv') ; gen ES_se_m`j' = `myse' in 1 ; local myb = 0 ; cap local myb = myb_ES`j'[1,\"D_p`i'\"] ; replace ES_b_m`j' = `myb' in 2 ; local myv = . ; cap local myv = myV_ES`j'[\"D_p`i'\",\"D_p`i'\"] ; local myse = sqrt(`myv') ; replace ES_se_m`j' = `myse' in 2 ; } ; capture append using `pooled' ; save `pooled' , replace ; } ; drop if label == \"m0\" ; drop if label == \"p10\" ; sort etime ; save `pooled' , replace ; local note1 \"gam(-1)=0\" ; local note2 \"Avg(gam(-))=0.\" ; forvalues i = 1/2 { ; gen top_`i' = ES_b_m`i' + 1.96 * ES_se_m`i' ; gen bot_`i' = ES_b_m`i' - 1.96 * ES_se_m`i' ; graph twoway (connected ES_b_m`i' truth_m`i' etime , msize(medsmall medium) msymbol(o oh) lpattern(solid dot) ) (line cf_m`i' etime , lpattern(dash) ) (line top_`i' bot_`i' etime, lpattern(dash dash) lcolor(brown brown)) , legend(off) xline(-0.5) note(\"`i': `note`i''\") name(g`i' , replace) yscale(range(-3,3.5)) yline(0 , lpattern(dash) lcolor(black)) ; } ; graph combine g1 g2 , ti(\"不同等标准化估计会影响结果\") note(\"All models: Avg(alpha)=0; DiD data structure. T=20, E1=11.\") ; graph export figures/apdx_fig_A04.png , replace ; end ; cap prog drop gendata ; program define gendata ; /***************** main data-generation process options /* possible treatment-effect types */ 1 - zero treatment ","date":"2024-06-24","heading":"Appendix C: Choosing the estimator","objectID":"/en/posts/event2/:3:0","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 2","uri":"/en/posts/event2/#appendix-c-choosing-the-estimator"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Appendix D: Approaching the raw data\rDID gets deified again and again 🤣（ Appendix D can essentially be understood as a decomposition that adds a time trend (a slope comparison). The code structure is the same as before; what\u0026rsquo;s added this time is predicting the counterfactual group, and using it to strengthen the causal argument through another comparison. /* create the counterfactual prediction cf_ES2 */ gen cf_ES2 = y ; // initialize cf_ES2 as the observed variable y /* loop over the time range */ qui summ etime ; // get summary statistics of etime local mymin = r(min) ; // get the minimum local mymax = r(max) ; // get the maximum forvalues i = `mymin'/`mymax' { // loop over the time range if `i' \u003c 0 { // if time is less than 0 local j = abs(`i') ; // take the absolute value replace cf_ES2 = cf_ES2 - _b[D_m`j'] * D_m`j' ; // subtract the treatment-effect coefficient times the corresponding dummy } else { // if time is greater than or equal to 0 replace cf_ES2 = cf_ES2 - _b[D_p`i'] * D_p`i' ; // subtract the treatment-effect coefficient times the corresponding dummy } } /* compute the counterfactual prediction mean by unit type and time */ egen meancf_ES2 = mean(cf_ES2), by(t unittype) ; // compute the mean of cf_ES2 by t and unittype\rTaking the difference of the coefficients before and after use again to get the result\r","date":"2024-06-24","heading":"Appendix D: Approaching the raw data","objectID":"/en/posts/event2/:4:0","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 2","uri":"/en/posts/event2/#appendix-d-approaching-the-raw-data"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Appendix E: Repeated event shocks\rThe problem this part solves is: if an event occurs repeatedly at different times, how should you choose? Here the generated true treatment effect is a continuously decaying curve. Approach 1 constrains the coefficients of the event dummies to be equal ($\\gamma_1=\\gamma_2$): The constraints below are segmentations into two-period, three-period, and four-period groups. Here\u0026rsquo;s an example of the constraint code: #delimit; /*two periods per group*/ constraint define 9 D_m10=D_m9; constraint define 10 D_m8=D_m7; constraint define 11 D_m6=D_m5; constraint define 12 D_m4=D_m3; constraint define 13 D_m2=D_m1; constraint define 14 D_p0=D_p1; constraint define 15 D_p2=D_p3; constraint define 16 D_p4=D_p5; constraint define 17 D_p6=D_p7; constraint define 18 D_p8=D_p9; /*three periods per group */ #delimit; constraint define 21 D_m1=D_m2; constraint define 22 D_m1=D_m3; constraint define 23 D_m4=D_m5; constraint define 24 D_m4=D_m6; constraint define 25 D_m7=D_m8; constraint define 26 D_m7=D_m9; constraint define 27 D_p0=D_p1; constraint define 28 D_p2=D_p1; constraint define 29 D_p3=D_p4; constraint define 30 D_p3=D_p5; constraint define 31 D_p6=D_p7; constraint define 32 D_p6=D_p8;\rApproach one: constrain the event-time dummy values to be equal\rApproach 2 constrains the slopes between coefficients to be equal ($\\gamma_1-\\gamma_0=\\gamma_2-\\gamma_1$) Here\u0026rsquo;s an example of the constraint code: constraint define 9 D_m10=D_m9; constraint define 10 D_m8=D_m7; constraint define 11 D_m6=D_m5; constraint define 12 D_m4=D_m3;\rConstraining the slopes between coefficients to be equal\rTop-left is the ordinary case. Top-right is the grouping with equal two-period slopes. Bottom-left is the grouping with equal three-period slopes. Bottom-right is the grouping where the two periods before and after are each constrained to be equal. ","date":"2024-06-24","heading":"Appendix E: Repeated event shocks","objectID":"/en/posts/event2/:5:0","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 2","uri":"/en/posts/event2/#appendix-e-repeated-event-shocks"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Appendix F: Controlling the time trend\rWhat this part studies is whether to add time-trend controls and other constraints. ","date":"2024-06-24","heading":"Appendix F: Controlling the time trend","objectID":"/en/posts/event2/:6:0","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 2","uri":"/en/posts/event2/#appendix-f-controlling-the-time-trend"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"DID: one unit, two times\rTwo kinds of constraints. One adds a trend control — adding trend_group2 to the controls: //trend control variable gen byte group2 = E_i == 11 gen trend_group2 = t * group2 same constraint //other constraint types are the same as before, ensuring event-time dummies have equal coefficients or equal slopes\rThe constraints applied include the trend control and the event-time dummy constraints\r","date":"2024-06-24","heading":"DID: one unit, two times","objectID":"/en/posts/event2/:6:1","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 2","uri":"/en/posts/event2/#did-one-unit-two-times"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Time-based: one unit, two times\rNext, verify the Time-based data form. The DID form has a control group to help generate counterfactual predictions, but time-based lacks a control group. The usual options are: The event-time dummy coefficients for the earliest and latest periods are equal, making the plot smoother The slopes between the earliest and latest event-time dummy coefficients are equal, better showing the trend The sum of the pre-trend coefficients is constrained to 0 The trend-weighted constraints across multiple event times sum to 0 You can see that in the experiment below, the fourth plot actually produced a strange result. The constraints applied were: Individual fixed effects sum to 0 Pre-event effects sum to 0 The slopes at the end of the post-event period are equal The weighted pre-trend is 0 \\\\I don't understand where the 5.5 base period in this constraint comes from? constraint define 8 (10-5.5)*D_m10 + (9-5.5)*D_m9 + (8-5.5)*D_m8 + (7-5.5)*D_m7 + (6-5.5)*D_m6 + (5-5.5)*D_m5 + (4-5.5)*D_m4 + (3-5.5)*D_m3 + (2-5.5)*D_m2 + (1-5.5)*D_m1 = 0 ; time-based simulation\rSo should we choose the constraint that the coefficients\u0026rsquo; slopes are equal or that the coefficient values are equal? The answer depends on the situation. If a policy\u0026rsquo;s true effect doesn\u0026rsquo;t change over time, choose the equal coefficient values constraint; if the policy effect changes over time, choose the equal coefficient slopes constraint. Simulation of a jump shock whose effect doesn\u0026rsquo;t change over time, where the equal-coefficient-values estimator is more efficient\rI think this conclusion has become circular reasoning. The whole point of event studies is to estimate the treatment effect (whether it is dynamic or static is precisely what we need to find out), and now it\u0026rsquo;s turned into choosing the method based on the result. Still, the takeaway is simply to analyze the policy background, form an assumption, and then choose the constraint. ","date":"2024-06-24","heading":"Time-based: one unit, two times","objectID":"/en/posts/event2/:6:2","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 2","uri":"/en/posts/event2/#time-based-one-unit-two-times"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"DID: many units, many times\rFor multi-period DID, adding multiple event-time trend-weighted constraints that sum to 0 makes the estimation more efficient. As shown: The first column is the ordinary estimate, with no restrictions beyond two-way individual and time fixed effects. The second column adds, on top of the first, the constraint that the pre-event trends sum to 0: //event dates are still 10 and 5; I don't understand where the 5.5 base period comes from constraint define 3 -4.5*D_m10 - 3.5*D_m9 - 2.5* D_m8 - 1.5* D_m7 - 0.5*D_m6 + 0.5 * D_m5 + 1.5 * D_m4 + 2.5 *D_m3 + 3.5 *D_m2 + 4.5 *D_m1 = 0 ;\rThe third column adds a type control: gen treated_time = treated * t DID estimation: the orange part is the counterfactual group predicted from residuals\r","date":"2024-06-24","heading":"DID: many units, many times","objectID":"/en/posts/event2/:6:3","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 2","uri":"/en/posts/event2/#did-many-units-many-times"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Time-based: many units, many times\rtime-based; orange is also the counterfactual group\rAbove is a Time-based structure where everything is the treated group, but this time there are individual differences. The second column adds, on top of the first, individual grouping and a time-weighted trend of 0: //individual grouping Egen unittype = group (E_i) ; Egen meany = mean (y) , by (t unittype) //time-trend weighting; I still don't understand where the 3.5 base period comes from constraint define 103 (6-3.5) * D_m6 + (5-3.5) * D_m5 + (4-3.5) * D_m4 + (3-3.5) * D_m3 + (2-3.5) * D_m2 + (1-3.5) * D_m1 = 0 ; The third column adds coefficient constraints on top of the second: constraint define 8 D_m7 = D_m6 ; constraint define 9 D_m6 = D_m5 ;\r","date":"2024-06-24","heading":"Time-based: many units, many times","objectID":"/en/posts/event2/:6:4","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 2","uri":"/en/posts/event2/#time-based-many-units-many-times"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Summary\rEvent study analysis is a generalization of DID. My understanding is that event studies further slice DID over time. Because there are more time dummies, solving requires more constraints, so we have to add time-trend controls based on the research context. DID and event studies complement each other; event studies can further show the dynamic effects of the DID estimate (increasing, decreasing, or reverting to the normal value after variation over time). If the two estimates point in opposite directions, it may be because the wrong constraints were chosen, or there is a collinearity issue. Different data structures call for different numbers and types of additional constraints in event studies. From the appendix-code experiments — Solving a Time-based dataset requires adding constraints, and how many depends on the number of event times and individuals. In event studies, standardizing the pre-trend generally tends to be more accurate. A dataset with only one unit but shocks at different times needs constraints added carefully, or you may get the opposite result. Data with many individuals, whether time-based or did, should add a group-type control. ","date":"2024-06-24","heading":"Summary","objectID":"/en/posts/event2/:7:0","tags":["Event Studies","Causal Inference","Stata"],"title":" Econometrics: Event Studies 2","uri":"/en/posts/event2/#summary"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":" Econometrics: Event Studies 1 Econometrics: Event Studies 2 Econometrics: Event Studies 3 Anyone who has done DID is no stranger to parallel-trends tests. And a parallel-trends test is one special application of the event study method. Recently my advisor had me read and study the paper An Introductory Guide to Event Study Models. The authors also published a YouTube video series. This post records my own reflections based on that paper\u0026rsquo;s framework. I haven\u0026rsquo;t looked closely at the code yet, so for now I\u0026rsquo;ll put down my understanding of the statistical theory. ","date":"2024-06-20","heading":"","objectID":"/en/posts/event1/:0:0","tags":["Event Studies","Causal Inference"],"title":" Econometrics: Event Studies 1","uri":"/en/posts/event1/#"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"How does economics study event shocks?\rEvent studies study whether a specific event affected the object of study. This method was first applied in finance — for example, analyzing the impact of company renamings, corporate scandals, and information disclosures on stock price movements.1 Of course, this method calls for more rigorous statistical analysis — Zhihu, for instance, is constantly full of questions like this: After a policy was implemented or a product launched, Apple\u0026rsquo;s or Nvidia\u0026rsquo;s stock evaporated or surged by tens of billions the next day — what\u0026rsquo;s the reason? That kind of analysis is the starting point of event studies, but the statistical test still needs to be more rigorous. Introduced into econometrics, event studies are mainly used to study dynamic treatment effects. By slicing the treatment effect into time groups, we can further discuss the impact of an event. For example, in the figure below studying the effect of unemployment on income,2 dynamic time dummies are built from each person\u0026rsquo;s unemployment timing: one year before unemployment (t-1), one year after (t+1), two years after (t+2). These include anticipatory trends and post-event trends. Earnings losses of displaced workers\rPre-event trends: For example, if everyone expects a wave of unemployment to come, you can see a slow decline before the event arrives, but the shock is still clearly visible right around the moment the event hits (where the x-axis is 0). Post-event trends: After the shock passes, the effect starts to rebound. That is, compare whether the effect strengthens or weakens year by year after the shock. Model assumptions: The parallel-trends test in DID is also an event study. It verifies that the policy satisfies the model assumption — an exogenous shock. So before the policy starts, the treatment effect should be insignificant with a coefficient close to 0, and after it starts, the coefficient should be significantly different from 0. Take the paper on English listening exams and educational inequality3 as an example. The time dummy it sets is when the English listening section was added to the gaokao. Dependent variables: English scores, math and Chinese scores, and admission rates. Heterogeneity groups: urban and rural samples. The figure also shows that before English listening was introduced, the urban-rural gap was small, and after its introduction the gap kept widening. English listening exams and educational inequality\r","date":"2024-06-20","heading":"How does economics study event shocks?","objectID":"/en/posts/event1/:1:0","tags":["Event Studies","Causal Inference"],"title":" Econometrics: Event Studies 1","uri":"/en/posts/event1/#how-does-economics-study-event-shocks"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"The \u0026ldquo;countless\u0026rdquo; little details of event studies\r","date":"2024-06-20","heading":"The \u0026ldquo;countless\u0026rdquo; little details of event studies","objectID":"/en/posts/event1/:2:0","tags":["Event Studies","Causal Inference"],"title":" Econometrics: Event Studies 1","uri":"/en/posts/event1/#the-countless-little-details-of-event-studies"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"The regression specification\rIn econometrics, an event study estimates dynamic treatment effects — it slices the regression over time. Taking panel data as an example, the distinctive feature is adding event-time dummies $D_{i, t-j}$ . $$ y_{ii}=\\underbrace{\\left(\\sum\\_{j\\in\\{-m,\\ldots,0,\\ldots,n\\}}\\gamma_{j}\\cdot D_{i,t-j}\\right)}\\_{\\text{事件时间虚拟变量}}\u0026#43;\\underbrace{\\alpha_{i}\u0026#43;\\delta_{i}}\\_{\\text{面板固定效应}}\u0026#43;\\underbrace{\\beta\\cdot X_{ii}}\\_{\\text{ 控制变量}}\u0026#43;\\epsilon_{ii}. $$","date":"2024-06-20","heading":"The regression specification","objectID":"/en/posts/event1/:2:1","tags":["Event Studies","Causal Inference"],"title":" Econometrics: Event Studies 1","uri":"/en/posts/event1/#the-regression-specification"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Data structure classification\rAn introductory guide to event study models4 gives two classification criteria: Is there a sample group that \u0026ldquo;never received treatment\u0026rdquo;? Do different sample groups have substantially different event dates for treatment? Grouping\rNo \u0026ldquo;never-treated\u0026rdquo; sample\rHas a \u0026ldquo;never-treated\u0026rdquo; sample\rSame event date\rN/A\rDID-type\rDifferent event dates\rTiming-based\rHybrid\rTL;DR — N/A: no control group, so the treatment effect can\u0026rsquo;t be estimated at all. DiD-type: a perfect controlled experiment — the traditional DID. Timing-based: everyone is in the treated group, but the event shocks differ across units, so a comparison can still be made. Take a panel-data study on relocation for poverty alleviation as an example.5 Renmin University\u0026rsquo;s relocation database has long run surveys at relocation resettlement sites, so their study is actually an ITT — all samples are treated units that went through the relocation policy. But! Relocation was carried out in batches — some people moved out earlier, some later. So in the same year, there is both a treated group that already moved and a control group that hasn\u0026rsquo;t, which means the study can still be done. By the way, the paper\u0026rsquo;s conclusion is that once living conditions improve, migrant workers no longer want to leave home. Hence the paper\u0026rsquo;s title, Home Sweet Home. Hybrid: has both a comparison between treated and control groups and a comparison within the treated group in the same year. ","date":"2024-06-20","heading":"Data structure classification","objectID":"/en/posts/event1/:2:2","tags":["Event Studies","Causal Inference"],"title":" Econometrics: Event Studies 1","uri":"/en/posts/event1/#data-structure-classification"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Choosing the event time\rThe overall logic of the event study method is: Choose the event and when it occurs, choose the base period for the event, choose the window (the range of dynamic treatment effects), choose the treated and control groups, and compute and decompose the average treatment effect. Choosing the event date\rEven if a policy is rolled out nationwide at a specific time, markets may react in advance; moreover, most of the time the shock is uneven, spreading out gradually by group, by carrier, by time, and by space. But in applied statistics you just work with what you have and pick the best option available. Take the study of Facebook\u0026rsquo;s effect on college students\u0026rsquo; mental health as an example.6 When each person started using Facebook is obviously hard data to get, so the study matches individual mental-health questionnaires to the timing of when Facebook rolled out on each campus, and runs the regression with that. By the way, the finding: social media use worsened college students\u0026rsquo; mental health. A channel test shows it was driven by comparison anxiety. Handling the base period\rA quick refresher on dummy variables in econometrics: To avoid collinearity, use n-1 dummy variables to estimate the relative gaps among n variables. For example, compare air-pollution levels across the spring-summer-autumn-winter cycle. Estimating such treatment effects requires a base period for comparison. We can default to spring as the base period, so the estimated coefficients for summer, autumn, and winter are all results compared against spring\u0026rsquo;s data. The time dummies in event studies also need a base period, hence the following choices or treatments: Absolute base period: usually choose the period right before the event (the contrast works better and highlights the jump): it reflects long-run gaps, used when there are many pre-event periods. Relative base period: use the previous period as the base: used when focusing on anticipatory effects, or when there are few pre-event periods. Merging periods: to handle collinearity. For example, merge t-6 and earlier into one period, and t+5 and later into one period, or drop a certain period. Base-period treatment: normalize it, set it to 0\u0026hellip;\u0026hellip; Time trends: whether to add time trends, individual fixed effects, and time fixed effects. Event endpoints: the endpoints may be shifted and look ugly, or may reflect the event\u0026rsquo;s trend. An introductory guide to event study models notes that since the choice of event dummies can affect the results, one should strengthen the description of how the dummies are set and restricted. But in the top-5 papers I\u0026rsquo;ve read recently, event studies seem mainly used to visually display heterogeneity and the model\u0026rsquo;s exogenous-shock assumption. So this part is usually glossed over — they just say how the dummies were set, without stressing why. Choosing the window\rChoosing the window is essentially a balance between prettier results and statistical bias. Too short, and the statistics are biased; too long, and the counterfactual estimate isn\u0026rsquo;t efficient enough. From a pragmatic standpoint 🤪 — it\u0026rsquo;s best to let the regression show a clear trend. A symmetric pre- and post-event window is best. You can go further with fitting — for example, first estimate the dynamics by month, then weight by season to bring out a trend. Weighted fitting across multiple events works the same way. A quadratic weighted fit, better at showing a trend\rChoosing the treated and control groups\rExclude special samples. With Chinese city data, for instance, we usually drop municipalities directly under the central government because they\u0026rsquo;re too special! And in the heterogeneity section, we usually look at the difference between provincial capitals and non-capital cities. Pay attention to the parallel-trends test. That is, before the shock, the treated and control groups should look as similar as possible. Add control variable","date":"2024-06-20","heading":"Choosing the event time","objectID":"/en/posts/event1/:2:3","tags":["Event Studies","Causal Inference"],"title":" Econometrics: Event Studies 1","uri":"/en/posts/event1/#choosing-the-event-time"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Choosing the event time\rThe overall logic of the event study method is: Choose the event and when it occurs, choose the base period for the event, choose the window (the range of dynamic treatment effects), choose the treated and control groups, and compute and decompose the average treatment effect. Choosing the event date\rEven if a policy is rolled out nationwide at a specific time, markets may react in advance; moreover, most of the time the shock is uneven, spreading out gradually by group, by carrier, by time, and by space. But in applied statistics you just work with what you have and pick the best option available. Take the study of Facebook\u0026rsquo;s effect on college students\u0026rsquo; mental health as an example.6 When each person started using Facebook is obviously hard data to get, so the study matches individual mental-health questionnaires to the timing of when Facebook rolled out on each campus, and runs the regression with that. By the way, the finding: social media use worsened college students\u0026rsquo; mental health. A channel test shows it was driven by comparison anxiety. Handling the base period\rA quick refresher on dummy variables in econometrics: To avoid collinearity, use n-1 dummy variables to estimate the relative gaps among n variables. For example, compare air-pollution levels across the spring-summer-autumn-winter cycle. Estimating such treatment effects requires a base period for comparison. We can default to spring as the base period, so the estimated coefficients for summer, autumn, and winter are all results compared against spring\u0026rsquo;s data. The time dummies in event studies also need a base period, hence the following choices or treatments: Absolute base period: usually choose the period right before the event (the contrast works better and highlights the jump): it reflects long-run gaps, used when there are many pre-event periods. Relative base period: use the previous period as the base: used when focusing on anticipatory effects, or when there are few pre-event periods. Merging periods: to handle collinearity. For example, merge t-6 and earlier into one period, and t+5 and later into one period, or drop a certain period. Base-period treatment: normalize it, set it to 0\u0026hellip;\u0026hellip; Time trends: whether to add time trends, individual fixed effects, and time fixed effects. Event endpoints: the endpoints may be shifted and look ugly, or may reflect the event\u0026rsquo;s trend. An introductory guide to event study models notes that since the choice of event dummies can affect the results, one should strengthen the description of how the dummies are set and restricted. But in the top-5 papers I\u0026rsquo;ve read recently, event studies seem mainly used to visually display heterogeneity and the model\u0026rsquo;s exogenous-shock assumption. So this part is usually glossed over — they just say how the dummies were set, without stressing why. Choosing the window\rChoosing the window is essentially a balance between prettier results and statistical bias. Too short, and the statistics are biased; too long, and the counterfactual estimate isn\u0026rsquo;t efficient enough. From a pragmatic standpoint 🤪 — it\u0026rsquo;s best to let the regression show a clear trend. A symmetric pre- and post-event window is best. You can go further with fitting — for example, first estimate the dynamics by month, then weight by season to bring out a trend. Weighted fitting across multiple events works the same way. A quadratic weighted fit, better at showing a trend\rChoosing the treated and control groups\rExclude special samples. With Chinese city data, for instance, we usually drop municipalities directly under the central government because they\u0026rsquo;re too special! And in the heterogeneity section, we usually look at the difference between provincial capitals and non-capital cities. Pay attention to the parallel-trends test. That is, before the shock, the treated and control groups should look as similar as possible. Add control variable","date":"2024-06-20","heading":"Choosing the event date","objectID":"/en/posts/event1/:2:3","tags":["Event Studies","Causal Inference"],"title":" Econometrics: Event Studies 1","uri":"/en/posts/event1/#choosing-the-event-date"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Choosing the event time\rThe overall logic of the event study method is: Choose the event and when it occurs, choose the base period for the event, choose the window (the range of dynamic treatment effects), choose the treated and control groups, and compute and decompose the average treatment effect. Choosing the event date\rEven if a policy is rolled out nationwide at a specific time, markets may react in advance; moreover, most of the time the shock is uneven, spreading out gradually by group, by carrier, by time, and by space. But in applied statistics you just work with what you have and pick the best option available. Take the study of Facebook\u0026rsquo;s effect on college students\u0026rsquo; mental health as an example.6 When each person started using Facebook is obviously hard data to get, so the study matches individual mental-health questionnaires to the timing of when Facebook rolled out on each campus, and runs the regression with that. By the way, the finding: social media use worsened college students\u0026rsquo; mental health. A channel test shows it was driven by comparison anxiety. Handling the base period\rA quick refresher on dummy variables in econometrics: To avoid collinearity, use n-1 dummy variables to estimate the relative gaps among n variables. For example, compare air-pollution levels across the spring-summer-autumn-winter cycle. Estimating such treatment effects requires a base period for comparison. We can default to spring as the base period, so the estimated coefficients for summer, autumn, and winter are all results compared against spring\u0026rsquo;s data. The time dummies in event studies also need a base period, hence the following choices or treatments: Absolute base period: usually choose the period right before the event (the contrast works better and highlights the jump): it reflects long-run gaps, used when there are many pre-event periods. Relative base period: use the previous period as the base: used when focusing on anticipatory effects, or when there are few pre-event periods. Merging periods: to handle collinearity. For example, merge t-6 and earlier into one period, and t+5 and later into one period, or drop a certain period. Base-period treatment: normalize it, set it to 0\u0026hellip;\u0026hellip; Time trends: whether to add time trends, individual fixed effects, and time fixed effects. Event endpoints: the endpoints may be shifted and look ugly, or may reflect the event\u0026rsquo;s trend. An introductory guide to event study models notes that since the choice of event dummies can affect the results, one should strengthen the description of how the dummies are set and restricted. But in the top-5 papers I\u0026rsquo;ve read recently, event studies seem mainly used to visually display heterogeneity and the model\u0026rsquo;s exogenous-shock assumption. So this part is usually glossed over — they just say how the dummies were set, without stressing why. Choosing the window\rChoosing the window is essentially a balance between prettier results and statistical bias. Too short, and the statistics are biased; too long, and the counterfactual estimate isn\u0026rsquo;t efficient enough. From a pragmatic standpoint 🤪 — it\u0026rsquo;s best to let the regression show a clear trend. A symmetric pre- and post-event window is best. You can go further with fitting — for example, first estimate the dynamics by month, then weight by season to bring out a trend. Weighted fitting across multiple events works the same way. A quadratic weighted fit, better at showing a trend\rChoosing the treated and control groups\rExclude special samples. With Chinese city data, for instance, we usually drop municipalities directly under the central government because they\u0026rsquo;re too special! And in the heterogeneity section, we usually look at the difference between provincial capitals and non-capital cities. Pay attention to the parallel-trends test. That is, before the shock, the treated and control groups should look as similar as possible. Add control variable","date":"2024-06-20","heading":"Handling the base period","objectID":"/en/posts/event1/:2:3","tags":["Event Studies","Causal Inference"],"title":" Econometrics: Event Studies 1","uri":"/en/posts/event1/#handling-the-base-period"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Choosing the event time\rThe overall logic of the event study method is: Choose the event and when it occurs, choose the base period for the event, choose the window (the range of dynamic treatment effects), choose the treated and control groups, and compute and decompose the average treatment effect. Choosing the event date\rEven if a policy is rolled out nationwide at a specific time, markets may react in advance; moreover, most of the time the shock is uneven, spreading out gradually by group, by carrier, by time, and by space. But in applied statistics you just work with what you have and pick the best option available. Take the study of Facebook\u0026rsquo;s effect on college students\u0026rsquo; mental health as an example.6 When each person started using Facebook is obviously hard data to get, so the study matches individual mental-health questionnaires to the timing of when Facebook rolled out on each campus, and runs the regression with that. By the way, the finding: social media use worsened college students\u0026rsquo; mental health. A channel test shows it was driven by comparison anxiety. Handling the base period\rA quick refresher on dummy variables in econometrics: To avoid collinearity, use n-1 dummy variables to estimate the relative gaps among n variables. For example, compare air-pollution levels across the spring-summer-autumn-winter cycle. Estimating such treatment effects requires a base period for comparison. We can default to spring as the base period, so the estimated coefficients for summer, autumn, and winter are all results compared against spring\u0026rsquo;s data. The time dummies in event studies also need a base period, hence the following choices or treatments: Absolute base period: usually choose the period right before the event (the contrast works better and highlights the jump): it reflects long-run gaps, used when there are many pre-event periods. Relative base period: use the previous period as the base: used when focusing on anticipatory effects, or when there are few pre-event periods. Merging periods: to handle collinearity. For example, merge t-6 and earlier into one period, and t+5 and later into one period, or drop a certain period. Base-period treatment: normalize it, set it to 0\u0026hellip;\u0026hellip; Time trends: whether to add time trends, individual fixed effects, and time fixed effects. Event endpoints: the endpoints may be shifted and look ugly, or may reflect the event\u0026rsquo;s trend. An introductory guide to event study models notes that since the choice of event dummies can affect the results, one should strengthen the description of how the dummies are set and restricted. But in the top-5 papers I\u0026rsquo;ve read recently, event studies seem mainly used to visually display heterogeneity and the model\u0026rsquo;s exogenous-shock assumption. So this part is usually glossed over — they just say how the dummies were set, without stressing why. Choosing the window\rChoosing the window is essentially a balance between prettier results and statistical bias. Too short, and the statistics are biased; too long, and the counterfactual estimate isn\u0026rsquo;t efficient enough. From a pragmatic standpoint 🤪 — it\u0026rsquo;s best to let the regression show a clear trend. A symmetric pre- and post-event window is best. You can go further with fitting — for example, first estimate the dynamics by month, then weight by season to bring out a trend. Weighted fitting across multiple events works the same way. A quadratic weighted fit, better at showing a trend\rChoosing the treated and control groups\rExclude special samples. With Chinese city data, for instance, we usually drop municipalities directly under the central government because they\u0026rsquo;re too special! And in the heterogeneity section, we usually look at the difference between provincial capitals and non-capital cities. Pay attention to the parallel-trends test. That is, before the shock, the treated and control groups should look as similar as possible. Add control variable","date":"2024-06-20","heading":"Choosing the window","objectID":"/en/posts/event1/:2:3","tags":["Event Studies","Causal Inference"],"title":" Econometrics: Event Studies 1","uri":"/en/posts/event1/#choosing-the-window"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Choosing the event time\rThe overall logic of the event study method is: Choose the event and when it occurs, choose the base period for the event, choose the window (the range of dynamic treatment effects), choose the treated and control groups, and compute and decompose the average treatment effect. Choosing the event date\rEven if a policy is rolled out nationwide at a specific time, markets may react in advance; moreover, most of the time the shock is uneven, spreading out gradually by group, by carrier, by time, and by space. But in applied statistics you just work with what you have and pick the best option available. Take the study of Facebook\u0026rsquo;s effect on college students\u0026rsquo; mental health as an example.6 When each person started using Facebook is obviously hard data to get, so the study matches individual mental-health questionnaires to the timing of when Facebook rolled out on each campus, and runs the regression with that. By the way, the finding: social media use worsened college students\u0026rsquo; mental health. A channel test shows it was driven by comparison anxiety. Handling the base period\rA quick refresher on dummy variables in econometrics: To avoid collinearity, use n-1 dummy variables to estimate the relative gaps among n variables. For example, compare air-pollution levels across the spring-summer-autumn-winter cycle. Estimating such treatment effects requires a base period for comparison. We can default to spring as the base period, so the estimated coefficients for summer, autumn, and winter are all results compared against spring\u0026rsquo;s data. The time dummies in event studies also need a base period, hence the following choices or treatments: Absolute base period: usually choose the period right before the event (the contrast works better and highlights the jump): it reflects long-run gaps, used when there are many pre-event periods. Relative base period: use the previous period as the base: used when focusing on anticipatory effects, or when there are few pre-event periods. Merging periods: to handle collinearity. For example, merge t-6 and earlier into one period, and t+5 and later into one period, or drop a certain period. Base-period treatment: normalize it, set it to 0\u0026hellip;\u0026hellip; Time trends: whether to add time trends, individual fixed effects, and time fixed effects. Event endpoints: the endpoints may be shifted and look ugly, or may reflect the event\u0026rsquo;s trend. An introductory guide to event study models notes that since the choice of event dummies can affect the results, one should strengthen the description of how the dummies are set and restricted. But in the top-5 papers I\u0026rsquo;ve read recently, event studies seem mainly used to visually display heterogeneity and the model\u0026rsquo;s exogenous-shock assumption. So this part is usually glossed over — they just say how the dummies were set, without stressing why. Choosing the window\rChoosing the window is essentially a balance between prettier results and statistical bias. Too short, and the statistics are biased; too long, and the counterfactual estimate isn\u0026rsquo;t efficient enough. From a pragmatic standpoint 🤪 — it\u0026rsquo;s best to let the regression show a clear trend. A symmetric pre- and post-event window is best. You can go further with fitting — for example, first estimate the dynamics by month, then weight by season to bring out a trend. Weighted fitting across multiple events works the same way. A quadratic weighted fit, better at showing a trend\rChoosing the treated and control groups\rExclude special samples. With Chinese city data, for instance, we usually drop municipalities directly under the central government because they\u0026rsquo;re too special! And in the heterogeneity section, we usually look at the difference between provincial capitals and non-capital cities. Pay attention to the parallel-trends test. That is, before the shock, the treated and control groups should look as similar as possible. Add control variable","date":"2024-06-20","heading":"Choosing the treated and control groups","objectID":"/en/posts/event1/:2:3","tags":["Event Studies","Causal Inference"],"title":" Econometrics: Event Studies 1","uri":"/en/posts/event1/#choosing-the-treated-and-control-groups"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Choosing the event time\rThe overall logic of the event study method is: Choose the event and when it occurs, choose the base period for the event, choose the window (the range of dynamic treatment effects), choose the treated and control groups, and compute and decompose the average treatment effect. Choosing the event date\rEven if a policy is rolled out nationwide at a specific time, markets may react in advance; moreover, most of the time the shock is uneven, spreading out gradually by group, by carrier, by time, and by space. But in applied statistics you just work with what you have and pick the best option available. Take the study of Facebook\u0026rsquo;s effect on college students\u0026rsquo; mental health as an example.6 When each person started using Facebook is obviously hard data to get, so the study matches individual mental-health questionnaires to the timing of when Facebook rolled out on each campus, and runs the regression with that. By the way, the finding: social media use worsened college students\u0026rsquo; mental health. A channel test shows it was driven by comparison anxiety. Handling the base period\rA quick refresher on dummy variables in econometrics: To avoid collinearity, use n-1 dummy variables to estimate the relative gaps among n variables. For example, compare air-pollution levels across the spring-summer-autumn-winter cycle. Estimating such treatment effects requires a base period for comparison. We can default to spring as the base period, so the estimated coefficients for summer, autumn, and winter are all results compared against spring\u0026rsquo;s data. The time dummies in event studies also need a base period, hence the following choices or treatments: Absolute base period: usually choose the period right before the event (the contrast works better and highlights the jump): it reflects long-run gaps, used when there are many pre-event periods. Relative base period: use the previous period as the base: used when focusing on anticipatory effects, or when there are few pre-event periods. Merging periods: to handle collinearity. For example, merge t-6 and earlier into one period, and t+5 and later into one period, or drop a certain period. Base-period treatment: normalize it, set it to 0\u0026hellip;\u0026hellip; Time trends: whether to add time trends, individual fixed effects, and time fixed effects. Event endpoints: the endpoints may be shifted and look ugly, or may reflect the event\u0026rsquo;s trend. An introductory guide to event study models notes that since the choice of event dummies can affect the results, one should strengthen the description of how the dummies are set and restricted. But in the top-5 papers I\u0026rsquo;ve read recently, event studies seem mainly used to visually display heterogeneity and the model\u0026rsquo;s exogenous-shock assumption. So this part is usually glossed over — they just say how the dummies were set, without stressing why. Choosing the window\rChoosing the window is essentially a balance between prettier results and statistical bias. Too short, and the statistics are biased; too long, and the counterfactual estimate isn\u0026rsquo;t efficient enough. From a pragmatic standpoint 🤪 — it\u0026rsquo;s best to let the regression show a clear trend. A symmetric pre- and post-event window is best. You can go further with fitting — for example, first estimate the dynamics by month, then weight by season to bring out a trend. Weighted fitting across multiple events works the same way. A quadratic weighted fit, better at showing a trend\rChoosing the treated and control groups\rExclude special samples. With Chinese city data, for instance, we usually drop municipalities directly under the central government because they\u0026rsquo;re too special! And in the heterogeneity section, we usually look at the difference between provincial capitals and non-capital cities. Pay attention to the parallel-trends test. That is, before the shock, the treated and control groups should look as similar as possible. Add control variable","date":"2024-06-20","heading":"The problem of trend contamination","objectID":"/en/posts/event1/:2:3","tags":["Event Studies","Causal Inference"],"title":" Econometrics: Event Studies 1","uri":"/en/posts/event1/#the-problem-of-trend-contamination"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Inference for event studies\rClustering tests for autocorrelation. Cluster at whichever level the autocorrelation lives. See Grouping and Measuring Econometric Data (Stata Edition). ","date":"2024-06-20","heading":"Inference for event studies","objectID":"/en/posts/event1/:2:4","tags":["Event Studies","Causal Inference"],"title":" Econometrics: Event Studies 1","uri":"/en/posts/event1/#inference-for-event-studies"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Future directions\rMeasuring event effects with varying intensity Interact the time dummies with the size of the event. I feel this is similar to the shift-share instrumental variable (shift-IV). It uses the group trend net of the individual, multiplied by the individual\u0026rsquo;s size, as the instrument. Multiple events per unit Weight them, or restrict to a single one — count only the largest event or the first occurrence. Handling heterogeneity Interactions, or grouping by time — for example, earlier-affected and later-affected groups. Estimate further through the counterfactual. Because event studies can be biased when fixed effects and trends aren\u0026rsquo;t estimated, the paper uses an estimation technique to make it more accurate (I didn\u0026rsquo;t understand this part). Because event studies can be biased when fixed effects and trends aren\u0026rsquo;t estimated, the paper uses an estimation technique to make it more accurate (I didn\u0026rsquo;t understand this part).\rConsidering non-year event time For example, cohort effects. This is really just custom grouping of time dummies. State transitions An Introductory Guide to Event Study Models doesn\u0026rsquo;t mention this, but I think there\u0026rsquo;s one more direction worth exploring — decomposing the extensive and intensive margins. See Is the Log(y+1) Transformation Reliable? ","date":"2024-06-20","heading":"Future directions","objectID":"/en/posts/event1/:3:0","tags":["Event Studies","Causal Inference"],"title":" Econometrics: Event Studies 1","uri":"/en/posts/event1/#future-directions"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"TL;DR\rEvent studies fundamentally estimate dynamic treatment effects. For accurate estimation, here are some suggestions: Standardize the coefficients Choose an appropriate base period and event window Account for individual effects, time effects, and time trends Account for confounders arising from sample characteristics (use the estimator provided in the paper). ","date":"2024-06-20","heading":"TL;DR","objectID":"/en/posts/event1/:4:0","tags":["Event Studies","Causal Inference"],"title":" Econometrics: Event Studies 1","uri":"/en/posts/event1/#tldr"},{"categories":["Economic Studies"],"collections":["Event Studies"],"content":"Main references\rStata: Programming the Event Study Method From DID to Event Studies (1): Three Acts Make a Play Stata: Understanding the Event Study Method in One Post An Introductory Guide to Event Study Models Xu Wenli\u0026rsquo;s Econometrics Lecture Notes ES, Launch! — A Beginner\u0026rsquo;s Guide to Event Studies [Literature Study] A Beginner\u0026rsquo;s Guide to Event Studies This fits perfectly with my stereotype of finance research relentlessly mining information factors.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Jacobson L S, LaLonde R J, Sullivan D G. Earnings losses of displaced workers[J]. The American economic review, 1993: 685-709.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Li H, Meng L, Mu K, et al. English language requirement and educational inequality: Evidence from 16 million college applicants in China[J]. Journal of Development Economics, 2024: 103271.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Miller D L. An introductory guide to event study models[J]. Journal of Economic Perspectives, 2023, 37（2）: 203-230.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Qiu H, Hong J, Wang X, et al. Home sweet home: Impacts of living conditions on worker migration with evidence from randomized resettlement in China[J]. Journal of Economic Behavior \u0026amp; Organization, 2024, 220: 558-583.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Braghieri L, Levy R, Makarin A. Social media and mental health[J]. American Economic Review, 2022, 112（11）: 3660-3693.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2024-06-20","heading":"Main references","objectID":"/en/posts/event1/:5:0","tags":["Event Studies","Causal Inference"],"title":" Econometrics: Event Studies 1","uri":"/en/posts/event1/#main-references"},{"categories":["Travel"],"collections":["Fieldwork Notes"],"content":" Beijing\u0026rsquo;s popular tourist spots are often located in the east and south—head east to Qinhuangdao or travel south to the Tianjin seaside. The southeast, near the sea, is a favorite among visitors. In the northwest, it\u0026rsquo;s a paradise for hiking and mountain adventures. For example, heading north to Miyun Research Note 2: Miyun Wild Great Wall. This time, the destination for our field research is the Mentougou District on the western side of Beijing. ","date":"2024-06-17","heading":"","objectID":"/en/posts/rose/:0:0","tags":["Fieldwork"],"title":" Research Note 3: Mountains and Red Roses","uri":"/en/posts/rose/#"},{"categories":["Travel"],"collections":["Fieldwork Notes"],"content":"Mountains and Hikers\r","date":"2024-06-17","heading":"Mountains and Hikers","objectID":"/en/posts/rose/:1:0","tags":["Fieldwork"],"title":" Research Note 3: Mountains and Red Roses","uri":"/en/posts/rose/#mountains-and-hikers"},{"categories":["Travel"],"collections":["Fieldwork Notes"],"content":"Beijing Three Peaks\rThis field research takes us to Jianjian Village in Mentougou District, situated at the foot of Miaofeng Mountain. The main peak of Miaofeng Mountain stands at an elevation of 1291 meters, making it the closest peak over a thousand meters to Beijing\u0026rsquo;s urban area1. Along the way, almost every 20 minutes, a backpacker can be seen jogging down the mountain, waving trekking poles. Upon inquiry, we learned that this is the famous \u0026ldquo;Beijing Three Peaks\u0026rdquo; hiking route. The Three Peaks Traverse: from Dajue Temple in Haidian District to Yangtai Mountain and finally to Miaofeng Mountain.\rIn Beijing, this kind of hiking business model is quite common, and many friends in my social circle have participated. If you explore the mountains in the suburbs of Beijing, you’ll often see red ribbons with writing fluttering from the trees—these are usually route markers and advertisements from hiking groups. ","date":"2024-06-17","heading":"Beijing Three Peaks","objectID":"/en/posts/rose/:1:1","tags":["Fieldwork"],"title":" Research Note 3: Mountains and Red Roses","uri":"/en/posts/rose/#beijing-three-peaks"},{"categories":["Travel"],"collections":["Fieldwork Notes"],"content":"Miaofeng Mountain\rDue to time constraints, I only managed to climb the main peak of Miaofeng Mountain. A brief map is provided below: Miaofeng Mountain\r","date":"2024-06-17","heading":"Miaofeng Mountain","objectID":"/en/posts/rose/:1:2","tags":["Fieldwork"],"title":" Research Note 3: Mountains and Red Roses","uri":"/en/posts/rose/#miaofeng-mountain"},{"categories":["Travel"],"collections":["Fieldwork Notes"],"content":"Pingxi Intelligence Station\rDuring the War of Resistance against Japan, Jianjian Village served as a liaison station for joint intelligence with the Northeast Anti-Japanese forces. The Pingxi Intelligence Station is a red education-themed museum dedicated to this history. You can bike up Miaofeng Mountain along the road, and at the foot of the mountain, there\u0026rsquo;s a cycling station with a café. ","date":"2024-06-17","heading":"Pingxi Intelligence Station","objectID":"/en/posts/rose/:1:3","tags":["Fieldwork"],"title":" Research Note 3: Mountains and Red Roses","uri":"/en/posts/rose/#pingxi-intelligence-station"},{"categories":["Travel"],"collections":["Fieldwork Notes"],"content":"Dayun Temple\rIf you choose to take the mountain path (hiking route), the trail up the mountain is hidden among the streets and alleys. Pay attention to the signs and the backpackers coming down the mountain. The starting point of the climb is hidden among the residential streets at the foot of the mountain.\rIt takes about 40 minutes from the foot of the mountain to the top. On the mountainside is the Lingguan Temple (free). Lingguan Temple on the mountainside\rThe summit is Dayun Temple (admission fee required). These temples are all privately managed. Dayun Temple is nominally open from 8:30 to 17:00. The entrance fee is 40 ￥ per person. Because the ticket seller arrived late and left early, I started climbing at 7:20 am and reached the summit gate at 7:55 am. The ticket seller had not arrived yet, but the gate was open2, so I went in directly. gate\rsave point\rInside, there are four halls: the Lower Niangniang Temple, the Temple of the God of Wealth, and one temple that is currently under renovation. The Chinese characters \u0026ldquo;招财进宝\u0026rdquo; mean to attract wealth and treasure. Here, the Chinese character \u0026ldquo;宝\u0026rdquo; is missing a part \u0026ldquo;、\u0026rdquo;, and they promote it as \u0026ldquo;少了一点你,\u0026rdquo; implying that the part that is missing is you. attract wealth and treasure\rJust up another long flight of stairs is the summit, where you\u0026rsquo;ll find Yuhuang Temple. When I entered Yuhuang Temple, the temple gate had just opened. The caretaker who opened the gate expressed surprise that someone had come so early. On June 16, 2024, I was the first person to enter Yuhuang Temple on Miaofeng Mountain. It was me! From the top of Yuhuang Temple, the view is quite stunning. The early bird 😤 gets to enjoy the scenery from up high for free! Standing on the top of the mountain overlooking the first floor\rStanding on the top of the mountain overlooking the first floor\r","date":"2024-06-17","heading":"Dayun Temple","objectID":"/en/posts/rose/:1:4","tags":["Fieldwork"],"title":" Research Note 3: Mountains and Red Roses","uri":"/en/posts/rose/#dayun-temple"},{"categories":["Travel"],"collections":["Fieldwork Notes"],"content":"Mountains and Red Roses\rNot far from Yingtao Gou, there is another local specialty in red — the red rose. Only this place can grow it, also known as Alpine Rose or Miaofeng Mountain Rose. Jianjian Village faces north and south, forming a basin shape, with good conditions for heat drainage. During the summer solstice, it receives no fewer than 13 hours of sunlight. The flowering period has little rain, abundant sunshine, which is conducive to the formation and accumulation of aromatic oil. The soil has a thick humus layer, slightly acidic, with high content of trace elements such as iron, manganese, copper, and zinc. The unique natural conditions produce roses with distinctive fragrance and quality. Reference from Specialty China. The restaurant owner said that since her grandmother\u0026rsquo;s generation, red roses have been a specialty here. They offer rose cakes, rose wine, rose sauce, and rose perfume. Rose scrambled eggs are indeed delicious 😍, while rose cakes lack distinctive flavor, primarily aromatic. Hawthorn and red fruit 3 are also local specialty produce, and both are red What determines my ranking is the attributive!\u0026#160;\u0026#x21a9;\u0026#xfe0e; The gates of the scenic area are opened because the staff on the mountain came down to repair the mountain road.\u0026#160;\u0026#x21a9;\u0026#xfe0e; It tastes no different from hawthorn.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2024-06-17","heading":"Mountains and Red Roses","objectID":"/en/posts/rose/:2:0","tags":["Fieldwork"],"title":" Research Note 3: Mountains and Red Roses","uri":"/en/posts/rose/#mountains-and-red-roses"},{"categories":["Travel"],"collections":["Fieldwork Notes"],"content":"Beijing WTown\rDue to a shortage in the research team, I was roped in by my professor to join the weekend\u0026rsquo;s door-to-door survey. The destination was Chao Guan Village in Beijing WTown, Miyun District, Beijing. This place is quite remarkable, embodying the robust spirit of the north while cloaked in the delicate facade of the south. Miyun District is renowned for its reservoirs, and Gubei Water Town stands proudly along the river. Despite being in the north, it exudes the charm of a southern waterscape. White walls and black tiles, interwoven alleys, rivers running through, and reeds swaying gently in the breeze. Miyun is very rich in water resources.\rHowever, looking far along the river, one can see the northern foothills of the Yan Mountains. Steep mountain ranges border the village’s edge, obscuring much of the sky. In this rugged landscape, the Great Wall of the Ming Dynasty winds and twists, like a dragon turning over in its sleep. Majestic and ancient, grand and serpentine, this Great Wall now stands as the boundary, separating Beijing from Hebei. The Great Wall of the Ming Dynasty, followed by the Simatai Great Wall, a stop in front of Shanhaiguan\r","date":"2024-06-04","heading":"Beijing WTown","objectID":"/en/posts/mycc/:1:0","tags":["Fieldwork"],"title":" Research Note 2: Miyun Wild Great Wall","uri":"/en/posts/mycc/#beijing-wtown"},{"categories":["Travel"],"collections":["Fieldwork Notes"],"content":"Wo Hu Mountain Great Wall\rHaving been in Beijing for so long, I had yet to climb a wild section of the Great Wall. The Wo Hu Mountain Great Wall, part of the Ming Dynasty’s construction, is unique for its circular beacon towers1. The owner of the guesthouse2 gave directions to my classmates on how to reach the Wall, and I decided to join them for the sunrise. We set off at 3 a. m., walking along the national highway beside the guesthouse. After spotting a tourism signpost, we found Yang Qilang’s tomb and temple nearby. Passing through the temple, we reached a dirt path leading into the mountains. The stone-brick road of the Great Wall was mostly in ruins, with only the bricks near the beacon towers remaining relatively intact. Starting from this point was particularly memorable because of the presence of a train tunnel. The first relatively complete beacon tower we arrived at. Around 4 o\u0026rsquo;clock, the sky was already glowing red.\rBecause we needed time for the door-to-door survey, we ended our climb at the third-to-last beacon tower. It was around four o\u0026rsquo;clock then. Climbing all the way up would take about an hour and a half, while descending would be much faster, less than an hour. I haven\u0026rsquo;t climbed many mountains, and before this, I had only watched the sunrise once on Mount Emei. Watching the sunrise on Mount Emei feels like forging iron3. The sea of clouds at the peak rolls like icy rivers, and suddenly, a spark of the sun pierces through the shroud, creating a hole in the canvas. In an instant, the sea of clouds boils, and the flowing mist splashes around, much like the steaming heat during iron forging. Paired with the golden, gleaming Buddha at the summit, it feels like a celestial realm. Watching the sunrise from the mountainside of Wo Hu Mountain, the sun is initially blocked by the distant peaks, making the process slower and more nurturing. As the red foam slowly rises in the distance, the ink-wash painting ambiance gradually ascends from near to far. The layers of verdant mountains, the dissipating mist, and the distant lights flickering on one by one—this is the mortal world. sunrise view\rTaking photos at this time has the feeling of silhouette - other students’ photography skills are so good. In my hand is a wooden stick that I picked up casually\rAt 4:46, the sun officially crested the mountain peak4. At that moment, I kept thinking of Shi Tiesheng\u0026rsquo;s words— But the sun, it is always both a setting sun and a rising sun. As it extinguishes itself, descending and gathering up the desolate remnants of light, it is simultaneously blazing and climbing the peak on the other side, spreading its radiant dawn. One day, I too will quietly descend the mountain, supported by my crutch. One day, in some mountain hollow, a joyous child will surely run up, clutching his toy. Of course, that child won’t be me. But is it not me? —Shi Tiesheng, I and the Temple of Earth sunrise view\r","date":"2024-06-04","heading":"Wo Hu Mountain Great Wall","objectID":"/en/posts/mycc/:2:0","tags":["Fieldwork"],"title":" Research Note 2: Miyun Wild Great Wall","uri":"/en/posts/mycc/#wo-hu-mountain-great-wall"},{"categories":["Travel"],"collections":["Fieldwork Notes"],"content":"Research Summary\rThis survey was conducted at the village level, which made the social interactions significantly easier compared to the previous county-level research I had participated in—finally, no more socializing over alcohol. Personal Reflections: Addressing climate change is indeed urgent. Gubei Water Town is blessed with ample water resources, with most of its land being irrigated fields, including many paddy fields. However, villagers reported that since 2018, the water levels have been declining annually, leading to many irrigated fields being converted into forested areas due to the decreasing water levels. The suburbs of Beijing aren’t much different from my hometown. It is often assumed that poorer areas tend to favor sons over daughters, but here, due to men\u0026rsquo;s jobs being insufficient to support a family and the bride price system, people actually feel it’s better to have daughters. The attitude of the residents reflects the quality of governance. In areas with rampant corruption, villagers clearly distrusted us, feeling that despite all the surveys, nothing changes: \u0026ldquo;We common folks, no matter how much we talk, it doesn’t help.\u0026rdquo; In well-governed areas with good welfare, every response was filled with gratitude towards the state, with villagers willing to comply with any government directives. I realized I am indeed quite careless! My fellow classmates, especially the female students, were much more meticulous than I was. Their questionnaire filling and reviewing were more rigorous, and I should learn from them. Survey Methods: Elderly party members and enthusiastic grandmothers make the best interviewees—they are attentive, sincere, and willing to actively cooperate with door-to-door surveys. When it comes to income-related surveys, respondents often understate their wealth. In such cases, it is important to observe the room (decoration, presence of a car, size, quality of furniture, etc.) and learn to ask disaggregated questions. For example, break down farming into the yield per mu, the number of mu farmed, and the price per jin. Similarly, use cross-verification by asking unexpected questions. For instance, when calculating income and expenses separately, ensure they balance. For household expenses, consider the number of family members and their consumption. When respondents are uncertain, set ranges—do you have 100 yuan? 200 yuan? The answers to questions can easily be manipulated. For example, asking if villagers come together to discuss solutions when faced with difficulties will invariably get a positive response. However, asking specific questions reveals more. After a recent storm in Beijing knocked down trees in many parks and schools, asking about the storm\u0026rsquo;s impact on their fields and if they sought collective solutions will likely reveal that everyone managed their own fields independently. Village-household integration. When implementing subsidy programs at the village level, the approach is often straightforward and crude. For example, the distinction between reforestation and ecological public welfare forests is blurred for villagers, who view both as tree planting for money. Subsidies are divided into planting subsidies and other types, but in the village, they are distributed together, making farmers think they get money just for planting. To address this, policies need to be broken down and explained in conjunction with villagers\u0026rsquo; responses. Praise should be moderate. Each questionnaire typically takes about an hour5. To ensure cooperation, we often praise the respondents during the interview. However, if the praise is excessive, some attitudinal questions may receive overly positive responses, distorting the results. Moreover, for questions about marital harmony or neighborly relations, unless asked about neighbors, personal responses tend to be uniformly positive. The owner of the B\u0026amp;B said that the circular beacon tower here is one of only two in Beijing.\u0026#","date":"2024-06-04","heading":"Research Summary","objectID":"/en/posts/mycc/:3:0","tags":["Fieldwork"],"title":" Research Note 2: Miyun Wild Great Wall","uri":"/en/posts/mycc/#research-summary"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"I only started using Obsidian recently, so this post is a quick record of my workflow. I mainly use Obsidian to write and manage blog posts and literature-reading notes. ","date":"2024-05-24","heading":"","objectID":"/en/posts/ob/:0:0","tags":["Obsidian","Zotero","Hugo"],"title":"Using Obsidian for Literature Reading and Blog Writing","uri":"/en/posts/ob/#"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"Obsidian and plugin usage\rForum: https://forum-zh.obsidian.md/ Recommended tutorial: An Incomplete Beginner Guide to Obsidian Obsidian represents the idea of bidirectional linking: notes can connect to each other and gradually form a network of knowledge. For me, the real reason to use Obsidian is its absurdly good plugin ecosystem. It makes writing and organizing notes genuinely enjoyable. A quick note: the minimum entry requirement is knowing basic Markdown syntax. ","date":"2024-05-24","heading":"Obsidian and plugin usage","objectID":"/en/posts/ob/:1:0","tags":["Obsidian","Zotero","Hugo"],"title":"Using Obsidian for Literature Reading and Blog Writing","uri":"/en/posts/ob/#obsidian-and-plugin-usage"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"Downloading the software\rDownload the app from the official website: https://obsidian.md/ After installing it, the startup screen looks like this. A vault is simply the folder where your notes are stored. In my case, I keep separate vaults for blog writing and literature notes. Startup screen\rAfter you choose a vault location, an extra .obsidian folder appears inside it. That folder stores the app settings, including plugins, interface style, and so on. My own layout looks like this: My interface layout\rThe rich have a second monitor. The rest of us make do with split view 😤 Obsidian settings: Just replace the .obsidian folder in the vault. You can download my .obsidian config from my GitHub repository. After downloading it, remember to unzip themes.zip. Each vault has its own settings. That means every vault can use a completely different theme and plugin setup. I really like this, because writing blog posts and managing notes often call for different tools, so independent vault settings feel necessary. ","date":"2024-05-24","heading":"Downloading the software","objectID":"/en/posts/ob/:1:1","tags":["Obsidian","Zotero","Hugo"],"title":"Using Obsidian for Literature Reading and Blog Writing","uri":"/en/posts/ob/#downloading-the-software"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"Interface fonts\rYou can change the interface font in Settings -\u0026gt; Appearance -\u0026gt; Font. ","date":"2024-05-24","heading":"Interface fonts","objectID":"/en/posts/ob/:1:2","tags":["Obsidian","Zotero","Hugo"],"title":"Using Obsidian for Literature Reading and Blog Writing","uri":"/en/posts/ob/#interface-fonts"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"About bidirectional links\rDocument properties: if the first line is blank, type --- three times to add document properties. If the first line is not blank, --- creates a horizontal rule instead. Adding tags: #tag1, #tag2 Links: Link to a note: [[文件名]] Link to a heading in a note: [[ # ]] Link to a paragraph (block) in a note: [[ # ^ ]] Create an alias for a link (keyword): [[ | 关键词]] Link to an external file such as Evernote: [关键词](链接) Add an image: ![[]] or ![图片标题](图片引用路径)\r","date":"2024-05-24","heading":"About bidirectional links","objectID":"/en/posts/ob/:1:3","tags":["Obsidian","Zotero","Hugo"],"title":"Using Obsidian for Literature Reading and Blog Writing","uri":"/en/posts/ob/#about-bidirectional-links"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"Plugin usage\rAfter replacing the .obsidian folder, open the vault, click Trust author, and turn off safe mode. Settings page: you can change themes under Appearance, and install or enable community plugins here\rClick the gear icon labeled Settings in the lower-left corner to open all installed plugins. You can also check for plugin updates and browse the community plugin marketplace (you need a VPN/proxy for that). ","date":"2024-05-24","heading":"Plugin usage","objectID":"/en/posts/ob/:2:0","tags":["Obsidian","Zotero","Hugo"],"title":"Using Obsidian for Literature Reading and Blog Writing","uri":"/en/posts/ob/#plugin-usage"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"Command\rMost plugins are easy enough to use once they show up in the interface. The rest are mainly driven by keyboard commands. Click the \u0026gt;_ icon in the far-left sidebar (shortcut: ctrl+p), type the command you want in the pop-up, and run the plugin from there. Some plugins need to be called through commands\rThe Command plugin can also help you add quick-access buttons for commands. Where you add a command button\rOpen the right-click menu, or click the three-dot icon at the top right of the note pane, then choose Add command. After going through choose command -\u0026gt; choose icon -\u0026gt; choose name, the shortcut button is added. ","date":"2024-05-24","heading":"Command","objectID":"/en/posts/ob/:2:1","tags":["Obsidian","Zotero","Hugo"],"title":"Using Obsidian for Literature Reading and Blog Writing","uri":"/en/posts/ob/#command"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"Pandoc\rIt is not enough to install only the plugin. Obsidian notes use Markdown syntax and can export to PDF. Pandoc lets you export to more formats too, such as LaTeX, epub, and HTML. There are two steps: Go to the official site and download the Pandoc application itself. Then install and enable the Pandoc plugin and the Enhancing export plugin. In the settings for both plugins, fill in the Pandoc file path and set the export directory. After that, an Export as... option will appear under the three-dot menu in the top-right corner of the note pane. ","date":"2024-05-24","heading":"Pandoc","objectID":"/en/posts/ob/:2:2","tags":["Obsidian","Zotero","Hugo"],"title":"Using Obsidian for Literature Reading and Blog Writing","uri":"/en/posts/ob/#pandoc"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"Easy typing\rThis is one of the main plugins that sold me on Obsidian. When you write documents that mix Chinese and English, there are lots of little conventions to keep track of. For example: Put spaces between Chinese text and numbers or English words; Switching input methods is annoying; English sentences should start with a capital letter. With easy typing enabled, numbers and English words are automatically spaced in Chinese text; typing a Chinese punctuation mark twice turns it into the English version; and the first letter of an English sentence is capitalized automatically\u0026hellip; ","date":"2024-05-24","heading":"Easy typing","objectID":"/en/posts/ob/:2:3","tags":["Obsidian","Zotero","Hugo"],"title":"Using Obsidian for Literature Reading and Blog Writing","uri":"/en/posts/ob/#easy-typing"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"Annotator\rObsidian itself cannot read PDF files directly, so people usually use the annotator plugin. In a new note, type --- on the first line to add document properties, then add annotation-target, click the field that appears, and choose the PDF you want to read. Close and reopen the note, and it turns into a PDF reading interface that also supports annotations. Example of document properties\r","date":"2024-05-24","heading":"Annotator","objectID":"/en/posts/ob/:2:4","tags":["Obsidian","Zotero","Hugo"],"title":"Using Obsidian for Literature Reading and Blog Writing","uri":"/en/posts/ob/#annotator"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"Copilot chat\rThere are roughly three ways people integrate AI into Obsidian. One is direct embedding, where you continue writing notes from context through commands. Another focuses on built-in file search and note-style management. The third keeps the conversation in a sidebar. Personally, I recommend that third route, and Copilot chat is the plugin I would pick. After installation, open the settings page. For Default model, I recommend choosing OPEENROUTER. AI. It is basically a broker that lets you access different models through one service. Scroll down to the model settings and choose the model you want. I recommend OPEENROUTER. AI\rScroll down a bit further and you will find the place to enter the OPEENROUTER API. Scroll down to find the model settings and choose the one you want\rOpenrouter. Ai API key can be generated here The model list is here: You are not limited to GPT-3.5 either. Just search for the keyword free, and the listed AI models can all be used for free. Choose the free model name you want\rFor example, copy one of the following model names into openrouter model: openchat/openchat-7b:free meta-llama/llama-3-8b-instruct:free google/gemma-7b-it:free gryphe/mythomist-7b:free\rClick Copilot chat in the left sidebar, and an AI chat panel will appear on the right. It can read your notes too. ","date":"2024-05-24","heading":"Copilot chat","objectID":"/en/posts/ob/:2:5","tags":["Obsidian","Zotero","Hugo"],"title":"Using Obsidian for Literature Reading and Blog Writing","uri":"/en/posts/ob/#copilot-chat"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"Other plugins\rBetter word count: counts Chinese characters more accurately (Obsidian already has a word count in the bottom-right corner). Footnote shortcut: gives you a better footnote editing experience. It can add footnotes through commands automatically, and if you run the footnote command again on an existing footnote, you can jump between the footnote marker and the footnote content at the end of the article. Word Splitting for Simplified Chinese in Edit Mode and Vim Mode: when you double-click a sentence, this plugin does a better job recognizing Chinese word boundaries. ","date":"2024-05-24","heading":"Other plugins","objectID":"/en/posts/ob/:2:6","tags":["Obsidian","Zotero","Hugo"],"title":"Using Obsidian for Literature Reading and Blog Writing","uri":"/en/posts/ob/#other-plugins"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"Obsidian and mobile devices\rHow to sync Obsidian files in March 2022 (a stage-by-stage summary) One of Obsidian\u0026rsquo;s weak spots is cross-device syncing: it can be fiddly and unreliable. If you can afford the official service, that is still the best option. Short version: ","date":"2024-05-24","heading":"Obsidian and mobile devices","objectID":"/en/posts/ob/:3:0","tags":["Obsidian","Zotero","Hugo"],"title":"Using Obsidian for Literature Reading and Blog Writing","uri":"/en/posts/ob/#obsidian-and-mobile-devices"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"Cross-platform sync: Remotely save\rRemotely save (sync plugin) has been one of the most discussed plugins lately, and the tutorial page already collects a lot of material: Obsidian sync: Remotely Save S3 setup guide by 恐咖兵糖 Third-party sync plugin (an introduction to Remotely save) by 软通达: Dropbox Using the Obsidian Remotely Save plugin to sync desktop and mobile by yaozhuwa: OneDrive method (In my own tests, the plain Remotely save + OneDrive setup was already broken. On Android, OneDrive folder recognition has issues, so you need a third-party transfer tool such as FolderSync to act as a OneDrive middle layer, and even then you still have to trigger syncing manually.) The most comfortable third-party multi-device sync setup for Obsidian by 维客笔记：Dropbox Tutorial on pairing the Remotely plugin with Tencent Cloud COS by 八宝周：Tencent Cloud, S3 Using the Remotely save plugin with Obsidian to sync via Nutstore by BCS：Nutstore, WebDAV Using Remotely Save with Alibaba Cloud OSS for multi-platform sync by zm：Alibaba Cloud OSS, S3 ","date":"2024-05-24","heading":"Cross-platform sync: Remotely save","objectID":"/en/posts/ob/:3:1","tags":["Obsidian","Zotero","Hugo"],"title":"Using Obsidian for Literature Reading and Blog Writing","uri":"/en/posts/ob/#cross-platform-sync-remotely-save"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"PC and Android sync\rOn Windows and Android, you can consider Syncthing (sync software) or a similar option such as 微力同步. See also Using Tencent Cloud to build Syncthing for syncing Obsidian by 软通达. ","date":"2024-05-24","heading":"PC and Android sync","objectID":"/en/posts/ob/:3:2","tags":["Obsidian","Zotero","Hugo"],"title":"Using Obsidian for Literature Reading and Blog Writing","uri":"/en/posts/ob/#pc-and-android-sync"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"Mac and iOS sync\rYou can consider iCloud. I do not have the devices myself, so I have not tried it. ","date":"2024-05-24","heading":"Mac and iOS sync","objectID":"/en/posts/ob/:3:3","tags":["Obsidian","Zotero","Hugo"],"title":"Using Obsidian for Literature Reading and Blog Writing","uri":"/en/posts/ob/#mac-and-ios-sync"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"Computer-to-computer sync only\rI recommend sync tools such as Nutstore. Just keep two things in mind: Do not keep Obsidian and the sync software open on both machines at the same time, or saving errors may occur. Make sure you understand the difference between a sync disk and a storage disk (cloud drive). ","date":"2024-05-24","heading":"Computer-to-computer sync only","objectID":"/en/posts/ob/:3:4","tags":["Obsidian","Zotero","Hugo"],"title":"Using Obsidian for Literature Reading and Blog Writing","uri":"/en/posts/ob/#computer-to-computer-sync-only"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"Hugo and Obsidian\rRecommended reading: Best practices for writing with Hugo One-click blog publishing with Obsidian Obsidian + Hugo + Cloudflare: making blog publishing ridiculously simple I would also recommend the hugo preview plugin. It basically loads an online blog preview page inside Obsidian. Once the plugin is enabled, click the blue square in the lower-right corner to open it. In practice, it is just importing a specific webpage into Obsidian for preview. Best of both worlds!\rAnother plugin worth mentioning is mermaid. The LoveIt Hugo theme supports flowchart rendering, and I can never remember every last detail of the syntax, so this plugin helps a lot. I still use local image references for now (I just like managing files locally 😀), imge converter can automatically compress, rename, and convert image formats; the clear unsed images plugin can help clean up local images that are no longer referenced. As for changing image reference paths (copying post/img to static/img) and pushing the blog to Git, I do not use Obsidian\u0026rsquo;s Git plugin. I let .bat scripts handle both jobs instead (honestly, just letting GPT write them is enough), and it is simple. That way I can focus on writing. As for creating new blog templates, there is no need to set up a quick plugin. Obsidian already has built-in template support: just create a template folder, put your Markdown template files in it, and when you create a new post, click the corresponding template-import icon in the left sidebar. ","date":"2024-05-24","heading":"Hugo and Obsidian","objectID":"/en/posts/ob/:4:0","tags":["Obsidian","Zotero","Hugo"],"title":"Using Obsidian for Literature Reading and Blog Writing","uri":"/en/posts/ob/#hugo-and-obsidian"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"Zotero and Obsidian\rRecommended reading: Zotero + Obsidian workflow roundup - the most complete 2023 guide The sad part is that the best solutions are usually paid 🤧. When Zotero 7 had just been updated, I paid for a plugin from Qingning Academic. It let me move Zotero annotation notes into Obsidian almost seamlessly. Qingning Academic plugin integration. If you want image transfer to feel truly seamless, you pretty much need to set up image hosting no matter what\rBy 2024, Zotero had split into Zotero 6 and Zotero 7, and the author of the mdnote plugin had explicitly said they would not keep improving compatibility for Zotero 7. That left even fewer options. Another free setup I am currently using is Zotero\u0026rsquo;s Better Note plugin together with Obsidian\u0026rsquo;s Zotero Integration plugin. My Zotero Better Note template and tutorial Create literature notes with Better Note in Zotero, then import those notes into Obsidian through the Zotero Integration plugin for further organization. ","date":"2024-05-24","heading":"Zotero and Obsidian","objectID":"/en/posts/ob/:5:0","tags":["Obsidian","Zotero","Hugo"],"title":"Using Obsidian for Literature Reading and Blog Writing","uri":"/en/posts/ob/#zotero-and-obsidian"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"The note-taking app debate\rA lot of people online compare Notion, Obsidian, and other note-taking apps. I picked Obsidian mainly for its rich open-source plugin ecosystem and the peace of mind that comes with local storage. That said, the usual complaint about Obsidian is easy enough to understand: there are too many plugins, the features can get flashy, and the learning curve is not exactly low, so the priorities sometimes feel blurred. Even so, I still have not used Obsidian to build a proper knowledge graph. Just using it as a writing tool already feels great. Beyond that, Obsidian was originally meant to help people build a knowledge system. What inspires me in other people\u0026rsquo;s setups is not how pretty their notes look, but how they use Obsidian to carry out their own way of organizing information🦾. Using plugins to rotate periodic notes for review; building keyword-based note blocks and expanding them over time; connecting Obsidian with other tools to refine a workflow; combining note structure with design\u0026hellip; ","date":"2024-05-24","heading":"The note-taking app debate","objectID":"/en/posts/ob/:6:0","tags":["Obsidian","Zotero","Hugo"],"title":"Using Obsidian for Literature Reading and Blog Writing","uri":"/en/posts/ob/#the-note-taking-app-debate"},{"categories":["Software Tools"],"collections":[],"content":" My current latest streaming solution is Moonlight; my evaluation of the various streaming solutions I have tried is at the end. I finally switched to a gaming laptop. Since I usually carry my computer around everywhere, I picked the Tianxuan 3, which has the strongest battery life and lightest weight among value gaming laptops1. But I miscalculated in the end; after adjusting for a while I still found it too bulky, so I decided to use a tablet to remotely control it. There are many remote-control options: ToDesk, Sunlogin, TeamViewer, RustDesk, Parsec\u0026hellip; Speed, convenience, and image quality — ToDesk is number one in all of them (Parsec is better, but connecting requires an external network). The free version has no privacy screen, but in my dorm room nobody pays any attention to my computer screen ( My setup: Huawei MatePad Soft Light Edition + ToDesk + Tianxuan 3 Core Edition. Here I will mainly cover how to enable remote audio transmission. ","date":"2024-05-19","heading":"","objectID":"/en/posts/todesk/:0:0","tags":["ToDesk","Remote Access"],"title":"Audio Issues When Remotely Controlling a PC with a ToDesk Tablet","uri":"/en/posts/todesk/#"},{"categories":["Software Tools"],"collections":[],"content":"PC Side\rYou need the sound-card driver protocol to transmit the computer\u0026rsquo;s audio to the controlling device. If there is no sound-card driver, create a .text file as follows, enter the code, rename it to end with .bat, and run it. @echo off pushd \"%~dp0\" dir /b C:\\Windows\\servicing\\Packages\\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~3*.mum \u003eList.txt dir /b C:\\Windows\\servicing\\Packages\\Microsoft-Windows-GroupPolicy-ClientTools-Package~3*.mum \u003e\u003eList.txt for /f %%i in ('findstr /i . List.txt 2^\u003enul') do dism /online /norestart /add-package:\"C:\\Windows\\servicing\\Packages\\%%i\" pause\rThen start the audio invocation: Open the Run window, type gpedit.msc in the Run box, and click OK. Type the gpedit.msc command\rOpen the editing interface. Open the Local Group Policy Editor\rIn the menu bar, select 【Computer Configuration】-【Administrative Templates】-【All Settings】in order. Select the configuration\rScroll down the page on the right, find the \u0026ldquo;Allow audio and video playback redirection\u0026rdquo; option, right-click it, and choose Edit. Find the Allow audio and video playback redirection option\rEnable \u0026ldquo;Allow audio and video playback redirection\u0026rdquo;. Choose Enable\r","date":"2024-05-19","heading":"PC Side","objectID":"/en/posts/todesk/:1:0","tags":["ToDesk","Remote Access"],"title":"Audio Issues When Remotely Controlling a PC with a ToDesk Tablet","uri":"/en/posts/todesk/#pc-side"},{"categories":["Software Tools"],"collections":[],"content":"Tablet Side\rClick the expand arrow in the bottom-right corner of the control page. The expand button to the left of the keyboard symbol\rClick to turn on audio; once it is on, the corresponding button becomes \u0026ldquo;turn off audio\u0026rdquo;. If you switch away from the tablet page and come back to no sound, turn audio off and then back on. Turning audio on and off\r","date":"2024-05-19","heading":"Tablet Side","objectID":"/en/posts/todesk/:2:0","tags":["ToDesk","Remote Access"],"title":"Audio Issues When Remotely Controlling a PC with a ToDesk Tablet","uri":"/en/posts/todesk/#tablet-side"},{"categories":["Software Tools"],"collections":[],"content":"Notes\rAfter enabling audio transmission, even if the computer is muted, the controlling device still has sound, and the volume is controlled by the controlling device. Since tablets generally have no earpiece, audio is played through the speakers by default. I use Bluetooth earbuds connected to the tablet; sometimes the audio plays through the speakers and sometimes through the earbuds. From what I have observed, you need to connect the earbuds to the tablet first, and then start the remote control, so the audio goes through the earbuds rather than the speakers. ","date":"2024-05-19","heading":"Notes","objectID":"/en/posts/todesk/:3:0","tags":["ToDesk","Remote Access"],"title":"Audio Issues When Remotely Controlling a PC with a ToDesk Tablet","uri":"/en/posts/todesk/#notes"},{"categories":["Software Tools"],"collections":[],"content":"Brief Review of Streaming Solutions\rHuawei: I flashed a Huawei PC Manager onto the Tianxuan; in its settings you can enable remote control, and on Huawei phones and tablets you can find remote control under Smart Connection. Includes a privacy screen, decent speed, no gaming mouse support, lower image quality — basically a ToDesk with an extra privacy screen. ASUS: requires a personal Microsoft account; mine is a family account, so it does not work. Parsec: high image quality, low latency, game support, no privacy screen, easy to set up (you just need a VPN when logging into the software on the device). It should be the best solution in general — but it is not compatible with the Huawei tablet, where the mouse wheel and audio playback fail. Moonlight + Sunshine: a drop-in replacement for Parsec, and optimized for Steam — the ultimate solution for streaming from anywhere. The downside is that the campus network assigns a random IP each time, so I have to reconfigure it. This is the solution I am currently using. Another drawback — occasionally the audio still stutters, and the mouse optimization is poor too. Changing to a remote-friendly mouse in moonlight works, but then it no longer suits games2. With the 4060 config, it basically came down to choosing among the OMEN 9, the Lenovo Y7000, and the Tianxuan 3.\u0026#160;\u0026#x21a9;\u0026#xfe0e; For example, in games like Genshin Impact and Honkai: Star Rail that hide the mouse cursor, enabling this feature will make you lose the mouse-look function in-game.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2024-05-19","heading":"Brief Review of Streaming Solutions","objectID":"/en/posts/todesk/:4:0","tags":["ToDesk","Remote Access"],"title":"Audio Issues When Remotely Controlling a PC with a ToDesk Tablet","uri":"/en/posts/todesk/#brief-review-of-streaming-solutions"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Is the log(y+1) transformation reliable?\r","date":"2024-05-12","heading":"Is the log(y+1) transformation reliable?","objectID":"/en/posts/log0/:0:0","tags":["Causal Inference"],"title":"Econometrics: Is the log(y+1) transformation reliable?","uri":"/en/posts/log0/#is-the-logy1-transformation-reliable"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Abstract\rTitle: Logs with Zeros? Some Problems and Solutions\rAuthors: Jiafeng Chen; Jonathan Roth\rJournal: The Quarterly Journal of Economics (2024/3/30)\rDOI: 10.1093/qje/qjad054\rTranslated abstract: When studying an outcome variable $Y$ that can equal 0 (for example, earnings), many researchers estimate the average treatment effect (ATE) after applying a transformation that behaves like $\\log(Y)$ when $Y$ is large and is defined at zero by using $\\log(1\u0026#43;Y)$. Our paper shows that the average treatment effect under this kind of log-like transformation should not be interpreted as a percentage effect, because the estimate depends on the units in which the outcome is measured. In fact, we show that one can obtain treatment effects of arbitrary magnitude simply by changing the units of $Y$ before applying the transformation. This happens because, for observations whose outcome moves from zero to nonzero, the individual-level percentage effect is not well defined, and the units of the outcome implicitly determine how much weight the transformed ATE places on the extensive margin. More generally, we uncover an \u0026ldquo;impossibility triangle\u0026rdquo;: when the outcome variable can equal zero, one cannot simultaneously have an estimand that is an average treatment effect, is invariant to the units of $Y$, and is point identified. We discuss several alternative approaches that may be reasonable in settings with both intensive and extensive margins, including (1) estimating average treatment effects in levels and then expressing them in percentage terms afterward (for example, with Poisson regression), (2) explicitly calibrating the weight placed on the intensive and extensive margins, and (3) estimating intensive-margin and extensive-margin treatment effects separately (for example, with Lee bounds). We illustrate these methods in three empirical applications.\r","date":"2024-05-12","heading":"Abstract","objectID":"/en/posts/log0/:1:0","tags":["Causal Inference"],"title":"Econometrics: Is the log(y+1) transformation reliable?","uri":"/en/posts/log0/#abstract"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"The short version\rThis post asks whether log transformations with zeros, such as $log(1\u0026#43;y)$ and $arcsinh(y)=\\sqrt{1\u0026#43;y^2}\u0026#43;y$, are actually reliable. ","date":"2024-05-12","heading":"The short version","objectID":"/en/posts/log0/:2:0","tags":["Causal Inference"],"title":"Econometrics: Is the log(y+1) transformation reliable?","uri":"/en/posts/log0/#the-short-version"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"A code example\rThe output below shows that when the data contain zeros, changing the units of $y$ before taking logs can change the statistical significance of the regression. sysuse nlsw88, clear replace wage = 0 if _n\u003c=400 //前400个观测值的工资改为0值 gen lnwage1 = ln(1 + .128683 * wage) gen lnwage2 = ln(1 + .7744329 * wage) gen lnwage3 = ln(1 + 84.02252 * wage) gen lnwage4 = ln(1 + 4.68e+08 * wage) gen lnwage5 = ln(1 + 3.77e+25 * wage) reg lnwage1 tenure grade eststo m1 reg lnwage2 tenure grade eststo m2 reg lnwage3 tenure grade eststo m3 reg lnwage4 tenure grade eststo m4 reg lnwage5 tenure grade eststo m5 esttab m1 m2 m3 m4 m5, keep(tenure) b(3) se compress /*------------------------------------------------------------------------- (1) (2) (3) (4) (5) lnwage1 lnwage2 lnwage3 lnwage4 lnwage5 --------------------------------------------------------------------------- tenure 0.010*** 0.020*** 0.030** 0.050 0.100 (0.001) (0.003) (0.010) (0.032) (0.090) --------------------------------------------------------------------------- N 2229 2229 2229 2229 2229 ---------------------------------------------------------------------------*/\r","date":"2024-05-12","heading":"A code example","objectID":"/en/posts/log0/:3:0","tags":["Causal Inference"],"title":"Econometrics: Is the log(y+1) transformation reliable?","uri":"/en/posts/log0/#a-code-example"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Explanation\rHow we usually interpret log transformations\rThe standard view is that, once you take logs, the coefficient has a percentage interpretation. What a log coefficient means\rAfter taking logs, we usually read the coefficient as a percentage change. For example, with lnGDP, the coefficient in a regression is often read as the percentage change in GDP. If the model is reg lny lnx, then the coefficient is an elasticity. See What taking logs means. For the regression below, $$ \\ln y_n=\\alpha\u0026#43;\\beta x_n \u0026#43;\\varepsilon $$ the coefficient has the following economic meaning: $$ \\begin{align} \\beta \u0026amp; = \\frac{\\ln Y\\_{n\u0026#43;1}-\\ln Y\\_{n}}{X\\_{n\u0026#43;1}-X\\_{n}}\\\\ \u0026amp;=\\frac{\\ln \\frac{Y\\_{n\u0026#43;1}}{Y\\_{n}}}{X\\_{n\u0026#43;1}-X\\_{n}}= \\frac{\\ln (1\u0026#43;\\frac{Y\\_{n\u0026#43;1}-Y\\_{n}}{Y\\_{n}})}{\\Delta X}\\\\ \u0026amp;= \\frac{\\ln (1\u0026#43;\\Delta Y \\\\\\% )}{\\Delta X} \\approx\\frac{\\Delta Y \\\\\\% }{\\Delta X} \\end{align} $$ Sometimes researchers also take logs because the data are long-tailed, and logging them makes the distribution more compact. The limits of log transformations\rThe paper\u0026rsquo;s main point is this: when the data contain zeros and the unit of measurement changes (for example, hourly wages, monthly wages, and weekly wages in labor economics), the estimated effect from the log transformation changes too, which makes the result hard to trust. We usually think the treatment effect after logging is a kind of percentage effect and should not depend on the scaling parameter $\\alpha$. $$ \\small ATE=E[\\log(1\u0026#43;aY(1))-\\log(1\u0026#43;aY(0))]=E\\left[\\log\\left(\\frac{1\u0026#43;aY(1)}{1\u0026#43;aY(0)}\\right)\\right] $$ But once we look more carefully at the structure of the data, things change: $$ \\begin{aligned} \\lim_{a\\to\\infty}\\log\\left(\\frac{1\u0026#43;aY(1)}{1\u0026#43;aY(0)}\\right)=\\begin{cases}\\log\\left(\\frac{Y(1)}{Y(0)}\\right)\u0026amp;\\text{if }Y(1)\u0026gt;0,Y(0)\u0026gt;0\\\\ 0\u0026amp;\\text{if }Y(1)=0,Y(0)=0\\\\ \\infty\u0026amp;\\text{if }Y(1)\u0026gt;0,Y(0)=0\\\\ -\\infty\u0026amp;\\text{if }Y(1)=0,Y(0)\u0026gt;0 \\end{cases} \\end{aligned} $$ The last three cases show exactly where the treatment-effect estimate can be distorted. The paper\u0026rsquo;s discussion of this bias is somewhat similar to Local Average Treatment Effects (LATE). Suppose the policy being studied is an employment policy\rTake an employment policy as the example. The policy shock makes the treated group respond in different ways. 0 means unemployed, and 1 means employed. Originally, the treated group contains both unemployed people (0) and employed people (1). After the policy shock, everyone ends up employed (1). If someone is already employed (1) and remains employed (1) after the shock, but income still rises, then the change in the variable comes directly from the policy shock. This is the intensive margin. If someone starts at 0 and moves to 1 after the shock, then the change in the variable comes not only from the policy shock but also from the change in status itself. This is the extensive margin. So the treatment effect can be thought of like this: Diagram\rCode\rgraph LR A(Exogenous policy shock: binary variable Z)--treated group--\u003eC{How the individual responds} C--extensive margin--\u003eD(From 0 to 1) C--intensive margin--\u003eE(From 1 to 1) D--\u003eF{Outcome variable} E--\u003eF{Outcome variable}\rgraph LR A(Exogenous policy shock: binary variable Z)--treated group--\u003eC{How the individual responds} C--extensive margin--\u003eD(From 0 to 1) C--intensive margin--\u003eE(From 1 to 1) D--\u003eF{Outcome variable} E--\u003eF{Outcome variable}\rgraph LR A(Exogenous policy shock: binary variable Z)--treated group--\u003eC{How the individual responds} C--extensive margin--\u003eD(From 0 to 1) C--intensive margin--\u003eE(From 1 to 1) D--\u003eF{Outcome variable} E--\u003eF{Outcome variable}\rgraph LR A(Exogenous policy shock: binary variable Z)--treated group--\u003eC{How the individual responds} C--extensive margin--\u003eD(From 0 to 1) C--intensive margin--\u003eE(From 1 to 1) D--\u003eF{Outcome variable} E--\u003eF{Outcome variable}\rSo the average treatment effect is the sum of the expected values of those two margin effec","date":"2024-05-12","heading":"Explanation","objectID":"/en/posts/log0/:4:0","tags":["Causal Inference"],"title":"Econometrics: Is the log(y+1) transformation reliable?","uri":"/en/posts/log0/#explanation"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Explanation\rHow we usually interpret log transformations\rThe standard view is that, once you take logs, the coefficient has a percentage interpretation. What a log coefficient means\rAfter taking logs, we usually read the coefficient as a percentage change. For example, with lnGDP, the coefficient in a regression is often read as the percentage change in GDP. If the model is reg lny lnx, then the coefficient is an elasticity. See What taking logs means. For the regression below, $$ \\ln y_n=\\alpha\u0026#43;\\beta x_n \u0026#43;\\varepsilon $$ the coefficient has the following economic meaning: $$ \\begin{align} \\beta \u0026amp; = \\frac{\\ln Y\\_{n\u0026#43;1}-\\ln Y\\_{n}}{X\\_{n\u0026#43;1}-X\\_{n}}\\\\ \u0026amp;=\\frac{\\ln \\frac{Y\\_{n\u0026#43;1}}{Y\\_{n}}}{X\\_{n\u0026#43;1}-X\\_{n}}= \\frac{\\ln (1\u0026#43;\\frac{Y\\_{n\u0026#43;1}-Y\\_{n}}{Y\\_{n}})}{\\Delta X}\\\\ \u0026amp;= \\frac{\\ln (1\u0026#43;\\Delta Y \\\\\\% )}{\\Delta X} \\approx\\frac{\\Delta Y \\\\\\% }{\\Delta X} \\end{align} $$ Sometimes researchers also take logs because the data are long-tailed, and logging them makes the distribution more compact. The limits of log transformations\rThe paper\u0026rsquo;s main point is this: when the data contain zeros and the unit of measurement changes (for example, hourly wages, monthly wages, and weekly wages in labor economics), the estimated effect from the log transformation changes too, which makes the result hard to trust. We usually think the treatment effect after logging is a kind of percentage effect and should not depend on the scaling parameter $\\alpha$. $$ \\small ATE=E[\\log(1\u0026#43;aY(1))-\\log(1\u0026#43;aY(0))]=E\\left[\\log\\left(\\frac{1\u0026#43;aY(1)}{1\u0026#43;aY(0)}\\right)\\right] $$ But once we look more carefully at the structure of the data, things change: $$ \\begin{aligned} \\lim_{a\\to\\infty}\\log\\left(\\frac{1\u0026#43;aY(1)}{1\u0026#43;aY(0)}\\right)=\\begin{cases}\\log\\left(\\frac{Y(1)}{Y(0)}\\right)\u0026amp;\\text{if }Y(1)\u0026gt;0,Y(0)\u0026gt;0\\\\ 0\u0026amp;\\text{if }Y(1)=0,Y(0)=0\\\\ \\infty\u0026amp;\\text{if }Y(1)\u0026gt;0,Y(0)=0\\\\ -\\infty\u0026amp;\\text{if }Y(1)=0,Y(0)\u0026gt;0 \\end{cases} \\end{aligned} $$ The last three cases show exactly where the treatment-effect estimate can be distorted. The paper\u0026rsquo;s discussion of this bias is somewhat similar to Local Average Treatment Effects (LATE). Suppose the policy being studied is an employment policy\rTake an employment policy as the example. The policy shock makes the treated group respond in different ways. 0 means unemployed, and 1 means employed. Originally, the treated group contains both unemployed people (0) and employed people (1). After the policy shock, everyone ends up employed (1). If someone is already employed (1) and remains employed (1) after the shock, but income still rises, then the change in the variable comes directly from the policy shock. This is the intensive margin. If someone starts at 0 and moves to 1 after the shock, then the change in the variable comes not only from the policy shock but also from the change in status itself. This is the extensive margin. So the treatment effect can be thought of like this: Diagram\rCode\rgraph LR A(Exogenous policy shock: binary variable Z)--treated group--\u003eC{How the individual responds} C--extensive margin--\u003eD(From 0 to 1) C--intensive margin--\u003eE(From 1 to 1) D--\u003eF{Outcome variable} E--\u003eF{Outcome variable}\rgraph LR A(Exogenous policy shock: binary variable Z)--treated group--\u003eC{How the individual responds} C--extensive margin--\u003eD(From 0 to 1) C--intensive margin--\u003eE(From 1 to 1) D--\u003eF{Outcome variable} E--\u003eF{Outcome variable}\rgraph LR A(Exogenous policy shock: binary variable Z)--treated group--\u003eC{How the individual responds} C--extensive margin--\u003eD(From 0 to 1) C--intensive margin--\u003eE(From 1 to 1) D--\u003eF{Outcome variable} E--\u003eF{Outcome variable}\rgraph LR A(Exogenous policy shock: binary variable Z)--treated group--\u003eC{How the individual responds} C--extensive margin--\u003eD(From 0 to 1) C--intensive margin--\u003eE(From 1 to 1) D--\u003eF{Outcome variable} E--\u003eF{Outcome variable}\rSo the average treatment effect is the sum of the expected values of those two margin effec","date":"2024-05-12","heading":"How we usually interpret log transformations","objectID":"/en/posts/log0/:4:0","tags":["Causal Inference"],"title":"Econometrics: Is the log(y+1) transformation reliable?","uri":"/en/posts/log0/#how-we-usually-interpret-log-transformations"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Explanation\rHow we usually interpret log transformations\rThe standard view is that, once you take logs, the coefficient has a percentage interpretation. What a log coefficient means\rAfter taking logs, we usually read the coefficient as a percentage change. For example, with lnGDP, the coefficient in a regression is often read as the percentage change in GDP. If the model is reg lny lnx, then the coefficient is an elasticity. See What taking logs means. For the regression below, $$ \\ln y_n=\\alpha\u0026#43;\\beta x_n \u0026#43;\\varepsilon $$ the coefficient has the following economic meaning: $$ \\begin{align} \\beta \u0026amp; = \\frac{\\ln Y\\_{n\u0026#43;1}-\\ln Y\\_{n}}{X\\_{n\u0026#43;1}-X\\_{n}}\\\\ \u0026amp;=\\frac{\\ln \\frac{Y\\_{n\u0026#43;1}}{Y\\_{n}}}{X\\_{n\u0026#43;1}-X\\_{n}}= \\frac{\\ln (1\u0026#43;\\frac{Y\\_{n\u0026#43;1}-Y\\_{n}}{Y\\_{n}})}{\\Delta X}\\\\ \u0026amp;= \\frac{\\ln (1\u0026#43;\\Delta Y \\\\\\% )}{\\Delta X} \\approx\\frac{\\Delta Y \\\\\\% }{\\Delta X} \\end{align} $$ Sometimes researchers also take logs because the data are long-tailed, and logging them makes the distribution more compact. The limits of log transformations\rThe paper\u0026rsquo;s main point is this: when the data contain zeros and the unit of measurement changes (for example, hourly wages, monthly wages, and weekly wages in labor economics), the estimated effect from the log transformation changes too, which makes the result hard to trust. We usually think the treatment effect after logging is a kind of percentage effect and should not depend on the scaling parameter $\\alpha$. $$ \\small ATE=E[\\log(1\u0026#43;aY(1))-\\log(1\u0026#43;aY(0))]=E\\left[\\log\\left(\\frac{1\u0026#43;aY(1)}{1\u0026#43;aY(0)}\\right)\\right] $$ But once we look more carefully at the structure of the data, things change: $$ \\begin{aligned} \\lim_{a\\to\\infty}\\log\\left(\\frac{1\u0026#43;aY(1)}{1\u0026#43;aY(0)}\\right)=\\begin{cases}\\log\\left(\\frac{Y(1)}{Y(0)}\\right)\u0026amp;\\text{if }Y(1)\u0026gt;0,Y(0)\u0026gt;0\\\\ 0\u0026amp;\\text{if }Y(1)=0,Y(0)=0\\\\ \\infty\u0026amp;\\text{if }Y(1)\u0026gt;0,Y(0)=0\\\\ -\\infty\u0026amp;\\text{if }Y(1)=0,Y(0)\u0026gt;0 \\end{cases} \\end{aligned} $$ The last three cases show exactly where the treatment-effect estimate can be distorted. The paper\u0026rsquo;s discussion of this bias is somewhat similar to Local Average Treatment Effects (LATE). Suppose the policy being studied is an employment policy\rTake an employment policy as the example. The policy shock makes the treated group respond in different ways. 0 means unemployed, and 1 means employed. Originally, the treated group contains both unemployed people (0) and employed people (1). After the policy shock, everyone ends up employed (1). If someone is already employed (1) and remains employed (1) after the shock, but income still rises, then the change in the variable comes directly from the policy shock. This is the intensive margin. If someone starts at 0 and moves to 1 after the shock, then the change in the variable comes not only from the policy shock but also from the change in status itself. This is the extensive margin. So the treatment effect can be thought of like this: Diagram\rCode\rgraph LR A(Exogenous policy shock: binary variable Z)--treated group--\u003eC{How the individual responds} C--extensive margin--\u003eD(From 0 to 1) C--intensive margin--\u003eE(From 1 to 1) D--\u003eF{Outcome variable} E--\u003eF{Outcome variable}\rgraph LR A(Exogenous policy shock: binary variable Z)--treated group--\u003eC{How the individual responds} C--extensive margin--\u003eD(From 0 to 1) C--intensive margin--\u003eE(From 1 to 1) D--\u003eF{Outcome variable} E--\u003eF{Outcome variable}\rgraph LR A(Exogenous policy shock: binary variable Z)--treated group--\u003eC{How the individual responds} C--extensive margin--\u003eD(From 0 to 1) C--intensive margin--\u003eE(From 1 to 1) D--\u003eF{Outcome variable} E--\u003eF{Outcome variable}\rgraph LR A(Exogenous policy shock: binary variable Z)--treated group--\u003eC{How the individual responds} C--extensive margin--\u003eD(From 0 to 1) C--intensive margin--\u003eE(From 1 to 1) D--\u003eF{Outcome variable} E--\u003eF{Outcome variable}\rSo the average treatment effect is the sum of the expected values of those two margin effec","date":"2024-05-12","heading":"The limits of log transformations","objectID":"/en/posts/log0/:4:0","tags":["Causal Inference"],"title":"Econometrics: Is the log(y+1) transformation reliable?","uri":"/en/posts/log0/#the-limits-of-log-transformations"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Conclusions and possible fixes\r","date":"2024-05-12","heading":"Conclusions and possible fixes","objectID":"/en/posts/log0/:5:0","tags":["Causal Inference"],"title":"Econometrics: Is the log(y+1) transformation reliable?","uri":"/en/posts/log0/#conclusions-and-possible-fixes"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Main takeaway\rWhen you\u0026rsquo;re dealing with a sample where the variable being transformed contains zeros: A lot of social-media summaries overstate what this paper says. The paper is criticizing log transformations when the variable contains zeros, and the real issue is an impossibility triangle in treatment-effect estimation. Diagram\rCode\rgraph LR A(Estimate the individual average treatment effect)------B(Treatment effect stays unchanged after changing units) B------ C(Point identification from the marginal distributions of potential outcomes) C------A\rgraph LR A(Estimate the individual average treatment effect)------B(Treatment effect stays unchanged after changing units) B------ C(Point identification from the marginal distributions of potential outcomes) C------A\rgraph LR A(Estimate the individual average treatment effect)------B(Treatment effect stays unchanged after changing units) B------ C(Point identification from the marginal distributions of potential outcomes) C------A\rgraph LR A(Estimate the individual average treatment effect)------B(Treatment effect stays unchanged after changing units) B------ C(Point identification from the marginal distributions of potential outcomes) C------A\r","date":"2024-05-12","heading":"Main takeaway","objectID":"/en/posts/log0/:5:1","tags":["Causal Inference"],"title":"Econometrics: Is the log(y+1) transformation reliable?","uri":"/en/posts/log0/#main-takeaway"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Possible fixes\rEach method below amounts to making a trade-off within that impossibility triangle. Use standard normalization or standardization to remove unit effects. Use Poisson regression with maximum likelihood. Drop the zero-value observations. Work out the sample distribution more carefully and separate the intensive and extensive margins. Use other approaches such as Lee bounds (I still haven\u0026rsquo;t figured out exactly how to do this one). ","date":"2024-05-12","heading":"Possible fixes","objectID":"/en/posts/log0/:5:2","tags":["Causal Inference"],"title":"Econometrics: Is the log(y+1) transformation reliable?","uri":"/en/posts/log0/#possible-fixes"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"References\rOne of the authors\u0026rsquo; blog Maybe your teacher has been teaching this wrong all along: stop using log(Y+0.0000000001) A top-5 paper questioned for using log(1+x), fixed effects, and event-study DiD: maybe the conclusions are not reliable Top-5 journals now reject log(y+1) and arcsinh(y): absolutely reject them! Taking logs: how to deal with zeros and negative values The day logs died Causal effects A quick read: QJE and the end of log transformations How to deal with non-positive values Code for the \u0026ldquo;logs with zeros\u0026rdquo; paper ","date":"2024-05-12","heading":"References","objectID":"/en/posts/log0/:6:0","tags":["Causal Inference"],"title":"Econometrics: Is the log(y+1) transformation reliable?","uri":"/en/posts/log0/#references"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"I am recording these study notes because of the elegance of the calculus of variations. The reference book is \u0026ldquo;Fundamentals of Dynamic Optimization\u0026rdquo; by Alpha C. Chiang, which is a very friendly introductory textbook on dynamic optimization for economics students. These notes are based on my quick study and personal understanding. If there are any inaccuracies, please bear with me. ","date":"2024-05-07","heading":"","objectID":"/en/posts/bff/:0:0","tags":["Calculus of Variations","Dynamic Optimization"],"title":"Notes on Learning Calculus of Variations","uri":"/en/posts/bff/#"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Functional\rLet\u0026rsquo;s start with the study of functions. In elementary school, we began to encounter unknowns like $x$. In middle school, we started to learn about specific functions like $f(x) = ax \u0026#43; bx^2 \u0026#43; c$. In high school, we began to understand abstract functions like $f(x) = f(-x)$ and $f\u0026#39;(x) = f(x)$. In university, we started to learn about implicit functions like $y\u0026#39; = y \u0026#43; y\u0026#39;\u0026#39;$, which solve a class of functions. As our study of functions moves from concrete to abstract, we begin to develop the ability to infer the form of a function based on its properties. Nonlinear functionals in functional analysis are functions of functions. Given specific functional characteristics, we can narrow down the range of functional forms and then select the optimal function based on constraints. For example, a firm choosing the optimal production process, or an architect selecting the best curve for a building\u0026hellip; Previously, given a specific type of function, we sought extremum points; Now, given functional characteristics, we seek the best specific function. Generally, the characteristic constraints of a function can be expressed as $f(t, y(t), y\u0026#39;(t))$, which can be understood as $f(\\text{time}, \\text{state}, \\text{direction})$. As shown in the figure below, there are three functions from $a$ to $b$ that satisfy the functional characteristics. Which one is the optimal? This introduces the use of calculus to find the extremum of the functional path. Functions satisfying constraints\r$$ V(t) = \\int_0^T f(t, y, y\u0026#39;) dt $$ As the functional form $y$ changes, $V(t)$ also changes. This is the starting point of functional analysis. We aim to find the optimal path $y^*$ from a set of functional forms $y$ by seeking the extremum of $V(t)$ and other constraints. ","date":"2024-05-07","heading":"Functional","objectID":"/en/posts/bff/:1:0","tags":["Calculus of Variations","Dynamic Optimization"],"title":"Notes on Learning Calculus of Variations","uri":"/en/posts/bff/#functional"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Calculus of Variations\rWhen learning about derivatives, we used the concept of approximation to find limits: $$ \\lim_{\\Delta x \\rightarrow 0} \\frac{f(x \u0026#43; \\Delta x) - f(x)}{\\Delta x} $$ Here, we use a similar approach. Assume the optimal function is $y^\\*$, and represent a class of functions near it as $y^* \u0026#43; \\varepsilon P(t)$. Note that $P(0) = P(T) = 0$ Functional representation\rThus, we obtain the following expression in terms of $\\varepsilon$: $$ V(\\varepsilon) = \\int\\_0^T F\\left[t, \\underbrace{y^\\*(t) \u0026#43; \\varepsilon p(t)}\\_{y(t)}, \\underbrace{y^\\*(t) \u0026#43; \\varepsilon p\u0026#39;(t)}_{y\u0026#39;(t)}\\right] dt $$ The first-order condition for the extremum is $\\frac{dV}{d\\varepsilon} = 0$. Derivative formula in calculus\r$$ \\frac{d}{dt} \\int_{g(t)}^{h(t)} F(x, t) dx = F(h, t) \\frac{dh}{dt} - F(g, t) \\frac{dg}{dt} \u0026#43; \\int_{g(t)}^{h(t)} \\frac{\\partial F}{\\partial t} dx $$\r$$ \\begin{aligned} \\frac{dV}{d\\varepsilon} \u0026amp;= \\int_0^T \\frac{\\partial F}{\\partial \\varepsilon} dt = \\int_0^T \\left( \\frac{\\partial F}{\\partial y} \\frac{dy}{d\\varepsilon} \u0026#43; \\frac{\\partial F}{\\partial y\u0026#39;} \\frac{dy\u0026#39;}{d\\varepsilon} \\right) dt \\\\\\\\ \u0026amp;= \\int_0^T \\left[ F_y p(t) \u0026#43; F_{y\u0026#39;} p\u0026#39;(t) \\right] dt \\\\\\\\ \u0026amp;= \\int_0^T F_y p(t) dt \u0026#43; \\color{red}{\\int_0^T F_{y\u0026#39;} p\u0026#39;(t) dt} = 0 \\end{aligned} $$ Local transformation\r$$ \\frac{dy}{d\\varepsilon} = \\frac{d(y^*(t) \u0026#43; \\varepsilon p)}{d\\varepsilon} = P(t) $$ Similarly, $\\frac{dy\u0026#39;}{d\\varepsilon} = P\u0026#39;(t)$ Next, we transform the $\\color{red}{\\text{red part}}$ using integration by parts $\\int\\_{t=a}^{t=b} v du = vu \\big|\\_{t=a}^{t=b} - \\int\\_{t=a}^{t=b} u dv$ (where $u = u(t)$, $v = v(t)$): $$ \\begin{align} \u0026amp; \\color{red}{\\int_0^T F\\_{y\u0026#39;} p\u0026#39;(t) dt} \\\\\\\\ \u0026amp;= \\left[ F\\_{y\u0026#39;} p(t) \\right]_0^T - \\int\\_0^T p(t) \\frac{d}{dt} F\\_{y\u0026#39;} dt \\\\\\\\ \u0026amp;= -\\int\\_0^T p(t) \\frac{d}{dt} F\\_{y\u0026#39;} dt \\\\\\\\ \u0026amp; (\\text{Because } P(0) = P(T) = 0\\\\\\\\ \u0026amp; \\text{ see the image of the perturbation function } P(t)) \\end{align} $$ Substituting the $\\color{red}{\\text{red part}}$ back, we get: $$ \\int_0^T p(t) \\left[ F_y - \\frac{d}{dt} F_{y\u0026#39;} \\right] dt = 0 $$ Considering that the perturbation function $P(t)$ can be any function, the only way for the above equation to be zero is if $F_y - \\frac{d}{dt} F_{y\u0026#39;} = 0$. Thus, we obtain the Euler equation: $$ F_y - \\frac{d}{dt} F_{y\u0026#39;} = 0, \\quad t \\in [0, T] $$ When the equation constraint only involves three variables, i.e., $F(t, y, y\u0026#39;)$, it can be expanded as: $$ \\begin{aligned} \\frac{dF_{y\u0026#39;}}{dt} \u0026amp;= \\frac{\\partial F_{y\u0026#39;}}{\\partial t} \u0026#43; \\frac{\\partial F_{y\u0026#39;}}{\\partial y} \\frac{dy}{dt} \u0026#43; \\frac{\\partial F_{y\u0026#39;}}{\\partial y\u0026#39;} \\frac{dy\u0026#39;}{dt} \\\\\\\\ \u0026amp;= F_{ty\u0026#39;} \u0026#43; F_{yy\u0026#39;} y\u0026#39;(t) \u0026#43; F_{y\u0026#39;y\u0026#39;} y\u0026#39;\u0026#39;(t) \\end{aligned} $$ Expanding, we get: $$ F_{y\u0026#39;y\u0026#39;} y\u0026#39;\u0026#39;(t) \u0026#43; F_{yy\u0026#39;} y\u0026#39;(t) \u0026#43; F_{ty\u0026#39;} - F_y = 0, \\quad t \\in [0, T] $$\rA problem\rGiven the functional $V(y) = \\int_0^2 (12ty \u0026#43; y\u0026#39;^2) dt$ The general solution to the Euler equation is $y^*(t) = t^3 \u0026#43; c_1 t \u0026#43; c_2$ Extensions of the Euler equation\rHere, we only mention the extensions without further elaboration. When the functional $F$ contains only some variables, such as $F(t, y\u0026#39;)$, $F(y, y\u0026#39;)$, or $F(t, y)$, there are shortcut methods for each case. The core of the Euler equation is $F_y - \\frac{d}{dt} F_{y\u0026#39;} = 0, \\quad t \\in [0, T]$ When the functional $F$ contains multiple variables or higher-order variables, the core remains the same, but further expansion is needed. ","date":"2024-05-07","heading":"Calculus of Variations","objectID":"/en/posts/bff/:2:0","tags":["Calculus of Variations","Dynamic Optimization"],"title":"Notes on Learning Calculus of Variations","uri":"/en/posts/bff/#calculus-of-variations"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"The Catenary Problem\rImagine a red string hanging between two poles for drying clothes. Establish a coordinate system and rotate this string around the x-axis. What curvature should the string have to minimize the surface area of the resulting solid? Even a humble clothesline has profound principles\rConsider the Pythagorean theorem for a differential element: $$ (ds)^2 = (dx)^2 \u0026#43; (dy)^2 $$ We can obtain the differential of the curve: $$ \\frac{ds}{dt} = \\sqrt{1 \u0026#43; \\left( \\frac{dy}{dt} \\right)^2} = (1 \u0026#43; y\u0026#39;^2)^{1/2} $$ By differentiating along the curve, the integral of the circumference of each differential circle ($2\\pi r$) gives the surface area after rotation. Thus, we obtain the following functional: $$ V(t) = \\int_0^T 2\\pi y ds = 2\\pi \\int_0^T y (1 \u0026#43; y\u0026#39;^2)^{1/2} dt $$ Simplifying the expression: $$ V(t) = \\int_0^T y (1 \u0026#43; y\u0026#39;^2)^{1/2} dt $$ Using the Euler equation, we get: $$ y (1 \u0026#43; y\u0026#39;^2)^{1/2} - y y\u0026#39;^2 (1 \u0026#43; y\u0026#39;^2)^{-1/2} = c $$ Simplifying (by rationalizing the denominator and squaring to eliminate the square root in the denominator), we obtain: $$ y\u0026#39; \\left( \\equiv \\frac{dy}{dt} \\right) = \\frac{1}{c} \\sqrt{y^2 - c^2} $$ Which is: $$ \\frac{c dy}{\\sqrt{y^2 - c^2}} = dt $$ Integrating, we get: $$ \\int \\frac{c dy}{\\sqrt{y^2 - c^2}} = c \\ln \\left( \\frac{y \u0026#43; \\sqrt{y^2 - c^2}}{c} \\right) \u0026#43; c_1 = \\int dt = t \u0026#43; c_2 $$ Rearranging the above expression and combining the two arbitrary constants $c_1$ and $c_2$ into $k$, we obtain the general solution: $$ y^*(t) = \\frac{c}{2} \\left[ e^{(t \u0026#43; k)/c} \u0026#43; e^{-(t \u0026#43; k)/c} \\right] $$ And the catenary curve is of the form: $$ y = \\frac{1}{2} (e^t \u0026#43; e^{-t}) $$ Catenary curve, image from Wikipedia\rA uniformly dense string (e.g., a clothesline) hanging under uniform gravitational force will also form this curve. Suspension bridges, hyperbolic arch bridges, and overhead cables all utilize the principles of the catenary curve. In architectural design, the following form is generally used: $$ \u0026gt; y = c \u0026#43; a \\cosh \\frac{x}{a} \u0026gt; $$ Nature and society are always under optimal control! ","date":"2024-05-07","heading":"The Catenary Problem","objectID":"/en/posts/bff/:3:0","tags":["Calculus of Variations","Dynamic Optimization"],"title":"Notes on Learning Calculus of Variations","uri":"/en/posts/bff/#the-catenary-problem"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"The Brachistochrone Problem\rImagine a marble race with three different slides. A contestant has only one chance to choose. Which slide should they choose for the marble to reach the finish line the fastest? Yes, even slides hide profound principles\rSource: Beijing Science and Technology Museum. Imagine ancient architecture; which building curve would facilitate easier drainage? The logic is the same.\rUsing the conservation of energy, we get: $$ \\begin{align} \\frac{1}{2} m v^2 \u0026amp;= m g y \\\\ v \u0026amp;= \\sqrt{2 g y} \\end{align} $$ In the catenary problem, we introduced the differential of the curve as $ds = (1 \u0026#43; y\u0026#39;^2)^{1/2} dt$. Thus, considering velocity as the derivative of distance with respect to time: $$ v = \\frac{ds}{dt} = \\sqrt{1 \u0026#43; y\u0026#39;^2} \\frac{dx}{dt} $$ Combining the above equations: $$ \\begin{cases} v = \\sqrt{2 g y} \\\\ v = \\sqrt{1 \u0026#43; y\u0026#39;^2} \\frac{dx}{dt} \\end{cases} $$ We obtain: $$ dt = \\frac{\\sqrt{1 \u0026#43; y\u0026#39;^2}}{\\sqrt{2 g y}} dx $$ The target functional seeks the minimum total time: $$ T = \\int dt = \\int \\frac{\\sqrt{1 \u0026#43; y\u0026#39;^2}}{\\sqrt{2 g y}} dx $$ Using the Euler equation, we get: $$ 2 y\u0026#39;\u0026#39; y \u0026#43; y\u0026#39;^2 \u0026#43; 1 = 0 $$ For the complete solution, refer to A Brief Discussion on the Calculus of Variations, which also mentions other mathematicians\u0026rsquo; solutions to this problem. In any case, one form of the solution is (where $a$ and $c$ are arbitrary constants): $$ \\begin{cases} x = a (\\theta - \\sin \\theta) \u0026#43; c \\\\ y = a (1 - \\cos \\theta) \\end{cases} $$ This form is related to the cycloid. Source: Wikipedia\r","date":"2024-05-07","heading":"The Brachistochrone Problem","objectID":"/en/posts/bff/:4:0","tags":["Calculus of Variations","Dynamic Optimization"],"title":"Notes on Learning Calculus of Variations","uri":"/en/posts/bff/#the-brachistochrone-problem"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Monopoly Economics Problem\rConsider a monopoly firm with a profit function written as $F(P, P\u0026#39;)$. The economic meaning is that the monopoly firm has the power to set prices. The functional is then: $$ V = \\int F(P, P\u0026#39;) dt $$ Substituting into the Euler equation, we get: $$ F_{P\u0026#39;P\u0026#39;} P\u0026#39;\u0026#39; \u0026#43; F_{PP\u0026#39;} P\u0026#39; - F_P = 0 $$ Solving this implicit function requires some clever manipulation. Multiply both sides by $P\u0026#39;$ and then rearrange: $$ \\begin{aligned} \u0026amp; \\frac{d}{dt} (P\u0026#39; F_{P\u0026#39;} - F) \\\\\\\\ \u0026amp; = \\frac{d}{dt} (P\u0026#39; F_{P\u0026#39;}) - \\frac{d}{dt} F(P, P\u0026#39;) \\\\\\\\ \u0026amp; = F_{P\u0026#39;} P\u0026#39;\u0026#39; \u0026#43; P\u0026#39; \\left( F_{PP\u0026#39;} P\u0026#39; \u0026#43; F_{P\u0026#39;P\u0026#39;} P\u0026#39;\u0026#39; \\right) - \\left( F_P P\u0026#39; \u0026#43; F_{P\u0026#39;} P\u0026#39;\u0026#39; \\right) \\\\\\\\ \u0026amp; = P\u0026#39; \\color{red}{\\left( F_{P\u0026#39;P\u0026#39;} P\u0026#39;\u0026#39; \u0026#43; F_{PP\u0026#39;} P\u0026#39; - F_P \\right)} \\end{aligned} $$ The red part is the original equation. Thus, we obtain: $$ F - P\u0026#39; F_{P\u0026#39;} = c $$ Where $c$ is a constant. Writing $F$ as the common profit function $\\pi$, we get: $$ \\pi - P\u0026#39; \\frac{\\partial \\pi}{\\partial P\u0026#39;} = c $$ Considering static monopoly, the monopoly firm makes only one pricing decision (more detailed static game theory also considers product differentiation, information asymmetry, game sequence, and firm entry/exit states). In this case, the profit function only depends on $P$ and not on $P\u0026#39;$ (since there is only one pricing decision, no price change occurs). Clearly, $P\u0026#39; \\frac{\\partial \\pi}{\\partial P\u0026#39;} = 0$, so $\\pi_s = c$. Now, consider dynamic game theory on top of static game theory. After the first pricing decision, monopoly firms begin to make multiple pricing decisions. The profit function is now: $$ \\pi - P\u0026#39; \\frac{\\partial \\pi}{\\partial P\u0026#39;} = \\pi_s $$ Here, the profit function $\\pi$ must depend on both $P$ and $P\u0026#39;$. Thus, consider the elasticity of $\\pi$ with respect to $P\u0026#39;$, denoted as: $$ \\frac{\\partial \\pi}{\\partial P\u0026#39;} \\frac{P\u0026#39;}{\\pi} = \\varepsilon_{\\pi P\u0026#39;} $$ Substituting into the dynamic monopoly game formula, we get: $$ \\varepsilon_{\\pi P\u0026#39;} = 1 - \\frac{\\pi_\\varepsilon}{\\pi} $$ In other words, in dynamic monopoly, firms should continuously adjust their profit functions based on this relationship. ","date":"2024-05-07","heading":"Monopoly Economics Problem","objectID":"/en/posts/bff/:5:0","tags":["Calculus of Variations","Dynamic Optimization"],"title":"Notes on Learning Calculus of Variations","uri":"/en/posts/bff/#monopoly-economics-problem"},{"categories":["Economic Studies","Software Tools"],"collections":["Reference Management with Zotero"],"content":"As everyone knows, Zotero has a ton of god-tier plugins, and Better Notes is one of them. You can read papers and write Markdown notes directly inside Zotero. A lot of the time teachers ask us to make a PPT for a paper presentation. If your Markdown template is written well, using it as a PPT isn\u0026rsquo;t out of the question ( Combined with plugins like Zotero Style, Jasminum, Green Frog, ZoteroGPT, and Translate, we can also auto-fill the notes. Two paper topics I came up with recently, after a bunch of fancy operations, turned out to have insignificant data. No new inspiration either, so I went back to tinkering with math and software. Insignificance actually shows how reliable econometrics is — it is not forced significance; everyone is practicing alchemy, and someone will eventually dig up the real treasure. The one who does will say it was economic intuition and research taste — which is a bit mystical1. I am writing this post because after the Zotero 7 update my old templates stopped being compatible, and I also wanted to add a paper-reading note template that suits me. The classic SCI reading template in Better Notes; the information above comes from reading file metadata\r","date":"2024-05-06","heading":"","objectID":"/en/posts/zoteronote/:0:0","tags":["Zotero"],"title":"Zotero 7 Better Notes: An Empirical Economics Note Template","uri":"/en/posts/zoteronote/#"},{"categories":["Economic Studies","Software Tools"],"collections":["Reference Management with Zotero"],"content":"1. Installing Better Notes\rGitHub project: https://github.com/windingwind/zotero-better-notes The project\u0026rsquo;s discussions (discuss) is where everyone shares templates. ","date":"2024-05-06","heading":"1. Installing Better Notes","objectID":"/en/posts/zoteronote/:1:0","tags":["Zotero"],"title":"Zotero 7 Better Notes: An Empirical Economics Note Template","uri":"/en/posts/zoteronote/#1-installing-better-notes"},{"categories":["Economic Studies","Software Tools"],"collections":["Reference Management with Zotero"],"content":"2. Adding Templates\rCopy my template, or go to the discussions and copy whichever template you want. ","date":"2024-05-06","heading":"2. Adding Templates","objectID":"/en/posts/zoteronote/:2:0","tags":["Zotero"],"title":"Zotero 7 Better Notes: An Empirical Economics Note Template","uri":"/en/posts/zoteronote/#2-adding-templates"},{"categories":["Economic Studies","Software Tools"],"collections":["Reference Management with Zotero"],"content":"Template 1: Utterly Simple\rThe content is something I wrote after reading; this template does not support automatic metadata import, but even a beginner can understand how to modify the code headings\rThe text part is the heading; \u0026lt;h1\u0026gt; represents a level-one heading, and \u0026lt;/li\u0026gt; represents an unordered list. 标题 创新与边际贡献 模型方法 数据： 因变量： 自变量： 控制变量： 稳健性和内生性 机制检验 异质性 总结 ","date":"2024-05-06","heading":"Template 1: Utterly Simple","objectID":"/en/posts/zoteronote/:2:1","tags":["Zotero"],"title":"Zotero 7 Better Notes: An Empirical Economics Note Template","uri":"/en/posts/zoteronote/#template-1-utterly-simple"},{"categories":["Economic Studies","Software Tools"],"collections":["Reference Management with Zotero"],"content":"Template 2: Fancy\rAdapted from: Self-use SCI note template You can find my modified source code on GitHub or Zhihu. This is the image shown at the start of the post. You will need to additionally install the Zotero Style, Green Frog, and Translate plugins as template support. Mainly added tables and modified the headings\rSince the Hugo blog does not support embedding Zotero\u0026rsquo;s HTML code (it even renders incorrectly in a code block), you can find the source code on GitHub (#973), or find the code on Zhihu. ","date":"2024-05-06","heading":"Template 2: Fancy","objectID":"/en/posts/zoteronote/:2:2","tags":["Zotero"],"title":"Zotero 7 Better Notes: An Empirical Economics Note Template","uri":"/en/posts/zoteronote/#template-2-fancy"},{"categories":["Economic Studies","Software Tools"],"collections":["Reference Management with Zotero"],"content":"Loading the Template and Errors:\rZotero top-left corner - Edit - Template Editor - New - paste the code into the middle - Save As shown\rPossible error case 1: Template New Template: 1714978248098 Error: ReferenceError: topItem is not defined Because the template name has to be in the form [Item]论文笔记. Do not ask — it is legacy underlying code from Zotero 6. Possible error case 2: Template Preview Error: TypeError: Zotero. ZoteroStyle. Data. Ztoolkit. ItemTree. FieldHooks. GlobalCache is undefined Here the note template reads file metadata through Zotero Style; it will not work if the versions do not match. The code in this post corresponds to, Zotero 7.0.0-beta.77+adaa61f2c + Ethereal Style 4.4.2 + Better Notes 1.1.4-49. It is also because the recent Zotero 7 versions have all been bug-fix optimizations, and the version has stabilized, that I decided to update my Better Notes template. A heads-up: Better Notes is still stuck at version 2023.122, so note export still seems to have some issues. Possible error case 3: many people still get errors after the above two steps, and the reason is still that this note template needs to read file metadata. If you add the note template to a PDF attachment directly instead of the paper entry, it will error out because there is no metadata. ","date":"2024-05-06","heading":"Loading the Template and Errors:","objectID":"/en/posts/zoteronote/:2:3","tags":["Zotero"],"title":"Zotero 7 Better Notes: An Empirical Economics Note Template","uri":"/en/posts/zoteronote/#loading-the-template-and-errors"},{"categories":["Economic Studies","Software Tools"],"collections":["Reference Management with Zotero"],"content":"3. Using the Template\rAfter opening the PDF you want to read (make sure the PDF has Zotero entry information), click the plus sign in the item-notes row on the right - New Note from Template - then open the template you want in the popup. The plus sign in the item-notes row on the right - New Note from Template\r","date":"2024-05-06","heading":"3. Using the Template","objectID":"/en/posts/zoteronote/:3:0","tags":["Zotero"],"title":"Zotero 7 Better Notes: An Empirical Economics Note Template","uri":"/en/posts/zoteronote/#3-using-the-template"},{"categories":["Economic Studies","Software Tools"],"collections":["Reference Management with Zotero"],"content":"4. Economics at Home and Abroad\rFinally, some thoughts from reading papers recently. Right now, domestic economists have a terrible reputation, and everyone says you have to go abroad to study economics (poor me, with my bad English, naturally chose to hunker down domestically). I agree, since the mainstream economics framework comes from the West. But this is not a question of comparing totals; it is a question of catching up. A huge number of domestic universities cannot even scrape together quality teaching resources for the \u0026ldquo;three highs\u0026rdquo; (advanced micro, macro, and econometrics)3, yet research progress is advancing by leaps and bounds — you could say the new generation has competed the difficulty way up ( Ten years ago, a complete regression workflow in Economic Research Journal was enough. Five years ago, econometrics had already become widespread. Even your thesis would get pushed to include econometrics if it did not have any. Nowadays, look at the recent issues of China Industrial Economics, Management World, and The Journal of World Economy: a large chunk of good papers are already mathematical-model qualitative analysis + social reality analysis + econometric argumentation, three-in-one. At least in format they have fully aligned with international standards. The increasing number of papers I read recently — heterogeneity and mechanism tests — feel like they are mixing testing with economic-meaning analysis. I get the feeling the big shots are at the stage of \u0026ldquo;a formless move beats a formed move.\u0026rdquo; Considering only purely domestically-trained scholars: research rigor has caught up, and what remains is original thought. Catching up on that will take at least another 20 years, right? Even if someone proposes a genius innovation theory this year, it still needs 20 years for the theory to pass the test of history and society. ","date":"2024-05-06","heading":"4. Economics at Home and Abroad","objectID":"/en/posts/zoteronote/:4:0","tags":["Zotero"],"title":"Zotero 7 Better Notes: An Empirical Economics Note Template","uri":"/en/posts/zoteronote/#4-economics-at-home-and-abroad"},{"categories":["Economic Studies","Software Tools"],"collections":["Reference Management with Zotero"],"content":"Other Zotero-Related Posts\rHuaxiangshan: Word as a LaTeX Replacement? Huaxiangshan: Should You Upgrade Zotero 6 to 7? Huaxiangshan: Zotero and RSS Subscriptions for Economics Journals Lately I wonder if I have been brainwashed — economics always needs to tell an interesting story, yet the so-called \u0026ldquo;taste\u0026rdquo; is not up to me to decide. And speaking of problems, with so many issues in the Chinese economy right now, I cannot even come up with one concretely researchable question — that is pretty sad\u0026hellip;\u0026#160;\u0026#x21a9;\u0026#xfe0e; Upgrading Zotero 6 to 7 broke a whole wave of plugin compatibility, and I feel it is getting laggier too.\u0026#160;\u0026#x21a9;\u0026#xfe0e; The 101 Plan actually has no soil to take root in, does it?\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2024-05-06","heading":"Other Zotero-Related Posts","objectID":"/en/posts/zoteronote/:5:0","tags":["Zotero"],"title":"Zotero 7 Better Notes: An Empirical Economics Note Template","uri":"/en/posts/zoteronote/#other-zotero-related-posts"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"R Notes 1: Interface Introduction and Syntax Structure R Notes 2: Data Cleaning, Plotting, and Econometrics Recommended learning resources are in R Notes 1: Interface Introduction and Syntax Structure Common databases and cleaning ideas were already introduced in the Stata version; here I focus on recording commonly used R code for data cleaning. While organizing this, I kept feeling the power of open source. Every task has a native R trick, but all sorts of packages keep popping up to save you effort, so\u0026hellip; Even if guidance has shattered, please become the king of package-calling! ","date":"2024-04-22","heading":"","objectID":"/en/posts/r2/:0:0","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Data Cleaning\r","date":"2024-04-22","heading":"Data Cleaning","objectID":"/en/posts/r2/:1:0","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#data-cleaning"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Working Directory\r# Clear all variables rm(list=ls()) # View the current directory getwd() # Set the working directory; note that forward slashes are used setwd(\"F:/桌面\") # Get a file path; this opens a file browser to find the file manually, and clicking it returns the file path file.choose() ","date":"2024-04-22","heading":"Working Directory","objectID":"/en/posts/r2/:1:1","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#working-directory"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Data Import\rTable source: R in Data Science Format\rCommand\r.txt\rread.table()\r.csv\rread.csv() and readr::read_csv()\r.xls and .xlsx\rreadxl::read_excel() and openxlsx::read.xlsx()\r.sav （SPSS files）\rhaven::read_sav() and foreign::read.spss()\r.Rdata or rda\rload()\r.rds\rreadRDS() and readr::read_rds()\r.dta\rhaven::read_dta() and haven::read_stata()\r.sas 7 bdat （SAS files）\rhaven::read_sas()\rInternet\rdownload.file()\rIf you run into garbled Chinese text, add an encoding. read.table(…, fileEncoding = “UTF-8”)\rSource: Statistical Analysis (with R as the Tool): Supplementary Materials ### 1. read.rable() ### # Read from txt, with \"\\t\" as the delimiter # head means viewing the first few rows tes = read.table(\"./data/top250.txt\", header = TRUE, sep = \"\\t\",fileEncoding = \"GBK\"); head(tes) ### 2. read.csv() ### # Dedicated function read.csv movie_csv = read.csv(\"./data/top250.csv\",fileEncoding = \"GBK\"); head(movie_csv) library(\"readxl\") # Load the package # The col_names parameter is again used to set whether the first row is treated as variable names movie_excel = data.frame(read_excel(\"./data/top250.xlsx\", col_names = TRUE));head(movie_excel)\rManual input: mydatatxt\u003c-\"name gender age 张三 M 20 李四 F 23 \"\rCode for bulk-merging Excel and CSV files # Get csv files in bulk library(readr) library(dplyr) # Set the folder path folder_path \u003c- \"F:/桌面/文件夹/\" # Get the paths of all csv files in the folder csv_files \u003c- list.files(folder_path, pattern = \"\\\\.csv$\", full.names = TRUE) # Create an empty list to store the read csv data data_list \u003c- list() # Loop through and read each csv file, storing it in data_list for (file in csv_files) { data \u003c- read_csv(file) data_list[[file]] \u003c- data } # Combine all the data into one data frame combined_data \u003c- bind_rows(data_list) # View the combined data print(combined_data) #———————————————————————————————————————————————————— # Get xlsx files in bulk library(readxl) library(dplyr) # Set the folder path folder_path \u003c- \"F:/桌面/文件夹/\" # Get the paths of all xlsx files in the folder xlsx_files \u003c- list.files(folder_path, pattern = \"\\\\.xlsx$\", full.names = TRUE) # Create an empty list to store the read xlsx data data_list \u003c- list() # Loop through and read each xlsx file, storing it in data_list for (file in xlsx_files) { data \u003c- read_excel(file) data_list[[file]] \u003c- data } # Combine all the data into one data frame combined_data \u003c- bind_rows(data_list)\r","date":"2024-04-22","heading":"Data Import","objectID":"/en/posts/r2/:1:2","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#data-import"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Checking Data Types\rnames(中国城市数据库) # View the column numbers corresponding to the variable names str(中国城市数据库) # Check the data types summary(中国城市数据库) # Max, min, and mean; only supports numeric columns summary(中国城市数据库[, c(2, 4:6)]) # View column 2 and columns 4 to 6 summary(中国城市数据库[,2:12]) # View columns 2 to 12\r","date":"2024-04-22","heading":"Checking Data Types","objectID":"/en/posts/r2/:1:3","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#checking-data-types"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Renaming Variables\rThe simplest method — select Note! We want to rename the column 年份 to year, i.e., the assignment is year = 年份! If the file contains special symbols, wrap them with `` symbols library(dplyr) names(中国城市数据库) data\u003c-rename(中国城市数据库,year = 年份 ,GDP = `地区生产总值(万元)` ,one = `第一产业增加值(万元)`)\rBy the way, here\u0026rsquo;s a more complicated way to rename (basic R syntax): # Rename the first column to bb setwd(\"F:/桌面/R\") 中国城市数据库 \u003c- readxl::read_excel(\"中国城市数据库.xlsx\") colnames(中国城市数据库)[1] \u003c- 'bb' # Similarly, row names are changed with rownames\rUsing dataset$column_name is how you specify a column variable; many of RStudio\u0026rsquo;s features are quite handy\rIf a variable name is too long and we don\u0026rsquo;t know which column the variable to rename is in, use names(中国城市数据库); the result will show the variable names and their corresponding column numbers. ","date":"2024-04-22","heading":"Renaming Variables","objectID":"/en/posts/r2/:1:4","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#renaming-variables"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Creating New Variables\rI recommend Method 1. Method 1\rd3 \u003c- mutate(中国城市数据库, year = 年份/2 )\rMethod 2\r# Mainly use transform() # The first argument is the name of the data frame to operate on # The following arguments are the operation formulas # The left side of the formula is the new variable name # The right side of the formula is the specific operation mydata \u003c- transform( mydata, sum = x1 + x2, mean = (x1 + x2)/2 )\rMethod 3\rmydata$mean \u003c- (mydata$x1 + mydata$x2)/2 # Create a new variable named mean, obtained by averaging the two original variables (x1 and x2) mydata$empty_variable \u003c- NULL # Create an empty variable\rExtracting and Appending Characters\rCreate a new variable x by extracting a string of length 4 from variable var starting at position 1. 中国城市数据库 \u003c- 中国城市数据库 %\u003e% mutate(x = substr(var, 1, 4)) # Append at the end 中国城市数据库2 \u003c- 中国城市数据库2 %\u003e% mutate(x = paste0(var, \"_suffix\")) # Add at the front 中国城市数据库2 \u003c- 中国城市数据库2 %\u003e% mutate(x = paste(var, \"_suffix\"))\r","date":"2024-04-22","heading":"Creating New Variables","objectID":"/en/posts/r2/:1:5","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#creating-new-variables"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Creating New Variables\rI recommend Method 1. Method 1\rd3 \u003c- mutate(中国城市数据库, year = 年份/2 )\rMethod 2\r# Mainly use transform() # The first argument is the name of the data frame to operate on # The following arguments are the operation formulas # The left side of the formula is the new variable name # The right side of the formula is the specific operation mydata \u003c- transform( mydata, sum = x1 + x2, mean = (x1 + x2)/2 )\rMethod 3\rmydata$mean \u003c- (mydata$x1 + mydata$x2)/2 # Create a new variable named mean, obtained by averaging the two original variables (x1 and x2) mydata$empty_variable \u003c- NULL # Create an empty variable\rExtracting and Appending Characters\rCreate a new variable x by extracting a string of length 4 from variable var starting at position 1. 中国城市数据库 \u003c- 中国城市数据库 %\u003e% mutate(x = substr(var, 1, 4)) # Append at the end 中国城市数据库2 \u003c- 中国城市数据库2 %\u003e% mutate(x = paste0(var, \"_suffix\")) # Add at the front 中国城市数据库2 \u003c- 中国城市数据库2 %\u003e% mutate(x = paste(var, \"_suffix\"))\r","date":"2024-04-22","heading":"Method 1","objectID":"/en/posts/r2/:1:5","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#method-1"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Creating New Variables\rI recommend Method 1. Method 1\rd3 \u003c- mutate(中国城市数据库, year = 年份/2 )\rMethod 2\r# Mainly use transform() # The first argument is the name of the data frame to operate on # The following arguments are the operation formulas # The left side of the formula is the new variable name # The right side of the formula is the specific operation mydata \u003c- transform( mydata, sum = x1 + x2, mean = (x1 + x2)/2 )\rMethod 3\rmydata$mean \u003c- (mydata$x1 + mydata$x2)/2 # Create a new variable named mean, obtained by averaging the two original variables (x1 and x2) mydata$empty_variable \u003c- NULL # Create an empty variable\rExtracting and Appending Characters\rCreate a new variable x by extracting a string of length 4 from variable var starting at position 1. 中国城市数据库 \u003c- 中国城市数据库 %\u003e% mutate(x = substr(var, 1, 4)) # Append at the end 中国城市数据库2 \u003c- 中国城市数据库2 %\u003e% mutate(x = paste0(var, \"_suffix\")) # Add at the front 中国城市数据库2 \u003c- 中国城市数据库2 %\u003e% mutate(x = paste(var, \"_suffix\"))\r","date":"2024-04-22","heading":"Method 2","objectID":"/en/posts/r2/:1:5","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#method-2"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Creating New Variables\rI recommend Method 1. Method 1\rd3 \u003c- mutate(中国城市数据库, year = 年份/2 )\rMethod 2\r# Mainly use transform() # The first argument is the name of the data frame to operate on # The following arguments are the operation formulas # The left side of the formula is the new variable name # The right side of the formula is the specific operation mydata \u003c- transform( mydata, sum = x1 + x2, mean = (x1 + x2)/2 )\rMethod 3\rmydata$mean \u003c- (mydata$x1 + mydata$x2)/2 # Create a new variable named mean, obtained by averaging the two original variables (x1 and x2) mydata$empty_variable \u003c- NULL # Create an empty variable\rExtracting and Appending Characters\rCreate a new variable x by extracting a string of length 4 from variable var starting at position 1. 中国城市数据库 \u003c- 中国城市数据库 %\u003e% mutate(x = substr(var, 1, 4)) # Append at the end 中国城市数据库2 \u003c- 中国城市数据库2 %\u003e% mutate(x = paste0(var, \"_suffix\")) # Add at the front 中国城市数据库2 \u003c- 中国城市数据库2 %\u003e% mutate(x = paste(var, \"_suffix\"))\r","date":"2024-04-22","heading":"Method 3","objectID":"/en/posts/r2/:1:5","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#method-3"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Creating New Variables\rI recommend Method 1. Method 1\rd3 \u003c- mutate(中国城市数据库, year = 年份/2 )\rMethod 2\r# Mainly use transform() # The first argument is the name of the data frame to operate on # The following arguments are the operation formulas # The left side of the formula is the new variable name # The right side of the formula is the specific operation mydata \u003c- transform( mydata, sum = x1 + x2, mean = (x1 + x2)/2 )\rMethod 3\rmydata$mean \u003c- (mydata$x1 + mydata$x2)/2 # Create a new variable named mean, obtained by averaging the two original variables (x1 and x2) mydata$empty_variable \u003c- NULL # Create an empty variable\rExtracting and Appending Characters\rCreate a new variable x by extracting a string of length 4 from variable var starting at position 1. 中国城市数据库 \u003c- 中国城市数据库 %\u003e% mutate(x = substr(var, 1, 4)) # Append at the end 中国城市数据库2 \u003c- 中国城市数据库2 %\u003e% mutate(x = paste0(var, \"_suffix\")) # Add at the front 中国城市数据库2 \u003c- 中国城市数据库2 %\u003e% mutate(x = paste(var, \"_suffix\"))\r","date":"2024-04-22","heading":"Extracting and Appending Characters","objectID":"/en/posts/r2/:1:5","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#extracting-and-appending-characters"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Data Type Conversion\rIncluding date conversion. mydata$x \u003c- as.factor(mydata$x) # Other types as.numeric('123') as.character(123) as.logical(FALSE)\r","date":"2024-04-22","heading":"Data Type Conversion","objectID":"/en/posts/r2/:1:6","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#data-type-conversion"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Dates and Times\rDate Conversion\ras.Date('1/15/2020', format = '%m/%d/%Y') ###(2) Convert characters to POSIXct/POSIXlt time format ### as.POSIXct(1472562988, origin = \"1960-01-01\")# Convert a date value, using \"1960-01-01\" as the origin\rExtracting Date Components\rlibrary(lubridate) # Load the lubridate package t = \"2020-11-20 01:30:29\" year(t)# Extract the year ## [1] 2020 month(t)# Extract the month ## [1] 11 mday(t)# Extract the day of the month ## [1] 20 wday(t)# Extract the day of the week ## [1] 6 hour(t)# Extract the hour ## [1] 1 minute(t)# Extract the minute ## [1] 30 second(t)# Extract the second ## [1] 29\rDate Calculations\r# Find the number of days between any two dates begin = as.Date(\"2016-03-04\") end = as.Date(\"2016-05-08\") (during = end - begin) ## Time difference of 65 days # Find the number of weeks and hours between any two dates difftime(end, begin, units = \"weeks\") ## Time difference of 9.285714 weeks difftime(end, begin, units = \"hours\") ## Time difference of 1560 hours\r","date":"2024-04-22","heading":"Dates and Times","objectID":"/en/posts/r2/:1:7","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#dates-and-times"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Dates and Times\rDate Conversion\ras.Date('1/15/2020', format = '%m/%d/%Y') ###(2) Convert characters to POSIXct/POSIXlt time format ### as.POSIXct(1472562988, origin = \"1960-01-01\")# Convert a date value, using \"1960-01-01\" as the origin\rExtracting Date Components\rlibrary(lubridate) # Load the lubridate package t = \"2020-11-20 01:30:29\" year(t)# Extract the year ## [1] 2020 month(t)# Extract the month ## [1] 11 mday(t)# Extract the day of the month ## [1] 20 wday(t)# Extract the day of the week ## [1] 6 hour(t)# Extract the hour ## [1] 1 minute(t)# Extract the minute ## [1] 30 second(t)# Extract the second ## [1] 29\rDate Calculations\r# Find the number of days between any two dates begin = as.Date(\"2016-03-04\") end = as.Date(\"2016-05-08\") (during = end - begin) ## Time difference of 65 days # Find the number of weeks and hours between any two dates difftime(end, begin, units = \"weeks\") ## Time difference of 9.285714 weeks difftime(end, begin, units = \"hours\") ## Time difference of 1560 hours\r","date":"2024-04-22","heading":"Date Conversion","objectID":"/en/posts/r2/:1:7","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#date-conversion"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Dates and Times\rDate Conversion\ras.Date('1/15/2020', format = '%m/%d/%Y') ###(2) Convert characters to POSIXct/POSIXlt time format ### as.POSIXct(1472562988, origin = \"1960-01-01\")# Convert a date value, using \"1960-01-01\" as the origin\rExtracting Date Components\rlibrary(lubridate) # Load the lubridate package t = \"2020-11-20 01:30:29\" year(t)# Extract the year ## [1] 2020 month(t)# Extract the month ## [1] 11 mday(t)# Extract the day of the month ## [1] 20 wday(t)# Extract the day of the week ## [1] 6 hour(t)# Extract the hour ## [1] 1 minute(t)# Extract the minute ## [1] 30 second(t)# Extract the second ## [1] 29\rDate Calculations\r# Find the number of days between any two dates begin = as.Date(\"2016-03-04\") end = as.Date(\"2016-05-08\") (during = end - begin) ## Time difference of 65 days # Find the number of weeks and hours between any two dates difftime(end, begin, units = \"weeks\") ## Time difference of 9.285714 weeks difftime(end, begin, units = \"hours\") ## Time difference of 1560 hours\r","date":"2024-04-22","heading":"Extracting Date Components","objectID":"/en/posts/r2/:1:7","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#extracting-date-components"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Dates and Times\rDate Conversion\ras.Date('1/15/2020', format = '%m/%d/%Y') ###(2) Convert characters to POSIXct/POSIXlt time format ### as.POSIXct(1472562988, origin = \"1960-01-01\")# Convert a date value, using \"1960-01-01\" as the origin\rExtracting Date Components\rlibrary(lubridate) # Load the lubridate package t = \"2020-11-20 01:30:29\" year(t)# Extract the year ## [1] 2020 month(t)# Extract the month ## [1] 11 mday(t)# Extract the day of the month ## [1] 20 wday(t)# Extract the day of the week ## [1] 6 hour(t)# Extract the hour ## [1] 1 minute(t)# Extract the minute ## [1] 30 second(t)# Extract the second ## [1] 29\rDate Calculations\r# Find the number of days between any two dates begin = as.Date(\"2016-03-04\") end = as.Date(\"2016-05-08\") (during = end - begin) ## Time difference of 65 days # Find the number of weeks and hours between any two dates difftime(end, begin, units = \"weeks\") ## Time difference of 9.285714 weeks difftime(end, begin, units = \"hours\") ## Time difference of 1560 hours\r","date":"2024-04-22","heading":"Date Calculations","objectID":"/en/posts/r2/:1:7","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#date-calculations"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Sorting, Selecting, and Grouping\rFiltering Rows\r# Select rows in mydata with year 2020 and cityid \u003e= 1100 filter(mydata, year == 2020, cityid \u003e= 1100) # Exclude rows in mydata with year 2020 or cityid \u003e= 1100 filter(mydata, !(year == 2020| cityid \u003e= 1100))\rSelecting Columns\r# Drop the columns from year to cityid select(mydata, -(year:cityid))\rSorting\r# Sort by GDP order(中国城市数据库$$地区生产总值.万元.) # When a variable name contains (), use .. in place of the name so R can recognize it # Sort by GDP in descending order sorted_values \u003c- sort(中国城市数据库$地区生产总值.万元., decreasing = TRUE)\rGrouped Processing\rlibrary(dplyr) # Use the dplyr package to compute group means 中国城市数据库 \u003c- 中国城市数据库 %\u003e% group_by(国界) %\u003e% mutate( 乡村振兴边境 = mean(乡村振兴, na.rm = TRUE), 产业兴旺边境 = mean(产业兴旺, na.rm = TRUE), 生态宜居边境 = mean(生态宜居, na.rm = TRUE), 治理有效边境 = mean(治理有效, na.rm = TRUE), 乡风文明边境 = mean(乡风文明, na.rm = TRUE), 生活富裕边境 = mean(生活富裕, na.rm = TRUE) )\r","date":"2024-04-22","heading":"Sorting, Selecting, and Grouping","objectID":"/en/posts/r2/:1:8","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#sorting-selecting-and-grouping"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Sorting, Selecting, and Grouping\rFiltering Rows\r# Select rows in mydata with year 2020 and cityid \u003e= 1100 filter(mydata, year == 2020, cityid \u003e= 1100) # Exclude rows in mydata with year 2020 or cityid \u003e= 1100 filter(mydata, !(year == 2020| cityid \u003e= 1100))\rSelecting Columns\r# Drop the columns from year to cityid select(mydata, -(year:cityid))\rSorting\r# Sort by GDP order(中国城市数据库$$地区生产总值.万元.) # When a variable name contains (), use .. in place of the name so R can recognize it # Sort by GDP in descending order sorted_values \u003c- sort(中国城市数据库$地区生产总值.万元., decreasing = TRUE)\rGrouped Processing\rlibrary(dplyr) # Use the dplyr package to compute group means 中国城市数据库 \u003c- 中国城市数据库 %\u003e% group_by(国界) %\u003e% mutate( 乡村振兴边境 = mean(乡村振兴, na.rm = TRUE), 产业兴旺边境 = mean(产业兴旺, na.rm = TRUE), 生态宜居边境 = mean(生态宜居, na.rm = TRUE), 治理有效边境 = mean(治理有效, na.rm = TRUE), 乡风文明边境 = mean(乡风文明, na.rm = TRUE), 生活富裕边境 = mean(生活富裕, na.rm = TRUE) )\r","date":"2024-04-22","heading":"Filtering Rows","objectID":"/en/posts/r2/:1:8","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#filtering-rows"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Sorting, Selecting, and Grouping\rFiltering Rows\r# Select rows in mydata with year 2020 and cityid \u003e= 1100 filter(mydata, year == 2020, cityid \u003e= 1100) # Exclude rows in mydata with year 2020 or cityid \u003e= 1100 filter(mydata, !(year == 2020| cityid \u003e= 1100))\rSelecting Columns\r# Drop the columns from year to cityid select(mydata, -(year:cityid))\rSorting\r# Sort by GDP order(中国城市数据库$$地区生产总值.万元.) # When a variable name contains (), use .. in place of the name so R can recognize it # Sort by GDP in descending order sorted_values \u003c- sort(中国城市数据库$地区生产总值.万元., decreasing = TRUE)\rGrouped Processing\rlibrary(dplyr) # Use the dplyr package to compute group means 中国城市数据库 \u003c- 中国城市数据库 %\u003e% group_by(国界) %\u003e% mutate( 乡村振兴边境 = mean(乡村振兴, na.rm = TRUE), 产业兴旺边境 = mean(产业兴旺, na.rm = TRUE), 生态宜居边境 = mean(生态宜居, na.rm = TRUE), 治理有效边境 = mean(治理有效, na.rm = TRUE), 乡风文明边境 = mean(乡风文明, na.rm = TRUE), 生活富裕边境 = mean(生活富裕, na.rm = TRUE) )\r","date":"2024-04-22","heading":"Selecting Columns","objectID":"/en/posts/r2/:1:8","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#selecting-columns"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Sorting, Selecting, and Grouping\rFiltering Rows\r# Select rows in mydata with year 2020 and cityid \u003e= 1100 filter(mydata, year == 2020, cityid \u003e= 1100) # Exclude rows in mydata with year 2020 or cityid \u003e= 1100 filter(mydata, !(year == 2020| cityid \u003e= 1100))\rSelecting Columns\r# Drop the columns from year to cityid select(mydata, -(year:cityid))\rSorting\r# Sort by GDP order(中国城市数据库$$地区生产总值.万元.) # When a variable name contains (), use .. in place of the name so R can recognize it # Sort by GDP in descending order sorted_values \u003c- sort(中国城市数据库$地区生产总值.万元., decreasing = TRUE)\rGrouped Processing\rlibrary(dplyr) # Use the dplyr package to compute group means 中国城市数据库 \u003c- 中国城市数据库 %\u003e% group_by(国界) %\u003e% mutate( 乡村振兴边境 = mean(乡村振兴, na.rm = TRUE), 产业兴旺边境 = mean(产业兴旺, na.rm = TRUE), 生态宜居边境 = mean(生态宜居, na.rm = TRUE), 治理有效边境 = mean(治理有效, na.rm = TRUE), 乡风文明边境 = mean(乡风文明, na.rm = TRUE), 生活富裕边境 = mean(生活富裕, na.rm = TRUE) )\r","date":"2024-04-22","heading":"Sorting","objectID":"/en/posts/r2/:1:8","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#sorting"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Sorting, Selecting, and Grouping\rFiltering Rows\r# Select rows in mydata with year 2020 and cityid \u003e= 1100 filter(mydata, year == 2020, cityid \u003e= 1100) # Exclude rows in mydata with year 2020 or cityid \u003e= 1100 filter(mydata, !(year == 2020| cityid \u003e= 1100))\rSelecting Columns\r# Drop the columns from year to cityid select(mydata, -(year:cityid))\rSorting\r# Sort by GDP order(中国城市数据库$$地区生产总值.万元.) # When a variable name contains (), use .. in place of the name so R can recognize it # Sort by GDP in descending order sorted_values \u003c- sort(中国城市数据库$地区生产总值.万元., decreasing = TRUE)\rGrouped Processing\rlibrary(dplyr) # Use the dplyr package to compute group means 中国城市数据库 \u003c- 中国城市数据库 %\u003e% group_by(国界) %\u003e% mutate( 乡村振兴边境 = mean(乡村振兴, na.rm = TRUE), 产业兴旺边境 = mean(产业兴旺, na.rm = TRUE), 生态宜居边境 = mean(生态宜居, na.rm = TRUE), 治理有效边境 = mean(治理有效, na.rm = TRUE), 乡风文明边境 = mean(乡风文明, na.rm = TRUE), 生活富裕边境 = mean(生活富裕, na.rm = TRUE) )\r","date":"2024-04-22","heading":"Grouped Processing","objectID":"/en/posts/r2/:1:8","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#grouped-processing"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Matching and Merging\rAlthough R has a built-in merge similar to Stata\u0026rsquo;s, it\u0026rsquo;s weaker and can only do one-to-one matching, so I recommend the dplyr package here. Horizontal\rVertical\rlibrary(dplyr) # Horizontal dplyr::left_join(a,b,by=\"x1\") dplyr::right_join(a,b,by=\"x1\") dplyr::inner_join(a,b,by=\"x1\") dplyr::outer_join(a,b,by=\"x1\") dplyr::semi_join(a,b,by=\"x1\") dplyr::anti_join(a,b,by=\"x1\") # Vertical dplyr::intersect(a,b) dplyr::union(a,b) dplyr::setdiff(a,b) dplyr::bind_rows(a,b) # Example # Match city data and pilot policy by id and year # For partial matching, slice by index [m,n:l] merged_data \u003c- dplyr::left_join(中国城市数据库, 智慧城市,by = c(\"year\", \"id\")) merged_data2 \u003c- merge(中国城市数据库[,3:5], 智慧城市, by = \"year\", all = TRUE)\r","date":"2024-04-22","heading":"Matching and Merging","objectID":"/en/posts/r2/:1:9","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#matching-and-merging"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Handling Outliers\rRemoving Duplicates\runique_data \u003c- 中国城市数据库 %\u003e% distinct(id, year, .keep_all = TRUE)\rData Imputation\rna.rm = TRUE is a parameter usually used to specify whether to remove missing values when performing calculations on data. When the na.rm parameter is set to TRUE, the function removes missing values from the data before computing; when it is set to FALSE or omitted, the function includes the missing values and returns NA as the result. Cross-Sectional Interpolation # Replace missing values in the gdp column of 中国城市数据库 with the column mean 中国城市数据库[is.na(中国城市数据库$gdp), ]$gdp \u003c- mean(中国城市数据库$gdp, na.rm = TRUE) # Replace outliers less than 0 in the score column of 中国城市数据库 with missing values 中国城市数据库[which(中国城市数据库$score \u003c 0), ]$score \u003c- NA # Replace missing values in the score column of 中国城市数据库 with the column mean 中国城市数据库[is.na(中国城市数据库$score), ]$score \u003c- mean(中国城市数据库$score, na.rm = TRUE)\rPanel Interpolation Referring to Stata\u0026rsquo;s interpolation command, I found a similar interpolation method in R. library(dplyr) library(zoo) # Treat the data frame as panel data, group by id and year, and interpolate \"地区生产总值.万元.\" 中国城市数据库_new \u003c- 中国城市数据库 %\u003e% arrange(id, year) %\u003e% group_by(id) # Interpolation 中国城市数据库_new \u003c- 中国城市数据库_new %\u003e% mutate(地区生产总值.万元. = na.approx(地区生产总值.万元.)) # Extrapolation 中国城市数据库_new \u003c- 中国城市数据库_new %\u003e% mutate(地区生产总值.万元. = na.approx(地区生产总值.万元., method = \"constant\"))\rWinsorizing\rReferring to Equivalent Commands in R and Stata - statar, using the statar package. Values beyond a specific range are replaced with the value at the boundary of that range. library(statar) statar::winsorize(v, probs = c(0.01, 0.99)) # R can also first compute the data distribution and then delete based on it # Compute the percentiles quantiles \u003c- quantile(中国城市数据库2$R.D内部经费支出.万元., probs = c(0.01, 0.99)) # Replace the extreme values 中国城市数据库2$R.D内部经费支出.万元.[中国城市数据库2$R.D内部经费支出.万元. \u003c quantiles[1]] \u003c- quantiles[1] 中国城市数据库2$R.D内部经费支出.万元.[中国城市数据库2$R.D内部经费支出.万元. \u003e quantiles[2]] \u003c- quantiles[2]\rDeleting Data\rDelete blank values and values that don\u0026rsquo;t apply to the questionnaire. Since Stata can only operate on one table at a time, you add and remove everything on a single table; but R supports working with multiple tables, so in practice filtering is achieved by extracting the appropriate data to form a new table. # Delete the rows with year 2020, and drop columns 5 and 10 中国城市数据库_new \u003c- 中国城市数据库[中国城市数据库$year != \"2020\", -c(5, 10)] # Use a loop function # Create a character vector containing the variable names to be imputed var \u003c- c(\"var0\", \"var1\", \"var2\", \"var3\", \"genshin\") # Loop through each variable name for (i in var) { # Delete specific values in the variable data \u003c- subset(data, !(data[, i] == -88 | data[, i] == -99 | is.na(data[, i]) | data[, i] \u003c= 0)) }\r","date":"2024-04-22","heading":"Handling Outliers","objectID":"/en/posts/r2/:1:10","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#handling-outliers"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Handling Outliers\rRemoving Duplicates\runique_data \u003c- 中国城市数据库 %\u003e% distinct(id, year, .keep_all = TRUE)\rData Imputation\rna.rm = TRUE is a parameter usually used to specify whether to remove missing values when performing calculations on data. When the na.rm parameter is set to TRUE, the function removes missing values from the data before computing; when it is set to FALSE or omitted, the function includes the missing values and returns NA as the result. Cross-Sectional Interpolation # Replace missing values in the gdp column of 中国城市数据库 with the column mean 中国城市数据库[is.na(中国城市数据库$gdp), ]$gdp \u003c- mean(中国城市数据库$gdp, na.rm = TRUE) # Replace outliers less than 0 in the score column of 中国城市数据库 with missing values 中国城市数据库[which(中国城市数据库$score \u003c 0), ]$score \u003c- NA # Replace missing values in the score column of 中国城市数据库 with the column mean 中国城市数据库[is.na(中国城市数据库$score), ]$score \u003c- mean(中国城市数据库$score, na.rm = TRUE)\rPanel Interpolation Referring to Stata\u0026rsquo;s interpolation command, I found a similar interpolation method in R. library(dplyr) library(zoo) # Treat the data frame as panel data, group by id and year, and interpolate \"地区生产总值.万元.\" 中国城市数据库_new \u003c- 中国城市数据库 %\u003e% arrange(id, year) %\u003e% group_by(id) # Interpolation 中国城市数据库_new \u003c- 中国城市数据库_new %\u003e% mutate(地区生产总值.万元. = na.approx(地区生产总值.万元.)) # Extrapolation 中国城市数据库_new \u003c- 中国城市数据库_new %\u003e% mutate(地区生产总值.万元. = na.approx(地区生产总值.万元., method = \"constant\"))\rWinsorizing\rReferring to Equivalent Commands in R and Stata - statar, using the statar package. Values beyond a specific range are replaced with the value at the boundary of that range. library(statar) statar::winsorize(v, probs = c(0.01, 0.99)) # R can also first compute the data distribution and then delete based on it # Compute the percentiles quantiles \u003c- quantile(中国城市数据库2$R.D内部经费支出.万元., probs = c(0.01, 0.99)) # Replace the extreme values 中国城市数据库2$R.D内部经费支出.万元.[中国城市数据库2$R.D内部经费支出.万元. \u003c quantiles[1]] \u003c- quantiles[1] 中国城市数据库2$R.D内部经费支出.万元.[中国城市数据库2$R.D内部经费支出.万元. \u003e quantiles[2]] \u003c- quantiles[2]\rDeleting Data\rDelete blank values and values that don\u0026rsquo;t apply to the questionnaire. Since Stata can only operate on one table at a time, you add and remove everything on a single table; but R supports working with multiple tables, so in practice filtering is achieved by extracting the appropriate data to form a new table. # Delete the rows with year 2020, and drop columns 5 and 10 中国城市数据库_new \u003c- 中国城市数据库[中国城市数据库$year != \"2020\", -c(5, 10)] # Use a loop function # Create a character vector containing the variable names to be imputed var \u003c- c(\"var0\", \"var1\", \"var2\", \"var3\", \"genshin\") # Loop through each variable name for (i in var) { # Delete specific values in the variable data \u003c- subset(data, !(data[, i] == -88 | data[, i] == -99 | is.na(data[, i]) | data[, i] \u003c= 0)) }\r","date":"2024-04-22","heading":"Removing Duplicates","objectID":"/en/posts/r2/:1:10","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#removing-duplicates"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Handling Outliers\rRemoving Duplicates\runique_data \u003c- 中国城市数据库 %\u003e% distinct(id, year, .keep_all = TRUE)\rData Imputation\rna.rm = TRUE is a parameter usually used to specify whether to remove missing values when performing calculations on data. When the na.rm parameter is set to TRUE, the function removes missing values from the data before computing; when it is set to FALSE or omitted, the function includes the missing values and returns NA as the result. Cross-Sectional Interpolation # Replace missing values in the gdp column of 中国城市数据库 with the column mean 中国城市数据库[is.na(中国城市数据库$gdp), ]$gdp \u003c- mean(中国城市数据库$gdp, na.rm = TRUE) # Replace outliers less than 0 in the score column of 中国城市数据库 with missing values 中国城市数据库[which(中国城市数据库$score \u003c 0), ]$score \u003c- NA # Replace missing values in the score column of 中国城市数据库 with the column mean 中国城市数据库[is.na(中国城市数据库$score), ]$score \u003c- mean(中国城市数据库$score, na.rm = TRUE)\rPanel Interpolation Referring to Stata\u0026rsquo;s interpolation command, I found a similar interpolation method in R. library(dplyr) library(zoo) # Treat the data frame as panel data, group by id and year, and interpolate \"地区生产总值.万元.\" 中国城市数据库_new \u003c- 中国城市数据库 %\u003e% arrange(id, year) %\u003e% group_by(id) # Interpolation 中国城市数据库_new \u003c- 中国城市数据库_new %\u003e% mutate(地区生产总值.万元. = na.approx(地区生产总值.万元.)) # Extrapolation 中国城市数据库_new \u003c- 中国城市数据库_new %\u003e% mutate(地区生产总值.万元. = na.approx(地区生产总值.万元., method = \"constant\"))\rWinsorizing\rReferring to Equivalent Commands in R and Stata - statar, using the statar package. Values beyond a specific range are replaced with the value at the boundary of that range. library(statar) statar::winsorize(v, probs = c(0.01, 0.99)) # R can also first compute the data distribution and then delete based on it # Compute the percentiles quantiles \u003c- quantile(中国城市数据库2$R.D内部经费支出.万元., probs = c(0.01, 0.99)) # Replace the extreme values 中国城市数据库2$R.D内部经费支出.万元.[中国城市数据库2$R.D内部经费支出.万元. \u003c quantiles[1]] \u003c- quantiles[1] 中国城市数据库2$R.D内部经费支出.万元.[中国城市数据库2$R.D内部经费支出.万元. \u003e quantiles[2]] \u003c- quantiles[2]\rDeleting Data\rDelete blank values and values that don\u0026rsquo;t apply to the questionnaire. Since Stata can only operate on one table at a time, you add and remove everything on a single table; but R supports working with multiple tables, so in practice filtering is achieved by extracting the appropriate data to form a new table. # Delete the rows with year 2020, and drop columns 5 and 10 中国城市数据库_new \u003c- 中国城市数据库[中国城市数据库$year != \"2020\", -c(5, 10)] # Use a loop function # Create a character vector containing the variable names to be imputed var \u003c- c(\"var0\", \"var1\", \"var2\", \"var3\", \"genshin\") # Loop through each variable name for (i in var) { # Delete specific values in the variable data \u003c- subset(data, !(data[, i] == -88 | data[, i] == -99 | is.na(data[, i]) | data[, i] \u003c= 0)) }\r","date":"2024-04-22","heading":"Data Imputation","objectID":"/en/posts/r2/:1:10","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#data-imputation"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Handling Outliers\rRemoving Duplicates\runique_data \u003c- 中国城市数据库 %\u003e% distinct(id, year, .keep_all = TRUE)\rData Imputation\rna.rm = TRUE is a parameter usually used to specify whether to remove missing values when performing calculations on data. When the na.rm parameter is set to TRUE, the function removes missing values from the data before computing; when it is set to FALSE or omitted, the function includes the missing values and returns NA as the result. Cross-Sectional Interpolation # Replace missing values in the gdp column of 中国城市数据库 with the column mean 中国城市数据库[is.na(中国城市数据库$gdp), ]$gdp \u003c- mean(中国城市数据库$gdp, na.rm = TRUE) # Replace outliers less than 0 in the score column of 中国城市数据库 with missing values 中国城市数据库[which(中国城市数据库$score \u003c 0), ]$score \u003c- NA # Replace missing values in the score column of 中国城市数据库 with the column mean 中国城市数据库[is.na(中国城市数据库$score), ]$score \u003c- mean(中国城市数据库$score, na.rm = TRUE)\rPanel Interpolation Referring to Stata\u0026rsquo;s interpolation command, I found a similar interpolation method in R. library(dplyr) library(zoo) # Treat the data frame as panel data, group by id and year, and interpolate \"地区生产总值.万元.\" 中国城市数据库_new \u003c- 中国城市数据库 %\u003e% arrange(id, year) %\u003e% group_by(id) # Interpolation 中国城市数据库_new \u003c- 中国城市数据库_new %\u003e% mutate(地区生产总值.万元. = na.approx(地区生产总值.万元.)) # Extrapolation 中国城市数据库_new \u003c- 中国城市数据库_new %\u003e% mutate(地区生产总值.万元. = na.approx(地区生产总值.万元., method = \"constant\"))\rWinsorizing\rReferring to Equivalent Commands in R and Stata - statar, using the statar package. Values beyond a specific range are replaced with the value at the boundary of that range. library(statar) statar::winsorize(v, probs = c(0.01, 0.99)) # R can also first compute the data distribution and then delete based on it # Compute the percentiles quantiles \u003c- quantile(中国城市数据库2$R.D内部经费支出.万元., probs = c(0.01, 0.99)) # Replace the extreme values 中国城市数据库2$R.D内部经费支出.万元.[中国城市数据库2$R.D内部经费支出.万元. \u003c quantiles[1]] \u003c- quantiles[1] 中国城市数据库2$R.D内部经费支出.万元.[中国城市数据库2$R.D内部经费支出.万元. \u003e quantiles[2]] \u003c- quantiles[2]\rDeleting Data\rDelete blank values and values that don\u0026rsquo;t apply to the questionnaire. Since Stata can only operate on one table at a time, you add and remove everything on a single table; but R supports working with multiple tables, so in practice filtering is achieved by extracting the appropriate data to form a new table. # Delete the rows with year 2020, and drop columns 5 and 10 中国城市数据库_new \u003c- 中国城市数据库[中国城市数据库$year != \"2020\", -c(5, 10)] # Use a loop function # Create a character vector containing the variable names to be imputed var \u003c- c(\"var0\", \"var1\", \"var2\", \"var3\", \"genshin\") # Loop through each variable name for (i in var) { # Delete specific values in the variable data \u003c- subset(data, !(data[, i] == -88 | data[, i] == -99 | is.na(data[, i]) | data[, i] \u003c= 0)) }\r","date":"2024-04-22","heading":"Winsorizing","objectID":"/en/posts/r2/:1:10","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#winsorizing"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Handling Outliers\rRemoving Duplicates\runique_data \u003c- 中国城市数据库 %\u003e% distinct(id, year, .keep_all = TRUE)\rData Imputation\rna.rm = TRUE is a parameter usually used to specify whether to remove missing values when performing calculations on data. When the na.rm parameter is set to TRUE, the function removes missing values from the data before computing; when it is set to FALSE or omitted, the function includes the missing values and returns NA as the result. Cross-Sectional Interpolation # Replace missing values in the gdp column of 中国城市数据库 with the column mean 中国城市数据库[is.na(中国城市数据库$gdp), ]$gdp \u003c- mean(中国城市数据库$gdp, na.rm = TRUE) # Replace outliers less than 0 in the score column of 中国城市数据库 with missing values 中国城市数据库[which(中国城市数据库$score \u003c 0), ]$score \u003c- NA # Replace missing values in the score column of 中国城市数据库 with the column mean 中国城市数据库[is.na(中国城市数据库$score), ]$score \u003c- mean(中国城市数据库$score, na.rm = TRUE)\rPanel Interpolation Referring to Stata\u0026rsquo;s interpolation command, I found a similar interpolation method in R. library(dplyr) library(zoo) # Treat the data frame as panel data, group by id and year, and interpolate \"地区生产总值.万元.\" 中国城市数据库_new \u003c- 中国城市数据库 %\u003e% arrange(id, year) %\u003e% group_by(id) # Interpolation 中国城市数据库_new \u003c- 中国城市数据库_new %\u003e% mutate(地区生产总值.万元. = na.approx(地区生产总值.万元.)) # Extrapolation 中国城市数据库_new \u003c- 中国城市数据库_new %\u003e% mutate(地区生产总值.万元. = na.approx(地区生产总值.万元., method = \"constant\"))\rWinsorizing\rReferring to Equivalent Commands in R and Stata - statar, using the statar package. Values beyond a specific range are replaced with the value at the boundary of that range. library(statar) statar::winsorize(v, probs = c(0.01, 0.99)) # R can also first compute the data distribution and then delete based on it # Compute the percentiles quantiles \u003c- quantile(中国城市数据库2$R.D内部经费支出.万元., probs = c(0.01, 0.99)) # Replace the extreme values 中国城市数据库2$R.D内部经费支出.万元.[中国城市数据库2$R.D内部经费支出.万元. \u003c quantiles[1]] \u003c- quantiles[1] 中国城市数据库2$R.D内部经费支出.万元.[中国城市数据库2$R.D内部经费支出.万元. \u003e quantiles[2]] \u003c- quantiles[2]\rDeleting Data\rDelete blank values and values that don\u0026rsquo;t apply to the questionnaire. Since Stata can only operate on one table at a time, you add and remove everything on a single table; but R supports working with multiple tables, so in practice filtering is achieved by extracting the appropriate data to form a new table. # Delete the rows with year 2020, and drop columns 5 and 10 中国城市数据库_new \u003c- 中国城市数据库[中国城市数据库$year != \"2020\", -c(5, 10)] # Use a loop function # Create a character vector containing the variable names to be imputed var \u003c- c(\"var0\", \"var1\", \"var2\", \"var3\", \"genshin\") # Loop through each variable name for (i in var) { # Delete specific values in the variable data \u003c- subset(data, !(data[, i] == -88 | data[, i] == -99 | is.na(data[, i]) | data[, i] \u003c= 0)) }\r","date":"2024-04-22","heading":"Deleting Data","objectID":"/en/posts/r2/:1:10","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#deleting-data"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Plotting\rThis section refers to the electronic lecture notes Statistical Software R by Teacher Li Dongfeng. My data source ggplot2 is about divide-and-conquer plotting, so its syntax consists of $$ Step 1 (specify the dataset, specify the axes) \u0026#43; Step 2 (specify the plot type) \u0026#43; Plot 3 (decoration) \u0026#43; Combination 4 (......) $$ The general steps for plotting with ggplot2 are: Prepare the data, usually a data frame, and generally in long format, i.e., each observation time takes one row and each observed variable takes one column. Input the data into the ggplot() function, and specify which graphical attributes each variable in the plot maps to, such as the x coordinate, y coordinate, color, shape, etc. These mappings are called aesthetic mappings, or aesthetics. Choose a suitable plot type; the function name starts with geom_, such as geom_point() for a scatter plot. The plot type is called a geom for short. Connect the ggplot() part and the geom_xxx() part with a plus sign. You can already make a plot at this point; the following steps are further refinements. Set an appropriate coordinate system, such as coord_cartesian(), scale_x_log10(), etc. Again connect with a plus sign. Set the title, legend position, and so on, such as labs(). Again connect with a plus sign. A rough template for this workflow is: library(ggplot2) p \u003c- ggplot(data=, mapping=aes(=, =, \u003c...\u003e)) p + geom_(\u003c...\u003e) + scale__(\u003c...\u003e) + coord_(\u003c...\u003e) + labs(\u003c...\u003e)\r","date":"2024-04-22","heading":"Plotting","objectID":"/en/posts/r2/:2:0","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#plotting"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Scatter Plots and Line Plots\rThe syntax really doesn\u0026rsquo;t feel as clean and convenient as Stata\u0026rsquo;s ( geom_point(): scatter points; similarly, add a line plot with geom_line() geom_smooth(): fitted line scale_x_log10: log-transform the x-axis with base 10 color = quality: fill colors by group according to the quality variable facet_wrap(~ quality): slice into groups by the quality variable; it can also be (a~b), which is two-dimensional grouping. You can also use facet_grid(row variable ~ column variable). setwd(\"F:/桌面/R\") testdata \u003c- readr::read_csv(\"wineQualityReds.csv\") names(testdata) library(ggplot2) # qplot for quick plotting qplot(x=chlorides , y=chlorides , data=testdata, geom = \"point\") # Plot with ggplot p \u003c- ggplot(data = testdata, mapping = aes( x = residual.sugar, y = chlorides, color = quality, fill = quality)) p1 \u003c- p + geom_point() + geom_smooth(method = \"loess\") + scale_x_log10(labels = scales::dollar) + labs( x = \"横坐标\", y = \"纵坐标\", title = \"test标题\", subtitle = \"随便找的数据\", caption = \"数据来源: github\" )+ facet_wrap(~ quality) print(p1) ggsave(filename=\"文件名.png\")\rScatter plot with a fitted line\rAfter faceting\r","date":"2024-04-22","heading":"Scatter Plots and Line Plots","objectID":"/en/posts/r2/:2:1","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#scatter-plots-and-line-plots"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Bar Charts\r# Count using the dataset 数据集 \u003c- 原始数据集 |\u003e select(分类变量) |\u003e count(分类变量) |\u003e mutate(比例值 = n / sum(n)) p\u003c-ggplot(数据集, aes( x = 分类变量 y = n, # Can also change to the ratio value fill =religion # Different categories in different colors )) p+geom_col() +labs(y = \"纵坐标名字\") +guides(fill = \"none\") # Whether to remove the legend + coord_flip() # Swap the x and y axes + geom_col(position = \"stack\") # Stack +facet_grid(A ~ B) # Facet into groups A bar chart grouped internally df3 \u003c- gss_sm |\u003e select(bigregion, religion) |\u003e group_by(bigregion, religion) |\u003e summarise(n = n(), .groups=\"drop_last\") |\u003e mutate(ratio = n / sum(n)) p \u003c- ggplot(df3, aes( x = bigregion, y = n, fill = religion)) p + geom_col()\rA histogram grouped internally\r","date":"2024-04-22","heading":"Bar Charts","objectID":"/en/posts/r2/:2:2","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#bar-charts"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Histograms\r# midwest is a dataset bundled with ggplot # Histogram p \u003c- ggplot(midwest, aes(x = area)) p + geom_histogram() # Kernel density plot ggplot(midwest, aes( x = area, color = state, fill = state)) + geom_density(alpha = 0.3) # alpha = 0.3 sets the transparency # Histogram with kernel density ggplot(midwest, aes(x = area)) + geom_histogram( mapping = aes(y = ..density..), alpha = 0.6) + geom_density(size = 1.1)\rHistogram with a kernel density line added\r","date":"2024-04-22","heading":"Histograms","objectID":"/en/posts/r2/:2:3","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#histograms"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Box Plots\r# Just change ggplot(dataset, aes(categorical x, target y)) p \u003c- ggplot(midwest,aes(state,area))+ stat_boxplot(geom = 'errorbar',width=0.3,cex=1)+ #errorbar geom_boxplot(cex=1)+ labs(x=NULL)+ theme_classic(base_size = 18)+ theme(panel.border = element_rect(size = 1,fill = 'transparent'), legend.position = 'none', axis.text = element_text(color = 'black')) # Theme adjustments p\rmidwest is a built-in dataset\r","date":"2024-04-22","heading":"Box Plots","objectID":"/en/posts/r2/:2:4","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#box-plots"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Word Clouds\rlibrary(wordcloud2) wordcloud2(demoFreq)\rDataset bundled with the wordcloud2 package\r","date":"2024-04-22","heading":"Word Clouds","objectID":"/en/posts/r2/:2:5","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#word-clouds"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Correlation Heatmap\rReference: Drawing Correlation Heatmaps in R # Load the package library(ggcorrplot) cormtcars \u003c- round(cor(mtcars), 3) # round() sets the number of decimal places ggcorrplot(cor(cormtcars)) # The default is squares; change to circles and add the correlation coefficients ggcorrplot(cormtcars,method = \"circle\",lab=T) # Use the cor_pmat() function from the ggcorrplot package to compute p-values: pmtcars \u003c- cor_pmat(mtcars) ggcorrplot(cormtcars,hc.order = T, # Hierarchical clustering to reorder the matrix ggtheme = ggplot2::theme_void(base_size = 15), # Theme changes colors = c(\"CornflowerBlue\",\"white\",\"Salmon\"), # Custom colors; choose what you like, or refer to the figure styles in well-designed papers. lab = T,lab_size = 5, # Font size of the correlation coefficient text tl.cex = 15, # Axis label font size p.mat = pmtcars, # Add significance information sig.level = 0.01, # Significance level pch = 4, # Mark the cells that aren't significant enough; pch selects the marking style, and you can try other numbers to see what style each gives pch.cex = 10) # Size of the non-significant marks; use insig = \"blank\" to blank out the non-significant cells\rCorrelation coefficient heatmap\r","date":"2024-04-22","heading":"Correlation Heatmap","objectID":"/en/posts/r2/:2:6","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#correlation-heatmap"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Bubble Plots\r# Set the working environment setwd(\"F:/桌面/R\") 中国城市数据库 \u003c- readxl::read_excel(\"中国城市数据库.xlsx\") # Load the packages library(ggplot2) library(dplyr) # Rename the dataset columns names(中国城市数据库) str(中国城市数据库) data\u003c-rename(中国城市数据库,year = 年份 ,GDP = `地区生产总值(万元)` ,one = `第一产业增加值(万元)` ,id=`行政区划代码`) data \u003c- mutate(data, pro = substr(id, 1, 2), # Extract characters; the first two digits of cityid represent the province lgone=log(one,base=10) # Log-transform ) # Plot p\u003c-ggplot(data[1:400,], mapping =aes( x=year, y=GDP, size=lgone, # Bubble size weight color = pro,# Line color grouping, by province fill = pro))# Fill color grouping, by province p+ geom_point(shape=21,colour=\"black\",alpha = .5)+geom_smooth(method = \"loess\", aes(group = pro))\rBubble plot\r","date":"2024-04-22","heading":"Bubble Plots","objectID":"/en/posts/r2/:2:7","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#bubble-plots"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Combining Plots\rRecommended reading: The most comprehensive guide to combining and stitching plots in R Loading Packages and Plotting\r# Load the plotting packages library(ggplot2) library(ggprism) library(reshape) library(ggpubr) # Data df \u003c- data.frame(A = c(1, 2, 3, 4, 5, 6, 8, 12, 13), B = c(1, 2, 4, 5, 7, 10,5,6,8), C = c(1, 5, 6, 7, 8, 9, 10, 11, 13), D = c(1, 2, 5, 8, 10, 13,5,8,6)) df1=melt(df) colnames(df1)=c(\"group\",\"value\") # fig.1 p1\u003c-ggplot(df1,aes(x=group,y=value))+ stat_boxplot(geom = \"errorbar\", width=0.1)+ geom_boxplot(aes(fill=group), outlier.colour=\"white\")+ geom_jitter(width = 0.2)+ theme_prism(palette = \"candy_bright\", base_fontface = \"plain\", base_family = \"serif\", base_size = 16, base_line_size = 0.8, axis_text_angle = 45)+ scale_fill_prism(palette = \"candy_bright\")+ theme(legend.position=\"none\") p1 # fig.2 p2\u003c-ggplot( df1, aes(x = group, y=value,color=group,fill=group) ) + geom_bar(stat=\"summary\",fun=mean,position=\"dodge\")+ stat_summary(fun.data = 'mean_sd', geom = \"errorbar\", width = 0.3)+ labs(x=\"Samples\",y=NULL)+ theme_prism(palette = \"candy_bright\", base_fontface = \"plain\", base_family = \"serif\", base_size = 16, base_line_size = 0.8, axis_text_angle = 45)+ scale_fill_prism(palette = \"candy_bright\")+ theme(legend.position=\"none\") p2 # fig.3 p3\u003c-ggplot(df1, aes(x = group, y=value,fill=group))+ geom_violin(trim = T,position = position_dodge(width = 0.1))+ geom_boxplot(alpha=1,outlier.size=0, size=0.3, width=0.2,fill=\"white\")+ stat_summary(fun=\"mean\",geom=\"point\",shape=21, size=2,fill=\"blue\")+ labs(x=\"Samples\",y=NULL)+ theme_prism(palette = \"flames\", base_fontface = \"plain\", base_family = \"serif\", base_size = 16, base_line_size = 0.8, axis_text_angle = 45)+ scale_fill_prism(palette = \"candy_bright\")+ theme(legend.position = 'none') p3 # fig.4 p4\u003c-ggplot(df) + geom_segment(aes(x=A, xend=A, y=0, yend=B), color=\"grey\",size=1) + geom_point( aes(x=A, y=B,color=A), size=4 ) + theme_prism(palette = \"pearl\", base_fontface = \"plain\", base_family = \"serif\", base_size = 14, base_line_size = 0.8, axis_text_angle = 45) + theme(legend.position = \"none\") + ggtitle(\"Lollipop Chart\") p4\rCombining Plots\r# cowplot package cowplot::plot_grid(p1,p2,p3,p4,ncol = 4) # gridExtra package gridExtra::grid.arrange(p1,p2,p3,p4, layout_matrix=rbind(c(1,2),c(3,4)))# Split the figure into 4 regions; the top two hold Figure 1 and Figure 2, and the bottom two hold Figure 3 and Figure 4 gridExtra::grid.arrange(p1,p2,p3,p4, layout_matrix=rbind(c(1,2,3,4)))# Arrange horizontally gridExtra::grid.arrange(p1,p2,p3,p4, layout_matrix=rbind(c(1),c(2),c(3),c(4)))# Arrange vertically\rA 2x2 split\r","date":"2024-04-22","heading":"Combining Plots","objectID":"/en/posts/r2/:2:8","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#combining-plots"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Combining Plots\rRecommended reading: The most comprehensive guide to combining and stitching plots in R Loading Packages and Plotting\r# Load the plotting packages library(ggplot2) library(ggprism) library(reshape) library(ggpubr) # Data df \u003c- data.frame(A = c(1, 2, 3, 4, 5, 6, 8, 12, 13), B = c(1, 2, 4, 5, 7, 10,5,6,8), C = c(1, 5, 6, 7, 8, 9, 10, 11, 13), D = c(1, 2, 5, 8, 10, 13,5,8,6)) df1=melt(df) colnames(df1)=c(\"group\",\"value\") # fig.1 p1\u003c-ggplot(df1,aes(x=group,y=value))+ stat_boxplot(geom = \"errorbar\", width=0.1)+ geom_boxplot(aes(fill=group), outlier.colour=\"white\")+ geom_jitter(width = 0.2)+ theme_prism(palette = \"candy_bright\", base_fontface = \"plain\", base_family = \"serif\", base_size = 16, base_line_size = 0.8, axis_text_angle = 45)+ scale_fill_prism(palette = \"candy_bright\")+ theme(legend.position=\"none\") p1 # fig.2 p2\u003c-ggplot( df1, aes(x = group, y=value,color=group,fill=group) ) + geom_bar(stat=\"summary\",fun=mean,position=\"dodge\")+ stat_summary(fun.data = 'mean_sd', geom = \"errorbar\", width = 0.3)+ labs(x=\"Samples\",y=NULL)+ theme_prism(palette = \"candy_bright\", base_fontface = \"plain\", base_family = \"serif\", base_size = 16, base_line_size = 0.8, axis_text_angle = 45)+ scale_fill_prism(palette = \"candy_bright\")+ theme(legend.position=\"none\") p2 # fig.3 p3\u003c-ggplot(df1, aes(x = group, y=value,fill=group))+ geom_violin(trim = T,position = position_dodge(width = 0.1))+ geom_boxplot(alpha=1,outlier.size=0, size=0.3, width=0.2,fill=\"white\")+ stat_summary(fun=\"mean\",geom=\"point\",shape=21, size=2,fill=\"blue\")+ labs(x=\"Samples\",y=NULL)+ theme_prism(palette = \"flames\", base_fontface = \"plain\", base_family = \"serif\", base_size = 16, base_line_size = 0.8, axis_text_angle = 45)+ scale_fill_prism(palette = \"candy_bright\")+ theme(legend.position = 'none') p3 # fig.4 p4\u003c-ggplot(df) + geom_segment(aes(x=A, xend=A, y=0, yend=B), color=\"grey\",size=1) + geom_point( aes(x=A, y=B,color=A), size=4 ) + theme_prism(palette = \"pearl\", base_fontface = \"plain\", base_family = \"serif\", base_size = 14, base_line_size = 0.8, axis_text_angle = 45) + theme(legend.position = \"none\") + ggtitle(\"Lollipop Chart\") p4\rCombining Plots\r# cowplot package cowplot::plot_grid(p1,p2,p3,p4,ncol = 4) # gridExtra package gridExtra::grid.arrange(p1,p2,p3,p4, layout_matrix=rbind(c(1,2),c(3,4)))# Split the figure into 4 regions; the top two hold Figure 1 and Figure 2, and the bottom two hold Figure 3 and Figure 4 gridExtra::grid.arrange(p1,p2,p3,p4, layout_matrix=rbind(c(1,2,3,4)))# Arrange horizontally gridExtra::grid.arrange(p1,p2,p3,p4, layout_matrix=rbind(c(1),c(2),c(3),c(4)))# Arrange vertically\rA 2x2 split\r","date":"2024-04-22","heading":"Loading Packages and Plotting","objectID":"/en/posts/r2/:2:8","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#loading-packages-and-plotting"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Combining Plots\rRecommended reading: The most comprehensive guide to combining and stitching plots in R Loading Packages and Plotting\r# Load the plotting packages library(ggplot2) library(ggprism) library(reshape) library(ggpubr) # Data df \u003c- data.frame(A = c(1, 2, 3, 4, 5, 6, 8, 12, 13), B = c(1, 2, 4, 5, 7, 10,5,6,8), C = c(1, 5, 6, 7, 8, 9, 10, 11, 13), D = c(1, 2, 5, 8, 10, 13,5,8,6)) df1=melt(df) colnames(df1)=c(\"group\",\"value\") # fig.1 p1\u003c-ggplot(df1,aes(x=group,y=value))+ stat_boxplot(geom = \"errorbar\", width=0.1)+ geom_boxplot(aes(fill=group), outlier.colour=\"white\")+ geom_jitter(width = 0.2)+ theme_prism(palette = \"candy_bright\", base_fontface = \"plain\", base_family = \"serif\", base_size = 16, base_line_size = 0.8, axis_text_angle = 45)+ scale_fill_prism(palette = \"candy_bright\")+ theme(legend.position=\"none\") p1 # fig.2 p2\u003c-ggplot( df1, aes(x = group, y=value,color=group,fill=group) ) + geom_bar(stat=\"summary\",fun=mean,position=\"dodge\")+ stat_summary(fun.data = 'mean_sd', geom = \"errorbar\", width = 0.3)+ labs(x=\"Samples\",y=NULL)+ theme_prism(palette = \"candy_bright\", base_fontface = \"plain\", base_family = \"serif\", base_size = 16, base_line_size = 0.8, axis_text_angle = 45)+ scale_fill_prism(palette = \"candy_bright\")+ theme(legend.position=\"none\") p2 # fig.3 p3\u003c-ggplot(df1, aes(x = group, y=value,fill=group))+ geom_violin(trim = T,position = position_dodge(width = 0.1))+ geom_boxplot(alpha=1,outlier.size=0, size=0.3, width=0.2,fill=\"white\")+ stat_summary(fun=\"mean\",geom=\"point\",shape=21, size=2,fill=\"blue\")+ labs(x=\"Samples\",y=NULL)+ theme_prism(palette = \"flames\", base_fontface = \"plain\", base_family = \"serif\", base_size = 16, base_line_size = 0.8, axis_text_angle = 45)+ scale_fill_prism(palette = \"candy_bright\")+ theme(legend.position = 'none') p3 # fig.4 p4\u003c-ggplot(df) + geom_segment(aes(x=A, xend=A, y=0, yend=B), color=\"grey\",size=1) + geom_point( aes(x=A, y=B,color=A), size=4 ) + theme_prism(palette = \"pearl\", base_fontface = \"plain\", base_family = \"serif\", base_size = 14, base_line_size = 0.8, axis_text_angle = 45) + theme(legend.position = \"none\") + ggtitle(\"Lollipop Chart\") p4\rCombining Plots\r# cowplot package cowplot::plot_grid(p1,p2,p3,p4,ncol = 4) # gridExtra package gridExtra::grid.arrange(p1,p2,p3,p4, layout_matrix=rbind(c(1,2),c(3,4)))# Split the figure into 4 regions; the top two hold Figure 1 and Figure 2, and the bottom two hold Figure 3 and Figure 4 gridExtra::grid.arrange(p1,p2,p3,p4, layout_matrix=rbind(c(1,2,3,4)))# Arrange horizontally gridExtra::grid.arrange(p1,p2,p3,p4, layout_matrix=rbind(c(1),c(2),c(3),c(4)))# Arrange vertically\rA 2x2 split\r","date":"2024-04-22","heading":"Combining Plots","objectID":"/en/posts/r2/:2:8","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#combining-plots-1"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Econometrics\rRecommended package: the bruceR package developed by Zhihu expert 包寒吴霜, with the goal of replacing SPSS! I often read this expert\u0026rsquo;s articles on regression, and in their view, economic regression is just a special variant of general/generalized/multilevel linear models. Since R is mainly used in biomedical statistics, the mainstream R package three-line tables and the three-line tables required in economics are not the same. ","date":"2024-04-22","heading":"Econometrics","objectID":"/en/posts/r2/:3:0","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#econometrics"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Descriptive Statistics and Output\rDescriptive Statistics\rlibrary(bruceR) head(mtcars) # Data bundled with R mtcarsdemo \u003c- mtcars[c(\"mpg\", \"disp\", \"hp\", \"drat\", \"wt\", \"qsec\")] Describe(mtcarsdemo, digits = 2, file = \"describe\") # digits means the number of decimal places to keep # Output the result to Word\rOutput result\rCorrelation Analysis\rThe package this expert developed is terrifyingly good! Short, elegant, and efficient! Still using the Describe command library(bruceR) Describe(mtcarsdemo, # Dataset digits = 2, # Decimal places plot = T, # Plotting feature upper.triangle = T, # Scatter plots in the upper-right triangle upper.smooth = \"loess\") # Fitted line; lm is linear, loess is quadratic\rbruceR\u0026rsquo;s correlation analysis; I was stunned the first time I used it!\r","date":"2024-04-22","heading":"Descriptive Statistics and Output","objectID":"/en/posts/r2/:3:1","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#descriptive-statistics-and-output"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Descriptive Statistics and Output\rDescriptive Statistics\rlibrary(bruceR) head(mtcars) # Data bundled with R mtcarsdemo \u003c- mtcars[c(\"mpg\", \"disp\", \"hp\", \"drat\", \"wt\", \"qsec\")] Describe(mtcarsdemo, digits = 2, file = \"describe\") # digits means the number of decimal places to keep # Output the result to Word\rOutput result\rCorrelation Analysis\rThe package this expert developed is terrifyingly good! Short, elegant, and efficient! Still using the Describe command library(bruceR) Describe(mtcarsdemo, # Dataset digits = 2, # Decimal places plot = T, # Plotting feature upper.triangle = T, # Scatter plots in the upper-right triangle upper.smooth = \"loess\") # Fitted line; lm is linear, loess is quadratic\rbruceR\u0026rsquo;s correlation analysis; I was stunned the first time I used it!\r","date":"2024-04-22","heading":"Descriptive Statistics","objectID":"/en/posts/r2/:3:1","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#descriptive-statistics"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Descriptive Statistics and Output\rDescriptive Statistics\rlibrary(bruceR) head(mtcars) # Data bundled with R mtcarsdemo \u003c- mtcars[c(\"mpg\", \"disp\", \"hp\", \"drat\", \"wt\", \"qsec\")] Describe(mtcarsdemo, digits = 2, file = \"describe\") # digits means the number of decimal places to keep # Output the result to Word\rOutput result\rCorrelation Analysis\rThe package this expert developed is terrifyingly good! Short, elegant, and efficient! Still using the Describe command library(bruceR) Describe(mtcarsdemo, # Dataset digits = 2, # Decimal places plot = T, # Plotting feature upper.triangle = T, # Scatter plots in the upper-right triangle upper.smooth = \"loess\") # Fitted line; lm is linear, loess is quadratic\rbruceR\u0026rsquo;s correlation analysis; I was stunned the first time I used it!\r","date":"2024-04-22","heading":"Correlation Analysis","objectID":"/en/posts/r2/:3:1","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#correlation-analysis"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Regression and Word Output\rRegression\rrobust=\u0026quot;HC1\u0026quot;: robust mode setting; HC1 is reg y x,r in Stata cluster=\u0026quot;stratum\u0026quot;: same as Stata; cluster is hierarchical clustering to handle autocorrelation family=binomial: whether to use binomial regression regress(Temp ~ Month + Day + Wind + Solar.R, data=airquality, robust=TRUE) regress(case ~ age + parity + education + spontaneous + induced, data=infert, family=binomial, robust=\"HC1\", cluster=\"stratum\")\rRegression Output\rThe bruceR package merges the three-line table output of reg into generalized multilevel regression, The following two regression code snippets are equivalent: # Code 1: lm2 = lm(Temp ~ Month + Day + Wind + Solar.R, data=airquality) model_summary(lm2, robust=\"HC1\") # Code 2: regress(Temp ~ Month + Day + Wind + Solar.R, data=airquality, robust=TRUE)\rSo use the lm model to output the regression results: library(bruceR) head(airquality) # Built-in dataset names(airquality) lm1 = lm(Temp ~ Month + Day, data=airquality) lm2 = lm(Temp ~ Month + Day + Wind + Solar.R, data=airquality) model_summary(lm1) model_summary(lm2, robust=\"HC1\") model_summary(list(lm1, lm2), file=\"OLS Models.doc\")\rRegression results\r","date":"2024-04-22","heading":"Regression and Word Output","objectID":"/en/posts/r2/:3:2","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#regression-and-word-output"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Regression and Word Output\rRegression\rrobust=\u0026quot;HC1\u0026quot;: robust mode setting; HC1 is reg y x,r in Stata cluster=\u0026quot;stratum\u0026quot;: same as Stata; cluster is hierarchical clustering to handle autocorrelation family=binomial: whether to use binomial regression regress(Temp ~ Month + Day + Wind + Solar.R, data=airquality, robust=TRUE) regress(case ~ age + parity + education + spontaneous + induced, data=infert, family=binomial, robust=\"HC1\", cluster=\"stratum\")\rRegression Output\rThe bruceR package merges the three-line table output of reg into generalized multilevel regression, The following two regression code snippets are equivalent: # Code 1: lm2 = lm(Temp ~ Month + Day + Wind + Solar.R, data=airquality) model_summary(lm2, robust=\"HC1\") # Code 2: regress(Temp ~ Month + Day + Wind + Solar.R, data=airquality, robust=TRUE)\rSo use the lm model to output the regression results: library(bruceR) head(airquality) # Built-in dataset names(airquality) lm1 = lm(Temp ~ Month + Day, data=airquality) lm2 = lm(Temp ~ Month + Day + Wind + Solar.R, data=airquality) model_summary(lm1) model_summary(lm2, robust=\"HC1\") model_summary(list(lm1, lm2), file=\"OLS Models.doc\")\rRegression results\r","date":"2024-04-22","heading":"Regression","objectID":"/en/posts/r2/:3:2","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#regression"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Regression and Word Output\rRegression\rrobust=\u0026quot;HC1\u0026quot;: robust mode setting; HC1 is reg y x,r in Stata cluster=\u0026quot;stratum\u0026quot;: same as Stata; cluster is hierarchical clustering to handle autocorrelation family=binomial: whether to use binomial regression regress(Temp ~ Month + Day + Wind + Solar.R, data=airquality, robust=TRUE) regress(case ~ age + parity + education + spontaneous + induced, data=infert, family=binomial, robust=\"HC1\", cluster=\"stratum\")\rRegression Output\rThe bruceR package merges the three-line table output of reg into generalized multilevel regression, The following two regression code snippets are equivalent: # Code 1: lm2 = lm(Temp ~ Month + Day + Wind + Solar.R, data=airquality) model_summary(lm2, robust=\"HC1\") # Code 2: regress(Temp ~ Month + Day + Wind + Solar.R, data=airquality, robust=TRUE)\rSo use the lm model to output the regression results: library(bruceR) head(airquality) # Built-in dataset names(airquality) lm1 = lm(Temp ~ Month + Day, data=airquality) lm2 = lm(Temp ~ Month + Day + Wind + Solar.R, data=airquality) model_summary(lm1) model_summary(lm2, robust=\"HC1\") model_summary(list(lm1, lm2), file=\"OLS Models.doc\")\rRegression results\r","date":"2024-04-22","heading":"Regression Output","objectID":"/en/posts/r2/:3:2","tags":["R","Data Cleaning"],"title":"R Notes 2: Data Cleaning, Plotting, and Econometrics","uri":"/en/posts/r2/#regression-output"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"R Notes 1: Interface Introduction and Syntax Structure R Notes 2: Data Cleaning, Plotting, and Econometrics Notes on my R learning journey. Personally, as an economics learner who only runs regressions, Stata is more than enough1. Whatever it lacks I usually fill with Python wheels, and even for DSGE I use MATLAB\u0026rsquo;s Dynare add-on. For econometrics, R\u0026rsquo;s regression table formatting and export are not very friendly, which is a bit of a turn-off. Although it\u0026rsquo;s not of much use to me right now, there are three reasons I\u0026rsquo;m learning it: I support open source2, so I wanted to get my feet wet with R; I\u0026rsquo;m currently using RStudio to write my blog files; I\u0026rsquo;ve looked at analyst-type internship postings at big companies like Kuaishou, ByteDance, Tencent, and Baidu, and they generally require using R to handle SQL databases. ","date":"2024-04-20","heading":"","objectID":"/en/posts/r1/:0:0","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Recommended Tutorials\r","date":"2024-04-20","heading":"Recommended Tutorials","objectID":"/en/posts/r1/:1:0","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#recommended-tutorials"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"My Recommendations\rForum: Capital of Statistics Run R code online: Runoob The foreign counterpart of Runoob: w3schools A recommended blog site Strongly recommended: Statistical Software R, an electronic lecture notes by Teacher Li Dongfeng Strongly recommended: R in Data Science, an electronic lecture notes by Teacher Wang Minjie Strongly recommended: Introduction to Econometrics with R — the textbook has a strong interactive feel! Because R can generate websites, many teachers at home and abroad have written their courses as online electronic lecture notes. Writing a blog is accumulation; writing lecture notes is dedication. There are more and more such teachers, so China should keep getting better too. See the big collection of R electronic books at bookdown. Most teachers\u0026rsquo; electronic lecture notes will recommend this one. R project: Mounment\u0026rsquo;s GitHub repo Domestic tutorials3, recommended: I like tutorials that are quick to get into but detailed enough at the key points, and most of the notes in this post come from this video: After watching the syntax introduction in the video, I suggest going straight to the electronic lecture notes. The later videos get complicated; no need for them. ","date":"2024-04-20","heading":"My Recommendations","objectID":"/en/posts/r1/:1:1","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#my-recommendations"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Electronic Lecture Notes and Textbooks\rTable source: A carefully curated list of the latest and top R books across all fields in 2022 Field\rTop R Books or Resources\rAuthor\rBook URL\rR Programming\rR Programming: Based on the Tidyverse\rZhang Jingxin\rhttps://zhuanlan.zhihu.com/p/467134727\rR Programming\rR Tutorial\rLi Dongfeng\rhttps://www.math.pku.edu.cn/teachers/lidf/docs/Rbook/html/_Rbook/index.html\rR Programming\rAdvanced R\rHadley\rhttps://adv-r.hadley.nz/\rR Programming\rEfficient R programming\rColin Gillespie, Robin Lovelace\rhttps://csgillespie.github.io/efficientR/\rR Visualization\rggplot 2: Elegant Graphics for Data Analysis\rHadley\rhttps://ggplot2-book.org/\rR Visualization\rInteractive web-based data visualization with R, plotly, and shiny\rCarson Sievert\rhttps://plotly-r.com/\rR Visualization\rModern Statistical Graphics\rZhao Peng, Xie Yihui, Huang Xiangyun\rhttps://bookdown.org/xiangyun/msg/\rR Visualization\rrstudio:: conf 2020 data visualization workshop\rKieran Healy\rhttps://github.com/rstudio-conf-2020/dataviz\rR Visualization\rR Graphics Cookbook, 2 nd edition\rWinston Chang\rhttps://r-graphics.org/\rR Visualization\rThe Beauty of Data Visualization in R\rZhang Jie\rhttps://gitee.com/easyshu/Beautiful-Visualization-with-R\rDocumentation\rR Markdown Cookbook\rXie Yihui\rhttps://bookdown.org/yihui/rmarkdown-cookbook/\rDocumentation\rR Markdown: The Definitive Guide\rXie Yihui\rhttps://bookdown.org/yihui/rmarkdown/\rDocumentation\rbookdown: Authoring Books and Technical Documents with R Markdown\rXie Yihui\rhttps://bookdown.org/yihui/bookdown/\rR Package Development\rR Packages\rHadley\rhttps://r-pkgs.org/\rShiny\rMastering Shiny\rHadley\rhttps://mastering-shiny.org/\rShiny\rEngineering Production-Grade Shiny Apps\rColin Fay, Sébastien Rochette, Vincent Guyader and Cervan Girard\rhttps://engineering-shiny.org/\rShiny\rJavaScript for R\rJohn Coene\rhttps://javascript-for-r.com/\rApplied Statistics\rStatistical Inference via Data Science\rChester Ismay and Albert Y. Kim\rhttps://moderndive.com/\rApplied Statistics\rIntroduction to Modern Statistics\rMine Çetinkaya-Rundel\rhttps://openintro-ims.netlify.app/\rApplied Statistics\rModern Applied Statistics and R\rHuang Xiangyun\rhttps://bookdown.org/xiangyun/masr/\rApplied Statistics\rStatistics and R (Courseware)\rZhang Jingxin\rtidy-R Language Group 2 (222427909) group files\rExperimental Design\rThe Grammar of Experimental Designs\rEmi Tanaka\rhttps://emitanaka.org/edibble-book/\rBayesian\rDoing Bayesian Data Analysis in brms and the tidyverse\rA Solomon Kurz\rhttps://bookdown.org/content/3686/\rBayesian\rIntroduction to Bayesian Econometrics: A GUIded tour using R\rAndrés Ramírez-Hassan\rhttps://bookdown.org/aramir21/IntroductionBayesianEconometricsGuidedTour/\rBayesian\rAn Introduction to Bayesian Reasoning and Methods\rKevin Ross\rhttps://bookdown.org/kevin_davisross/bayesian-reasoning-and-methods/\rBayesian\rStatistical rethinking with brms, ggplot 2, and the tidyverse: Second edition\rA Solomon Kurz\rhttps://bookdown.org/content/70a06054-8138-4d90-aaa0-895f57aab1b4/\rData Science\rR for Data Science\rHadley\rhttps://r4ds.had.co.nz/\rData Science\rTidyverse Skills for Data Science in R\rCarrie Wright, Shannon Ellis, Stephanie Hicks, and Roger D. Peng\rhttps://leanpub.com/tidyverseskillsdatascience\rData Science\rR in Data Science\rWang Minjie\rhttps://bookdown.org/wangminjie/R4DS/\rData Science\rData Science Live Book\rPablo Casas\rhttps://livebook.datascienceheroes.com/\rData Science\rR in Action (Third Edition)\rRob Kabacoff\rhttps://livebook.manning.com/book/r-in-action-third-edition/\rData Science\rModern Data Science with R （2 nd）\rBenjamin S. Baumer, Daniel T. Kaplan, and Nicholas J. Horton\rhttps://mdsr-book.github.io/mdsr2e/\rMachine Learning\rmlr 3 book\rOfficial\rhttps://mlr3book.mlr-org.com/\rMachine Learning\rTidy Modeling with R\rMAX KUHN AND JULIASILGE\rhttps://www.tmwr.org/index.html\rMachine Learning\rHands-On Machine Learning with R\rBradley Boehmke \u0026amp; Brandon Greenwell\rhttps://bradleyboehmke.github.io/HOML/\rMachine Learning\rFeature Engineering and Selection: A Practic","date":"2024-04-20","heading":"Electronic Lecture Notes and Textbooks","objectID":"/en/posts/r1/:1:2","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#electronic-lecture-notes-and-textbooks"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Downloading R\rMy environment: R (the language itself) + RStudio (IDE) + Rtools (package management, Windows only) Downloading is simple — just click through and say yes all the way. R itself: https://cran.r-project.org/ RStudio desktop software: https://posit.co/download/rstudio-desktop/ R itself comes with Chinese support, but RStudio doesn\u0026rsquo;t. There\u0026rsquo;s a Chinese localization GitHub project, but it doesn\u0026rsquo;t work well and I don\u0026rsquo;t recommend it — you\u0026rsquo;ll get crashes and incompatibility bugs, which is a hassle. ","date":"2024-04-20","heading":"Downloading R","objectID":"/en/posts/r1/:2:0","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#downloading-r"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"RStudio Interface and Setup\r","date":"2024-04-20","heading":"RStudio Interface and Setup","objectID":"/en/posts/r1/:3:0","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#rstudio-interface-and-setup"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Interface Introduction\rMenu path for page settings: tools - global option - Pane Layout Page\rAt this point, The source panel in the top-left (after creating a new R script project) is where you write code. The console in the bottom-left shows the results. The top and bottom sections on the right are customizable panels. For example, history shows your code run history; environment is the variable environment, where you can use import Dataset to load Stata, Excel, and other data; file shows the computer directories of your working environment. A random dataset I happened to load\r","date":"2024-04-20","heading":"Interface Introduction","objectID":"/en/posts/r1/:3:1","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#interface-introduction"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Managing and Downloading Packages\rManual Installation\rUsing R over the long term is tough on your computer\u0026rsquo;s storage, because you keep downloading packages. On Windows, R is generally managed with Rtools. Recent versions of R should come with this toolkit; if not, just install it from the official site — just install the .exe. In the file panel, there\u0026rsquo;s a Packages section; click install there to install packages. Installing packages\rInstalling and Loading via Commands\rR is a language for statisticians. I personally find its base syntax not very elegant, but since it\u0026rsquo;s open source, once you load the right packages it becomes a real joy. For example, to install the car package, you can use the following commands: # Installing a package install.packages(\"car\") # This is a comment # Loading a package library(caret) # Load a single function from a package # car::vif() # Update packages update.packages() # Remove a package remove.packages() # Get help ?help help(\"library\") # Help on a keyword help.search(\"library\") # Help on a package help(packages = \"ggplot2\")\rSince different packages may have functions with the same name, when loading two packages causes a conflict, the same-named function from the later package will override the earlier one. Setting the Working Directory\r# View the current directory getwd() # Set the working directory; note that forward slashes are used setwd(\"F:/桌面\") # Get a file path; this opens a file browser to find the file manually, and clicking it returns the file path file.choose() # Save R files (.RData) save() save.image() # Load an R file load(\"F:/文档1\") load(file.choose() ) # Load a package's dataset data()\rLoading Data\rIn Stata, one window can only load one dataset, but R can load multiple. The environment panel can be loaded manually\r# Show all data objects in the current environment panel, listed by dataset name ls() # Remove an object rm(list = ls())\r","date":"2024-04-20","heading":"Managing and Downloading Packages","objectID":"/en/posts/r1/:3:2","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#managing-and-downloading-packages"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Managing and Downloading Packages\rManual Installation\rUsing R over the long term is tough on your computer\u0026rsquo;s storage, because you keep downloading packages. On Windows, R is generally managed with Rtools. Recent versions of R should come with this toolkit; if not, just install it from the official site — just install the .exe. In the file panel, there\u0026rsquo;s a Packages section; click install there to install packages. Installing packages\rInstalling and Loading via Commands\rR is a language for statisticians. I personally find its base syntax not very elegant, but since it\u0026rsquo;s open source, once you load the right packages it becomes a real joy. For example, to install the car package, you can use the following commands: # Installing a package install.packages(\"car\") # This is a comment # Loading a package library(caret) # Load a single function from a package # car::vif() # Update packages update.packages() # Remove a package remove.packages() # Get help ?help help(\"library\") # Help on a keyword help.search(\"library\") # Help on a package help(packages = \"ggplot2\")\rSince different packages may have functions with the same name, when loading two packages causes a conflict, the same-named function from the later package will override the earlier one. Setting the Working Directory\r# View the current directory getwd() # Set the working directory; note that forward slashes are used setwd(\"F:/桌面\") # Get a file path; this opens a file browser to find the file manually, and clicking it returns the file path file.choose() # Save R files (.RData) save() save.image() # Load an R file load(\"F:/文档1\") load(file.choose() ) # Load a package's dataset data()\rLoading Data\rIn Stata, one window can only load one dataset, but R can load multiple. The environment panel can be loaded manually\r# Show all data objects in the current environment panel, listed by dataset name ls() # Remove an object rm(list = ls())\r","date":"2024-04-20","heading":"Manual Installation","objectID":"/en/posts/r1/:3:2","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#manual-installation"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Managing and Downloading Packages\rManual Installation\rUsing R over the long term is tough on your computer\u0026rsquo;s storage, because you keep downloading packages. On Windows, R is generally managed with Rtools. Recent versions of R should come with this toolkit; if not, just install it from the official site — just install the .exe. In the file panel, there\u0026rsquo;s a Packages section; click install there to install packages. Installing packages\rInstalling and Loading via Commands\rR is a language for statisticians. I personally find its base syntax not very elegant, but since it\u0026rsquo;s open source, once you load the right packages it becomes a real joy. For example, to install the car package, you can use the following commands: # Installing a package install.packages(\"car\") # This is a comment # Loading a package library(caret) # Load a single function from a package # car::vif() # Update packages update.packages() # Remove a package remove.packages() # Get help ?help help(\"library\") # Help on a keyword help.search(\"library\") # Help on a package help(packages = \"ggplot2\")\rSince different packages may have functions with the same name, when loading two packages causes a conflict, the same-named function from the later package will override the earlier one. Setting the Working Directory\r# View the current directory getwd() # Set the working directory; note that forward slashes are used setwd(\"F:/桌面\") # Get a file path; this opens a file browser to find the file manually, and clicking it returns the file path file.choose() # Save R files (.RData) save() save.image() # Load an R file load(\"F:/文档1\") load(file.choose() ) # Load a package's dataset data()\rLoading Data\rIn Stata, one window can only load one dataset, but R can load multiple. The environment panel can be loaded manually\r# Show all data objects in the current environment panel, listed by dataset name ls() # Remove an object rm(list = ls())\r","date":"2024-04-20","heading":"Installing and Loading via Commands","objectID":"/en/posts/r1/:3:2","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#installing-and-loading-via-commands"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Managing and Downloading Packages\rManual Installation\rUsing R over the long term is tough on your computer\u0026rsquo;s storage, because you keep downloading packages. On Windows, R is generally managed with Rtools. Recent versions of R should come with this toolkit; if not, just install it from the official site — just install the .exe. In the file panel, there\u0026rsquo;s a Packages section; click install there to install packages. Installing packages\rInstalling and Loading via Commands\rR is a language for statisticians. I personally find its base syntax not very elegant, but since it\u0026rsquo;s open source, once you load the right packages it becomes a real joy. For example, to install the car package, you can use the following commands: # Installing a package install.packages(\"car\") # This is a comment # Loading a package library(caret) # Load a single function from a package # car::vif() # Update packages update.packages() # Remove a package remove.packages() # Get help ?help help(\"library\") # Help on a keyword help.search(\"library\") # Help on a package help(packages = \"ggplot2\")\rSince different packages may have functions with the same name, when loading two packages causes a conflict, the same-named function from the later package will override the earlier one. Setting the Working Directory\r# View the current directory getwd() # Set the working directory; note that forward slashes are used setwd(\"F:/桌面\") # Get a file path; this opens a file browser to find the file manually, and clicking it returns the file path file.choose() # Save R files (.RData) save() save.image() # Load an R file load(\"F:/文档1\") load(file.choose() ) # Load a package's dataset data()\rLoading Data\rIn Stata, one window can only load one dataset, but R can load multiple. The environment panel can be loaded manually\r# Show all data objects in the current environment panel, listed by dataset name ls() # Remove an object rm(list = ls())\r","date":"2024-04-20","heading":"Setting the Working Directory","objectID":"/en/posts/r1/:3:2","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#setting-the-working-directory"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Managing and Downloading Packages\rManual Installation\rUsing R over the long term is tough on your computer\u0026rsquo;s storage, because you keep downloading packages. On Windows, R is generally managed with Rtools. Recent versions of R should come with this toolkit; if not, just install it from the official site — just install the .exe. In the file panel, there\u0026rsquo;s a Packages section; click install there to install packages. Installing packages\rInstalling and Loading via Commands\rR is a language for statisticians. I personally find its base syntax not very elegant, but since it\u0026rsquo;s open source, once you load the right packages it becomes a real joy. For example, to install the car package, you can use the following commands: # Installing a package install.packages(\"car\") # This is a comment # Loading a package library(caret) # Load a single function from a package # car::vif() # Update packages update.packages() # Remove a package remove.packages() # Get help ?help help(\"library\") # Help on a keyword help.search(\"library\") # Help on a package help(packages = \"ggplot2\")\rSince different packages may have functions with the same name, when loading two packages causes a conflict, the same-named function from the later package will override the earlier one. Setting the Working Directory\r# View the current directory getwd() # Set the working directory; note that forward slashes are used setwd(\"F:/桌面\") # Get a file path; this opens a file browser to find the file manually, and clicking it returns the file path file.choose() # Save R files (.RData) save() save.image() # Load an R file load(\"F:/文档1\") load(file.choose() ) # Load a package's dataset data()\rLoading Data\rIn Stata, one window can only load one dataset, but R can load multiple. The environment panel can be loaded manually\r# Show all data objects in the current environment panel, listed by dataset name ls() # Remove an object rm(list = ls())\r","date":"2024-04-20","heading":"Loading Data","objectID":"/en/posts/r1/:3:2","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#loading-data"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Syntax\r","date":"2024-04-20","heading":"Syntax","objectID":"/en/posts/r1/:4:0","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#syntax"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Data Types\rType\rExample or Description\rType\rNumeric\r2333 233.3\rnumeric\rCharacter\r\u0026lsquo;Next one is you\u0026rsquo; \u0026ldquo;JOJO\u0026rdquo; \u0026ldquo;2333\u0026rdquo;\rcharacter\rLogical\rTRUE T FALSE F\rlogical\rMissing value\rFor example, forcing text into a number fails\rNA\rBlank value\rNULL\rNot a number\rNot a Number\rNaN\rInfinity\rabbreviation of \u0026ldquo;Infinite\u0026rdquo;\rInf\r# Check the data type is.numeric(123) is.character('123') is.logical(FALSE) is.na(NA) is.null(NULL) is.nan(NaN) # Convert the data type as.numeric('123') as.character(123) as.logical(FALSE)\r","date":"2024-04-20","heading":"Data Types","objectID":"/en/posts/r1/:4:1","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#data-types"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Data Structures\rAssignment and Vectors\rThe usual order of introduction: assignment, indexing, slicing. # Assignment # object_name \u003c- object_value # Shortcut: Alt - v1 \u003c- 1:5 # Generate the vector v1 corresponding to 1 through 5 v2 \u003c- c(v1,3,2,44,6) # Link/connect, nested v3 \u003c- rep(v2,times = 2)# repeat: repeat the whole sequence twice v4 \u003c- rep(v2,each = 2)# repeat: repeat each element twice v5 \u003c- rep(v2,times=2 , each = 2)# each is applied first, then times v6 \u003c- seq(from = 2, to = 9, by = 3) # Start from 2, add 3 each time, until it exceeds 9 v7 \u003c- seq(from = 2, to = 12, length.out = 3) # Constrain the vector length, so the extra values are averaged out v8 \u003c- c('JOJO' ,'下一个就是你了') v9 \u003c- c('JOJO' ,T , 123) # There is coercion here; character \u003e logical \u003e numeric # Vector names names(v2)\u003c- v9 # Change the names of v2 to v9 # At this point v2 looks like this JOJO TRUE 123 1 2 3 4 5 3 2 3 6 # Vector length length(v9) length(v9)\u003c- 9 # Vector indexing # Unlike Python, whose default index starts from 0, R's index starts from 1 by default # Unlike Python, where a negative sign means the reverse direction, in R a negative index means dropping that index value v7[3] v7[c(1,3,5)] v2[c(1,4)] v2[-c(1,4)] # Drop the values at indices 1 and 4 v2[c('JOJO' ,'TRUE')] v1[v1%%2==1] # Conditional indexing: odd numbers with remainder 1 when divided by 2 # Constants pi # Pi letters # Lowercase letters LETTERS # Uppercase letters month.abb # Month abbreviations, \"Jan\" month.name # Full month names, \"January\" Matrices\rMatrices are just vector commands stacked together. # Matrix m1 \u003c- matrix( 1:6, nrow = 2, # Two rows # ncol = 3, # Columns byrow = F, # Fill column-wise, so there's no need to specify ncol dimnames = list(c('r1','r2'), c('c1','c2','c3')) ) # Like vectors, matrices accept only one data type # Create an empty 3*3 matrix m0 \u003c- matrix(NA,nclo = 3,nrow=3) m2 \u003c- matrix( c(1:6, letters[1:6]), nrow = 3, byrow = TRUE, dimnames = list(c('r1', 'r2', 'r3'), c('c1', 'c2', 'c3', 'c4')) ) # Row and column names colnames(m1) # Columns rownames(m1) # Rows dimnames(m2)\u003c-list(c) # Row and column names # Dimension info, i.e., the shape command in Python dim(m1) ncol(m1) nrow(m1) # Matrix indexing m2[1,2] # Return the value at row 1, column 2 m2[1,] # Return the vector of the first row m2[c(1,3),c(2,4)] # Slicing by index name works the same way m2['r1',] # Convert to a vector as.vector(m1) # Extract column-wise in order #array\rLists\rUnlike vectors and matrices, lists can combine different data types and structures. v1 \u003c- 1:5 m1 \u003c- matrix( 1:6, nrow = 2, byrow = F, dimnames = list(c('r1','r2'), c('c1','c2','c3')) ) # Unlike vectors and matrices, lists can hold different data types and structures l1\u003c- list(com1 = v1, com2 = m1) # List names names(l1) # List indexing. A video said these commands are different, i.e., they differ in returning a list, matrix, or vector, but I tried them and there doesn't seem to be a difference. l1$com1 l1[['com2']] l1['com2'] l1[20] # Create a new component l1$com3\u003c- 3:6 l1 # Flatten the list unlist(l1) # Reduce the list to a vector; indices become which list and which value\rData Frames\rA special kind of list — the panel data and time series we often work with are built using data frames. # Create a data frame df1 \u003c- data.frame( C1 = 2:5, C2 = letters[2:5] ) df1 # Dimension info dim(df1) ncol(df1) nrow(df1) # Row and column names dimnames(df1) # Column and row names names(df1) # Row names colnames(df1) rownames(df1) # Data frame indexing df1[1:2 ,2] df1[,2] df1[,\"c1\"] df1['1',] df1[[2]] df1$c1 df1[2] df1['c1'] # Create a new column df1$c3 \u003c- 1:4 # Generate a grid-search data frame expand.grid(mtry = 2:5, ntree=c(200,500))\r","date":"2024-04-20","heading":"Data Structures","objectID":"/en/posts/r1/:4:2","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#data-structures"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Data Structures\rAssignment and Vectors\rThe usual order of introduction: assignment, indexing, slicing. # Assignment # object_name \u003c- object_value # Shortcut: Alt - v1 \u003c- 1:5 # Generate the vector v1 corresponding to 1 through 5 v2 \u003c- c(v1,3,2,44,6) # Link/connect, nested v3 \u003c- rep(v2,times = 2)# repeat: repeat the whole sequence twice v4 \u003c- rep(v2,each = 2)# repeat: repeat each element twice v5 \u003c- rep(v2,times=2 , each = 2)# each is applied first, then times v6 \u003c- seq(from = 2, to = 9, by = 3) # Start from 2, add 3 each time, until it exceeds 9 v7 \u003c- seq(from = 2, to = 12, length.out = 3) # Constrain the vector length, so the extra values are averaged out v8 \u003c- c('JOJO' ,'下一个就是你了') v9 \u003c- c('JOJO' ,T , 123) # There is coercion here; character \u003e logical \u003e numeric # Vector names names(v2)\u003c- v9 # Change the names of v2 to v9 # At this point v2 looks like this JOJO TRUE 123 1 2 3 4 5 3 2 3 6 # Vector length length(v9) length(v9)\u003c- 9 # Vector indexing # Unlike Python, whose default index starts from 0, R's index starts from 1 by default # Unlike Python, where a negative sign means the reverse direction, in R a negative index means dropping that index value v7[3] v7[c(1,3,5)] v2[c(1,4)] v2[-c(1,4)] # Drop the values at indices 1 and 4 v2[c('JOJO' ,'TRUE')] v1[v1%%2==1] # Conditional indexing: odd numbers with remainder 1 when divided by 2 # Constants pi # Pi letters # Lowercase letters LETTERS # Uppercase letters month.abb # Month abbreviations, \"Jan\" month.name # Full month names, \"January\" Matrices\rMatrices are just vector commands stacked together. # Matrix m1 \u003c- matrix( 1:6, nrow = 2, # Two rows # ncol = 3, # Columns byrow = F, # Fill column-wise, so there's no need to specify ncol dimnames = list(c('r1','r2'), c('c1','c2','c3')) ) # Like vectors, matrices accept only one data type # Create an empty 3*3 matrix m0 \u003c- matrix(NA,nclo = 3,nrow=3) m2 \u003c- matrix( c(1:6, letters[1:6]), nrow = 3, byrow = TRUE, dimnames = list(c('r1', 'r2', 'r3'), c('c1', 'c2', 'c3', 'c4')) ) # Row and column names colnames(m1) # Columns rownames(m1) # Rows dimnames(m2)\u003c-list(c) # Row and column names # Dimension info, i.e., the shape command in Python dim(m1) ncol(m1) nrow(m1) # Matrix indexing m2[1,2] # Return the value at row 1, column 2 m2[1,] # Return the vector of the first row m2[c(1,3),c(2,4)] # Slicing by index name works the same way m2['r1',] # Convert to a vector as.vector(m1) # Extract column-wise in order #array\rLists\rUnlike vectors and matrices, lists can combine different data types and structures. v1 \u003c- 1:5 m1 \u003c- matrix( 1:6, nrow = 2, byrow = F, dimnames = list(c('r1','r2'), c('c1','c2','c3')) ) # Unlike vectors and matrices, lists can hold different data types and structures l1\u003c- list(com1 = v1, com2 = m1) # List names names(l1) # List indexing. A video said these commands are different, i.e., they differ in returning a list, matrix, or vector, but I tried them and there doesn't seem to be a difference. l1$com1 l1[['com2']] l1['com2'] l1[20] # Create a new component l1$com3\u003c- 3:6 l1 # Flatten the list unlist(l1) # Reduce the list to a vector; indices become which list and which value\rData Frames\rA special kind of list — the panel data and time series we often work with are built using data frames. # Create a data frame df1 \u003c- data.frame( C1 = 2:5, C2 = letters[2:5] ) df1 # Dimension info dim(df1) ncol(df1) nrow(df1) # Row and column names dimnames(df1) # Column and row names names(df1) # Row names colnames(df1) rownames(df1) # Data frame indexing df1[1:2 ,2] df1[,2] df1[,\"c1\"] df1['1',] df1[[2]] df1$c1 df1[2] df1['c1'] # Create a new column df1$c3 \u003c- 1:4 # Generate a grid-search data frame expand.grid(mtry = 2:5, ntree=c(200,500))\r","date":"2024-04-20","heading":"Assignment and Vectors","objectID":"/en/posts/r1/:4:2","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#assignment-and-vectors"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Data Structures\rAssignment and Vectors\rThe usual order of introduction: assignment, indexing, slicing. # Assignment # object_name \u003c- object_value # Shortcut: Alt - v1 \u003c- 1:5 # Generate the vector v1 corresponding to 1 through 5 v2 \u003c- c(v1,3,2,44,6) # Link/connect, nested v3 \u003c- rep(v2,times = 2)# repeat: repeat the whole sequence twice v4 \u003c- rep(v2,each = 2)# repeat: repeat each element twice v5 \u003c- rep(v2,times=2 , each = 2)# each is applied first, then times v6 \u003c- seq(from = 2, to = 9, by = 3) # Start from 2, add 3 each time, until it exceeds 9 v7 \u003c- seq(from = 2, to = 12, length.out = 3) # Constrain the vector length, so the extra values are averaged out v8 \u003c- c('JOJO' ,'下一个就是你了') v9 \u003c- c('JOJO' ,T , 123) # There is coercion here; character \u003e logical \u003e numeric # Vector names names(v2)\u003c- v9 # Change the names of v2 to v9 # At this point v2 looks like this JOJO TRUE 123 1 2 3 4 5 3 2 3 6 # Vector length length(v9) length(v9)\u003c- 9 # Vector indexing # Unlike Python, whose default index starts from 0, R's index starts from 1 by default # Unlike Python, where a negative sign means the reverse direction, in R a negative index means dropping that index value v7[3] v7[c(1,3,5)] v2[c(1,4)] v2[-c(1,4)] # Drop the values at indices 1 and 4 v2[c('JOJO' ,'TRUE')] v1[v1%%2==1] # Conditional indexing: odd numbers with remainder 1 when divided by 2 # Constants pi # Pi letters # Lowercase letters LETTERS # Uppercase letters month.abb # Month abbreviations, \"Jan\" month.name # Full month names, \"January\" Matrices\rMatrices are just vector commands stacked together. # Matrix m1 \u003c- matrix( 1:6, nrow = 2, # Two rows # ncol = 3, # Columns byrow = F, # Fill column-wise, so there's no need to specify ncol dimnames = list(c('r1','r2'), c('c1','c2','c3')) ) # Like vectors, matrices accept only one data type # Create an empty 3*3 matrix m0 \u003c- matrix(NA,nclo = 3,nrow=3) m2 \u003c- matrix( c(1:6, letters[1:6]), nrow = 3, byrow = TRUE, dimnames = list(c('r1', 'r2', 'r3'), c('c1', 'c2', 'c3', 'c4')) ) # Row and column names colnames(m1) # Columns rownames(m1) # Rows dimnames(m2)\u003c-list(c) # Row and column names # Dimension info, i.e., the shape command in Python dim(m1) ncol(m1) nrow(m1) # Matrix indexing m2[1,2] # Return the value at row 1, column 2 m2[1,] # Return the vector of the first row m2[c(1,3),c(2,4)] # Slicing by index name works the same way m2['r1',] # Convert to a vector as.vector(m1) # Extract column-wise in order #array\rLists\rUnlike vectors and matrices, lists can combine different data types and structures. v1 \u003c- 1:5 m1 \u003c- matrix( 1:6, nrow = 2, byrow = F, dimnames = list(c('r1','r2'), c('c1','c2','c3')) ) # Unlike vectors and matrices, lists can hold different data types and structures l1\u003c- list(com1 = v1, com2 = m1) # List names names(l1) # List indexing. A video said these commands are different, i.e., they differ in returning a list, matrix, or vector, but I tried them and there doesn't seem to be a difference. l1$com1 l1[['com2']] l1['com2'] l1[20] # Create a new component l1$com3\u003c- 3:6 l1 # Flatten the list unlist(l1) # Reduce the list to a vector; indices become which list and which value\rData Frames\rA special kind of list — the panel data and time series we often work with are built using data frames. # Create a data frame df1 \u003c- data.frame( C1 = 2:5, C2 = letters[2:5] ) df1 # Dimension info dim(df1) ncol(df1) nrow(df1) # Row and column names dimnames(df1) # Column and row names names(df1) # Row names colnames(df1) rownames(df1) # Data frame indexing df1[1:2 ,2] df1[,2] df1[,\"c1\"] df1['1',] df1[[2]] df1$c1 df1[2] df1['c1'] # Create a new column df1$c3 \u003c- 1:4 # Generate a grid-search data frame expand.grid(mtry = 2:5, ntree=c(200,500))\r","date":"2024-04-20","heading":"Matrices","objectID":"/en/posts/r1/:4:2","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#matrices"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Data Structures\rAssignment and Vectors\rThe usual order of introduction: assignment, indexing, slicing. # Assignment # object_name \u003c- object_value # Shortcut: Alt - v1 \u003c- 1:5 # Generate the vector v1 corresponding to 1 through 5 v2 \u003c- c(v1,3,2,44,6) # Link/connect, nested v3 \u003c- rep(v2,times = 2)# repeat: repeat the whole sequence twice v4 \u003c- rep(v2,each = 2)# repeat: repeat each element twice v5 \u003c- rep(v2,times=2 , each = 2)# each is applied first, then times v6 \u003c- seq(from = 2, to = 9, by = 3) # Start from 2, add 3 each time, until it exceeds 9 v7 \u003c- seq(from = 2, to = 12, length.out = 3) # Constrain the vector length, so the extra values are averaged out v8 \u003c- c('JOJO' ,'下一个就是你了') v9 \u003c- c('JOJO' ,T , 123) # There is coercion here; character \u003e logical \u003e numeric # Vector names names(v2)\u003c- v9 # Change the names of v2 to v9 # At this point v2 looks like this JOJO TRUE 123 1 2 3 4 5 3 2 3 6 # Vector length length(v9) length(v9)\u003c- 9 # Vector indexing # Unlike Python, whose default index starts from 0, R's index starts from 1 by default # Unlike Python, where a negative sign means the reverse direction, in R a negative index means dropping that index value v7[3] v7[c(1,3,5)] v2[c(1,4)] v2[-c(1,4)] # Drop the values at indices 1 and 4 v2[c('JOJO' ,'TRUE')] v1[v1%%2==1] # Conditional indexing: odd numbers with remainder 1 when divided by 2 # Constants pi # Pi letters # Lowercase letters LETTERS # Uppercase letters month.abb # Month abbreviations, \"Jan\" month.name # Full month names, \"January\" Matrices\rMatrices are just vector commands stacked together. # Matrix m1 \u003c- matrix( 1:6, nrow = 2, # Two rows # ncol = 3, # Columns byrow = F, # Fill column-wise, so there's no need to specify ncol dimnames = list(c('r1','r2'), c('c1','c2','c3')) ) # Like vectors, matrices accept only one data type # Create an empty 3*3 matrix m0 \u003c- matrix(NA,nclo = 3,nrow=3) m2 \u003c- matrix( c(1:6, letters[1:6]), nrow = 3, byrow = TRUE, dimnames = list(c('r1', 'r2', 'r3'), c('c1', 'c2', 'c3', 'c4')) ) # Row and column names colnames(m1) # Columns rownames(m1) # Rows dimnames(m2)\u003c-list(c) # Row and column names # Dimension info, i.e., the shape command in Python dim(m1) ncol(m1) nrow(m1) # Matrix indexing m2[1,2] # Return the value at row 1, column 2 m2[1,] # Return the vector of the first row m2[c(1,3),c(2,4)] # Slicing by index name works the same way m2['r1',] # Convert to a vector as.vector(m1) # Extract column-wise in order #array\rLists\rUnlike vectors and matrices, lists can combine different data types and structures. v1 \u003c- 1:5 m1 \u003c- matrix( 1:6, nrow = 2, byrow = F, dimnames = list(c('r1','r2'), c('c1','c2','c3')) ) # Unlike vectors and matrices, lists can hold different data types and structures l1\u003c- list(com1 = v1, com2 = m1) # List names names(l1) # List indexing. A video said these commands are different, i.e., they differ in returning a list, matrix, or vector, but I tried them and there doesn't seem to be a difference. l1$com1 l1[['com2']] l1['com2'] l1[20] # Create a new component l1$com3\u003c- 3:6 l1 # Flatten the list unlist(l1) # Reduce the list to a vector; indices become which list and which value\rData Frames\rA special kind of list — the panel data and time series we often work with are built using data frames. # Create a data frame df1 \u003c- data.frame( C1 = 2:5, C2 = letters[2:5] ) df1 # Dimension info dim(df1) ncol(df1) nrow(df1) # Row and column names dimnames(df1) # Column and row names names(df1) # Row names colnames(df1) rownames(df1) # Data frame indexing df1[1:2 ,2] df1[,2] df1[,\"c1\"] df1['1',] df1[[2]] df1$c1 df1[2] df1['c1'] # Create a new column df1$c3 \u003c- 1:4 # Generate a grid-search data frame expand.grid(mtry = 2:5, ntree=c(200,500))\r","date":"2024-04-20","heading":"Lists","objectID":"/en/posts/r1/:4:2","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#lists"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Data Structures\rAssignment and Vectors\rThe usual order of introduction: assignment, indexing, slicing. # Assignment # object_name \u003c- object_value # Shortcut: Alt - v1 \u003c- 1:5 # Generate the vector v1 corresponding to 1 through 5 v2 \u003c- c(v1,3,2,44,6) # Link/connect, nested v3 \u003c- rep(v2,times = 2)# repeat: repeat the whole sequence twice v4 \u003c- rep(v2,each = 2)# repeat: repeat each element twice v5 \u003c- rep(v2,times=2 , each = 2)# each is applied first, then times v6 \u003c- seq(from = 2, to = 9, by = 3) # Start from 2, add 3 each time, until it exceeds 9 v7 \u003c- seq(from = 2, to = 12, length.out = 3) # Constrain the vector length, so the extra values are averaged out v8 \u003c- c('JOJO' ,'下一个就是你了') v9 \u003c- c('JOJO' ,T , 123) # There is coercion here; character \u003e logical \u003e numeric # Vector names names(v2)\u003c- v9 # Change the names of v2 to v9 # At this point v2 looks like this JOJO TRUE 123 1 2 3 4 5 3 2 3 6 # Vector length length(v9) length(v9)\u003c- 9 # Vector indexing # Unlike Python, whose default index starts from 0, R's index starts from 1 by default # Unlike Python, where a negative sign means the reverse direction, in R a negative index means dropping that index value v7[3] v7[c(1,3,5)] v2[c(1,4)] v2[-c(1,4)] # Drop the values at indices 1 and 4 v2[c('JOJO' ,'TRUE')] v1[v1%%2==1] # Conditional indexing: odd numbers with remainder 1 when divided by 2 # Constants pi # Pi letters # Lowercase letters LETTERS # Uppercase letters month.abb # Month abbreviations, \"Jan\" month.name # Full month names, \"January\" Matrices\rMatrices are just vector commands stacked together. # Matrix m1 \u003c- matrix( 1:6, nrow = 2, # Two rows # ncol = 3, # Columns byrow = F, # Fill column-wise, so there's no need to specify ncol dimnames = list(c('r1','r2'), c('c1','c2','c3')) ) # Like vectors, matrices accept only one data type # Create an empty 3*3 matrix m0 \u003c- matrix(NA,nclo = 3,nrow=3) m2 \u003c- matrix( c(1:6, letters[1:6]), nrow = 3, byrow = TRUE, dimnames = list(c('r1', 'r2', 'r3'), c('c1', 'c2', 'c3', 'c4')) ) # Row and column names colnames(m1) # Columns rownames(m1) # Rows dimnames(m2)\u003c-list(c) # Row and column names # Dimension info, i.e., the shape command in Python dim(m1) ncol(m1) nrow(m1) # Matrix indexing m2[1,2] # Return the value at row 1, column 2 m2[1,] # Return the vector of the first row m2[c(1,3),c(2,4)] # Slicing by index name works the same way m2['r1',] # Convert to a vector as.vector(m1) # Extract column-wise in order #array\rLists\rUnlike vectors and matrices, lists can combine different data types and structures. v1 \u003c- 1:5 m1 \u003c- matrix( 1:6, nrow = 2, byrow = F, dimnames = list(c('r1','r2'), c('c1','c2','c3')) ) # Unlike vectors and matrices, lists can hold different data types and structures l1\u003c- list(com1 = v1, com2 = m1) # List names names(l1) # List indexing. A video said these commands are different, i.e., they differ in returning a list, matrix, or vector, but I tried them and there doesn't seem to be a difference. l1$com1 l1[['com2']] l1['com2'] l1[20] # Create a new component l1$com3\u003c- 3:6 l1 # Flatten the list unlist(l1) # Reduce the list to a vector; indices become which list and which value\rData Frames\rA special kind of list — the panel data and time series we often work with are built using data frames. # Create a data frame df1 \u003c- data.frame( C1 = 2:5, C2 = letters[2:5] ) df1 # Dimension info dim(df1) ncol(df1) nrow(df1) # Row and column names dimnames(df1) # Column and row names names(df1) # Row names colnames(df1) rownames(df1) # Data frame indexing df1[1:2 ,2] df1[,2] df1[,\"c1\"] df1['1',] df1[[2]] df1$c1 df1[2] df1['c1'] # Create a new column df1$c3 \u003c- 1:4 # Generate a grid-search data frame expand.grid(mtry = 2:5, ntree=c(200,500))\r","date":"2024-04-20","heading":"Data Frames","objectID":"/en/posts/r1/:4:2","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#data-frames"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Basic Operations and Functions\rBasic Operations\r1+2 # Addition 3-2 # Subtraction 3*4 # Multiplication 8/5 # Division c(1:4)/c(2:5) # If lengths differ, the shorter one is recycled 2^3 # Power exp(1) log(x=25，base=5) # Log base 5 of 25 sqrt(4) # Square root abs(-5.6) # Absolute value slign(-5.6) # Sign round(3.1415926,2) # Keep the specified number of decimal places signif(3.1415926,2) # Keep significant digits ceiling(3.2) # Smallest integer greater than this number floor(3.2) # Largest integer smaller than this number # Numeric comparison == != \u003e \u003e= \u003c \u003c= 2 %in% 2:5 # Whether it is contained in \u0026 # And | # Or ! # Not\rVector Function Operations\rv2 \u003c- c(3,2,7,4,6,8,11,21) max(v2) # Maximum cummax(v2) # Maximum within the corresponding length range; returns a vector min(v2) cummin(v2) sum(v2) # Sum cumsum(v2) # Cumulative sum prod(v2) # Product cumprod(v2) # Cumulative product mean(v2) # Mean median(v2) # Median sd(v2) # Standard deviation, computed using the sample formula var(v2) # Variance, computed using the sample formula rev(v2) # Reverse the vector, i.e., reverse the order sort(v2) # Sort v2 \u003c- rep(v2,times=2) table(v5) # Frequency count unique(v5) # Value levels, arranged in the order the numbers first appear # Index functions which(v5==7) # Return the indices that satisfy the condition which.max(v5) # Return the index of the first occurrence when the maximum is repeated which.min(v5) # Intersection intersect(1:5,4:7) # Set difference setdiff(1:5,4:7) # Union; keeps only the element's position value, and keeps one even if there are duplicates union(1:5,4:7)\rData Frame and Matrix Operations\rData Frame\rdfs \u003c- data.frame( a = 1:5, b = 3:7, d = letters[1:5] ) # Row and column merging df1 \u003c- dfs[1:3, ] df1 df2 \u003c- dfs[3:5, ] df2 # Row merging rbind(df1, df2) # Rows increase, columns stay the same cbind(df1, df2) # Columns increase, rows stay the same # Row and column operations colMeans(dfs[,1:2]) # Column means colSums(dfs[,1:2]) # Column sums rowMeans(dfs[,1:2]) # Row means rowSums(dfs[,1:2]) # Row sums # apply(data frame, 1 for rows or 2 for columns, function) apply(dfs[,1:2],2,sd) # Compute the standard deviation by column apply( dfs[,1:2], 2, function(x){sum(is.na(x))} ) # Data structure info str(dfs) # Data types summary(dfs) # Minimum and maximum values View(dfs) # Display the data frame head(dfs,n=2) # Show the first two rows (n=2) tail(dfs,n=2) # Show the last two rows (n=2)\rMatrix\rm3 \u003c- matrix( c(5,7,3,4), ncol = 2, byrow = T, ) m3 m4 \u003c- matrix( c(5,7,3,4,8,9), ncol = 3, byrow = T, ) m4 t(m3) # Transpose det(m3) # Determinant m3 %*% m4 # Matrix multiplication solve(m3) # m3 %*% x = E, solve for x solve(m3,m4) # m3 %*% x = m4, solve for x\rCharacter Functions\r# Concatenate characters paste(1:5,collapse = \"+\") paste(letters[1:5],collapse = \"-\") paste(1:5,letters[1:8],collapse = \"~\") paste(1:5,letters[1:8]) # Character length nchar(month.name) # Convert letters to uppercase toupper(month.name) # Convert letters to lowercase tolower(month.name) # Index of elements containing a certain character grep(\"JU\",month.name) # Replace characters gsub(\"e\",\"000\",month.name) # Replace the parts of month.name containing \"e\" with \"000\"\rDistribution Functions\rset.seed(24) # Random seed sample(1:2,12,replace = T) # Draw 12 samples with replacement (T) from 1 and 2. You've probably seen random sampling in Stata placebo tests rnorm(10,mean=1,sd=2) # r random number + distribution (norm) pnorm(1,mean=1,sd=2) # p cumulative probability qnorm(0.5,mean=1,sd=2) # q quantile dnorm(1,mean=1,sd=2) # d probability density plot(x = seq(-5, 7, length = 1000), y = dnorm(seq(-5, 7, length = 1000), mean = 1, sd = 2), type = \"l\", ylim = c(0, 0.25)) abline(h = 0, v = 1) # Take 1000 numbers between -5 and 7, following a normal distribution with mean 1 and standard deviation 2 # Add a horizontal line at value 0 and a vertical line at value 1\rThe corresponding distribution function plot\r","date":"2024-04-20","heading":"Basic Operations and Functions","objectID":"/en/posts/r1/:4:3","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#basic-operations-and-functions"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Basic Operations and Functions\rBasic Operations\r1+2 # Addition 3-2 # Subtraction 3*4 # Multiplication 8/5 # Division c(1:4)/c(2:5) # If lengths differ, the shorter one is recycled 2^3 # Power exp(1) log(x=25，base=5) # Log base 5 of 25 sqrt(4) # Square root abs(-5.6) # Absolute value slign(-5.6) # Sign round(3.1415926,2) # Keep the specified number of decimal places signif(3.1415926,2) # Keep significant digits ceiling(3.2) # Smallest integer greater than this number floor(3.2) # Largest integer smaller than this number # Numeric comparison == != \u003e \u003e= \u003c \u003c= 2 %in% 2:5 # Whether it is contained in \u0026 # And | # Or ! # Not\rVector Function Operations\rv2 \u003c- c(3,2,7,4,6,8,11,21) max(v2) # Maximum cummax(v2) # Maximum within the corresponding length range; returns a vector min(v2) cummin(v2) sum(v2) # Sum cumsum(v2) # Cumulative sum prod(v2) # Product cumprod(v2) # Cumulative product mean(v2) # Mean median(v2) # Median sd(v2) # Standard deviation, computed using the sample formula var(v2) # Variance, computed using the sample formula rev(v2) # Reverse the vector, i.e., reverse the order sort(v2) # Sort v2 \u003c- rep(v2,times=2) table(v5) # Frequency count unique(v5) # Value levels, arranged in the order the numbers first appear # Index functions which(v5==7) # Return the indices that satisfy the condition which.max(v5) # Return the index of the first occurrence when the maximum is repeated which.min(v5) # Intersection intersect(1:5,4:7) # Set difference setdiff(1:5,4:7) # Union; keeps only the element's position value, and keeps one even if there are duplicates union(1:5,4:7)\rData Frame and Matrix Operations\rData Frame\rdfs \u003c- data.frame( a = 1:5, b = 3:7, d = letters[1:5] ) # Row and column merging df1 \u003c- dfs[1:3, ] df1 df2 \u003c- dfs[3:5, ] df2 # Row merging rbind(df1, df2) # Rows increase, columns stay the same cbind(df1, df2) # Columns increase, rows stay the same # Row and column operations colMeans(dfs[,1:2]) # Column means colSums(dfs[,1:2]) # Column sums rowMeans(dfs[,1:2]) # Row means rowSums(dfs[,1:2]) # Row sums # apply(data frame, 1 for rows or 2 for columns, function) apply(dfs[,1:2],2,sd) # Compute the standard deviation by column apply( dfs[,1:2], 2, function(x){sum(is.na(x))} ) # Data structure info str(dfs) # Data types summary(dfs) # Minimum and maximum values View(dfs) # Display the data frame head(dfs,n=2) # Show the first two rows (n=2) tail(dfs,n=2) # Show the last two rows (n=2)\rMatrix\rm3 \u003c- matrix( c(5,7,3,4), ncol = 2, byrow = T, ) m3 m4 \u003c- matrix( c(5,7,3,4,8,9), ncol = 3, byrow = T, ) m4 t(m3) # Transpose det(m3) # Determinant m3 %*% m4 # Matrix multiplication solve(m3) # m3 %*% x = E, solve for x solve(m3,m4) # m3 %*% x = m4, solve for x\rCharacter Functions\r# Concatenate characters paste(1:5,collapse = \"+\") paste(letters[1:5],collapse = \"-\") paste(1:5,letters[1:8],collapse = \"~\") paste(1:5,letters[1:8]) # Character length nchar(month.name) # Convert letters to uppercase toupper(month.name) # Convert letters to lowercase tolower(month.name) # Index of elements containing a certain character grep(\"JU\",month.name) # Replace characters gsub(\"e\",\"000\",month.name) # Replace the parts of month.name containing \"e\" with \"000\"\rDistribution Functions\rset.seed(24) # Random seed sample(1:2,12,replace = T) # Draw 12 samples with replacement (T) from 1 and 2. You've probably seen random sampling in Stata placebo tests rnorm(10,mean=1,sd=2) # r random number + distribution (norm) pnorm(1,mean=1,sd=2) # p cumulative probability qnorm(0.5,mean=1,sd=2) # q quantile dnorm(1,mean=1,sd=2) # d probability density plot(x = seq(-5, 7, length = 1000), y = dnorm(seq(-5, 7, length = 1000), mean = 1, sd = 2), type = \"l\", ylim = c(0, 0.25)) abline(h = 0, v = 1) # Take 1000 numbers between -5 and 7, following a normal distribution with mean 1 and standard deviation 2 # Add a horizontal line at value 0 and a vertical line at value 1\rThe corresponding distribution function plot\r","date":"2024-04-20","heading":"Basic Operations","objectID":"/en/posts/r1/:4:3","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#basic-operations"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Basic Operations and Functions\rBasic Operations\r1+2 # Addition 3-2 # Subtraction 3*4 # Multiplication 8/5 # Division c(1:4)/c(2:5) # If lengths differ, the shorter one is recycled 2^3 # Power exp(1) log(x=25，base=5) # Log base 5 of 25 sqrt(4) # Square root abs(-5.6) # Absolute value slign(-5.6) # Sign round(3.1415926,2) # Keep the specified number of decimal places signif(3.1415926,2) # Keep significant digits ceiling(3.2) # Smallest integer greater than this number floor(3.2) # Largest integer smaller than this number # Numeric comparison == != \u003e \u003e= \u003c \u003c= 2 %in% 2:5 # Whether it is contained in \u0026 # And | # Or ! # Not\rVector Function Operations\rv2 \u003c- c(3,2,7,4,6,8,11,21) max(v2) # Maximum cummax(v2) # Maximum within the corresponding length range; returns a vector min(v2) cummin(v2) sum(v2) # Sum cumsum(v2) # Cumulative sum prod(v2) # Product cumprod(v2) # Cumulative product mean(v2) # Mean median(v2) # Median sd(v2) # Standard deviation, computed using the sample formula var(v2) # Variance, computed using the sample formula rev(v2) # Reverse the vector, i.e., reverse the order sort(v2) # Sort v2 \u003c- rep(v2,times=2) table(v5) # Frequency count unique(v5) # Value levels, arranged in the order the numbers first appear # Index functions which(v5==7) # Return the indices that satisfy the condition which.max(v5) # Return the index of the first occurrence when the maximum is repeated which.min(v5) # Intersection intersect(1:5,4:7) # Set difference setdiff(1:5,4:7) # Union; keeps only the element's position value, and keeps one even if there are duplicates union(1:5,4:7)\rData Frame and Matrix Operations\rData Frame\rdfs \u003c- data.frame( a = 1:5, b = 3:7, d = letters[1:5] ) # Row and column merging df1 \u003c- dfs[1:3, ] df1 df2 \u003c- dfs[3:5, ] df2 # Row merging rbind(df1, df2) # Rows increase, columns stay the same cbind(df1, df2) # Columns increase, rows stay the same # Row and column operations colMeans(dfs[,1:2]) # Column means colSums(dfs[,1:2]) # Column sums rowMeans(dfs[,1:2]) # Row means rowSums(dfs[,1:2]) # Row sums # apply(data frame, 1 for rows or 2 for columns, function) apply(dfs[,1:2],2,sd) # Compute the standard deviation by column apply( dfs[,1:2], 2, function(x){sum(is.na(x))} ) # Data structure info str(dfs) # Data types summary(dfs) # Minimum and maximum values View(dfs) # Display the data frame head(dfs,n=2) # Show the first two rows (n=2) tail(dfs,n=2) # Show the last two rows (n=2)\rMatrix\rm3 \u003c- matrix( c(5,7,3,4), ncol = 2, byrow = T, ) m3 m4 \u003c- matrix( c(5,7,3,4,8,9), ncol = 3, byrow = T, ) m4 t(m3) # Transpose det(m3) # Determinant m3 %*% m4 # Matrix multiplication solve(m3) # m3 %*% x = E, solve for x solve(m3,m4) # m3 %*% x = m4, solve for x\rCharacter Functions\r# Concatenate characters paste(1:5,collapse = \"+\") paste(letters[1:5],collapse = \"-\") paste(1:5,letters[1:8],collapse = \"~\") paste(1:5,letters[1:8]) # Character length nchar(month.name) # Convert letters to uppercase toupper(month.name) # Convert letters to lowercase tolower(month.name) # Index of elements containing a certain character grep(\"JU\",month.name) # Replace characters gsub(\"e\",\"000\",month.name) # Replace the parts of month.name containing \"e\" with \"000\"\rDistribution Functions\rset.seed(24) # Random seed sample(1:2,12,replace = T) # Draw 12 samples with replacement (T) from 1 and 2. You've probably seen random sampling in Stata placebo tests rnorm(10,mean=1,sd=2) # r random number + distribution (norm) pnorm(1,mean=1,sd=2) # p cumulative probability qnorm(0.5,mean=1,sd=2) # q quantile dnorm(1,mean=1,sd=2) # d probability density plot(x = seq(-5, 7, length = 1000), y = dnorm(seq(-5, 7, length = 1000), mean = 1, sd = 2), type = \"l\", ylim = c(0, 0.25)) abline(h = 0, v = 1) # Take 1000 numbers between -5 and 7, following a normal distribution with mean 1 and standard deviation 2 # Add a horizontal line at value 0 and a vertical line at value 1\rThe corresponding distribution function plot\r","date":"2024-04-20","heading":"Vector Function Operations","objectID":"/en/posts/r1/:4:3","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#vector-function-operations"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Basic Operations and Functions\rBasic Operations\r1+2 # Addition 3-2 # Subtraction 3*4 # Multiplication 8/5 # Division c(1:4)/c(2:5) # If lengths differ, the shorter one is recycled 2^3 # Power exp(1) log(x=25，base=5) # Log base 5 of 25 sqrt(4) # Square root abs(-5.6) # Absolute value slign(-5.6) # Sign round(3.1415926,2) # Keep the specified number of decimal places signif(3.1415926,2) # Keep significant digits ceiling(3.2) # Smallest integer greater than this number floor(3.2) # Largest integer smaller than this number # Numeric comparison == != \u003e \u003e= \u003c \u003c= 2 %in% 2:5 # Whether it is contained in \u0026 # And | # Or ! # Not\rVector Function Operations\rv2 \u003c- c(3,2,7,4,6,8,11,21) max(v2) # Maximum cummax(v2) # Maximum within the corresponding length range; returns a vector min(v2) cummin(v2) sum(v2) # Sum cumsum(v2) # Cumulative sum prod(v2) # Product cumprod(v2) # Cumulative product mean(v2) # Mean median(v2) # Median sd(v2) # Standard deviation, computed using the sample formula var(v2) # Variance, computed using the sample formula rev(v2) # Reverse the vector, i.e., reverse the order sort(v2) # Sort v2 \u003c- rep(v2,times=2) table(v5) # Frequency count unique(v5) # Value levels, arranged in the order the numbers first appear # Index functions which(v5==7) # Return the indices that satisfy the condition which.max(v5) # Return the index of the first occurrence when the maximum is repeated which.min(v5) # Intersection intersect(1:5,4:7) # Set difference setdiff(1:5,4:7) # Union; keeps only the element's position value, and keeps one even if there are duplicates union(1:5,4:7)\rData Frame and Matrix Operations\rData Frame\rdfs \u003c- data.frame( a = 1:5, b = 3:7, d = letters[1:5] ) # Row and column merging df1 \u003c- dfs[1:3, ] df1 df2 \u003c- dfs[3:5, ] df2 # Row merging rbind(df1, df2) # Rows increase, columns stay the same cbind(df1, df2) # Columns increase, rows stay the same # Row and column operations colMeans(dfs[,1:2]) # Column means colSums(dfs[,1:2]) # Column sums rowMeans(dfs[,1:2]) # Row means rowSums(dfs[,1:2]) # Row sums # apply(data frame, 1 for rows or 2 for columns, function) apply(dfs[,1:2],2,sd) # Compute the standard deviation by column apply( dfs[,1:2], 2, function(x){sum(is.na(x))} ) # Data structure info str(dfs) # Data types summary(dfs) # Minimum and maximum values View(dfs) # Display the data frame head(dfs,n=2) # Show the first two rows (n=2) tail(dfs,n=2) # Show the last two rows (n=2)\rMatrix\rm3 \u003c- matrix( c(5,7,3,4), ncol = 2, byrow = T, ) m3 m4 \u003c- matrix( c(5,7,3,4,8,9), ncol = 3, byrow = T, ) m4 t(m3) # Transpose det(m3) # Determinant m3 %*% m4 # Matrix multiplication solve(m3) # m3 %*% x = E, solve for x solve(m3,m4) # m3 %*% x = m4, solve for x\rCharacter Functions\r# Concatenate characters paste(1:5,collapse = \"+\") paste(letters[1:5],collapse = \"-\") paste(1:5,letters[1:8],collapse = \"~\") paste(1:5,letters[1:8]) # Character length nchar(month.name) # Convert letters to uppercase toupper(month.name) # Convert letters to lowercase tolower(month.name) # Index of elements containing a certain character grep(\"JU\",month.name) # Replace characters gsub(\"e\",\"000\",month.name) # Replace the parts of month.name containing \"e\" with \"000\"\rDistribution Functions\rset.seed(24) # Random seed sample(1:2,12,replace = T) # Draw 12 samples with replacement (T) from 1 and 2. You've probably seen random sampling in Stata placebo tests rnorm(10,mean=1,sd=2) # r random number + distribution (norm) pnorm(1,mean=1,sd=2) # p cumulative probability qnorm(0.5,mean=1,sd=2) # q quantile dnorm(1,mean=1,sd=2) # d probability density plot(x = seq(-5, 7, length = 1000), y = dnorm(seq(-5, 7, length = 1000), mean = 1, sd = 2), type = \"l\", ylim = c(0, 0.25)) abline(h = 0, v = 1) # Take 1000 numbers between -5 and 7, following a normal distribution with mean 1 and standard deviation 2 # Add a horizontal line at value 0 and a vertical line at value 1\rThe corresponding distribution function plot\r","date":"2024-04-20","heading":"Data Frame and Matrix Operations","objectID":"/en/posts/r1/:4:3","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#data-frame-and-matrix-operations"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Basic Operations and Functions\rBasic Operations\r1+2 # Addition 3-2 # Subtraction 3*4 # Multiplication 8/5 # Division c(1:4)/c(2:5) # If lengths differ, the shorter one is recycled 2^3 # Power exp(1) log(x=25，base=5) # Log base 5 of 25 sqrt(4) # Square root abs(-5.6) # Absolute value slign(-5.6) # Sign round(3.1415926,2) # Keep the specified number of decimal places signif(3.1415926,2) # Keep significant digits ceiling(3.2) # Smallest integer greater than this number floor(3.2) # Largest integer smaller than this number # Numeric comparison == != \u003e \u003e= \u003c \u003c= 2 %in% 2:5 # Whether it is contained in \u0026 # And | # Or ! # Not\rVector Function Operations\rv2 \u003c- c(3,2,7,4,6,8,11,21) max(v2) # Maximum cummax(v2) # Maximum within the corresponding length range; returns a vector min(v2) cummin(v2) sum(v2) # Sum cumsum(v2) # Cumulative sum prod(v2) # Product cumprod(v2) # Cumulative product mean(v2) # Mean median(v2) # Median sd(v2) # Standard deviation, computed using the sample formula var(v2) # Variance, computed using the sample formula rev(v2) # Reverse the vector, i.e., reverse the order sort(v2) # Sort v2 \u003c- rep(v2,times=2) table(v5) # Frequency count unique(v5) # Value levels, arranged in the order the numbers first appear # Index functions which(v5==7) # Return the indices that satisfy the condition which.max(v5) # Return the index of the first occurrence when the maximum is repeated which.min(v5) # Intersection intersect(1:5,4:7) # Set difference setdiff(1:5,4:7) # Union; keeps only the element's position value, and keeps one even if there are duplicates union(1:5,4:7)\rData Frame and Matrix Operations\rData Frame\rdfs \u003c- data.frame( a = 1:5, b = 3:7, d = letters[1:5] ) # Row and column merging df1 \u003c- dfs[1:3, ] df1 df2 \u003c- dfs[3:5, ] df2 # Row merging rbind(df1, df2) # Rows increase, columns stay the same cbind(df1, df2) # Columns increase, rows stay the same # Row and column operations colMeans(dfs[,1:2]) # Column means colSums(dfs[,1:2]) # Column sums rowMeans(dfs[,1:2]) # Row means rowSums(dfs[,1:2]) # Row sums # apply(data frame, 1 for rows or 2 for columns, function) apply(dfs[,1:2],2,sd) # Compute the standard deviation by column apply( dfs[,1:2], 2, function(x){sum(is.na(x))} ) # Data structure info str(dfs) # Data types summary(dfs) # Minimum and maximum values View(dfs) # Display the data frame head(dfs,n=2) # Show the first two rows (n=2) tail(dfs,n=2) # Show the last two rows (n=2)\rMatrix\rm3 \u003c- matrix( c(5,7,3,4), ncol = 2, byrow = T, ) m3 m4 \u003c- matrix( c(5,7,3,4,8,9), ncol = 3, byrow = T, ) m4 t(m3) # Transpose det(m3) # Determinant m3 %*% m4 # Matrix multiplication solve(m3) # m3 %*% x = E, solve for x solve(m3,m4) # m3 %*% x = m4, solve for x\rCharacter Functions\r# Concatenate characters paste(1:5,collapse = \"+\") paste(letters[1:5],collapse = \"-\") paste(1:5,letters[1:8],collapse = \"~\") paste(1:5,letters[1:8]) # Character length nchar(month.name) # Convert letters to uppercase toupper(month.name) # Convert letters to lowercase tolower(month.name) # Index of elements containing a certain character grep(\"JU\",month.name) # Replace characters gsub(\"e\",\"000\",month.name) # Replace the parts of month.name containing \"e\" with \"000\"\rDistribution Functions\rset.seed(24) # Random seed sample(1:2,12,replace = T) # Draw 12 samples with replacement (T) from 1 and 2. You've probably seen random sampling in Stata placebo tests rnorm(10,mean=1,sd=2) # r random number + distribution (norm) pnorm(1,mean=1,sd=2) # p cumulative probability qnorm(0.5,mean=1,sd=2) # q quantile dnorm(1,mean=1,sd=2) # d probability density plot(x = seq(-5, 7, length = 1000), y = dnorm(seq(-5, 7, length = 1000), mean = 1, sd = 2), type = \"l\", ylim = c(0, 0.25)) abline(h = 0, v = 1) # Take 1000 numbers between -5 and 7, following a normal distribution with mean 1 and standard deviation 2 # Add a horizontal line at value 0 and a vertical line at value 1\rThe corresponding distribution function plot\r","date":"2024-04-20","heading":"Data Frame","objectID":"/en/posts/r1/:4:3","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#data-frame"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Basic Operations and Functions\rBasic Operations\r1+2 # Addition 3-2 # Subtraction 3*4 # Multiplication 8/5 # Division c(1:4)/c(2:5) # If lengths differ, the shorter one is recycled 2^3 # Power exp(1) log(x=25，base=5) # Log base 5 of 25 sqrt(4) # Square root abs(-5.6) # Absolute value slign(-5.6) # Sign round(3.1415926,2) # Keep the specified number of decimal places signif(3.1415926,2) # Keep significant digits ceiling(3.2) # Smallest integer greater than this number floor(3.2) # Largest integer smaller than this number # Numeric comparison == != \u003e \u003e= \u003c \u003c= 2 %in% 2:5 # Whether it is contained in \u0026 # And | # Or ! # Not\rVector Function Operations\rv2 \u003c- c(3,2,7,4,6,8,11,21) max(v2) # Maximum cummax(v2) # Maximum within the corresponding length range; returns a vector min(v2) cummin(v2) sum(v2) # Sum cumsum(v2) # Cumulative sum prod(v2) # Product cumprod(v2) # Cumulative product mean(v2) # Mean median(v2) # Median sd(v2) # Standard deviation, computed using the sample formula var(v2) # Variance, computed using the sample formula rev(v2) # Reverse the vector, i.e., reverse the order sort(v2) # Sort v2 \u003c- rep(v2,times=2) table(v5) # Frequency count unique(v5) # Value levels, arranged in the order the numbers first appear # Index functions which(v5==7) # Return the indices that satisfy the condition which.max(v5) # Return the index of the first occurrence when the maximum is repeated which.min(v5) # Intersection intersect(1:5,4:7) # Set difference setdiff(1:5,4:7) # Union; keeps only the element's position value, and keeps one even if there are duplicates union(1:5,4:7)\rData Frame and Matrix Operations\rData Frame\rdfs \u003c- data.frame( a = 1:5, b = 3:7, d = letters[1:5] ) # Row and column merging df1 \u003c- dfs[1:3, ] df1 df2 \u003c- dfs[3:5, ] df2 # Row merging rbind(df1, df2) # Rows increase, columns stay the same cbind(df1, df2) # Columns increase, rows stay the same # Row and column operations colMeans(dfs[,1:2]) # Column means colSums(dfs[,1:2]) # Column sums rowMeans(dfs[,1:2]) # Row means rowSums(dfs[,1:2]) # Row sums # apply(data frame, 1 for rows or 2 for columns, function) apply(dfs[,1:2],2,sd) # Compute the standard deviation by column apply( dfs[,1:2], 2, function(x){sum(is.na(x))} ) # Data structure info str(dfs) # Data types summary(dfs) # Minimum and maximum values View(dfs) # Display the data frame head(dfs,n=2) # Show the first two rows (n=2) tail(dfs,n=2) # Show the last two rows (n=2)\rMatrix\rm3 \u003c- matrix( c(5,7,3,4), ncol = 2, byrow = T, ) m3 m4 \u003c- matrix( c(5,7,3,4,8,9), ncol = 3, byrow = T, ) m4 t(m3) # Transpose det(m3) # Determinant m3 %*% m4 # Matrix multiplication solve(m3) # m3 %*% x = E, solve for x solve(m3,m4) # m3 %*% x = m4, solve for x\rCharacter Functions\r# Concatenate characters paste(1:5,collapse = \"+\") paste(letters[1:5],collapse = \"-\") paste(1:5,letters[1:8],collapse = \"~\") paste(1:5,letters[1:8]) # Character length nchar(month.name) # Convert letters to uppercase toupper(month.name) # Convert letters to lowercase tolower(month.name) # Index of elements containing a certain character grep(\"JU\",month.name) # Replace characters gsub(\"e\",\"000\",month.name) # Replace the parts of month.name containing \"e\" with \"000\"\rDistribution Functions\rset.seed(24) # Random seed sample(1:2,12,replace = T) # Draw 12 samples with replacement (T) from 1 and 2. You've probably seen random sampling in Stata placebo tests rnorm(10,mean=1,sd=2) # r random number + distribution (norm) pnorm(1,mean=1,sd=2) # p cumulative probability qnorm(0.5,mean=1,sd=2) # q quantile dnorm(1,mean=1,sd=2) # d probability density plot(x = seq(-5, 7, length = 1000), y = dnorm(seq(-5, 7, length = 1000), mean = 1, sd = 2), type = \"l\", ylim = c(0, 0.25)) abline(h = 0, v = 1) # Take 1000 numbers between -5 and 7, following a normal distribution with mean 1 and standard deviation 2 # Add a horizontal line at value 0 and a vertical line at value 1\rThe corresponding distribution function plot\r","date":"2024-04-20","heading":"Matrix","objectID":"/en/posts/r1/:4:3","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#matrix"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Basic Operations and Functions\rBasic Operations\r1+2 # Addition 3-2 # Subtraction 3*4 # Multiplication 8/5 # Division c(1:4)/c(2:5) # If lengths differ, the shorter one is recycled 2^3 # Power exp(1) log(x=25，base=5) # Log base 5 of 25 sqrt(4) # Square root abs(-5.6) # Absolute value slign(-5.6) # Sign round(3.1415926,2) # Keep the specified number of decimal places signif(3.1415926,2) # Keep significant digits ceiling(3.2) # Smallest integer greater than this number floor(3.2) # Largest integer smaller than this number # Numeric comparison == != \u003e \u003e= \u003c \u003c= 2 %in% 2:5 # Whether it is contained in \u0026 # And | # Or ! # Not\rVector Function Operations\rv2 \u003c- c(3,2,7,4,6,8,11,21) max(v2) # Maximum cummax(v2) # Maximum within the corresponding length range; returns a vector min(v2) cummin(v2) sum(v2) # Sum cumsum(v2) # Cumulative sum prod(v2) # Product cumprod(v2) # Cumulative product mean(v2) # Mean median(v2) # Median sd(v2) # Standard deviation, computed using the sample formula var(v2) # Variance, computed using the sample formula rev(v2) # Reverse the vector, i.e., reverse the order sort(v2) # Sort v2 \u003c- rep(v2,times=2) table(v5) # Frequency count unique(v5) # Value levels, arranged in the order the numbers first appear # Index functions which(v5==7) # Return the indices that satisfy the condition which.max(v5) # Return the index of the first occurrence when the maximum is repeated which.min(v5) # Intersection intersect(1:5,4:7) # Set difference setdiff(1:5,4:7) # Union; keeps only the element's position value, and keeps one even if there are duplicates union(1:5,4:7)\rData Frame and Matrix Operations\rData Frame\rdfs \u003c- data.frame( a = 1:5, b = 3:7, d = letters[1:5] ) # Row and column merging df1 \u003c- dfs[1:3, ] df1 df2 \u003c- dfs[3:5, ] df2 # Row merging rbind(df1, df2) # Rows increase, columns stay the same cbind(df1, df2) # Columns increase, rows stay the same # Row and column operations colMeans(dfs[,1:2]) # Column means colSums(dfs[,1:2]) # Column sums rowMeans(dfs[,1:2]) # Row means rowSums(dfs[,1:2]) # Row sums # apply(data frame, 1 for rows or 2 for columns, function) apply(dfs[,1:2],2,sd) # Compute the standard deviation by column apply( dfs[,1:2], 2, function(x){sum(is.na(x))} ) # Data structure info str(dfs) # Data types summary(dfs) # Minimum and maximum values View(dfs) # Display the data frame head(dfs,n=2) # Show the first two rows (n=2) tail(dfs,n=2) # Show the last two rows (n=2)\rMatrix\rm3 \u003c- matrix( c(5,7,3,4), ncol = 2, byrow = T, ) m3 m4 \u003c- matrix( c(5,7,3,4,8,9), ncol = 3, byrow = T, ) m4 t(m3) # Transpose det(m3) # Determinant m3 %*% m4 # Matrix multiplication solve(m3) # m3 %*% x = E, solve for x solve(m3,m4) # m3 %*% x = m4, solve for x\rCharacter Functions\r# Concatenate characters paste(1:5,collapse = \"+\") paste(letters[1:5],collapse = \"-\") paste(1:5,letters[1:8],collapse = \"~\") paste(1:5,letters[1:8]) # Character length nchar(month.name) # Convert letters to uppercase toupper(month.name) # Convert letters to lowercase tolower(month.name) # Index of elements containing a certain character grep(\"JU\",month.name) # Replace characters gsub(\"e\",\"000\",month.name) # Replace the parts of month.name containing \"e\" with \"000\"\rDistribution Functions\rset.seed(24) # Random seed sample(1:2,12,replace = T) # Draw 12 samples with replacement (T) from 1 and 2. You've probably seen random sampling in Stata placebo tests rnorm(10,mean=1,sd=2) # r random number + distribution (norm) pnorm(1,mean=1,sd=2) # p cumulative probability qnorm(0.5,mean=1,sd=2) # q quantile dnorm(1,mean=1,sd=2) # d probability density plot(x = seq(-5, 7, length = 1000), y = dnorm(seq(-5, 7, length = 1000), mean = 1, sd = 2), type = \"l\", ylim = c(0, 0.25)) abline(h = 0, v = 1) # Take 1000 numbers between -5 and 7, following a normal distribution with mean 1 and standard deviation 2 # Add a horizontal line at value 0 and a vertical line at value 1\rThe corresponding distribution function plot\r","date":"2024-04-20","heading":"Character Functions","objectID":"/en/posts/r1/:4:3","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#character-functions"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Basic Operations and Functions\rBasic Operations\r1+2 # Addition 3-2 # Subtraction 3*4 # Multiplication 8/5 # Division c(1:4)/c(2:5) # If lengths differ, the shorter one is recycled 2^3 # Power exp(1) log(x=25，base=5) # Log base 5 of 25 sqrt(4) # Square root abs(-5.6) # Absolute value slign(-5.6) # Sign round(3.1415926,2) # Keep the specified number of decimal places signif(3.1415926,2) # Keep significant digits ceiling(3.2) # Smallest integer greater than this number floor(3.2) # Largest integer smaller than this number # Numeric comparison == != \u003e \u003e= \u003c \u003c= 2 %in% 2:5 # Whether it is contained in \u0026 # And | # Or ! # Not\rVector Function Operations\rv2 \u003c- c(3,2,7,4,6,8,11,21) max(v2) # Maximum cummax(v2) # Maximum within the corresponding length range; returns a vector min(v2) cummin(v2) sum(v2) # Sum cumsum(v2) # Cumulative sum prod(v2) # Product cumprod(v2) # Cumulative product mean(v2) # Mean median(v2) # Median sd(v2) # Standard deviation, computed using the sample formula var(v2) # Variance, computed using the sample formula rev(v2) # Reverse the vector, i.e., reverse the order sort(v2) # Sort v2 \u003c- rep(v2,times=2) table(v5) # Frequency count unique(v5) # Value levels, arranged in the order the numbers first appear # Index functions which(v5==7) # Return the indices that satisfy the condition which.max(v5) # Return the index of the first occurrence when the maximum is repeated which.min(v5) # Intersection intersect(1:5,4:7) # Set difference setdiff(1:5,4:7) # Union; keeps only the element's position value, and keeps one even if there are duplicates union(1:5,4:7)\rData Frame and Matrix Operations\rData Frame\rdfs \u003c- data.frame( a = 1:5, b = 3:7, d = letters[1:5] ) # Row and column merging df1 \u003c- dfs[1:3, ] df1 df2 \u003c- dfs[3:5, ] df2 # Row merging rbind(df1, df2) # Rows increase, columns stay the same cbind(df1, df2) # Columns increase, rows stay the same # Row and column operations colMeans(dfs[,1:2]) # Column means colSums(dfs[,1:2]) # Column sums rowMeans(dfs[,1:2]) # Row means rowSums(dfs[,1:2]) # Row sums # apply(data frame, 1 for rows or 2 for columns, function) apply(dfs[,1:2],2,sd) # Compute the standard deviation by column apply( dfs[,1:2], 2, function(x){sum(is.na(x))} ) # Data structure info str(dfs) # Data types summary(dfs) # Minimum and maximum values View(dfs) # Display the data frame head(dfs,n=2) # Show the first two rows (n=2) tail(dfs,n=2) # Show the last two rows (n=2)\rMatrix\rm3 \u003c- matrix( c(5,7,3,4), ncol = 2, byrow = T, ) m3 m4 \u003c- matrix( c(5,7,3,4,8,9), ncol = 3, byrow = T, ) m4 t(m3) # Transpose det(m3) # Determinant m3 %*% m4 # Matrix multiplication solve(m3) # m3 %*% x = E, solve for x solve(m3,m4) # m3 %*% x = m4, solve for x\rCharacter Functions\r# Concatenate characters paste(1:5,collapse = \"+\") paste(letters[1:5],collapse = \"-\") paste(1:5,letters[1:8],collapse = \"~\") paste(1:5,letters[1:8]) # Character length nchar(month.name) # Convert letters to uppercase toupper(month.name) # Convert letters to lowercase tolower(month.name) # Index of elements containing a certain character grep(\"JU\",month.name) # Replace characters gsub(\"e\",\"000\",month.name) # Replace the parts of month.name containing \"e\" with \"000\"\rDistribution Functions\rset.seed(24) # Random seed sample(1:2,12,replace = T) # Draw 12 samples with replacement (T) from 1 and 2. You've probably seen random sampling in Stata placebo tests rnorm(10,mean=1,sd=2) # r random number + distribution (norm) pnorm(1,mean=1,sd=2) # p cumulative probability qnorm(0.5,mean=1,sd=2) # q quantile dnorm(1,mean=1,sd=2) # d probability density plot(x = seq(-5, 7, length = 1000), y = dnorm(seq(-5, 7, length = 1000), mean = 1, sd = 2), type = \"l\", ylim = c(0, 0.25)) abline(h = 0, v = 1) # Take 1000 numbers between -5 and 7, following a normal distribution with mean 1 and standard deviation 2 # Add a horizontal line at value 0 and a vertical line at value 1\rThe corresponding distribution function plot\r","date":"2024-04-20","heading":"Distribution Functions","objectID":"/en/posts/r1/:4:3","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#distribution-functions"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Basic Syntax\rLoops\rStata simplifies this to local, global, and foreach for looping over variables; the downside is that it\u0026rsquo;s not convenient for adding and subtracting across rows. # For loop for (x in c(-2,3,0,4)){ print(x) y= abs(x) z=y^3 print(z) print(\"____\") } # Using a macro variable to define the loop for (variable in vector){ } # While loop v1 \u003c- 1:5 i\u003c-1 while(i\u003c=length(v1)){ print(i) print(sum(v1[1:i])) i=i+1 print(i) print(\"####\") } df \u003c- data.frame(c1 = 2:5, c2 = 4:7, c3 = -19:-16) # Loop over each row of the data frame for (i in 1:nrow(df)) { # Compute the sum of each row and print it print(sum(df[i, ])) } #next: skip #break: stop for (i in 1:nrow(df)) { # Compute the sum of each row and print it if(i==3){break} print(sum(df[i, ])) }\rConditionals\rIf-else is old hat, so I won\u0026rsquo;t give too many examples here. a \u003c- 7 if (a \u003e 6) { print(\"a \u003e 6\") } else { print(\"a \u003c= 6\") } s = 45 if (s %% 2 ==0) { print(\"偶数\") } else { print(\"奇数\") } ifelse(55 %% 2 ==0,\"偶数\" \"奇数\")\rWriting Functions\rAfter defining a function, it also shows up in the variable panel\rname \u003c- function(parameters){ the actual operation } # Define a function: factorial f1 \u003c- function(aug1){ res1\u003c-1:aug1 res2\u003c-prod(res1) return(res2) } # Use the function f1(10) # Define a function: addition f2\u003c-function(aug1,aug2=4){ res \u003c- aug1+aug2 return(res) } f2(2333) f2(2333,6666) # This overrides the default value aug2=4\r","date":"2024-04-20","heading":"Basic Syntax","objectID":"/en/posts/r1/:4:4","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#basic-syntax"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Basic Syntax\rLoops\rStata simplifies this to local, global, and foreach for looping over variables; the downside is that it\u0026rsquo;s not convenient for adding and subtracting across rows. # For loop for (x in c(-2,3,0,4)){ print(x) y= abs(x) z=y^3 print(z) print(\"____\") } # Using a macro variable to define the loop for (variable in vector){ } # While loop v1 \u003c- 1:5 i\u003c-1 while(i\u003c=length(v1)){ print(i) print(sum(v1[1:i])) i=i+1 print(i) print(\"####\") } df \u003c- data.frame(c1 = 2:5, c2 = 4:7, c3 = -19:-16) # Loop over each row of the data frame for (i in 1:nrow(df)) { # Compute the sum of each row and print it print(sum(df[i, ])) } #next: skip #break: stop for (i in 1:nrow(df)) { # Compute the sum of each row and print it if(i==3){break} print(sum(df[i, ])) }\rConditionals\rIf-else is old hat, so I won\u0026rsquo;t give too many examples here. a \u003c- 7 if (a \u003e 6) { print(\"a \u003e 6\") } else { print(\"a \u003c= 6\") } s = 45 if (s %% 2 ==0) { print(\"偶数\") } else { print(\"奇数\") } ifelse(55 %% 2 ==0,\"偶数\" \"奇数\")\rWriting Functions\rAfter defining a function, it also shows up in the variable panel\rname \u003c- function(parameters){ the actual operation } # Define a function: factorial f1 \u003c- function(aug1){ res1\u003c-1:aug1 res2\u003c-prod(res1) return(res2) } # Use the function f1(10) # Define a function: addition f2\u003c-function(aug1,aug2=4){ res \u003c- aug1+aug2 return(res) } f2(2333) f2(2333,6666) # This overrides the default value aug2=4\r","date":"2024-04-20","heading":"Loops","objectID":"/en/posts/r1/:4:4","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#loops"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Basic Syntax\rLoops\rStata simplifies this to local, global, and foreach for looping over variables; the downside is that it\u0026rsquo;s not convenient for adding and subtracting across rows. # For loop for (x in c(-2,3,0,4)){ print(x) y= abs(x) z=y^3 print(z) print(\"____\") } # Using a macro variable to define the loop for (variable in vector){ } # While loop v1 \u003c- 1:5 i\u003c-1 while(i\u003c=length(v1)){ print(i) print(sum(v1[1:i])) i=i+1 print(i) print(\"####\") } df \u003c- data.frame(c1 = 2:5, c2 = 4:7, c3 = -19:-16) # Loop over each row of the data frame for (i in 1:nrow(df)) { # Compute the sum of each row and print it print(sum(df[i, ])) } #next: skip #break: stop for (i in 1:nrow(df)) { # Compute the sum of each row and print it if(i==3){break} print(sum(df[i, ])) }\rConditionals\rIf-else is old hat, so I won\u0026rsquo;t give too many examples here. a \u003c- 7 if (a \u003e 6) { print(\"a \u003e 6\") } else { print(\"a \u003c= 6\") } s = 45 if (s %% 2 ==0) { print(\"偶数\") } else { print(\"奇数\") } ifelse(55 %% 2 ==0,\"偶数\" \"奇数\")\rWriting Functions\rAfter defining a function, it also shows up in the variable panel\rname \u003c- function(parameters){ the actual operation } # Define a function: factorial f1 \u003c- function(aug1){ res1\u003c-1:aug1 res2\u003c-prod(res1) return(res2) } # Use the function f1(10) # Define a function: addition f2\u003c-function(aug1,aug2=4){ res \u003c- aug1+aug2 return(res) } f2(2333) f2(2333,6666) # This overrides the default value aug2=4\r","date":"2024-04-20","heading":"Conditionals","objectID":"/en/posts/r1/:4:4","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#conditionals"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Basic Syntax\rLoops\rStata simplifies this to local, global, and foreach for looping over variables; the downside is that it\u0026rsquo;s not convenient for adding and subtracting across rows. # For loop for (x in c(-2,3,0,4)){ print(x) y= abs(x) z=y^3 print(z) print(\"____\") } # Using a macro variable to define the loop for (variable in vector){ } # While loop v1 \u003c- 1:5 i\u003c-1 while(i\u003c=length(v1)){ print(i) print(sum(v1[1:i])) i=i+1 print(i) print(\"####\") } df \u003c- data.frame(c1 = 2:5, c2 = 4:7, c3 = -19:-16) # Loop over each row of the data frame for (i in 1:nrow(df)) { # Compute the sum of each row and print it print(sum(df[i, ])) } #next: skip #break: stop for (i in 1:nrow(df)) { # Compute the sum of each row and print it if(i==3){break} print(sum(df[i, ])) }\rConditionals\rIf-else is old hat, so I won\u0026rsquo;t give too many examples here. a \u003c- 7 if (a \u003e 6) { print(\"a \u003e 6\") } else { print(\"a \u003c= 6\") } s = 45 if (s %% 2 ==0) { print(\"偶数\") } else { print(\"奇数\") } ifelse(55 %% 2 ==0,\"偶数\" \"奇数\")\rWriting Functions\rAfter defining a function, it also shows up in the variable panel\rname \u003c- function(parameters){ the actual operation } # Define a function: factorial f1 \u003c- function(aug1){ res1\u003c-1:aug1 res2\u003c-prod(res1) return(res2) } # Use the function f1(10) # Define a function: addition f2\u003c-function(aug1,aug2=4){ res \u003c- aug1+aug2 return(res) } f2(2333) f2(2333,6666) # This overrides the default value aug2=4\r","date":"2024-04-20","heading":"Writing Functions","objectID":"/en/posts/r1/:4:4","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#writing-functions"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Data Wrangling\rThe tidyverse package\u0026rsquo;s official site: https://www.tidyverse.org/ You can download the test dataset here: https://moxingjiqi.shinyapps.io/dataset/ The haven package in tidyverse supports reading SPSS, Stata, and SAS. It\u0026rsquo;s best not to include Chinese characters in file paths, otherwise you can easily get garbled text and import failures. ","date":"2024-04-20","heading":"Data Wrangling","objectID":"/en/posts/r1/:5:0","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#data-wrangling"},{"categories":["Software Tools"],"collections":["Learning R"],"content":"Import and Export\rTable source: R in Data Science Format\rCommand\r.txt\rread.table()\r.csv\rread.csv() and readr::read_csv()\r.xls and .xlsx\rreadxl::read_excel() and openxlsx::read.xlsx()\r.sav （SPSS files）\rhaven::read_sav() and foreign::read.spss()\r.Rdata or rda\rload()\r.rds\rreadRDS() and readr::read_rds()\r.dta\rhaven::read_dta() and haven::read_stata()\r.sas 7 bdat （SAS files）\rhaven::read_sas()\rInternet\rdownload.file()\r# Import CSV data # Custom data list d.small \u003c- read_csv(\"John, 33, 95 Kim, 21, 64 Sandy, 49, 100 \", col_names=c(\"name\", \"x\", \"y\") ) # Read a file 1 data \u003c- read_csv(\"testcsv.csv\") # Read a file 2 rawdata\u003c- read.table(file.choose(),head=T,sep=\",\") # head: treat the first row as variable names; sep: CSV delimiter head(rawdata,n=4) # Output the first 4 rows of the data tail(rawdata,n=10) # Output the last 10 rows of the data rawdata[95:105] # Output rows 95-105 str(rawdata) # Check the data types # read.csv(file.choose()) # data.table::fread(file.choose()) # Export CSV data write.table(rawdata, # Object to export \"test.csv\", # Export path sep=\",\", # Export delimiter row.names=F) # Row names # Read an Excel sheet library(readxl) data1\u003c- read_excel(file.choose()) # Get csv files in bulk library(readr) library(dplyr) # Set the folder path folder_path \u003c- \"F:/桌面/房地产PB/\" # Get the paths of all csv files in the folder csv_files \u003c- list.files(folder_path, pattern = \"\\\\.csv$\", full.names = TRUE) # Create an empty list to store the read csv data data_list \u003c- list() # Loop through and read each csv file, storing it in data_list for (file in csv_files) { data \u003c- read_csv(file) data_list[[file]] \u003c- data } # Combine all the data into one data frame combined_data \u003c- bind_rows(data_list) # View the combined data print(combined_data)\rAt least the vast majority of journal master files are do-files. As for plotting, Stata\u0026rsquo;s schemepack package is already powerful enough to be adjusted to R\u0026rsquo;s default style.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Using Zotero for reference management was the start of my love for the open-source philosophy.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Selling courses in China really is second to none.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2024-04-20","heading":"Import and Export","objectID":"/en/posts/r1/:5:1","tags":["R"],"title":"R Basics 1: Interface Introduction and Syntax Structure","uri":"/en/posts/r1/#import-and-export"},{"categories":["Reading"],"collections":[],"content":" (This article was compiled from an oral account given by Xiaokai Yang to our reporters Xiao Rui and Li Liming in 2003, and was reviewed and revised by him; some parts were cut during editing.) Source: The Economic Observer Xiaokai Yang was a self-taught genius whose path of hardship is deeply moving. Lately I keep complaining that the environment is no good, but after going over Xiaokai Yang\u0026rsquo;s path of growth again, I feel deeply ashamed. In studying theory, one must be able to enter it and step out of it, to leap out of the knowledge and analyze the current situation; losing oneself in a vacuum world for one\u0026rsquo;s own pleasure is surely a failure. Accumulation should be persistent; one should actively use mathematics to describe reality, and through that grasp the thought behind it and cultivate intuition. For a partial introduction to Xiaokai Yang\u0026rsquo;s theory, see Development Economics: Marginal Analysis and Inframarginal Analysis (Introduction) As Heaven\u0026rsquo;s movement is ever vigorous, so must a gentleman ceaselessly strive along. Salute! My original name was Yang Xiguang; Xiaokai Yang was my childhood name, which I took up again after 1978. I was born in Jilin in 1948 and grew up in Changsha, Hunan. My grandfather was a landlord who ran a school in the countryside. He had received a strict Confucian education, and during the late-Qing movement to promote Western learning he also attended a Western-style school. Our parents\u0026rsquo; generation likewise received a Confucian education from childhood; I remember that when I was in elementary school, my father asked an uncle to teach me the Analects at home. Both my parents joined the revolution in 1938. My father was originally a senior cadre of the Hunan Provincial Party Committee. In 1959, because he supported Peng Dehuai\u0026rsquo;s views and opposed the Great Leap Forward and the public mess halls, he was branded a rightist opportunist. That was in the autumn of 1959. I was still very small then. One day my father carried me to the window and said to me kindly: \u0026ldquo;Cadres who stay too long in the higher organs don\u0026rsquo;t understand conditions at the grass roots, so they should go down to learn about conditions.\u0026rdquo; I looked at the red leaves of a big maple outside the window, a little puzzled why my father\u0026rsquo;s manner was so unexpectedly gentle that day. My father was in low spirits those days and often argued with my mother. Only three years later did I learn that my father had been branded a rightist opportunist in 1959. My father told me that in 1962 he was rehabilitated, and that they admitted his 1959 views had been correct. ","date":"2024-04-17","heading":"","objectID":"/en/posts/yxk2/:0:0","tags":["Xiaokai Yang"],"title":"Repost: Xiaokai Yang, \"My Life\"","uri":"/en/posts/yxk2/#"},{"categories":["Reading"],"collections":[],"content":"Where Is China Going?\rThe Cultural Revolution broke out in 1966. Because my parents were both sympathetic to the views of Liu Shaoqi and Peng Dehuai, they were again branded counterrevolutionary revisionists, and during the Cultural Revolution we became a family of \u0026ldquo;black monsters,\u0026rdquo; deeply discriminated against. At the time I was a first-year senior high student at Changsha No. 1 Middle School. Because I was discriminated against and could not join the Red Guards, I joined a rebel faction that opposed the Red Guards. The organization I joined was called the \u0026ldquo;Seize Military Power Combat Team,\u0026rdquo; which belonged to the \u0026ldquo;Provincial Proletarian Revolutionary Alliance\u0026rdquo; (\u0026ldquo;Sheng Wu Lian\u0026rdquo;). At school the difference between the Red Guards and the rebels was that the Red Guards were all of good class background, while the rebels were mostly of bad background. So during the Cultural Revolution we supported the rebels and opposed the Red Guards; the rebels in senior high mainly opposed the \u0026ldquo;theory of blood lineage.\u0026rdquo; In the early Cultural Revolution, the masses could form their own organizations and join different ones according to their own views. By 1967, the military had banned mass organizations and forbidden the masses from forming political organizations. On February 4, 1967, the Central Cultural Revolution Group suddenly ordered the Hunan Provincial Military District to send troops to suppress Hunan\u0026rsquo;s largest rebel organization, \u0026ldquo;Xiangjiang Fenglei,\u0026rdquo; arresting over ten thousand people. So the rebels came into conflict with the authorities. Our rebel organization, the \u0026ldquo;Seize Military Power Combat Team,\u0026rdquo; was also drawn into this conflict, and I was arrested and held in the Changsha Public Security Bureau detention center for more than two months. After I was released that time, I wrote many big-character posters one after another, including \u0026ldquo;An Investigation Report on Urban Educated Youth Going Up to the Mountains and Down to the Villages\u0026rdquo; and \u0026ldquo;Political Power Grows Out of the Barrel of a Gun,\u0026rdquo; and so on. In 1968 I wrote a big-character poster titled \u0026ldquo;Where Is China Going?,\u0026rdquo; advocating that China adopt a Paris Commune-style democracy. This article had a great impact at the time. After the second-in-command of the Hunan Provincial Revolutionary Committee preparatory group read \u0026ldquo;Where Is China Going?,\u0026rdquo; he hurriedly passed the word to the provincial cadres of the time to characterize it. Soon my article was sent up to the Central Cultural Revolution Group. At nine o\u0026rsquo;clock on the evening of January 24, 1968, some leaders received members of the Hunan Provincial Revolutionary Committee preparatory group and representatives of some Hunan rebel organizations in the Hunan Hall of the Great Hall of the People in Beijing, and announced the suppression of a Hunan rebel organization called \u0026ldquo;Sheng Wu Lian,\u0026rdquo; making some very stern, weighty speeches and instructions. During the meeting, Kang Sheng several times singled out \u0026ldquo;Yang Xiguang of No. 1 Middle School\u0026rdquo; and the article \u0026ldquo;Where Is China Going?,\u0026rdquo; calling it \u0026ldquo;the counterrevolutionary \u0026rsquo;lament of the warhorse.\u0026rsquo;\u0026rdquo; Kang also asserted: \u0026ldquo;I have a feeling that his theory is by no means something a middle school student, or even a university student, could write; there is a counterrevolutionary black hand behind him!\u0026rdquo; Jiang Qing put it more bluntly: \u0026ldquo;That \u0026lsquo;Seize Military Power Combat Team\u0026rsquo; — let it go to hell!\u0026rdquo; A few days later I was \u0026ldquo;personally named\u0026rdquo; and thrown into prison, held at the Zuojiatang detention center of the Changsha Public Security Bureau. I was held in the detention center for over a year. In the autumn of 1969, in October, I was transferred from detention to formal arrest. Soon after, on a clear winter day in November, I was sentenced to ten ye","date":"2024-04-17","heading":"Where Is China Going?","objectID":"/en/posts/yxk2/:1:0","tags":["Xiaokai Yang"],"title":"Repost: Xiaokai Yang, \"My Life\"","uri":"/en/posts/yxk2/#where-is-china-going"},{"categories":["Reading"],"collections":[],"content":"Ten Years Behind Bars\r\u0026ldquo;Where Is China Going?\u0026rdquo; not only landed me in prison but also brought great disaster to my family. In Kang Sheng\u0026rsquo;s instructions of January 24, 1968, he said that \u0026ldquo;Where Is China Going?,\u0026rdquo; \u0026ldquo;Our Program,\u0026rdquo; and \u0026ldquo;Resolutions on the Current Situation\u0026rdquo; by Sheng Wu Lian were not something middle school students could have written, nor university students; there must be a black hand pulling strings behind them, and they must ferret out \u0026ldquo;Teacher Chen,\u0026rdquo; who waved the goose-feather fan behind these students. My mother happened to be surnamed Chen, and after Kang Sheng\u0026rsquo;s instructions reached Changsha she was denounced many times; her hands were blackened with ink and she was forced to kneel in public as a warning. The blackened hands symbolized the \u0026ldquo;black hand.\u0026rdquo; After enduring endless humiliation, unable to bear the disgrace, she hanged herself. After my mother was driven to suicide, my two younger sisters lost their home. My father was locked up in a \u0026ldquo;Mao Zedong Thought Study Class,\u0026rdquo; one sister was sent down to the mountains of western Hunan, the other fled to Shanxi to seek refuge with relatives, and my elder brother was also expelled from his work unit and driven to the countryside. During the year and a half I was held at the Zuojiatang detention center, I found a teacher to study English, an electrical engineer to study electrical machinery, and a mechanical engineer to study mechanical drafting. I also read A General History of the World, Marx\u0026rsquo;s Capital, and a book called Long Live Mao Zedong Thought. I borrowed Capital from a fellow prisoner, Teacher Chen, and so at Zuojiatang I finished the thick three volumes of Capital. My first impression of Capital was quite good; it had far more of an academic flavor. But after I finished the first two volumes, I found that the labor theory of value ignored another important factor determining value — use value. It was many years later that I learned that what Marx called use value is called utility in modern economics. But I quite liked Marx\u0026rsquo;s elaboration on Adam Smith\u0026rsquo;s theory of the division of labor. After finishing Capital, for some reason my heart came to expect that I would become an economist in the future. I had three ideas: first, to clarify the importance of use value in the theory of value; second, to weave the problem of the division of labor into the theory of value; and third, to mathematize the theory of value. Later, in the labor reform team, I wrote an economics notebook along this line of thought. It was many years before I realized that these ideas had long ago become far more sophisticated theories in modern economics. The idea of mathematizing economic theory I first saw on a big-character poster at Peking University. Another big-character poster that stimulated me was about how a privileged stratum had already formed in China, and how Marx\u0026rsquo;s method of economic analysis should be used to reanalyze Chinese society. That stimulus was the intellectual starting point of my later writing of \u0026ldquo;Where Is China Going?\u0026rdquo; After I went to prison, my political philosophy was already very different from when I wrote \u0026ldquo;Where Is China Going?\u0026rdquo; When I wrote that article, I had a pursuit of idealism; I believed a democratic polity should be elected by the people. By the time I was in prison I had completely lost that idealism. I believed that the standards by which people judge the values they pursue change with history, so how history will develop is far more important than any ideal goal. Before, the question I cared about was \u0026ldquo;what is good and what is bad, and how should this world be?\u0026rdquo; In prison I asked instead: \u0026ldquo;how will this world develop?\u0026rdquo; The worst things might well happen within our own lifetime, so subjective judgments of good and bad, right and wrong have no meaning; how to adapt to circumstances ","date":"2024-04-17","heading":"Ten Years Behind Bars","objectID":"/en/posts/yxk2/:2:0","tags":["Xiaokai Yang"],"title":"Repost: Xiaokai Yang, \"My Life\"","uri":"/en/posts/yxk2/#ten-years-behind-bars"},{"categories":["Reading"],"collections":[],"content":"A First Trial\rAfter my release at the end of my term in April 1978, I returned to Changsha. Because no work unit dared accept me, the author of \u0026ldquo;Where Is China Going?,\u0026rdquo; I stayed at my father\u0026rsquo;s home for a year. That year I audited a year of mathematics courses in the mathematics department of Hunan University; these audits were arranged by some rightist professors who had just been reinstated. At this time I began to use my childhood name, Xiaokai Yang, again. Later I worked for half a year as a proofreader at the Hunan Xinhua No. 2 Printing Plant in Shaoyang. In 1979 I applied for the master\u0026rsquo;s program at the Institute of Economics of the Chinese Academy of Social Sciences, but because of my \u0026ldquo;counterrevolutionary history\u0026rdquo; I was refused permission to take the exam. In 1980 I applied again, and with the help of Yu Guangyuan, then vice president of the Chinese Academy of Social Sciences, I finally got the chance to take the quantitative economics exam. After passing the exam I was admitted as a research assistant and worked for nearly two years at the Institute of Quantitative and Technical Economics of the Chinese Academy of Social Sciences. From 1979 to 1982 I studied neoclassical economics quite systematically, often auditing courses at various universities, borrowing books from the Beijing Library, and attending econometrics training classes. I studied systems theory, information theory, control theory, and operations research, did some econometric research, computed some shadow prices, translated a textbook on economic cybernetics, and published Preliminary Economic Cybernetics and Foundations of Mathematical Economics, roughly at the level of intermediate microeconomics, which was still quite new at the time. Later I met many people who went abroad to study, and they all said that their main understanding of Western economics in China had come from reading my two books. By 1982 I was hired as a lecturer at Wuhan University, where I worked for a year and a half, teaching mathematical economics and economic cybernetics. During this period I also published Economic Control Theory and Foundations of Mathematical Economics, and I began preparing to study abroad. Because some of the econometric models in my books attracted the attention of Professor Gregory Chow of Princeton University, who was then visiting Wuhan University, I was admitted to the PhD program in the economics department of Princeton University in 1983 with Professor Chow\u0026rsquo;s help. When I was going abroad, since I had not yet been rehabilitated, I could not pass the political screening for going abroad. At this point it was again thanks to Professor Chow (Zou Zhizhuang), who wrote a letter to the leaders asking for help. Later this letter was forwarded to Liu Daoyu, then president of Wuhan University, asking him to handle it. In the end President Liu Daoyu approved the procedures for me to go abroad, and in 1983 I arrived at Princeton University. At the same time, under the instruction from the relevant leaders that \u0026ldquo;the Yang Xiguang problem should be handled by the court according to law,\u0026rdquo; the Supreme Court instructed the Hunan Provincial High Court to re-examine my \u0026ldquo;counterrevolutionary\u0026rdquo; case. In 1983 the trial committee of the Hunan Provincial High Court unanimously held that \u0026ldquo;Where Is China Going?\u0026rdquo; \u0026ldquo;belongs to a matter of ideological understanding, had no counterrevolutionary purpose, and did not constitute a crime. Accordingly, the original first-instance and second-instance determinations and sentences were improper and should both be revoked, and Yang Xiguang is declared not guilty.\u0026rdquo; ","date":"2024-04-17","heading":"A First Trial","objectID":"/en/posts/yxk2/:3:0","tags":["Xiaokai Yang"],"title":"Repost: Xiaokai Yang, \"My Life\"","uri":"/en/posts/yxk2/#a-first-trial"},{"categories":["Reading"],"collections":[],"content":"A Hidden Dragon Rises from the Deep\rMy theory of the division of labor took initial shape while I was in prison, but it truly matured during my doctoral studies at Princeton. In the doctoral program there were two years of coursework, and during those two years I gradually compared the ideas of the mainstream school with my own. In the two years in Beijing I basically set aside my own thinking and systematically studied neoclassical economics; much of what I know of neoclassical economics was learned in those two years. After arriving at Princeton, some of the courses I took I had already taught in China, so I compared neoclassical ideas with my own, to see whether there was any difference, to see which of the things I had thought about were valuable and which were not. For example, I had derived Gossen\u0026rsquo;s Second Law myself using mathematics in prison, and at the time I thought it was a discovery, but the moment I left prison I found people had known about it a hundred years earlier. I had also thought about hierarchy theory and the Nash bargaining model in prison, and I wrote these theories into my Preliminary Economic Cybernetics. I found that on many problems my thinking was not as good as others\u0026rsquo;; for example, I later found that the bargaining model Nash built was far better than mine, so I gave it up. But this also encouraged me: many of the things others thought of, I could think of too. This is what is meant by \u0026ldquo;great minds think alike.\u0026rdquo; The more I read, the more I realized how hard it is to innovate. People are all very similar; what you can think of, others can think of too. This was how I felt when I first went to America. I am a person with many new ideas, but after seeing more, I found that many so-called new ideas had actually been thought of centuries ago. Having slowly read their work, I found my own ideas were not new at all. Still, my luck was not bad; after reading a great deal, in the end I found that some of the things I had thought about had not yet been thought of by others — namely the equilibrium model of the theory of the division of labor, which later became my doctoral dissertation. In 1987 my dissertation was approved at my defense, after which I went to the Economic Growth Center at Yale University for a year of postdoctoral research. A year later I went to teach in the economics department of Monash University in Australia. In 1989 I was promoted to senior lecturer, in 1992 I became a full professor, in 1993 I was elected a Fellow of the Academy of Social Sciences in Australia, and in 2000 I was promoted to chair professor. Over these years, although I have always taught at Monash University, I have spent about a third of each year as a visiting professor in the United States, Hong Kong, and Taiwan. Since 1998 I have also returned to China more often, serving as a visiting professor at Peking University and Fudan University. ","date":"2024-04-17","heading":"A Hidden Dragon Rises from the Deep","objectID":"/en/posts/yxk2/:4:0","tags":["Xiaokai Yang"],"title":"Repost: Xiaokai Yang, \"My Life\"","uri":"/en/posts/yxk2/#a-hidden-dragon-rises-from-the-deep"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":" In \u0026ldquo;Development Economics: Marginal Analysis and Inframarginal Analysis,\u0026rdquo; Yang Xiaokai reshapes the theoretical history of development economics according to his own understanding. This article summarizes the introduction part and adds some points worth discussing. ","date":"2024-04-10","heading":"","objectID":"/en/posts/yxk1/:0:0","tags":["Xiaokai Yang","Inframarginal Analysis","Development Economics"],"title":"Development Economics: Marginal Analysis and Inframarginal Analysis (Introduction)","uri":"/en/posts/yxk1/#"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"1. Intellectual Origins: Marx vs. Adam Smith\rYang Xiaokai defines the core of mainstream classical development economics as—division of labor is the source of economic growth, and economic growth is the core concept of development economics. Adam Smith\u0026rsquo;s logical chain: $$ \\text{Transport conditions} \\Rightarrow \\text{Market size} \\Rightarrow \\text{Division of labor} \\Rightarrow \\text{Economic growth} $$ With this logical line as the main axis, division of labor occupies the absolute core—the emergence of money and specialized division of labor are inseparable, and investment is a tool to optimize division of labor. William Petty\u0026rsquo;s logical chain: $$ \\text{Reduction in transaction costs} \\Rightarrow \\text{Promotion of division of labor} $$ Scholars like North and Max Weber link division of labor with capitalist expansion, forming what Yang Xiaokai sees as modern classical development economics: $$ \\text{Capitalist system} \\Rightarrow \\text{Transaction conditions} \\Rightarrow \\text{Division of labor} $$\rThe Contradiction Between Marx and Adam Smith\rIn the courses I took on Marx\u0026rsquo;s \u0026ldquo;Capital,\u0026rdquo; the professor argued that Marx\u0026rsquo;s view is that division of labor determines the market, which is completely opposite to Adam Smith\u0026rsquo;s view. For example, according to Marx, the division between the propertied and the propertyless is a form of division of labor, which also brings class nature! Based on the labor theory of value, private property is undesirable, and this division of labor ultimately stems from property ownership. Adam Smith uses the \u0026ldquo;invisible hand\u0026rdquo; to avoid the part about \u0026ldquo;the bloody primitive accumulation of capitalism.\u0026rdquo; If we want to refute Marx\u0026rsquo;s view, we need to argue that division of labor indeed brings wealth growth. Yang Xiaokai\u0026rsquo;s inframarginal analysis should be able to address this point, and this contradiction will be mentioned later. ","date":"2024-04-10","heading":"1. Intellectual Origins: Marx vs. Adam Smith","objectID":"/en/posts/yxk1/:1:0","tags":["Xiaokai Yang","Inframarginal Analysis","Development Economics"],"title":"Development Economics: Marginal Analysis and Inframarginal Analysis (Introduction)","uri":"/en/posts/yxk1/#1-intellectual-origins-marx-vs-adam-smith"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"2. Classical Development Economics\rYang Xiaokai advocates analyzing economic development from four aspects. This is the historical background of classical development economics—the rapid development of Britain in the 17th-19th centuries and the liberal reforms in 19th-century Europe. Geopolitical landscape Europe: Fragmented, low trade and defense costs, free cities developed before nation-states. China was the opposite. Ideology, moral standards, legal norms Europe: The pursuit of wealth legitimized commerce (e.g., the Glorious Revolution in Britain), and the Industrial Revolution accumulated substantial commercial wealth. The Reformation led to competition among churches, weakening unity. China did not face external challenges to its nation-state. Industrial and commercial institutions and practices Market institutions, patent law, property law Division of labor and economic structure International trade system and colonial movements Total productivity and economic welfare ","date":"2024-04-10","heading":"2. Classical Development Economics","objectID":"/en/posts/yxk1/:2:0","tags":["Xiaokai Yang","Inframarginal Analysis","Development Economics"],"title":"Development Economics: Marginal Analysis and Inframarginal Analysis (Introduction)","uri":"/en/posts/yxk1/#2-classical-development-economics"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"3. Refuting Keynesianism\rEconomic crises and World Wars I and II led to excessive concentration of political power. But does the occurrence of an economic crisis mean the failure of the free market? No, because highly specialized division of labor always comes with contradictions that are difficult to coordinate and couple. In Yang Xiaokai\u0026rsquo;s view, economic crises are like the risk of accidents on a highway. Choosing to involve the government is like giving up the highway after a single crash, which is an overreaction. Using division of labor to explain economic crises: the cobweb model and the general equilibrium model from the perspective of division of labor. This is also the core contradiction in the debate between Lin Yifu and Zhang Weiying on industrial policy—government intervention can have adverse effects because it disrupts normal industrial division of labor, which is more severe than an economic crisis. However, please note that all this logic is based on the premise that division of labor determines economic growth. The disadvantage of backwardness is the same; imitation can only optimize short-term division of labor, which does not align with long-term natural market trends and will inevitably lead to problems. The Soviet Union\u0026rsquo;s planned economy made more people admire \u0026ldquo;social experiments\u0026rdquo;—attempting government intervention. But the Soviet Union eventually collapsed, so Yang Xiaokai believes the Soviet model also proves Keynes wrong. In my personal view, Yang Xiaokai\u0026rsquo;s argument ignores the injustice of colonial movements and skips over the economic causes of World Wars I and II, which might have been caused by the excessive laissez-faire market leading to unequal resource distribution. Perhaps the market brings efficiency but neglects fairness, leading to revolutions. Incorporating freedom into development is a historic moment in development economics. Exploring what is just and fair is also a historic moment in development economics. Hayek\u0026rsquo;s prophecy succeeded, but the correct answer does not mean the process was correct. ","date":"2024-04-10","heading":"3. Refuting Keynesianism","objectID":"/en/posts/yxk1/:3:0","tags":["Xiaokai Yang","Inframarginal Analysis","Development Economics"],"title":"Development Economics: Marginal Analysis and Inframarginal Analysis (Introduction)","uri":"/en/posts/yxk1/#3-refuting-keynesianism"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"4. What is Inframarginal Analysis?\rMarginal analysis considers the allocation of resources, addressing the question of how much to allocate. But inframarginal analysis is about making choices, dealing with either-or contradictions. In life, people often face many choices between \u0026ldquo;yes\u0026rdquo; and \u0026ldquo;no.\u0026rdquo; For example: When you graduate from high school and need to choose a major for university, if you choose economics among economics, chemistry, and physics, it means you won\u0026rsquo;t attend chemistry and physics classes during university, but you will attend microeconomics, macroeconomics, econometrics, and other economics electives. This means that before we perform marginal analysis on the time allocation for major courses, we first consider which major to choose—this preliminary decision-making process is the exploration of the national market\u0026rsquo;s division of labor. This additional process of choosing a major is inframarginal. From a mathematical perspective, we perform a two-step optimization analysis: Inframarginal analysis part: Find global multiple corner solutions, interior solutions, and compare total costs and benefits. For example, which has better market prospects—studying economics, management, or physics? At this stage, we cannot perform marginal analysis; we can only compare total costs and total benefits. After confirming a major, we then use marginal analysis to determine the time allocation for our studies, which is the marginal analysis of grades and time. For example, the Lewis Turning Point and public choice theory have not been mathematized in mainstream economics because of conflicting interests. The government does not seek to maximize social welfare but rather a game of interests among various parties. The urban-rural dichotomy is also a problem of conflicting interests brought by division of labor. Most importantly—whether it is equilibrium and Pareto optimality analysis or Marx\u0026rsquo;s economics, none can answer one question: Why can productivity improve through the improvement of division of labor when the production function and resource endowment remain unchanged??? So let\u0026rsquo;s return to classical operations research and control theory, and Yang Xiaokai also wrote a preliminary control theory. A very dated book. Yang Xiaokai\u0026rsquo;s books seem quite collectible, and second-hand ones are expensive. I chose to borrow from the library. If anyone has one at home, please keep it well; it seems to hold its value.\r","date":"2024-04-10","heading":"4. What is Inframarginal Analysis?","objectID":"/en/posts/yxk1/:4:0","tags":["Xiaokai Yang","Inframarginal Analysis","Development Economics"],"title":"Development Economics: Marginal Analysis and Inframarginal Analysis (Introduction)","uri":"/en/posts/yxk1/#4-what-is-inframarginal-analysis"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"5. General Equilibrium and Network Analysis\rYang Xiaokai believes that Marshall\u0026rsquo;s supply and demand analysis is limited to the relationship between two goods, making many things appear exogenous. The Difference Between Exogenous and Endogenous\rGenerally, exogenous variables are used as fixed parameters, with unchanged values, usually referring to variables outside the model. For example, in the short term, technology and institutions remain unchanged, so they can be understood as exogenous parameters. Correspondingly, variables within the model are endogenous. In the long run, everything can change, so everything tends to become endogenous. Adam Smith did not elaborate on the \u0026ldquo;invisible hand,\u0026rdquo; and this process, like machine learning, is a black box. From the perspective of general equilibrium, due to the large number of commodity exchanges forming a trade circle, a huge trading network is formed, where many transactions influence each other, eventually reaching equilibrium, which is the embodiment of the concept of general. Therefore, Yang Xiaokai emphasizes the need for network analysis. Yang Xiaokai\u0026rsquo;s model endogenizes division of labor through network analysis, thereby demonstrating the spontaneous development of the market. ","date":"2024-04-10","heading":"5. General Equilibrium and Network Analysis","objectID":"/en/posts/yxk1/:5:0","tags":["Xiaokai Yang","Inframarginal Analysis","Development Economics"],"title":"Development Economics: Marginal Analysis and Inframarginal Analysis (Introduction)","uri":"/en/posts/yxk1/#5-general-equilibrium-and-network-analysis"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"International Trade and Economic Paradigms\rHere, let\u0026rsquo;s additionally discuss the paradigm of the economics discipline. Many people criticize economics as a pseudo-science wrapped in mathematics, but here we mainly want to explain the reason for the formation of this paradigm. Economics strives to imitate physics, following the process of phenomenon-mathematical model-experimental verification. However, since social sciences do not have the powerful experimental verification of natural sciences, statistical verification is used as a substitute. Whether it is Yang Xiaokai\u0026rsquo;s neoclassical development economics or Lin Yifu\u0026rsquo;s new structural economics, both derive conclusions from international trade. Similarly, when a theory encounters phenomena it cannot explain—in the field of international trade, it is the Leontief Paradox—patches or revisions are needed. Many people use human irrationality to refute economics, but In practice, there are many theoretical patches in this area. Diagram\rCode\rgraph LR; A(Self-sufficiency)--Introduction of absolute and comparative advantage--\u003eB(International trade)--Introduction of game theory--\u003eC(Tariffs and subsidies);\rgraph LR; A(Self-sufficiency)--Introduction of absolute and comparative advantage--\u003eB(International trade)--Introduction of game theory--\u003eC(Tariffs and subsidies);\rgraph LR; A(Self-sufficiency)--Introduction of absolute and comparative advantage--\u003eB(International trade)--Introduction of game theory--\u003eC(Tariffs and subsidies);\rgraph LR; A(Self-sufficiency)--Introduction of absolute and comparative advantage--\u003eB(International trade)--Introduction of game theory--\u003eC(Tariffs and subsidies);\rIf one wants to establish a new framework, it must also be compatible with the phenomena described in the above flowchart. For example, later, Paul Krugman found that even without comparative advantage, increasing returns to scale can increase trade. (However, some people criticize Nobel laureate Krugman for being more of an economic writer.) Marc Melitz explains the emergence of international trade at the firm level, and many believe this theory will eventually win a Nobel Prize. Yang Xiaokai extended the consumer-producer trade model based on Ricardo\u0026rsquo;s trade theory. Each individual (unlike countries and firms) is both a consumer and a producer, allowing us to understand international trade from an individual perspective. Domestic trade is a necessity, and international trade is caused by exogenous comparative advantage, with transaction costs affecting individual choices in both domestic and international trade. Endogenizing and mathematizing transaction costs. ","date":"2024-04-10","heading":"International Trade and Economic Paradigms","objectID":"/en/posts/yxk1/:5:1","tags":["Xiaokai Yang","Inframarginal Analysis","Development Economics"],"title":"Development Economics: Marginal Analysis and Inframarginal Analysis (Introduction)","uri":"/en/posts/yxk1/#international-trade-and-economic-paradigms"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"6. Successors of Classical Development Theory\rCoase and Buchanan: Property rights economics, transaction costs, institutional economics. North\u0026rsquo;s new economic history. For example, externalities are essentially a property rights issue rather than a public goods issue; principal-agent problems are also an inframarginal manifestation of conflicting interests in division of labor. Policy practice. Believes that government intervention harms the economy. For example, Buchanan\u0026rsquo;s new political economy. The contribution of entrepreneurs and enterprise systems to economic development For example, Zhang Weiying\u0026rsquo;s entrepreneurial spirit (believing that entrepreneurs have the ability to create something from nothing, and using this to refute Lin Yifu\u0026rsquo;s new structural economics). Romer\u0026rsquo;s economic growth model. High Macro Notes has just updated the Romer model. ","date":"2024-04-10","heading":"6. Successors of Classical Development Theory","objectID":"/en/posts/yxk1/:6:0","tags":["Xiaokai Yang","Inframarginal Analysis","Development Economics"],"title":"Development Economics: Marginal Analysis and Inframarginal Analysis (Introduction)","uri":"/en/posts/yxk1/#6-successors-of-classical-development-theory"},{"categories":["Economic Studies"],"collections":["Reflections on Learning Economics"],"content":" Reflecting on myself, what constitutes enthusiasm for studying economics is essentially a form of showing off, typically preceded by achievements before love. That being said, after the ebbing tide, don\u0026rsquo;t some seaweeds also leave behind seeds that sprout on the land? This is also what I ponder—Truth becomes fiction when the fiction\u0026rsquo;s true; Real becomes not-real where the unreal\u0026rsquo;s real.Enthusiasm for a subject does not require pure reasons or pure motives; by persevering, it becomes genuine. A classmate I know once thought economics wasn\u0026rsquo;t for them and wanted to switch majors. However, after achieving good grades, they started praising economics. When I see this classmate throwing out various economic terms, it\u0026rsquo;s like seeing myself from the past. Thus, from the similarities between him and me, it is evident that the starting point of my enthusiasm for economics should be impure—I simply enjoyed the feeling of intellectual superiority. However, upon delving deeper into the subject, I discovered both my own insignificance and the wonders of economics. As for my own learning mentality, I have traversed the following path: Moreover, based on my experience of surfing the internet and interacting with classmates, it seems that almost everyone follows a similar path of upgrading in the hierarchy of disdain. ","date":"2024-04-09","heading":"","objectID":"/en/posts/fs/:0:0","tags":["Economic Methodology"],"title":"Self-questioning: Econ-Learning mentality within the hierarchy of disdain","uri":"/en/posts/fs/#"},{"categories":["Economic Studies"],"collections":["Reflections on Learning Economics"],"content":"Theoretical Framework:\rDuring High School: Filled with a mysterious fascination for \u0026ldquo;Das Kapital\u0026rdquo;. Choosing a Major: Personally, my initiation into economics came from Wu Xiaobo\u0026rsquo;s \u0026quot; 历代经济变革得失 (The Rise and Fall of Economic Revolutions)\u0026quot;1. Although I no longer agree with the book\u0026rsquo;s cyclic theory of China\u0026rsquo;s progress and regress, I am grateful for how it prompted me to actively explore the related theories of \u0026ldquo;The Joseph Needham Puzzle\u0026rdquo; during my university years. Some around me, however, had impressions mixed with pure economics, political science, aspirations for civil service, and Wall Street. Study of Economics: Started with mainstream economic theories. First, the clash of the two major internet trends—the Cambridge Capital Controversy, the intellectual battle between Hayek and Keynes (in China represented by Lin Yifu and Yang Xiaokai). Then, a gradual progression through the history of ideas—from Greece\u0026hellip; Emphasis on agriculture, emphasis on commerce\u0026hellip; Classical, neoclassical, synthesis of neoclassical\u0026hellip; Gradually refined theoretical cognition: overlaying macro and micro, dividing into labor economics, industrial economics, sustainable resources, economic growth, quantitative history\u0026hellip; And then becoming increasingly detailed, dividing by object, method, and field. Adding Modern Patches: Transformation of value, game theory, complexity economics, non-equilibrium, behavioral economics, interdisciplinary approaches (evolutionary economics, neuroeconomics\u0026hellip;). Here, no longer fixated on grandstand positions, but rather focusing on theoretical paradigms and application scenarios, while paying more attention to theory-guided practices. ","date":"2024-04-09","heading":"Theoretical Framework:","objectID":"/en/posts/fs/:0:1","tags":["Economic Methodology"],"title":"Self-questioning: Econ-Learning mentality within the hierarchy of disdain","uri":"/en/posts/fs/#theoretical-framework"},{"categories":["Economic Studies"],"collections":["Reflections on Learning Economics"],"content":"Methodology in Papers:\rEncountering macro and micro structures without self-awareness, at this time unaware of the debate between structure and simplicity. Started with econometrics, delved into causality, and then began to self-proclaim as a \u0026ldquo;reg monkey\u0026rdquo; (although in reality, I didn\u0026rsquo;t even fully understand regression). Through understanding the causal revolution, completed my comprehension of the debate between structural form and reduced form. By this time, many of my classmates had already begun to mix Chinese and English in speech and typing, but I personally detested this kind of mixing, even for default professional terms, so I chose Chinese with English parentheses! When I first began to understand econometrics and causal inference, I was ensnared by the mystique of statistics. After dispelling the allure of DID\\RDD\\PSM\\Bunching\\OLS\u0026hellip;, came the enchantment with machine learning and Bayesian estimation. R, Python, Matlab, SAS\u0026hellip; So much to learn! When I became aware of the existence of structural forms, I began to idolize mathematics. DSGE, engage! Ambition surpassing ability—yearning to master real analysis, measure theory, and functional analysis . And then there\u0026rsquo;s the endless learning of mathematics, the never-ending array of statistical software, the countless classic books yet to be read, and the me who has yet to take action. ","date":"2024-04-09","heading":"Methodology in Papers:","objectID":"/en/posts/fs/:0:2","tags":["Economic Methodology"],"title":"Self-questioning: Econ-Learning mentality within the hierarchy of disdain","uri":"/en/posts/fs/#methodology-in-papers"},{"categories":["Economic Studies"],"collections":["Reflections on Learning Economics"],"content":"Cognitive Perspectives in Papers:\rEmpirical papers initially seem daunting, pursuing flashy methods. Feeling sorrowful about lacking originality in my own thoughts, while feeling lost about where to find originality. Choosing a research topic for a paper is essentially driven by methods, data, and questions, often simply permutations and combinations of variables. Started realizing that keeping up with economics requires reading cutting-edge English literature, began advocating that Chinese journals are all rubbish, only reading the top 5 in English. This sentiment is widely supported on the internet, but isn\u0026rsquo;t it a bit extreme? Started understanding the importance of packaging a story, always saying that a paper tells a good story. Yes, we\u0026rsquo;ve become storytellers now (image of Zhang Wuchang.jpg) ","date":"2024-04-09","heading":"Cognitive Perspectives in Papers:","objectID":"/en/posts/fs/:0:3","tags":["Economic Methodology"],"title":"Self-questioning: Econ-Learning mentality within the hierarchy of disdain","uri":"/en/posts/fs/#cognitive-perspectives-in-papers"},{"categories":["Economic Studies"],"collections":["Reflections on Learning Economics"],"content":"Conclusion\rLooking back, it all seems to be driven by interest, but each step forward is indeed built on the disdain of the previous step. I cannot answer the debate on theoretical paradigms because it\u0026rsquo;s too vast, and I can\u0026rsquo;t see clearly. All I hear is the opening line from my history of economic thought professor—\u0026ldquo;Economics is a chaos.\u0026rdquo; Ultimately, the economists I admire the most in my eyes possess two modes of thinking. One is the sociological analysis that establishes comparative analysis, familiar with the histories of various countries, effortlessly comparing economies, the gods of institutional economics whose intuition and knowledge reservoirs are astonishing. The other is the mathematical analysis, dealing with various functions and equilibrium analyses, which can make one\u0026rsquo;s scalp tingle. Recently, while browsing the library, seeing the densely packed borrowing records on those monochrome old books, I can\u0026rsquo;t help but lament that I\u0026rsquo;ve read too few classic works. Personally, I feel that the biggest illusion I face is the tool illusion—thinking that learning a bit of coding satisfies me, when in fact my economic thinking hasn\u0026rsquo;t grown at all. Thanks to my high school history teacher for the gift.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2024-04-09","heading":"Conclusion","objectID":"/en/posts/fs/:0:4","tags":["Economic Methodology"],"title":"Self-questioning: Econ-Learning mentality within the hierarchy of disdain","uri":"/en/posts/fs/#conclusion"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"This post documents the process of drawing GIS choropleth maps in Stata. All the data mentioned in this post can be downloaded from the repository. ","date":"2024-03-22","heading":"","objectID":"/en/posts/statagis/:0:0","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"Getting Map Files\rESRI Shapefile files are spatial geographic data developed by the Environmental Systems Research Institute. They store both spatial locations and attribute data. The basic files are mainly: Main file (.shp): stores the spatial information of geometric features, i.e., XY coordinates. The map outline information of a GIS image is stored in this file. Table file (.dbf): a dBase table that stores the attribute information of the geographic data. Index file (.shx): stores index information about how the .shp data is stored — where the XY coordinate input points are, how many XY coordinate pairs there are, and so on. Here are some data sources I found: Dabing\u0026rsquo;s blog National Catalogue Service for Geographic Information GADM data: comprehensive international maps. China map data found on GitHub Rstata materials: provincial divisions of the China map. Domestic courses are world-class; personally I think the best Stata-focused content comes from \u0026ldquo;Lianxianghui\u0026rdquo; and \u0026ldquo;Rstata\u0026rdquo;. Even though I\u0026rsquo;m a firm freeloading open-source advocate, I often read their popular-science articles to learn Stata. Here a kind soul has uploaded the database related to Rstata. Institute of Geographic Sciences and Natural Resources Research, CAS: perhaps China\u0026rsquo;s semi-official source? Institute of Geographic Sciences and Natural Resources Research, CAS\rIf you still can\u0026rsquo;t find what you want, you can use the Alibaba Cloud map to generate map files. Go to Alibaba Cloud DataV, click to download the file (I recommend the \u0026ldquo;other download\u0026rdquo; option, which gives you a .json file). After downloading, go to the converter to convert it. Click Select, upload the .json file, then click export to export the converted file. It seems that because of data encoding or encryption, files converted from the Alibaba Cloud map sometimes can\u0026rsquo;t be read by Stata. In that case, use spshape2dta to convert them. ","date":"2024-03-22","heading":"Getting Map Files","objectID":"/en/posts/statagis/:1:0","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#getting-map-files"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"Basic StataGis Operations\r","date":"2024-03-22","heading":"Basic StataGis Operations","objectID":"/en/posts/statagis/:2:0","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#basic-statagis-operations"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"Installing the Required Commands\rYou just need the main file (.shp) and the table file (.dbf). Install the relevant commands in Stata beforehand. ssc install shp2dta, replace //file conversion command ssc install mif2dta, replace //file conversion command ssc install spmap, replace //GIS plotting command\r","date":"2024-03-22","heading":"Installing the Required Commands","objectID":"/en/posts/statagis/:2:1","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#installing-the-required-commands"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"Converting and Fixing Encoding Issues\rUsing a GIS map file made by a Bilibili user: 2019 China Map - Map Approval No. GS(2019)1822 The example data I use here is: PKU Digital Financial Inclusion Index 2011_2020 There are two files to convert here: the China map file 市 (cities) and the nine-dash line file 九段线 (nine-dash line). clear cd F:\\桌面\\GIS_sum\\2019中国地图审图号\\例子 //set the working folder, since some gis command options work better with relative paths import excel \"F:\\桌面\\GIS_sum\\2019中国地图审图号\\例子\\北大数字普惠金融指数2011_2020.xlsx\", sheet(\"Sheet1\") firstrow keep if year == 2020 rename pref_name_year18 ct_name save d2020data ,replace //load the data spshape2dta 市 spshape2dta 九段线 //here I use spshape2dta because shp2dta cannot convert these clear cd F:\\桌面\\GIS_sum\\2019中国地图审图号\\例子 unicode encoding set gb18030 unicode analyze 市.dta unicode translate 市.dta, invalid //recompile to fix some garbled Chinese characters //one-time command; to reuse it you need to delete the generated encoding file bak.stunicode in the directory\rIf a file can\u0026rsquo;t be converted — for example, the Alibaba Cloud map — it seems maps made in GIS also can\u0026rsquo;t be converted by shp2dta. That\u0026rsquo;s why spshape2dta is used here. Apart from this, the two commands don\u0026rsquo;t differ much. The downside of spshape2dta is that you can\u0026rsquo;t customize the name; you just follow it directly with the filename, and it automatically generates the two files you need. The label file is .dta, and the outline file is _shp.dta. ","date":"2024-03-22","heading":"Converting and Fixing Encoding Issues","objectID":"/en/posts/statagis/:2:2","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#converting-and-fixing-encoding-issues"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"Matching Data and Label Files\ruse 市.dta rename __ ct_name save 市.dta ,replace use d2020data merge 1:1 ct_name using 市.dta drop _merge gen ID =_ID save city_data2020,replace\r","date":"2024-03-22","heading":"Matching Data and Label Files","objectID":"/en/posts/statagis/:2:3","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#matching-data-and-label-files"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"Plotting Commands\rLet\u0026rsquo;s start plotting. The basic plotting command is as follows: grmap digitization_level using 市_shp.dta , /// id(ID) osize(vvthin ...) ocolor(white ...) /// clmethod(custom) clbreaks(-1 0 190 200 280 300 350) /// fcolor(gray \"224 242 241\" \"178 223 219\" \"128 203 196\" \"77 182 172\" \"38 166 154\") /// leg(order(2 \"无数据\" 3 \"0~190\" 4 \"190~200\" 5 \"200~280\" 6 \"280~300\" 7 \"300~350\")) /// graphr(margin(medium)) /// line(data(九段线_shp.dta)) /// ti(\"2020 年数字普惠金融指数\") /// subti(\"二级标题\") /// caption(\"数据来源：北大数字普惠金融指数\", size(*0.8))\rAs far as the plotting commands go, spmap and grmap seem to make no difference\r","date":"2024-03-22","heading":"Plotting Commands","objectID":"/en/posts/statagis/:2:4","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#plotting-commands"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"Parameter Explanations\rThe parameter explanations below were generated by GPT 3.5, with some additions by me. grmap type: specifies the graph type as a map. using chinaprov40_coord.dta: specifies the map data file, which contains the coordinate information of the provincial administrative divisions. id(ID): specifies the unique identifier variable in the map data. It links the map coordinates to the labels and data. osize(vvthin ...) and ocolor(white ...): set the thickness and color of the map boundary lines. vvthin is a predefined line style in Stata; it means a very thin line. When drawing maps, you can use different line thicknesses to distinguish different geographic features or boundaries. From thin to thick: vvthin, vthin, thin, medium, thick, vthick, vvthick. clmethod(custom) and clbreaks(0 1 2 3 4 5): custom classification method and classification intervals. Here they correspond to the provincial categories: municipalities directly under the central government, provinces, special administrative regions, and so on. fcolor(...): specifies the fill colors for different categories. The example uses RGB color definitions; you can check the color codes in PowerPoint\u0026rsquo;s custom color picker. RGB color definition\rleg(...): sets the order and labels of the legend. graphr(margin(medium)): sets the graph margins. line(data(chinaprov40_line_coord.dta) by(group) ...): draws the map boundary lines, specifying the boundary line data file and attributes such as color. Here the nine-dash line file is used. polygon(data(polygon) fcolor(black) ...): draws map polygons, specifying fill color, line thickness, and other attributes. Here it\u0026rsquo;s the legend and the compass. label(data(chinaprov40_label) ...): labels the map, specifying the label data file and label text. label(ename) is English, label(cnname) is Chinese. ti(\u0026quot;一级标题: 2019 年中国省级行政区划\u0026quot;): sets the main title. subti(\u0026quot;二级标题\u0026quot;): sets the subtitle. caption(\u0026quot;使用 Stata 绘制中国省级地图\u0026quot;, size(*0.8)): sets the graph caption. ","date":"2024-03-22","heading":"Parameter Explanations","objectID":"/en/posts/statagis/:2:5","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#parameter-explanations"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"Processing Flowchart\rMap line data (optional): for example, the lines for mountains, rivers, mountain ranges, the nine-dash line, the Qinling-Huaihe line, and the Hu Huanyong Line. Diagram\rCode\rgraph TD; 0(获取地图文件)==\u003e1(地图主文件.Shp); 0(获取地图文件)==\u003e11(线条主文件.Shp); 0(获取地图文件)==\u003e3(表文件.dbf); 1(地图主文件.Shp)==转译==\u003e2(地图轮廓数据); 11(线条主文件.Shp)==转译==\u003e9(地图线条数据); 3(表文件.dbf)==转译==\u003e4(标签文件); 5(数据分析文件)==\u003e6(匹配文件); 4(标签数据)==\u003e6(匹配文件); 6(匹配文件)==id标识==\u003e7(画图); 2(地图轮廓数据)==id标识==\u003e7(画图); 9(地图线条数据)==id标识==\u003e7(画图)\rgraph TD; 0(获取地图文件)==\u003e1(地图主文件.Shp); 0(获取地图文件)==\u003e11(线条主文件.Shp); 0(获取地图文件)==\u003e3(表文件.dbf); 1(地图主文件.Shp)==转译==\u003e2(地图轮廓数据); 11(线条主文件.Shp)==转译==\u003e9(地图线条数据); 3(表文件.dbf)==转译==\u003e4(标签文件); 5(数据分析文件)==\u003e6(匹配文件); 4(标签数据)==\u003e6(匹配文件); 6(匹配文件)==id标识==\u003e7(画图); 2(地图轮廓数据)==id标识==\u003e7(画图); 9(地图线条数据)==id标识==\u003e7(画图)\rgraph TD; 0(获取地图文件)==\u003e1(地图主文件.Shp); 0(获取地图文件)==\u003e11(线条主文件.Shp); 0(获取地图文件)==\u003e3(表文件.dbf); 1(地图主文件.Shp)==转译==\u003e2(地图轮廓数据); 11(线条主文件.Shp)==转译==\u003e9(地图线条数据); 3(表文件.dbf)==转译==\u003e4(标签文件); 5(数据分析文件)==\u003e6(匹配文件); 4(标签数据)==\u003e6(匹配文件); 6(匹配文件)==id标识==\u003e7(画图); 2(地图轮廓数据)==id标识==\u003e7(画图); 9(地图线条数据)==id标识==\u003e7(画图)\rgraph TD; 0(获取地图文件)==\u003e1(地图主文件.Shp); 0(获取地图文件)==\u003e11(线条主文件.Shp); 0(获取地图文件)==\u003e3(表文件.dbf); 1(地图主文件.Shp)==转译==\u003e2(地图轮廓数据); 11(线条主文件.Shp)==转译==\u003e9(地图线条数据); 3(表文件.dbf)==转译==\u003e4(标签文件); 5(数据分析文件)==\u003e6(匹配文件); 4(标签数据)==\u003e6(匹配文件); 6(匹配文件)==id标识==\u003e7(画图); 2(地图轮廓数据)==id标识==\u003e7(画图); 9(地图线条数据)==id标识==\u003e7(画图)\rLooks complicated? Here\u0026rsquo;s a simple summary of the steps: Get the data we want to describe — the value for each province. Match the descriptive data to _db.dta (the index file, converted from the .dbf file). Open the matched data, and additionally load the map outline data (_coord.dta) (converted from the .shp file). Optionally: you can add a label file (whether to show each province\u0026rsquo;s name). ","date":"2024-03-22","heading":"Processing Flowchart","objectID":"/en/posts/statagis/:3:0","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#processing-flowchart"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"Provincial Level (China)\rFrom Rstata. You can download the learning materials from the GitHub repository — provincial panel data for GIS maps and related data. File Overview\rMap outline data: chinaprov40_db.dta chinaprov40_coord.dta Line data: for example the nine-dash line, the Hu Huanyong Line, etc. chinaprov40_line_db.dta chinaprov40_line_coord.dta Label position data chinaprov40_label.dta For drawing the compass and scale bar polygon.dta ","date":"2024-03-22","heading":"Provincial Level (China)","objectID":"/en/posts/statagis/:4:0","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#provincial-level-china"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"Actual Plotting\rcd /Users/ac/Documents/系列课程/使用Stata绘制中国省级地图（版本4）/ * plotting a discrete variable use chinaprov40_db.dta, clear encode 类型, gen(type) codebook type *if the grmap command is not activated, just run: grmap, activate grmap type using chinaprov40_coord.dta, /// id(ID) osize(vvthin ...) ocolor(white ...) /// clmethod(custom) clbreaks(0 1 2 3 4 5) /// fcolor(\"254 212 57\" \"253 116 70\" \"138 145 151\" \"213 228 162\" \"210 175 129\") /// leg(order(2 \"不统计\" 3 \"特别行政区\" 4 \"直辖市\" 5 \"省\" 6 \"自治区\" 11 \"秦岭-淮河线\" 14 \"胡焕庸线\")) /// graphr(margin(medium)) /// line(data(chinaprov40_line_coord.dta) by(group) size(vvthin *1 *0.5 *1.2 *0.5 *0.5 *1.2) pattern(solid ...) /// color(white /// provincial boundary color black /// national boundary color \"0 85 170\" /// coastline color \"24 188 156\" /// Qinling-Huaihe line color black /// small map frame color black /// scale bar and compass color \"227 26 28\" /// Hu Huanyong line color )) /// polygon(data(polygon) fcolor(black) /// osize(vvthin)) /// label(data(chinaprov40_label) x(X) y(Y) label(cname) length(20) size(*0.8)) /// ti(\"一级标题: 2019 年中国省级行政区划\") /// subti(\"二级标题\") /// caption(\"使用 Stata 绘制中国省级地图\", size(*0.8)) gr export pic1.png, replace width(1200) * English version grmap type using chinaprov40_coord.dta, /// id(ID) osize(vvthin ...) ocolor(white ...) /// clmethod(custom) clbreaks(0 1 2 3 4 5) /// fcolor(\"254 212 57\" \"253 116 70\" \"138 145 151\" \"213 228 162\" \"210 175 129\") /// leg(order(2 \"Not within the scope of statistics\" 3 \"Special administrative region\" 4 \"Municipality directly under\" \"the Central Government\" 5 \"Province\" 6 \"Autonomous Region\" 11 \"Qinling Huaihe River Line\" 14 \"Hu Huanyong line\")) /// graphr(margin(medium)) /// line(data(chinaprov40_line_coord.dta) by(group) size(vvthin *1 *0.5 *1.2 *0.5 *0.5 *1.2) pattern(solid ...) /// color(white /// provincial boundary color black /// national boundary color \"0 85 170\" /// coastline color \"24 188 156\" /// Qinling-Huaihe line color black /// small map frame color black /// scale bar and compass color \"227 26 28\" /// Hu Huanyong line color )) /// polygon(data(polygon) fcolor(black) /// osize(vvthin)) /// label(data(chinaprov40_label) x(X) y(Y) label(ename) length(20) size(*0.6)) /// ti(\"title1: China’s provincial administrative divisions in 2019\") /// subti(\"title2\") /// caption(\"Use Stata to draw provincial maps of China\", size(*0.8)) gr export pic2.png, replace width(1200)\rUsing Stata to draw China\u0026rsquo;s 2019 provincial administrative divisions\r","date":"2024-03-22","heading":"Actual Plotting","objectID":"/en/posts/statagis/:4:1","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#actual-plotting"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"Other Examples\r* plotting example: * 1. GDP of Chinese provinces and cities in 2020 import delimited using \"2020年中国各省市地区生产总值.csv\", clear encoding(utf8) gen prov = substr(省份, 1, 6) save 2020年中国各省市地区生产总值, replace use chinaprov40_db.dta, clear gen prov = substr(省, 1, 6) merge 1:1 prov using 2020年中国各省市地区生产总值 replace 地区生产总值 = -1 if missing(地区生产总值) grmap 地区生产总值 using chinaprov40_coord.dta, /// id(ID) osize(vvthin ...) ocolor(white ...) /// clmethod(custom) clbreaks(-1 0 20000 40000 60000 80000 120000) /// fcolor(gray \"224 242 241\" \"178 223 219\" \"128 203 196\" \"77 182 172\" \"38 166 154\") /// leg(order(2 \"无数据\" 3 \"\u003c 2 万亿元\" 4 \"2～4 万亿元\" 5 \"4～6 万亿元\" 6 \"6～8 万亿元\" 7 \"\u003e 8 万亿元\")) /// graphr(margin(medium)) /// line(data(chinaprov40_line_coord.dta) /// /// remove the Qinling-Huaihe line (4) and Hu Huanyong line (7) select(keep if inlist(group, 1, 2, 3, 5, 6)) /// by(group) size(vvthin *1 *0.5 *0.5 *0.5) /// pattern(solid ...) /// solid line color(white /// provincial boundary color black /// national boundary color \"0 85 170\" /// coastline color black /// small map frame color black /// scale bar and compass color )) /// polygon(data(polygon) fcolor(black) /// osize(vvthin)) /// label(data(chinaprov40_label) x(X) y(Y) label(cname) length(20) size(*0.8)) /// ti(\"2020 年中国各省市地区生产总值\") /// subti(\"二级标题\") /// caption(\"数据来源：各地统计局\", size(*0.8)) gr export pic3.png, replace width(1200) * distribution of Chinese industrial enterprises in 2013 and their distance from the Qinling-Huaihe line * convert the coordinate system * conversion method 1: https://czxb.shinyapps.io/crs-trans/ * note: the uploaded csv file should contain numeric lon and lat variables; the observation limit is about 100,000, and it cannot be used by multiple people at the same time. use gq2013sample, clear keep 经度 纬度 ren 经度 lon ren 纬度 lat export delimited using \"待转换.csv\", replace * conversion method 2: use the R script in the attachment * process the converted data import delimited using \"转换后的数据.csv\", clear gen id = _n save 转换后的数据, replace use gq2013sample, clear gen id = _n merge 1:1 id using 转换后的数据 drop _m id *度 encode 北方或南方, gen(north) save pointdata, replace use chinaprov40_db.dta, clear spmap using chinaprov40_coord.dta, id(ID) /// ocolor(\"black\" ...) osize(vvthin ...) /// line(data(chinaprov40_line_coord.dta) /// /// Hu Huanyong line (7) select(keep if inlist(group, 1, 2, 3, 4, 5, 6)) /// by(group) size(vvthin *1 *0.5 *1.5 *0.5 *0.5) /// pattern(solid ...) /// color(white /// provincial boundary color black /// national boundary color \"0 85 170\" /// coastline color \"0 85 170\" /// Qinling-Huaihe line color black /// small map frame color black /// scale bar and compass color )) /// polygon(data(polygon) fcolor(black) /// osize(vvthin)) /// label(data(chinaprov40_label) x(X) y(Y) label(cname) length(20) size(*0.8)) /// point(data(pointdata) by(north) /// fcolor(\"227 26 28%30\" \"24 188 156%30\") /// x(x) y(y) /// proportional(与秦岭淮河线的距离) /// size(*0.1) legenda(on)) /// leg(order(7 \"秦岭-淮河线\" 10 \"北方工企业\" 11 \"南方工企业\")) /// ti(\"2013 年中国工业企业与秦岭-淮河线的距离\", color(black)) /// subti(\"二级标题\") /// graphr(margin(medium)) /// caption(\"数据来源：2013 年中国工业企业数据库，使用高德地图地理编码接口解析经纬度\", size(*0.8)) gr export pic4.png, replace width(1200) * GDP and industrial structure of Chinese provinces in 2019 use 各省历年GDP, clear drop if 省份 == \"中国\" replace 地区生产总值_亿元 = 地区生产总值_亿元 / 1000 merge m:m 省代码 using chinaprov40_db.dta replace 地区生产总值_亿元 = -1 if missing(年份) grmap 地区生产总值_亿元 if 年份 == 2019 | missing(年份) /// using chinaprov40_coord.dta, id(ID) /// clmethod(custom) clbreaks(-1 0 40 60 80 100 120) /// fcolor(\"gray\" \"237 248 233\" \"199 233 192\" \"161 217 155\" \"116 196 118\" \"49 163 84\") /// ocolor(\"gray\" ...) /// ti(\"2019 年中国各省地区生产总值 \u0026 产业结构\", size(*1.1)) /// subtitle(\"数据来源：CSMAR经济金融数据库\") /// graphr(margin(medium)) /// osize(vvthin ...) /// legend(size(*1.1) /// order(2 \"无数据\" 3 \"\u003c 40千亿\" /// 4 \"40～60千亿\" 5 \"60～80千亿\" /// 6 \"80～100千亿\" 7 \"\u003e 100千亿\" /// 14 \"第一产业\" 15 \"第二产业\" 16 \"第三产业\")) /// caption(\"二级标题\", size(*0.8)) /// line(data(chinaprov40_line_co","date":"2024-03-22","heading":"Other Examples","objectID":"/en/posts/statagis/:4:2","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#other-examples"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"Adjusting the Compass and Legend\rYou can change the effect by identifying the relevant data IDs and modifying their coordinates. * move the compass to the upper right use chinaprov40_line_db.dta, clear * the compass corresponds to IDs 40 and 41 use chinaprov40_line_coord.dta, clear replace _X = _X + 3000000 if inlist(_ID, 40, 41) replace _Y = _Y + 4000000 if inlist(_ID, 40, 41) save chinaprov40_line_coord2.dta, replace use polygon, clear replace _X = _X + 3000000 if _ID == 38 replace _Y = _Y + 4000000 if _ID == 38 save polygon2, replace use chinaprov40_label, clear replace X = X + 3000000 if cname == \"N\" replace Y = Y + 4000000 if cname == \"N\" save chinaprov40_label2, replace use chinaprov40_db.dta, clear encode 类型, gen(type) grmap type using chinaprov40_coord.dta, /// id(ID) osize(vvthin ...) ocolor(white ...) /// clmethod(custom) clbreaks(0 1 2 3 4 5) /// fcolor(\"254 212 57\" \"253 116 70\" \"138 145 151\" \"213 228 162\" \"210 175 129\") /// leg(order(2 \"不统计\" 3 \"特别行政区\" 4 \"直辖市\" 5 \"省\" 6 \"自治区\" 11 \"秦岭-淮河线\" 14 \"胡焕庸线\")) /// graphr(margin(medium)) /// line(data(chinaprov40_line_coord2.dta) by(group) size(vvthin *1 *0.5 *1.2 *0.5 *0.5 *1.2) pattern(solid ...) /// color(white /// provincial boundary color black /// national boundary color \"0 85 170\" /// coastline color \"24 188 156\" /// Qinling-Huaihe line color black /// small map frame color black /// scale bar and compass color \"227 26 28\" /// Hu Huanyong line color )) /// polygon(data(polygon2) fcolor(black) /// osize(vvthin)) /// label(data(chinaprov40_label2) x(X) y(Y) label(cname) length(20) size(*0.8)) /// ti(\"使用 Stata 绘制 2019 年中国省级行政区划\") /// subti(\"二级标题\") /// caption(\"版本：使用 Stata 绘制中国省级地图数据包 4.0\", size(*0.8)) gr export pic8.png, replace width(1200) * adjust the position of the scale bar (move it up slightly) use chinaprov40_line_db.dta, clear * the scale bar corresponds to IDs 42 and 43 use chinaprov40_line_coord2.dta, clear replace _Y = _Y + 200000 if inlist(_ID, 42, 43) save chinaprov40_line_coord3.dta, replace use polygon2, clear replace _Y = _Y + 200000 if _ID == 39 save polygon3, replace use chinaprov40_label2, clear replace Y = Y + 200000 if cname == \"1000km\" save chinaprov40_label3, replace use chinaprov40_db.dta, clear encode 类型, gen(type) grmap type using chinaprov40_coord.dta, /// id(ID) osize(vvthin ...) ocolor(white ...) /// clmethod(custom) clbreaks(0 1 2 3 4 5) /// fcolor(\"254 212 57\" \"253 116 70\" \"138 145 151\" \"213 228 162\" \"210 175 129\") /// leg(order(2 \"不统计\" 3 \"特别行政区\" 4 \"直辖市\" 5 \"省\" 6 \"自治区\" 11 \"秦岭-淮河线\" 14 \"胡焕庸线\")) /// graphr(margin(medium)) /// line(data(chinaprov40_line_coord3.dta) by(group) size(vvthin *1 *0.5 *1.2 *0.5 *0.5 *1.2) pattern(solid ...) /// color(white /// provincial boundary color black /// national boundary color \"0 85 170\" /// coastline color \"24 188 156\" /// Qinling-Huaihe line color black /// small map frame color black /// scale bar and compass color \"227 26 28\" /// Hu Huanyong line color )) /// polygon(data(polygon3) fcolor(black) /// osize(vvthin)) /// label(data(chinaprov40_label3) x(X) y(Y) label(cname) length(20) size(*0.8)) /// ti(\"使用 Stata 绘制 2019 年中国省级行政区划\") /// subti(\"二级标题\") /// caption(\"版本：使用 Stata 绘制中国省级地图数据包 4.0\", size(*0.8)) gr export pic9.png, replace width(1200)\r","date":"2024-03-22","heading":"Adjusting the Compass and Legend","objectID":"/en/posts/statagis/:4:3","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#adjusting-the-compass-and-legend"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"City Level (China)\rSee Stata Learning: How to Draw Provincial and City Choropleth Maps (Ten-Dash-Line Version)? Using machine learning to model technological heterogeneity in carbon emission efficiency evaluation: The case of China’s cities I dug up the paper\u0026rsquo;s data source. But when I used it, the map command grmap mysteriously threw an error with my data: r(198),option t() required . Logically this should mean a missing comma or parenthesis, but I checked and there was no problem; switching to spmap fixed it. The two have identical syntax, so you can swap them directly. ","date":"2024-03-22","heading":"City Level (China)","objectID":"/en/posts/statagis/:5:0","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#city-level-china"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"County Level (China)\rSame as above, omitted. ","date":"2024-03-22","heading":"County Level (China)","objectID":"/en/posts/statagis/:6:0","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#county-level-china"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"The Geoplot Command\rCompared with spmap and grmap, the commands are more concise and offer more definition options. Ben Jann (University of Bern) Data source Recommended tutorial ","date":"2024-03-22","heading":"The Geoplot Command","objectID":"/en/posts/statagis/:7:0","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#the-geoplot-command"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"Installing the Required Commands\rclear ssc install geoplot, replace ssc install palettes, replace ssc install colrspace, replace ssc install moremata, replace\r","date":"2024-03-22","heading":"Installing the Required Commands","objectID":"/en/posts/statagis/:7:1","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#installing-the-required-commands-1"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"Loading the Data\rcd F:\\桌面\\GIS_sum\\geoplot local url http://fmwww.bc.edu/repec/bocode/i/ geoframe create regions `url'Italy-RegionsData.dta, id(id) coord(xcoord ycoord) /// shpfile(Italy-RegionsCoordinates.dta) geoframe create country `url'Italy-OutlineCoordinates.dta geoframe create capitals `url'Italy-Capitals.dta, coord(xcoord ycoord) geoframe create lakes `url'Italy-Lakes.dta, feature(water) geoframe create rivers `url'Italy-Rivers.dta, feature(water)\rExplanation: geoframe create calls the named map label file, and id (unique identifier) coord (longitude and latitude) /// shpfile (map outline file) Each macro definition represents one layer. With these macro definitions, next time you only need to call the name to draw a map — less time and effort. ","date":"2024-03-22","heading":"Loading the Data","objectID":"/en/posts/statagis/:7:2","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#loading-the-data"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"Plotting\rBasic Command\rThe advantage of this command is that you can layer maps with simple parentheses. geoplot (area regions fortell, label(\"@lb-@ub (N=@n)\")) (line regions)\rarea means drawing an area map here, using the map outline of the regions macro; the plotting variable is fortell. label: on the map, these variables are replaced with their actual values. For example, if a region\u0026rsquo;s lower bound is 20, its upper bound is 50, and it contains 100 cells, the final label will read \u0026quot;20-50 (N=100)\u0026quot;. @lb: the lower bound of each region. @ub: the upper bound of each region. @n: the number of each region. line means calling the line plot of regions. Bubble Chart\rgeoplot /// (area regions) /// (point capitals i.size [w=pop98], color(Set1, opacity(50)) mlcolor(%0)) /// (label capitals city if pop98\u003e250000, color(black)) /// , legend compass sbar(length(300) units(km))\rBubble chart\r(area regions): draws the map area, representing the boundaries or extent of the geographic region. (point capitals i.size [w=pop98], color(Set1, opacity(50)) mlcolor(%0)): draws a scatter plot of cities, where city size is determined by i.size, colors use the Set1 palette, opacity is 50%, and the city label color is %0, i.e., black. City size is based on the pop98 variable, which represents the city\u0026rsquo;s population. (label capitals city if pop98\u0026gt;250000, color(black)): labels city names, but only for cities with population above 250,000, with black label color. , legend compass sbar(length(300) units(km)): adds a legend, compass, and scale bar. The scale bar length is 300 units, in kilometers. Zoomed-In Map\rgeoplot (area regions) /// (area regions if id==1, fc(Coral*.5) lc(gray)) /// (label regions region if id==1, color(black)) /// (area regions if id==1, fc(Coral) lc(gray) /* */ box(circle pad(5) fc(gs14))) /// (pie regions relig1 relig2 relig3 if id==1, lab(, reverse)) /// , legend(pos(se) rowgap(1)) zoom(4/5: 6 90 210)\r(area regions): draws the map area, representing the boundaries or extent of the geographic region. (area regions if id==1, fc(Coral*.5) lc(gray)): draws the map area of a specific region where id==1, with fill color Coral*.5 and gray boundary line color. (label regions region if id==1, color(black)): labels the name of the specific region, but only where id==1, with black label color. (area regions if id==1, fc(Coral) lc(gray) /* ... */ box(circle pad(5) fc(gs14))): draws the map area of a specific region where id==1, and adds a box around it with fill color Coral and gray boundary line color. (pie regions relig1 relig2 relig3 if id==1, lab(, reverse)): draws a pie chart in the specific region, but only where id==1. The pie chart includes the relig1, relig2, and relig3 variables, with labels reversed. , legend(pos(se) rowgap(1)): sets the legend position to the southeast, with row gap 1. zoom(4/5: 6 90 210): sets the map zoom ratio to 4/5 and specifies the displayed range. Zoomed-in map and pie chart\r","date":"2024-03-22","heading":"Plotting","objectID":"/en/posts/statagis/:7:3","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#plotting"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"Plotting\rBasic Command\rThe advantage of this command is that you can layer maps with simple parentheses. geoplot (area regions fortell, label(\"@lb-@ub (N=@n)\")) (line regions)\rarea means drawing an area map here, using the map outline of the regions macro; the plotting variable is fortell. label: on the map, these variables are replaced with their actual values. For example, if a region\u0026rsquo;s lower bound is 20, its upper bound is 50, and it contains 100 cells, the final label will read \u0026quot;20-50 (N=100)\u0026quot;. @lb: the lower bound of each region. @ub: the upper bound of each region. @n: the number of each region. line means calling the line plot of regions. Bubble Chart\rgeoplot /// (area regions) /// (point capitals i.size [w=pop98], color(Set1, opacity(50)) mlcolor(%0)) /// (label capitals city if pop98\u003e250000, color(black)) /// , legend compass sbar(length(300) units(km))\rBubble chart\r(area regions): draws the map area, representing the boundaries or extent of the geographic region. (point capitals i.size [w=pop98], color(Set1, opacity(50)) mlcolor(%0)): draws a scatter plot of cities, where city size is determined by i.size, colors use the Set1 palette, opacity is 50%, and the city label color is %0, i.e., black. City size is based on the pop98 variable, which represents the city\u0026rsquo;s population. (label capitals city if pop98\u0026gt;250000, color(black)): labels city names, but only for cities with population above 250,000, with black label color. , legend compass sbar(length(300) units(km)): adds a legend, compass, and scale bar. The scale bar length is 300 units, in kilometers. Zoomed-In Map\rgeoplot (area regions) /// (area regions if id==1, fc(Coral*.5) lc(gray)) /// (label regions region if id==1, color(black)) /// (area regions if id==1, fc(Coral) lc(gray) /* */ box(circle pad(5) fc(gs14))) /// (pie regions relig1 relig2 relig3 if id==1, lab(, reverse)) /// , legend(pos(se) rowgap(1)) zoom(4/5: 6 90 210)\r(area regions): draws the map area, representing the boundaries or extent of the geographic region. (area regions if id==1, fc(Coral*.5) lc(gray)): draws the map area of a specific region where id==1, with fill color Coral*.5 and gray boundary line color. (label regions region if id==1, color(black)): labels the name of the specific region, but only where id==1, with black label color. (area regions if id==1, fc(Coral) lc(gray) /* ... */ box(circle pad(5) fc(gs14))): draws the map area of a specific region where id==1, and adds a box around it with fill color Coral and gray boundary line color. (pie regions relig1 relig2 relig3 if id==1, lab(, reverse)): draws a pie chart in the specific region, but only where id==1. The pie chart includes the relig1, relig2, and relig3 variables, with labels reversed. , legend(pos(se) rowgap(1)): sets the legend position to the southeast, with row gap 1. zoom(4/5: 6 90 210): sets the map zoom ratio to 4/5 and specifies the displayed range. Zoomed-in map and pie chart\r","date":"2024-03-22","heading":"Basic Command","objectID":"/en/posts/statagis/:7:3","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#basic-command"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"Plotting\rBasic Command\rThe advantage of this command is that you can layer maps with simple parentheses. geoplot (area regions fortell, label(\"@lb-@ub (N=@n)\")) (line regions)\rarea means drawing an area map here, using the map outline of the regions macro; the plotting variable is fortell. label: on the map, these variables are replaced with their actual values. For example, if a region\u0026rsquo;s lower bound is 20, its upper bound is 50, and it contains 100 cells, the final label will read \u0026quot;20-50 (N=100)\u0026quot;. @lb: the lower bound of each region. @ub: the upper bound of each region. @n: the number of each region. line means calling the line plot of regions. Bubble Chart\rgeoplot /// (area regions) /// (point capitals i.size [w=pop98], color(Set1, opacity(50)) mlcolor(%0)) /// (label capitals city if pop98\u003e250000, color(black)) /// , legend compass sbar(length(300) units(km))\rBubble chart\r(area regions): draws the map area, representing the boundaries or extent of the geographic region. (point capitals i.size [w=pop98], color(Set1, opacity(50)) mlcolor(%0)): draws a scatter plot of cities, where city size is determined by i.size, colors use the Set1 palette, opacity is 50%, and the city label color is %0, i.e., black. City size is based on the pop98 variable, which represents the city\u0026rsquo;s population. (label capitals city if pop98\u0026gt;250000, color(black)): labels city names, but only for cities with population above 250,000, with black label color. , legend compass sbar(length(300) units(km)): adds a legend, compass, and scale bar. The scale bar length is 300 units, in kilometers. Zoomed-In Map\rgeoplot (area regions) /// (area regions if id==1, fc(Coral*.5) lc(gray)) /// (label regions region if id==1, color(black)) /// (area regions if id==1, fc(Coral) lc(gray) /* */ box(circle pad(5) fc(gs14))) /// (pie regions relig1 relig2 relig3 if id==1, lab(, reverse)) /// , legend(pos(se) rowgap(1)) zoom(4/5: 6 90 210)\r(area regions): draws the map area, representing the boundaries or extent of the geographic region. (area regions if id==1, fc(Coral*.5) lc(gray)): draws the map area of a specific region where id==1, with fill color Coral*.5 and gray boundary line color. (label regions region if id==1, color(black)): labels the name of the specific region, but only where id==1, with black label color. (area regions if id==1, fc(Coral) lc(gray) /* ... */ box(circle pad(5) fc(gs14))): draws the map area of a specific region where id==1, and adds a box around it with fill color Coral and gray boundary line color. (pie regions relig1 relig2 relig3 if id==1, lab(, reverse)): draws a pie chart in the specific region, but only where id==1. The pie chart includes the relig1, relig2, and relig3 variables, with labels reversed. , legend(pos(se) rowgap(1)): sets the legend position to the southeast, with row gap 1. zoom(4/5: 6 90 210): sets the map zoom ratio to 4/5 and specifies the displayed range. Zoomed-in map and pie chart\r","date":"2024-03-22","heading":"Bubble Chart","objectID":"/en/posts/statagis/:7:3","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#bubble-chart"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"Plotting\rBasic Command\rThe advantage of this command is that you can layer maps with simple parentheses. geoplot (area regions fortell, label(\"@lb-@ub (N=@n)\")) (line regions)\rarea means drawing an area map here, using the map outline of the regions macro; the plotting variable is fortell. label: on the map, these variables are replaced with their actual values. For example, if a region\u0026rsquo;s lower bound is 20, its upper bound is 50, and it contains 100 cells, the final label will read \u0026quot;20-50 (N=100)\u0026quot;. @lb: the lower bound of each region. @ub: the upper bound of each region. @n: the number of each region. line means calling the line plot of regions. Bubble Chart\rgeoplot /// (area regions) /// (point capitals i.size [w=pop98], color(Set1, opacity(50)) mlcolor(%0)) /// (label capitals city if pop98\u003e250000, color(black)) /// , legend compass sbar(length(300) units(km))\rBubble chart\r(area regions): draws the map area, representing the boundaries or extent of the geographic region. (point capitals i.size [w=pop98], color(Set1, opacity(50)) mlcolor(%0)): draws a scatter plot of cities, where city size is determined by i.size, colors use the Set1 palette, opacity is 50%, and the city label color is %0, i.e., black. City size is based on the pop98 variable, which represents the city\u0026rsquo;s population. (label capitals city if pop98\u0026gt;250000, color(black)): labels city names, but only for cities with population above 250,000, with black label color. , legend compass sbar(length(300) units(km)): adds a legend, compass, and scale bar. The scale bar length is 300 units, in kilometers. Zoomed-In Map\rgeoplot (area regions) /// (area regions if id==1, fc(Coral*.5) lc(gray)) /// (label regions region if id==1, color(black)) /// (area regions if id==1, fc(Coral) lc(gray) /* */ box(circle pad(5) fc(gs14))) /// (pie regions relig1 relig2 relig3 if id==1, lab(, reverse)) /// , legend(pos(se) rowgap(1)) zoom(4/5: 6 90 210)\r(area regions): draws the map area, representing the boundaries or extent of the geographic region. (area regions if id==1, fc(Coral*.5) lc(gray)): draws the map area of a specific region where id==1, with fill color Coral*.5 and gray boundary line color. (label regions region if id==1, color(black)): labels the name of the specific region, but only where id==1, with black label color. (area regions if id==1, fc(Coral) lc(gray) /* ... */ box(circle pad(5) fc(gs14))): draws the map area of a specific region where id==1, and adds a box around it with fill color Coral and gray boundary line color. (pie regions relig1 relig2 relig3 if id==1, lab(, reverse)): draws a pie chart in the specific region, but only where id==1. The pie chart includes the relig1, relig2, and relig3 variables, with labels reversed. , legend(pos(se) rowgap(1)): sets the legend position to the southeast, with row gap 1. zoom(4/5: 6 90 210): sets the map zoom ratio to 4/5 and specifies the displayed range. Zoomed-in map and pie chart\r","date":"2024-03-22","heading":"Zoomed-In Map","objectID":"/en/posts/statagis/:7:3","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#zoomed-in-map"},{"categories":["Software Tools","Economic Studies"],"collections":["GIS Practice","Stata Empirical Tools"],"content":"Map Usage Standards\rNotice of the Ministry of Natural Resources on Issuing the \u0026ldquo;Specifications for the Representation of Public Map Content\u0026rdquo; Use Maps Correctly — Not a Single Mistake Allowed TL;DR: using a single-province map or a street/township map is fine; using the full map of China is more troublesome. When using the full map of China, the scale and framing requirements are strict. Boundary lines: some national borders are temporarily undetermined or change slightly every year. Territory issues: Hong Kong, Macau, Taiwan, the islands of Hainan, the Diaoyu Islands, and so on. The nine-dash line must never be missing! Annotations of confidential data such as military-related information must not appear. It\u0026rsquo;s best to include a legend and compass, and keep them consistent with the official versions. For journals, it\u0026rsquo;s best to refer to: Standard Drawing of Map Illustrations in Scientific Journals and Common Problems For the most official maps, see: Standard Map Service. After drawing your own map, you can also submit it here for review. The official source does not provide shp files, only eps and jpg files. The \u0026ldquo;official\u0026rdquo; shp files circulating on the market are all made by individuals, so you need to check them carefully. ","date":"2024-03-22","heading":"Map Usage Standards","objectID":"/en/posts/statagis/:8:0","tags":["Stata","GIS"],"title":"Drawing GIS Choropleth Maps with Stata","uri":"/en/posts/statagis/#map-usage-standards"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Problem 1\rEnvironment: Hugo extended version + the LoveIt theme series Hugo generates a table of contents for every blog post, and the TOC headings should support click-to-jump. A few days ago I noticed that on my blog, the Chinese pages couldn\u0026rsquo;t jump to headings, while the English ones still could. Hugo TOC generation\r","date":"2024-03-21","heading":"Problem 1","objectID":"/en/posts/toc/:1:0","tags":["Hugo"],"title":"Table of Contents Navigation Fails on the Chinese Blog","uri":"/en/posts/toc/#problem-1"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"The cause\rAfter asking the doit theme maintainer, I got the cause of the error: I\u0026rsquo;d added a BGM to the page (as below) — this feature uses APIayer, and APIayer in turn calls smoothScroll. smoothScroll\u0026rsquo;s default settings use English parameters; after introducing APIayer to play music, the TOC jump return value becomes null. if (location.hash !== this.hash) window.history.pushState(null, null, this.hash) // using the history api to solve issue #1 - back doesn't work // most browser don't update :target when the history api is used: // THIS IS A BUG FROM THE BROWSERS. // change the scrolling duration in this call var node = document.getElementById(this.hash.substring(1)) if (!node) return; // Do not scroll to non-existing node\r","date":"2024-03-21","heading":"The cause","objectID":"/en/posts/toc/:2:0","tags":["Hugo"],"title":"Table of Contents Navigation Fails on the Chinese Blog","uri":"/en/posts/toc/#the-cause"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"The solution\rIn the end I found a solution in the blog post APlayer causing blog TOC navigation to fail. Modify APlayer.min.js in the \u0026lt;personal website\u0026gt;\\assets\\lib\\aplayer directory. The blogger 鱼の乐 has provided his modified APlayer.min.js. If the blogger\u0026rsquo;s domain hasn\u0026rsquo;t been renewed, you can refer to the file I copied: APlayer.min.js Just replace the whole file. These problems have been exposed since 2018, and it looks like there won\u0026rsquo;t be any maintenance going forward, so I suggest fixing it yourself. ","date":"2024-03-21","heading":"The solution","objectID":"/en/posts/toc/:3:0","tags":["Hugo"],"title":"Table of Contents Navigation Fails on the Chinese Blog","uri":"/en/posts/toc/#the-solution"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Problem 2\rWhen I added the giscus comment section, this problem appeared again? The previous solution also stopped working. Huge thanks here to @yllhwa for the help😍👍. Copy themes\\LoveIt\\assets\\data\\cdn\\jsdelivr.yml to \u0026lt;your website\u0026gt;\\assets\\data\\cdn\\jsdelivr.yml. Then comment out aplayerJS: aplayer@1.10.1/dist/APlayer.min.js. It seems it still comes down to a call problem\r","date":"2024-03-21","heading":"Problem 2","objectID":"/en/posts/toc/:4:0","tags":["Hugo"],"title":"Table of Contents Navigation Fails on the Chinese Blog","uri":"/en/posts/toc/#problem-2"},{"categories":["Economic Studies","Software Tools"],"collections":["Stata Empirical Tools"],"content":"When writing economic empirical papers, it is common to output a large number of tables (mainly descriptive statistics and regression results). Mastering instant table output techniques is like casting spells without incantations! When discussing variable selection with others, responding instantly feels just like this!\rCurrently, Stata has a plethora of corresponding commands—asdoc, outreg2, logout, estout. Here\u0026rsquo;s a brief summary of where each command is commonly used and its characteristics. ","date":"2024-03-13","heading":"","objectID":"/en/posts/regout/:0:0","tags":["Stata"],"title":"Stata Export Word Tables","uri":"/en/posts/regout/#"},{"categories":["Economic Studies","Software Tools"],"collections":["Stata Empirical Tools"],"content":"Estout: Versatile, LaTeX Output\restout is written by Professor Ben Jann from the University of Bern, Institute of Sociology. (The CODE_PLACEHOLDER_1 command was also developed by this expert). It excels in customization, making it a mainstream command for result outputs. Its most powerful feature is support for LaTeX export. ","date":"2024-03-13","heading":"Estout: Versatile, LaTeX Output","objectID":"/en/posts/regout/:0:1","tags":["Stata"],"title":"Stata Export Word Tables","uri":"/en/posts/regout/#estout-versatile-latex-output"},{"categories":["Economic Studies","Software Tools"],"collections":["Stata Empirical Tools"],"content":"Asdoc: Descriptive Statistics\rAdd asdoc to your operations to save the corresponding file. The downside is that regression table customization is poor and does not meet the general journal requirements. It is generally used only to display descriptive statistics. tabout supports powerful descriptive statistics custom tables. For the latest installation, see: [https://tabout.net.au/docs/home.php^1] ssc install asdoc, replace //Download command sysuse \"auto.dta\", clear //Use Stata’s built-in sample data asdoc sum price mpg rep78 trunk weight, dec(4) save(Table1_Descriptive_Statistics1.doc) title(\"Table 1 Descriptive Statistics 1\") asdoc reg price mpg rep78 trunk weight, robust, save(Table2_Basic_Regression.doc) title(\"Table 2 Basic Regression\")\rasdoc descriptive statistics\rasdoc regression statistics\r","date":"2024-03-13","heading":"Asdoc: Descriptive Statistics","objectID":"/en/posts/regout/:0:2","tags":["Stata"],"title":"Stata Export Word Tables","uri":"/en/posts/regout/#asdoc-descriptive-statistics"},{"categories":["Economic Studies","Software Tools"],"collections":["Stata Empirical Tools"],"content":"Logout: Mean Difference and Correlation Coefficient Tests\rlogout stands out by being able to output mean difference tests and correlation coefficient tests in addition to descriptive statistics and regression results1. ssc install logout //Download command ************Descriptive Statistics***************** sysuse \"auto.dta\", clear //Use Stata’s built-in sample data //Output to Word (RTF format) logout, save(Filename) word replace: /// tabstat price wei len mpg rep78, /// stats(mean sd min p50 max) c(s) f(%6.2f) //Output to Excel (XML format) logout, save(Filename) excel replace: /// tabstat price wei len mpg rep78, /// ************Mean Difference Tests***************** ssc install ttable2 //Mean t-tests by Professors Li Chuntao and Zhang Xuan from Zhongnan University of Economics and Law logout, save(Filename) word excel replace: /// ttable2 price mpg trunk trunk weight length turn headroom, /// by(foreign) f(%12.3f) ************Correlation Coefficient Tests***************** logout, save(Correlation_File_Name) word excel replace: /// pwcorr_a rep78 headroom trunk weight length, /// star1(0.01) star5(0.05) star10(0.1) //Add * annotations\rlogout correlation coefficient output\r","date":"2024-03-13","heading":"Logout: Mean Difference and Correlation Coefficient Tests","objectID":"/en/posts/regout/:0:3","tags":["Stata"],"title":"Stata Export Word Tables","uri":"/en/posts/regout/#logout-mean-difference-and-correlation-coefficient-tests"},{"categories":["Economic Studies","Software Tools"],"collections":["Stata Empirical Tools"],"content":"Outreg2: Regression Output\rFor table outputs, I choose outreg2! Tables are aesthetically pleasing, support Word, and are convenient to export. The command ssc hot, n(10) will show the top 10 most popular Stata commands. outreg ranks first! Stata external command rankings\rssc install outreg2 //Download command webuse grunfeld,clear //Use default data xtset company year //Define panel data ************Descriptive Statistics***************** outreg2 using Filename.doc, replace sum(log) keep(company year invest mvalue kstock time) eqkeep(N min mix) title(Descriptive statistics) ************Regression Results Output***************** //Perform random effects, fixed effects, and mixed effects regression, then merge //Starting a new table or merging corresponds to replace and append xtreg invest mvalue kstock, re outreg2 using Filename.doc, replace tstat bdec(4) tdec(4) rdec(4) ctitle(RE) keep(mvalue kstock) e(r2_a,F) addstat(F test, e(p)) addtext(Company FE, NO, Year FE, NO) xtreg invest mvalue kstock i.year, fe outreg2 using Filename.doc, append tstat bdec(4) tdec(4) rdec(4) ctitle(FE) keep(mvalue kstock) e(r2_a,F) addstat(F test, e(p)) addtext(Company FE, YES, Year FE, YES) reg invest mvalue outreg2 using Filename.doc, append tstat bdec(4) tdec(4) rdec(4) ctitle(OLS) keep(mvalue) e(r2_a,F) addstat(F test, e(p)) addtext(Company FE, YES, Year NO, NO) //bdec(4) tdec(4) rdec(4) represent decimal places for coefficients, t-tests, and R^2 respectively //addstat and addtext correspond to adding statistics and table content //keep(var1 var2 var3) selects the output coefficients to keep\routreg2 regression output\r","date":"2024-03-13","heading":"Outreg2: Regression Output","objectID":"/en/posts/regout/:0:4","tags":["Stata"],"title":"Stata Export Word Tables","uri":"/en/posts/regout/#outreg2-regression-output"},{"categories":["Economic Studies","Software Tools"],"collections":["Stata Empirical Tools"],"content":"Putdocx Series: Unified Solution\rThe docx series commands are developed by Crawler Club. Most of the above commands (not including asdoc) mean that a table output takes up a separate Word file. The docx series allows reusing a single file. ssc install sum2docx, replace ssc install corr2docx, replace ssc install t2docx, replace ssc install reg2docx, replace\rThe following example code is from \u0026ldquo;Jun Sheng Wo Wei Sheng! Stata Output: One-Click Paper Tables - reg2docx-corr2docx.\u0026rdquo; clear all set more off putdocx begin //Create a new Word document putdocx paragraph, halign(center) //Center the paragraph *-Define font, size, and basic settings putdocx text (\"Attachment: Tables to be inserted in the article\"), /// font(\"Huawei Kaiti\", 16, black) bold linebreak *-Save the Word document as My_Table.docx putdocx save \"My_Table.docx\", replace *-Load data sysuse \"auto.dta\", clear *-----Table 1----- sum2docx price-length using \"My_Table.docx\", append /// obs mean(%9.2f) sd min(%9.0g) median(%9.0g) max(%9.0g) /// title(\"Table 1: Descriptive Statistics\") *-Note: The append option adds this new table to the end of \"My_Table.docx\". *-----Table 2----- putdocx begin putdocx pagebreak putdocx save \"My_Table.docx\", append corr2docx price-length using \"My_Table.docx\", append /// star(* 0.05) fmt(%4.2f) /// title(\"Table 2: Correlation Matrix\") *-----Table 3----- putdocx begin putdocx pagebreak putdocx save \"My_Table.docx\", append t2docx price-length using \"My_Table.docx\", append /// by(foreign) title(\"Table 3: Between-Group Mean Difference t-Test\") *-----Table 4----- putdocx begin putdocx pagebreak putdocx save \"My_Table.docx\", append reg price mpg weight length est store m1 reg price mpg weight length foreign est store m2 probit foreign price weight length est store m3 reg2docx m1 m2 m3 using \"My_Table.docx\", append /// r2(%9.3f) ar2(%9.2f) b(%9.3f) t(%7.2f) /// title(\"Table 4: Regression Results\") shellout \"My_Table.docx\" //Done! Open the generated Word document\r","date":"2024-03-13","heading":"Putdocx Series: Unified Solution","objectID":"/en/posts/regout/:0:5","tags":["Stata"],"title":"Stata Export Word Tables","uri":"/en/posts/regout/#putdocx-series-unified-solution"},{"categories":["Economic Studies","Software Tools"],"collections":["Stata Empirical Tools"],"content":"Etable: Supports Chinese\rThe output command built into Stata 17 is not very user-friendly but seems to be the only one2 that supports Chinese encoding. clear input str6 Gender Income Expenditure Others \"Male\" 8 1 90 \"Female\" 9 2 21 \"Female\" 10 3 22 \"Male\" 11 4 31 \"Male\" 1 6 49 \"Female\" 2 7 95 \"Female\" 3 8 86 \"Male\" 4 9 17 end reg Expenditure Income Others if Gender == \"Male\", robust est store Male_Regression reg Expenditure Income Others if Gender == \"Female\", robust est store Female_Regression reg Expenditure Income Others, robust est store Overall_Regression etable, estimates(Male_Regression Female_Regression Overall_Regression) column(estimates) keep(Income Others) /// cstat(_r_b, nformat(%9.3f)) /// cstat(_r_se, nformat(%9.3f)) /// mstat(N, nformat(%9.0f)) /// mstat(r2, nformat(%9.3g)) /// stars(0.10 \"*\" .05 \"**\" .01 \"***\", attach(_r_b)) /// showstars showstarsnote /// title(\"Table 1: Etable Regression Results\") /// note(\"Data source: custom\") /// export(\"Filename.docx\")\retable regression command\r","date":"2024-03-13","heading":"Etable: Supports Chinese","objectID":"/en/posts/regout/:0:6","tags":["Stata"],"title":"Stata Export Word Tables","uri":"/en/posts/regout/#etable-supports-chinese"},{"categories":["Economic Studies","Software Tools"],"collections":["Stata Empirical Tools"],"content":"Code for Illustrations in This Article\rFrom Crawler Club WeChat Account clear set obs 12 gen x = _n gen y = x + uniform() gen emoji = ustrunescape(\"\\U0001f400\") if x == 1 replace emoji = ustrunescape(\"\\U0001f430\") if x == 2 replace emoji = ustrunescape(\"\\U0001f439\") if x == 3 replace emoji = ustrunescape(\"\\U0001f411\") if x == 4 replace emoji = ustrunescape(\"\\U0001f410\") if x == 5 replace emoji = ustrunescape(\"\\U0001f404\") if x == 6 replace emoji = ustrunescape(\"\\U0001f408\") if x == 7 replace emoji = ustrunescape(\"\\U0001f412\") if x == 8 replace emoji = ustrunescape(\"\\U0001f434\") if x == 9 replace emoji = ustrunescape(\"\\U0001f437\") if x == 10 replace emoji = ustrunescape(\"\\U0001f418\") if x == 11 replace emoji = ustrunescape(\"\\U0001f43a\") if x == 12 scatter y x, msymbol(none) mlabel(emoji) mlabposition(0) mlabsize(huge) graph export animals.svg, replace shellout animals.svg\r","date":"2024-03-13","heading":"Code for Illustrations in This Article","objectID":"/en/posts/regout/:0:7","tags":["Stata"],"title":"Stata Export Word Tables","uri":"/en/posts/regout/#code-for-illustrations-in-this-article"},{"categories":["Economic Studies","Software Tools"],"collections":["Stata Empirical Tools"],"content":"Footnotes\rCorrelation coefficients seem to be outputtable only by logout. All previous commands result in garbled text when loading Chinese variable names. ","date":"2024-03-13","heading":"Footnotes","objectID":"/en/posts/regout/:1:0","tags":["Stata"],"title":"Stata Export Word Tables","uri":"/en/posts/regout/#footnotes"},{"categories":["Software Tools"],"collections":["Python Environment Setup"],"content":"Today, when I ran Anaconda, it suddenly could not open the startup interface, but I could directly open and run Jupyter and Notebook. The error situation is shown in the picture below. I can\u0026rsquo;t understand this either\rThe commonly used solutions online did not work, but I will still list them here. Upgrade the installation packages, conda update navigator conda update anaconda-navigator conda update conda conda update --all\rDelete files Delete the .condarc file (usually found in C drive, Users, Current User). There was no similar situation online, and in the end, I opened the Anaconda Powershell Prompt and saw the specific issue, which was a problem with path recognition. I can\u0026rsquo;t understand this either\rThe reason was a conflict in Windows environment variables: my user variable path and system variable path settings conflicted and were inconsistent. This caused Anaconda in the user variable to be recognized as the Java environment in the system variable. Solution: unify user variables and system variables, or delete Java path\rSolution: unify user variables and system variables, or delete the Java path. Personally, it was because an invalid path blocked the way. I deleted the incorrect Java path: %Java_Home%\\bin;%Java_Home%\\jre\\bin. After that, I checked that the Java environment was not affected, and the Anaconda environment was restored. ","date":"2024-03-10","heading":"","objectID":"/en/posts/anaconda/:0:0","tags":["Anaconda","Python"],"title":"[Anaconda Error Solution] Anaconda bytes object has no attribute get","uri":"/en/posts/anaconda/#"},{"categories":["Travel"],"collections":[],"content":" Time: March 2024. I landed in Wuhan at 11:00 and my next flight was at 17:10, which gave me 6 hours and 50 minutes for the layover. Wuhan is one of the main transfer airports for northbound flights in China, and plenty of routes come with a long layover here. Yellow Crane Tower is famous, and the airport connects directly to it by metro, so if you have the time, it\u0026rsquo;s worth doing a quick run. ","date":"2024-03-10","heading":"","objectID":"/en/posts/hxl/:0:0","tags":["Travel"],"title":"Tianhe Airport Layover Guide: A Quick Trip to Yellow Crane Tower (6 h)","uri":"/en/posts/hxl/#"},{"categories":["Travel"],"collections":[],"content":"I. Airport prep\rFollow the WeChat account \u0026ldquo;Transfer Passenger Service\u0026rdquo;. The transfer service gives out free meal vouchers and luggage storage, and you can also book through-check baggage in advance. Through-checked baggage: This needs to be booked ahead of time and lets your checked luggage transfer seamlessly to the next flight. Transit meal: Tap to get the QR code. It can be used at the restaurant at the end of Corridor A in the departure hall outside security. You can redeem either a 30-yuan meal voucher or a small gift. I picked the 30-yuan chicken set at \u0026ldquo;食尚坊,\u0026rdquo; which also came with an egg and soy milk. My companion ordered a 26-yuan plate of hot dry noodles instead. Compared with the chicken set, that felt like a terrible deal. The 30-yuan chicken set at \u0026ldquo;食尚坊\u0026rdquo;: chicken stewed with mushrooms, steamed egg, rice, plus the extra egg and soy milk\rLuggage storage: Tap to get the QR code. The storage point is at the JD Express counter at the end of Corridor F in the departure hall outside security. Requirements: registration with your ID card, just like airport security. Items that cannot be checked, such as power banks, are not accepted for storage. Please forgive the overexposure on my phone camera\rI did not use through-checked baggage on this quick trip. I landed at 11:00, picked up my luggage, stored it, had lunch, and by then it was exactly 12:00. ","date":"2024-03-10","heading":"I. Airport prep","objectID":"/en/posts/hxl/:1:0","tags":["Travel"],"title":"Tianhe Airport Layover Guide: A Quick Trip to Yellow Crane Tower (6 h)","uri":"/en/posts/hxl/#i-airport-prep"},{"categories":["Travel"],"collections":[],"content":"II. Metro ride\rMetro route: Line 2 $ \\rightarrow$ Jiyuqiao $\\rightarrow$ Pengliuyang Metro Station $ \\xrightarrow {步行} $ Yellow Crane Tower Pengliuyang Metro Station: both Exit A and Exit C work if you want to get out and spot Yellow Crane Tower right away, but I recommend Exit C because that is where the internet-famous wall is. I got on the airport metro at 12:00 sharp and reached the entrance to the Yellow Crane Tower scenic area at 13:10. The internet-famous wall. I blurred the photo a bit for portrait privacy.\r","date":"2024-03-10","heading":"II. Metro ride","objectID":"/en/posts/hxl/:2:0","tags":["Travel"],"title":"Tianhe Airport Layover Guide: A Quick Trip to Yellow Crane Tower (6 h)","uri":"/en/posts/hxl/#ii-metro-ride"},{"categories":["Travel"],"collections":[],"content":"III. The tower\rYou can buy tickets through a WeChat mini-program. Student tickets are half price at 35 yuan. If you do not have your student ID with you, you can verify your status through Xuexin (also via WeChat mini-program). Special thanks to @leland for being my guide. There is one main route up the tower. On each floor, you circle around once before reaching the staircase to the next level. The way down is a different corridor, and it leads straight down continuously. Honestly, there is not that much to do inside\rFrom the higher levels of Yellow Crane Tower, you can look out over both the newer red bridge and the older white bridge spanning the Yangtze. (I forgot to take a photo.) After finishing the visit, I walked back to the metro station. The whole visit took no more than 40 minutes, and the time was 13:50. I then spent about an hour on the metro back and got to the airport around 15:00. That still left an hour to retrieve my stored luggage, clear security, and get ready to board. By 16:00, the quick run was complete. ","date":"2024-03-10","heading":"III. The tower","objectID":"/en/posts/hxl/:3:0","tags":["Travel"],"title":"Tianhe Airport Layover Guide: A Quick Trip to Yellow Crane Tower (6 h)","uri":"/en/posts/hxl/#iii-the-tower"},{"categories":["Travel"],"collections":[],"content":"IV. In short\rAfter arriving at the airport, Spend one hour storing your luggage and eating lunch. Spend one hour taking the metro and walking to Yellow Crane Tower. Forty minutes is enough to see Yellow Crane Tower. Spend one hour heading back from Yellow Crane Tower. Spend one hour at the airport handling the return procedures. ","date":"2024-03-10","heading":"IV. In short","objectID":"/en/posts/hxl/:4:0","tags":["Travel"],"title":"Tianhe Airport Layover Guide: A Quick Trip to Yellow Crane Tower (6 h)","uri":"/en/posts/hxl/#iv-in-short"},{"categories":["Film and TV"],"collections":[],"content":" Xiangzi went to his death convinced that he simply had not tried hard enough. Of course, Xiangzi kept his eyes fixed on the outside world. He thought he saw society clearly, yet missed one thing: when you only look outward, you can take in every corner of the world outside you, but you still cannot see yourself. And if you cannot see yourself, you cannot begin to talk about yourself in relation to your time. As protagonists, we are always looking outward. Only as readers can we watch \u0026ldquo;the world and me,\u0026rdquo; and then turn back to examine ourselves. That is why Lu Zhishen could say, \u0026ldquo;Only today do I finally know who I am.\u0026rdquo; I think that is exactly the point. Good television often has this kind of turn, like a beautiful painting: bright surface color alone can move the viewer, but if the hidden structure and ideas underneath move you further, then it becomes art. For me, the 2023 conversation around fate falls into two camps: the chroniclers and the absurdists. ","date":"2024-03-08","heading":"","objectID":"/en/posts/kj_2024/:0:0","tags":["TV Series"],"title":"2024 viewing roundup: a few ways of living with fate","uri":"/en/posts/kj_2024/#"},{"categories":["Film and TV"],"collections":[],"content":"Blossoms Shanghai and The Long Season\rBlossoms Shanghai and The Long Season belong to the chronicler camp. People always seem at a loss when history starts moving under their feet. The Long Season asks why Wang Xiang, a model worker, could still be laid off; why his son became a murderer; why nobody around him ever quite figured out how to live. One snowfall lasts twenty years. He never gets over that ridge, and keeps trying to dig old ghosts out of the world. Shen Mo asks Wang Yang, \u0026ldquo;Do you believe in fate?\u0026rdquo; Wang Xiang and Biaozi can no longer make sense of life either, so they too begin to call it \u0026ldquo;fate.\u0026rdquo; In Blossoms Shanghai, Wong Kar-wai stages a whole chain of missed connections1. A Bao and four women—Xuezhi, Lingzi, Miss Wang, and Li Li—keep missing one another. Wealth, place, status, and experience never quite line up, so feelings have to twist and double back. The show says, \u0026ldquo;From Zhenyuan Garden on, every ending had already been decided,\u0026rdquo; and \u0026ldquo;Everything is inevitable fate.\u0026rdquo; The novel ends with a line like this: walking through the whirlpool of fate, people eventually drift apart, until only you are left. ","date":"2024-03-08","heading":"","objectID":"/en/posts/kj_2024/:1:0","tags":["TV Series"],"title":"2024 viewing roundup: a few ways of living with fate","uri":"/en/posts/kj_2024/#blossoms-shanghai-and-the-long-season"},{"categories":["Film and TV"],"collections":[],"content":"Only the River Flows and Journey to the West\rOnly the River Flows and Journey to the West belong to the absurdist camp. When too many low-probability events pile up together, they leave people bewildered. In Only the River Flows, Ma Zhe refuses to accept that a madman could be the killer, and drifts farther and farther from the truth. The film quotes Camus: \u0026ldquo;Human beings cannot understand fate, so I disguised myself as fate. I put on God\u0026rsquo;s stupid and incomprehensible face.\u0026rdquo; In Journey to the West, Tang Zhijun believes fate is guiding him toward extraterrestrials. Every coincidence is inevitable. When we stay only inside the protagonist\u0026rsquo;s point of view, we always look outward, free to mock Kong Yiji. But as readers, we can feel that each of them is taking a different stance toward fate. ","date":"2024-03-08","heading":"","objectID":"/en/posts/kj_2024/:2:0","tags":["TV Series"],"title":"2024 viewing roundup: a few ways of living with fate","uri":"/en/posts/kj_2024/#only-the-river-flows-and-journey-to-the-west"},{"categories":["Film and TV"],"collections":[],"content":"The Long Season is reconciliation\rOne snowfall lasts twenty years. That is long enough, just as a truth can wait twenty years before finally coming to light. Wang Yang\u0026rsquo;s poem\rSnap your fingers, he said let\u0026rsquo;s snap together in resonance distant things will be shaken to pieces the people in front of us still do not know it yet Blow a whistle, I said, blow a slanting whistle like a piece of iron, then a needle, the arc of magnetic poles brushing past green glass Drink a glass of water, and watch the river when it is calm, calm, when it is not calm, we miss one layer of steps a small tear falls on stone and will not dry for a long time the whole season turns it into amber, flowing in a solid stream, the particular light behind it comes from distant things Wang Xiang answers to that finger snap: one case keeps him from getting over it for twenty years. At first, he believes that as long as he works hard and earns merit, he can avoid being laid off. Then the reversal arrives, at the workers\u0026rsquo; assembly, when the truth comes out: the factory owner can fire whoever he wants and keep whoever he wants. It was the plant director who organized the stripping of assets. Wang Xiang\u0026rsquo;s lifelong pride in Northeast industry finally shatters. Beneath the murder mystery, what is really rotting is the Northeast itself. An individual cannot withstand the upheavals of an era. At best, he can do what One Sentence Is Worth Ten Thousand Sentences suggests: hold on to the answer he needs and keep looking ahead. Fate cannot be resisted. People eventually have to learn to move forward. So the train begins to sound again, rolling slowly along the tracks through the cornfields. ","date":"2024-03-08","heading":"","objectID":"/en/posts/kj_2024/:3:0","tags":["TV Series"],"title":"2024 viewing roundup: a few ways of living with fate","uri":"/en/posts/kj_2024/#the-long-season-is-reconciliation"},{"categories":["Film and TV"],"collections":[],"content":"Blossoms Shanghai is also reconciliation\rA Bao can walk in and become Bao Zong, then walk out willing to be A Bao again, calm and unhurried2, still holding on to The Count of Monte Cristo\u0026rsquo;s motto: In the face of fate, there are only two words: wait and hope. ","date":"2024-03-08","heading":"","objectID":"/en/posts/kj_2024/:4:0","tags":["TV Series"],"title":"2024 viewing roundup: a few ways of living with fate","uri":"/en/posts/kj_2024/#blossoms-shanghai-is-also-reconciliation"},{"categories":["Film and TV"],"collections":[],"content":"Only the River Flows is just plain madness\rThe absurdist camp only raises the predicament; it never answers it. People cannot fight the era. That is where it stops. Once you understand that, you understand Cthulhu: there is no solution, and because people still want one, they go mad. Absurd events naturally have no answer, because we cannot understand them. Reality simply keeps flowing without pity—Only The River Flows\u0026hellip; ","date":"2024-03-08","heading":"","objectID":"/en/posts/kj_2024/:5:0","tags":["TV Series"],"title":"2024 viewing roundup: a few ways of living with fate","uri":"/en/posts/kj_2024/#only-the-river-flows-is-just-plain-madness"},{"categories":["Film and TV"],"collections":[],"content":"Journey to the West is waking up\rLike the party in Journey to the West, the main group maps onto Tang, Sun, Sha, and Zhu as they head west. Tang Zhijun wants to find his own true scripture—an alien. On the surface, they are looking for extraterrestrials. In truth, they are looking for an answer. An unhappy marriage, a bruising working life, the meaning of human existence—if human beings cannot solve these things, then could aliens? It looks like an obsession with science fiction, but underneath it is still a life cast adrift. The ending wants to turn back inward: searching for aliens is an outward move, and maybe it is unnecessary. Human beings are already a miracle, so at last one lets go. But the film does not unfold that process very smoothly. ","date":"2024-03-08","heading":"","objectID":"/en/posts/kj_2024/:6:0","tags":["TV Series"],"title":"2024 viewing roundup: a few ways of living with fate","uri":"/en/posts/kj_2024/#journey-to-the-west-is-waking-up"},{"categories":["Film and TV"],"collections":[],"content":"Living with fate\rWhen human smallness runs into an era the people inside it cannot understand, we use \u0026ldquo;fate\u0026rdquo; as a convenient blur. Those who come later, and those watching from outside, usually see more clearly. But when it lands on your own head, you still get dizzy. That is the scale of fate. Most people question fate, and the answers are always some version of this: \u0026ldquo;There is only relative fairness, never absolute fairness\u0026rdquo;; \u0026ldquo;Heroism is seeing the world clearly and still loving it\u0026rdquo;; \u0026ldquo;The world has kissed me with pain, and I answer with song.\u0026rdquo; At that point, truth is not the important thing. What matters is holding on to a philosophy of survival. Right or wrong, anything that helps us keep the will to go on living has some value. But when someone really wants to understand the relationship between a person and the tide of history, these answers are not enough3. Either you fall into madness, or you learn to compromise—accept everything, live for tomorrow, keep looking ahead. That is survival philosophy. Some things have already been proven impossible, and still your hands itch to go after them. That is fate and human beings. Giving up on thinking is one answer. Thinking until you collapse is another. Thinking until you compromise is another. Those, I suppose, are a few ways of getting along with fate. Honestly, online marketing is terrifying. See You Tomorrow has already been quietly forgotten in the corner and somehow rehabilitated.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Keynesians object to the idea that the market is always right.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Because this question usually appears in moments of historical tragedy, we tend to assume that individuals cannot resist their era, and \u0026ldquo;fate\u0026rdquo; becomes a gray, heavy word.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2024-03-08","heading":"Living with fate","objectID":"/en/posts/kj_2024/:7:0","tags":["TV Series"],"title":"2024 viewing roundup: a few ways of living with fate","uri":"/en/posts/kj_2024/#living-with-fate"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Introduction\rWhat is a web crawler? It\u0026rsquo;s scraping that follows \u0026ldquo;what you see is what you get\u0026rdquo;. Every website has source code, and that source code naturally contains the information the website displays. When you grab the source code, data and code are mixed together; we then clean it up to get clean data. The Stata code is attached at the end. Crawler code isn\u0026rsquo;t very reusable; this post mainly documents my web scraping learning process. Crawler workflow\rFor the whole crawling process, getting the website\u0026rsquo;s source code is the most critical step. For heavily encrypted websites (like \u0026ldquo;China Judgments Online\u0026rdquo;), you\u0026rsquo;d also need to spoof IPs, switch between multiple accounts, and break through text encryption — unfortunately Stata can\u0026rsquo;t do any of that. What Stata is good at is crawling defenseless websites and then quickly cleaning and processing the data. Although the part Stata is good at — \u0026ldquo;splitting code and data\u0026rdquo; — is just a matter of practice, using Stata for a first taste of web scraping is still pretty friendly for an individual. ","date":"2024-03-06","heading":"Introduction","objectID":"/en/posts/pachong/:1:0","tags":["Stata","Web Scraping"],"title":"Stata: Learning Web Scraping","uri":"/en/posts/pachong/#introduction"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"1. Grabbing the Page Source Code\rThe data website: the land market database of the Guoxin Real Estate Information Network. The page looks like this: Some schools have purchased this database; see if you can log in via IP. You can spoof your IP to log in with Python, but Stata seems unable to do that for now. This post is only for learning. Website\rRight-click — Inspect — in the panel on the right, click into \u0026ldquo;Network\u0026rdquo;. As shown\rThen we switch the page number of the website; the website updates its data, and on the right we get the corresponding source code for the data change. Source code\rFor this website\u0026rsquo;s data-switching source code, switching a few times reveals that what controls the page change is the code p=2. Likewise, when p=1, it corresponds to the first page of data. When you hit an encrypted website, this work gets much harder. http://www.crei.cn/tudi/tudibr1.aspx?p=2\u0026x=a0f010000\u0026k=\u0026k1=\u0026k2=\u0026k3=\u0026k4=\u0026c=\u0026j1=0\u0026j2=0\u0026m1=0\u0026m2=0\r","date":"2024-03-06","heading":"1. Grabbing the Page Source Code","objectID":"/en/posts/pachong/:2:0","tags":["Stata","Web Scraping"],"title":"Stata: Learning Web Scraping","uri":"/en/posts/pachong/#1-grabbing-the-page-source-code"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"2. Web Scraping in Stata\r","date":"2024-03-06","heading":"2. Web Scraping in Stata","objectID":"/en/posts/pachong/:3:0","tags":["Stata","Web Scraping"],"title":"Stata: Learning Web Scraping","uri":"/en/posts/pachong/#2-web-scraping-in-stata"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"1. Importing the Website\rFirst set the working path: *-website: Guoxin Real Estate Transaction Network: http://www.crei.cn/tudi/index.aspx *-time: February 2024 *-set the working path clear all global path \"F:\\桌面\\stata土地网爬虫\" global prcs \"$path\\process\" cd \"$D\" set scheme s2color //plot style\rThen import the website, using Stata\u0026rsquo;s copy command to pull in the source code. Use unicode to set the encoding as needed to avoid garbled text. *-[1] import the url copy \"http://www.crei.cn/tudi/tudibr1.aspx?p=1\u0026x=a0f000000\u0026k=\u0026k1=\u0026k2=\u0026k3=\u0026k4=\u0026c=\u0026j1=0\u0026j2=0\u0026m1=0\u0026m2=0 \" \"test.txt\", replace *-Note: set the font format to avoid garbled text, and force-delete the backup file at the end *-Note: store characters 1 to 200000 and label them as variable v local file = \"test.txt\" unicode analyze \"`file'\" unicode encoding set gb18030 local file = \"test.txt\" unicode translate \"`file'\", transutf8 unicode erasebackups, badidea local file = \"test.txt\" infix strL v 1-200000 using \"`file'\",clear\rYou can compare the page source code in Stata (after entering the website, right-click and view the page source). See the figure below: stata\r","date":"2024-03-06","heading":"1. Importing the Website","objectID":"/en/posts/pachong/:3:1","tags":["Stata","Web Scraping"],"title":"Stata: Learning Web Scraping","uri":"/en/posts/pachong/#1-importing-the-website"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"2. Initial Splitting\rkeep command: keeps which rows of the Stata data. split command: splits the table content by a certain symbol into multiple cells. sxpose command: transposes and rearranges the data. Looking at the page source, we can see the data we want is all in the row with \u0026lt;font face=\u0026quot;宋体\u0026quot;\u0026gt;. The real-estate entries are separated by \u0026lt;tr onmouseover=this..... The closing code \u0026lt;/table\u0026gt;\u0026lt;br\u0026gt;\u0026lt;center\u0026gt; should also be deleted. After splitting, transpose it. *-[2] initial data splitting *-Note: use the split function to split the retained data; this part requires knowing regular expressions *-Note: inspect the page source and keep the rows where the needed data lives; note the data uses SimSun keep if index (v,`\"\"') split v ,p(`\" \"') *-Note: also remove the extra parts at the end of this code: v 211 and v 212 split v 21 ,p(`\" \"') * Drop v v 1 v 212 v 21 Rename v 211 v 21 Sxpose ,clear *-Note: sxpose transposes and rearranges the data\rAs shown, up to this point the first 20 records of the first page have been scraped and given an initial split. Splitting\r","date":"2024-03-06","heading":"2. Initial Splitting","objectID":"/en/posts/pachong/:3:2","tags":["Stata","Web Scraping"],"title":"Stata: Learning Web Scraping","uri":"/en/posts/pachong/#2-initial-splitting"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"3. Further Splitting\rreplace: replace the code to be split with \u0026ldquo;滑翔闪\u0026rdquo; or \u0026quot;\u0026quot; (empty) to mean deletion, then split it all at once. *-[3] further split the data *-Note: replace the unwanted middle characters with the Zhihu user \"滑翔闪\"! replace _var = subinstr (_var,`\" \"',\"滑翔闪\",.) replace _var = subinstr (_var,`\" \"' ,\"滑翔闪\", .) replace _var = subinstr (_var,`\" \"',\"滑翔闪\",.) replace _var = subinstr (_var,`\" \"',\"滑翔闪\",.) replace _var = subinstr (_var,`\" \"',\"滑翔闪\",.) Replace _var = subinstr (_var,`\" *** *** \"',\"滑翔闪\",.) replace _var = subinstr (_var,`\" \"',\"滑翔闪\",.) replace _var = subinstr (_var,`\"'\u003e *** \"',\"\",.) *-Note: do it for me — land a Fire Punch on the character \"滑翔闪\"! Split _var ,p(`\"滑翔闪\"') Drop _var 1\r","date":"2024-03-06","heading":"3. Further Splitting","objectID":"/en/posts/pachong/:3:3","tags":["Stata","Web Scraping"],"title":"Stata: Learning Web Scraping","uri":"/en/posts/pachong/#3-further-splitting"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"4. Organizing and Saving\r*-[4] add variable labels Ren _var 11 城市 Ren _var 12 ID Ren _var 13 ID 2 Ren _var 14 地块 Ren _var 15 代码 Ren _var 16 地块 2 Ren _var 17 类型 Ren _var 18 用途 Ren _var 19 结果 Ren _var 110 编码 Ren _var 111 起始价 Ren _var 112 成交价 Ren _var 113 出让日期 Ren _var 114 成交日期 *-[5] save the data Save \"$path\\爬虫土地. Dta\", replace\rThe starting price and transaction price parts are encrypted with JS, so they can\u0026rsquo;t be scraped; this post mainly documents the principles and workflow of crawling. The starting price and transaction price parts are encrypted with JS, so they can\u0026rsquo;t be scraped; this post mainly documents the principles and workflow of crawling\rStata can\u0026rsquo;t log in with an IP and account, so it can\u0026rsquo;t scrape the prices. ","date":"2024-03-06","heading":"4. Organizing and Saving","objectID":"/en/posts/pachong/:3:4","tags":["Stata","Web Scraping"],"title":"Stata: Learning Web Scraping","uri":"/en/posts/pachong/#4-organizing-and-saving"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"5. Scraping Multiple Pages\rForvalues: a Stata loop command. By replacing p=1 in the source code with p=`i\u0026rsquo;, you can scrape in a loop. Note that often the first page and the pages after the second page are scraped differently; for example, on this website the ending page-number code differs. Because the land market network is encrypted, Stata can only scrape the first and second pages. *====================================== * Part 2 scrape multiple pages (133 pages total) * data source: Guoxin Real Estate Transaction Network - land market data *====================================== Forvalues i = 2/133{ //use a loop to scrape pages 2-133 and merge them with page 1 Di `i' Clear *-[1] import the url qui copy \"http://www.crei.cn/tudi/tudibr1.aspx?p=`i'\u0026x=a 00000000\u0026k=\u0026k 1=\u0026k 2=\u0026k 3=\u0026k 4=\u0026c=\u0026j 1=0\u0026j 2=0\u0026m 1=0\u0026m 2=0\" \"test`i'. Txt\", replace *-Note: set the font format to avoid garbled text, and force-delete the backup file at the end *-Note: store characters 1 to 200000 and label them as variable v Qui local file`i' = \"test`i'. Txt\" Qui unicode analyze \"`file`i''\" Qui unicode encoding set gb 18030 Qui unicode translate \"`file`i''\", transutf 8 Qui unicode erasebackups, badidea Qui infix strL v 1-200000 using \"test`i'. Txt\", clear *-[2] initial data splitting *-Note: use the split function to split the retained data; this part requires knowing regular expressions *-Note: inspect the page source and keep the rows where the needed data lives; note the data uses SimSun qui keep if index (v,`\"\"') qui split v ,p(`\" \"') *-Note: also remove the extra parts at the end of this code: v 211 and v 212 qui split v 21 ,p(`\" \"') Qui drop v v 1 v 21 Qui rename v 211 v 21 ylyih Qui sxpose ,clear *-Note: sxpose transposes and rearranges the data *-[3] further split the data *-Note: replace the unwanted middle characters with the Zhihu user \"滑翔闪\"! qui replace _var = subinstr (_var,`\" \"',\"滑翔闪\",.) qui replace _var = subinstr (_var,`\" \"' ,\"滑翔闪\", .) qui replace _var = subinstr (_var,`\" \"',\"滑翔闪\",.) qui replace _var = subinstr (_var,`\" \"',\"滑翔闪\",.) qui replace _var = subinstr (_var,`\" \"',\"滑翔闪\",.) Qui replace _var = subinstr (_var,`\" *** *** \"',\"滑翔闪\",.) qui replace _var = subinstr (_var,`\" \"',\"滑翔闪\",.) qui replace _var = subinstr (_var,`\"'\u003e *** \"',\"\",.) *-Note: do it for me — land a Fire Punch on the character \"滑翔闪\"! Qui split _var ,p(`\"滑翔闪\"') Qui drop _var 1 *-[4] add variable labels Qui ren _var 11 城市 Qui ren _var 12 ID Qui ren _var 13 ID 2 Qui ren _var 14 地块 Qui ren _var 15 代码 Qui ren _var 16 地块 2 Qui ren _var 17 类型 Qui ren _var 18 用途 Qui ren _var 19 结果 Qui ren _var 110 编码 Qui ren _var 111 起始价 Qui ren _var 112 成交价 Qui ren _var 113 出让日期 Qui ren _var 114 成交日期 *-[5] save the data Qui append using \"$path\\爬虫土地. Dta\" Qui save \"$path\\爬虫土地. Dta\", replace }\r","date":"2024-03-06","heading":"5. Scraping Multiple Pages","objectID":"/en/posts/pachong/:3:5","tags":["Stata","Web Scraping"],"title":"Stata: Learning Web Scraping","uri":"/en/posts/pachong/#5-scraping-multiple-pages"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"3. Attachments and References:\r","date":"2024-03-06","heading":"3. Attachments and References:","objectID":"/en/posts/pachong/:4:0","tags":["Stata","Web Scraping"],"title":"Stata: Learning Web Scraping","uri":"/en/posts/pachong/#3-attachments-and-references"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"1. References\rBaidu Netdisk The next step is to learn the crawling commands in R, Python, and CURL; the workflow and principles are similar. Python\u0026rsquo;s advantage is that it can run many threads at once and has flexible wheels you can use. The land transaction website scraped in this post can\u0026rsquo;t be crawled because of its JS encryption, but they never closed off the old source-code entry, so the old version is still completely defenseless — you can refer to the code in the article below to scrape the old source data. http://www.crei.cn/tudi/lawbr.aspx?p=1\u0026a=1\u0026jyzt=\u0026crfs=\u0026tdlx=\u0026rq1=\u0026rq2=\u0026rq3=\u0026rq4=\u0026key=\u0026ren=\u0026cs=%C8%AB%B2%BF\rTeaching You to Scrape Nationwide Land Transaction Data with Stata Stata: Batch Retrieval of Longitude-Latitude Data - Spatial Econometrics Stata Web Scraping: Scraping Regional Macro Data Regular Expressions ","date":"2024-03-06","heading":"1. References","objectID":"/en/posts/pachong/:4:1","tags":["Stata","Web Scraping"],"title":"Stata: Learning Web Scraping","uri":"/en/posts/pachong/#1-references"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"2. Some Papers\rIndustrial Land Prices and Firm Capacity Utilization: scrapes land data to uncover the relationship between industrial land transaction clustering and overcapacity 1; Minimum Wages and Heterogeneous Human Capital Demand: A Study Based on Recruitment Website Data: scrapes recruitment postings to study the demand-side features of labor 2； Industrial Robot Adoption and Labor Relations: An Empirical Study Based on Judicial Litigation — scrapes legal documents to study robot adoption and labor disputes 3。 Liu Ruohong, Xu Yanjun. Industrial Land Prices and Firm Capacity Utilization[J]. The Journal of World Economy, 2023, 46(11): 103-127. DOI: 10.19985/j.cnki. Cassjwe. 2023.11.004.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Ma Shuang, Xiao Han, Li Ding, et al. Minimum Wages and Heterogeneous Human Capital Demand: A Study Based on Recruitment Website Data[J]. The Journal of World Economy, 2023, 46(12): 92-114. DOI: 10.19985/j.cnki. Cassjwe. 2023.12.003.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Zhang Jun, Yan Xueling, Yu Shule, et al. Industrial Robot Adoption and Labor Relations: An Empirical Study Based on Judicial Litigation[J]. Management World, 2023, 39(12): 90-112. DOI: 10.19744/j.cnki. 11-1235/f.2023.0146.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2024-03-06","heading":"2. Some Papers","objectID":"/en/posts/pachong/:4:2","tags":["Stata","Web Scraping"],"title":"Stata: Learning Web Scraping","uri":"/en/posts/pachong/#2-some-papers"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":" Each Hugo theme handles custom fonts a little differently, and there are not many clear guides online on how to change them. Here, we\u0026rsquo;ll introduce how to change fonts in the LoveIt theme. ","date":"2024-03-05","heading":"","objectID":"/en/posts/font/:0:0","tags":["Hugo"],"title":"The Custom Font in Hugo","uri":"/en/posts/font/#"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Two Methods of Modification\rAccording to the LoveIt documentation, customizing fonts requires the extended version of Hugo, and there are two methods: In assets/css/_custom.scss, you can add CSS style code to customize the style. In assets/css/_override.scss, you can override variables in themes/LoveIt/assets/css/_variables.scss to customize the style. The first approach, writing the CSS yourself, is not especially beginner-friendly. The second approach relies on overriding font variables. Here, we\u0026rsquo;ll focus on the second method, which involves using the Google Fonts API to import fonts. ","date":"2024-03-05","heading":"Two Methods of Modification","objectID":"/en/posts/font/:1:0","tags":["Hugo"],"title":"The Custom Font in Hugo","uri":"/en/posts/font/#two-methods-of-modification"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Set Font Variables\rOpen the _override.scss file located in the \u0026lt;YourWebsite\u0026gt;/assets/css directory. Here, you can override the font variable settings of the theme. If you don\u0026rsquo;t have an _override.scss file, you can create one yourself. Alternatively, you can copy the css folder from themes\\LoveIt\\assets to the \u0026lt;YourWebsite\u0026gt;\\assets directory. Once you have it open, you\u0026rsquo;ll find two key files — _variables.scss and _override.scss. _variables.scss: This file is used to define font variables. For example, the website title font is a variable area; the directory font is another variable area. You can change the font for each area by modifying the corresponding variables in this file. For example, if the default title font is set to a sans-serif font, and you want to make it more decorative, you can modify the corresponding variable in the _variables.scss file to specify a different font family or style. HeiTi\rIn \u0026lt;YourWebsite\u0026gt;\\assets\\css\\override.scss, input the following code: @import url('https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng\u0026family=Madimi+One\u0026family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900\u0026family=Noto+Serif+SC\u0026display=swap'); $header-title-font-family:Ma Shan Zheng, Madimi One; $header-title-font-size: 35px; $header-title-font-height: 2rem;\rMa Shan Zheng\r@import url: The API for a specific font. $header-title-font-family: The name of the font. $header-title-font-size: The font size. $header-title-font-height: The line height. ","date":"2024-03-05","heading":"Set Font Variables","objectID":"/en/posts/font/:2:0","tags":["Hugo"],"title":"The Custom Font in Hugo","uri":"/en/posts/font/#set-font-variables"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Understanding Parameters\r","date":"2024-03-05","heading":"Understanding Parameters","objectID":"/en/posts/font/:3:0","tags":["Hugo"],"title":"The Custom Font in Hugo","uri":"/en/posts/font/#understanding-parameters"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Font Variable Parameters\rSee themes\\LoveIt\\assets_variables.scss for details on font variables. $global-font: Represents the global font variable. $header-title: Represents the font variable for webpage titles. $toc-title: Represents the font variable for table of contents. family\\size\\height: Corresponds to name, size, and height. $font-family: Ma Shan Zheng, Madimi One;: When multiple font names are present, it indicates priority from left to right for font selection. ","date":"2024-03-05","heading":"Font Variable Parameters","objectID":"/en/posts/font/:3:1","tags":["Hugo"],"title":"The Custom Font in Hugo","uri":"/en/posts/font/#font-variable-parameters"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"The Google Fonts API\rAfter accessing the Google Fonts website, choose the desired fonts, then click on Get font in the upper right corner to package them. Continue selecting all the fonts you want, and once you\u0026rsquo;re done, click on the shopping cart icon in the top right corner. fonts.google\rThen click on Get embed code. Choose Web - @import, which provides the corresponding API code. Get embed code\rThe code shown in the image corresponds to the API call. It also provides the name of each font. API\r","date":"2024-03-05","heading":"The Google Fonts API","objectID":"/en/posts/font/:3:2","tags":["Hugo"],"title":"The Custom Font in Hugo","uri":"/en/posts/font/#the-google-fonts-api"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"The fonts used on this site\r@import url('https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng\u0026family=Madimi+One\u0026family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900\u0026family=Noto+Serif+SC\u0026display=swap'); $header-title-font-family:Ma Shan Zheng, Madimi One; $header-title-font-size: 35px; $header-title-font-height: 2rem; $global-font-family: Noto Serif SC ,ZCOOL KuaiLe, Merriweather; $global-font-size: 18px; $global-font-height: 4rem; $toc-title-font-size: 25px; $toc-content-font-size: 20px ;\rLocal preview worked fine, but after I deployed to GitHub Pages the about page ran into issues, possibly because of file size or a related build constraint. So, I decided to simply delete the \u0026ldquo;about\u0026rdquo; folder under the \u0026ldquo;themes\u0026rdquo; directory. ","date":"2024-03-05","heading":"The fonts used on this site","objectID":"/en/posts/font/:3:3","tags":["Hugo"],"title":"The Custom Font in Hugo","uri":"/en/posts/font/#the-fonts-used-on-this-site"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Reference\rloveit主题文档 切换主题——从PaperMod到LoveIt hugo自定义全局字体 Hugo 博客自定义优化 LoveIt主题美化与博客功能增强 ","date":"2024-03-05","heading":"Reference","objectID":"/en/posts/font/:4:0","tags":["Hugo"],"title":"The Custom Font in Hugo","uri":"/en/posts/font/#reference"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Nowadays, there are many mature solutions for comments in Hugo. Waline is powerful and easy to use, but it\u0026rsquo;s a bit unfriendly for newcomers like me (for example, I don\u0026rsquo;t know how to configure Waline to automatically switch between Chinese and English); Gitalk uses the Issues section of a GitHub repository as the comment area, which is easy to set up but has some permission grant issues (as discussed here discussion). Therefore, I choose Giscus—simple to set up and secure. Environment: Hugo Enhanced Edition (V0.123.7) + Windows 64 AMD + LoveIt Theme ","date":"2024-03-05","heading":"","objectID":"/en/posts/comment/:0:0","tags":["Hugo","Giscus"],"title":"Setting Up Giscus Comment Section with Hugo","uri":"/en/posts/comment/#"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Creating a GitHub Repository as the Comment Area\rCreate repository on GitHub homepage\rMust be Public\rAfter selecting the options, click \u0026ldquo;Create repository\u0026rdquo; to create it. Once created, enter the repository and enable Discussions to open the discussion area. Repository settings\r","date":"2024-03-05","heading":"Creating a GitHub Repository as the Comment Area","objectID":"/en/posts/comment/:1:0","tags":["Hugo","Giscus"],"title":"Setting Up Giscus Comment Section with Hugo","uri":"/en/posts/comment/#creating-a-github-repository-as-the-comment-area"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Enter Giscus Official Website to Obtain the Code\rGo to the Giscus official website, click \u0026ldquo;Install,\u0026rdquo; and enter the repository you just created. If forgotten, you can check the repository name in the repository settings\rFor the settings, I chose the default: Page ↔️ Discussion Mapping: Select \u0026ldquo;Discussion title contains the page\u0026rsquo;s pathname\u0026rdquo; Discussion Category: Select \u0026ldquo;Announcements\u0026rdquo; Theme: Select \u0026ldquo;User-recommended color scheme\u0026rdquo; After checking, the page will display the corresponding call code: Pay special attention to data-repo, data-repo-id, data-category, data-category-id, and data-mapping values. ","date":"2024-03-05","heading":"Enter Giscus Official Website to Obtain the Code","objectID":"/en/posts/comment/:2:0","tags":["Hugo","Giscus"],"title":"Setting Up Giscus Comment Section with Hugo","uri":"/en/posts/comment/#enter-giscus-official-website-to-obtain-the-code"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Hugo Configuration\r","date":"2024-03-05","heading":"Hugo Configuration","objectID":"/en/posts/comment/:3:0","tags":["Hugo","Giscus"],"title":"Setting Up Giscus Comment Section with Hugo","uri":"/en/posts/comment/#hugo-configuration"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Modify the toml Configuration\rIn the config.toml file of your personal website project, add the following content: [params.page.comment] enable = true [params.page.comment.giscus] # You can refer to the official documentation to use the following configurations enable = true repo = \"**********\" repoId = \"**************\" category = \"Announcements\" categoryId = \"***************\" # corresponds to the data-repo on the official website # corresponds to the data-repo-id on the official website # corresponds to the data-category on the official website # corresponds to the data-category-id on the official website # Leave empty to automatically adapt to the current theme i18n configuration lang = \"\" mapping = \"pathname\" # corresponds to the data-mapping on the official website reactionsEnabled = \"1\" emitMetadata = \"0\" inputPosition = \"bottom\" lazyLoading = false lightTheme = \"light\" darkTheme = \"dark_dimmed\"\r","date":"2024-03-05","heading":"Modify the toml Configuration","objectID":"/en/posts/comment/:3:1","tags":["Hugo","Giscus"],"title":"Setting Up Giscus Comment Section with Hugo","uri":"/en/posts/comment/#modify-the-toml-configuration"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Hugo Rendering\rhugo serve is the local preview environment and will not enable the production environment. Start hugo serve -e production to render and start the production environment, enabling the comment section. Personally, I think the style is better than gitalk. Below is the dark mode and Chinese-English effect\r","date":"2024-03-05","heading":"Hugo Rendering","objectID":"/en/posts/comment/:4:0","tags":["Hugo","Giscus"],"title":"Setting Up Giscus Comment Section with Hugo","uri":"/en/posts/comment/#hugo-rendering"},{"categories":["Hugo Customization"],"collections":["Hugo Customization"],"content":"Pay Attention to Version Control\rFollow the above method strictly. Using the LoveIt theme, but the comment section did not appear. It might be due to version mismatch. LoveIt page, directly download and unzip via code. The latest release code is actually several versions behind! It does not support giscus. ","date":"2024-03-05","heading":"Pay Attention to Version Control","objectID":"/en/posts/comment/:5:0","tags":["Hugo","Giscus"],"title":"Setting Up Giscus Comment Section with Hugo","uri":"/en/posts/comment/#pay-attention-to-version-control"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"1. What are the causal frameworks?\rToday, with numerous causal frameworks emerging and various disciplines such as statistics (including pharmacology and psychology, each with its own statistical interpretation), economics, and computer science having their own schools of thought, the landscape has become intricate and diverse. It is intertwined and complex, and I am not entirely sure about the overall system. Personally, I have been exposed to Judea Pearl\u0026rsquo;s Structural Causal Model (SCM) the most. Regarding his work \u0026ldquo;The Book of Why,\u0026rdquo;1 My personal understanding is that association-intervention-counterfactual represents the three levels of causality. The selection of control variables controls for backdoor paths, while setting instrumental variables controls for frontdoor paths. Correlation does not imply causation; correlation does not discuss directionality. Causality is unidirectional, so we need directed acyclic graphs to guide us. After identifying pathways, we then analyze to envision a counterfactual world.\rThe knowledge about ATE (Average Treatment Effect), ATT (Average Treatment Effect for the Treated), ITT (Intention-to-Treat), and LATE (Local Average Treatment Effect) appears sporadically in \u0026ldquo;Mostly Harmless Econometrics\u0026rdquo; 1. The entire framework is based on Donald Rubin\u0026rsquo;s proposal of the Potential Outcome Framework (also known as Rubin Causal Model, abbreviated as RCM). It\u0026rsquo;s interesting that Judea Pearl (in \u0026ldquo;The Book of Why\u0026rdquo;) proposes that counterfactuals under causal pathways are the same as Rubin\u0026rsquo;s concept of \u0026ldquo;potential outcomes.\u0026rdquo; However, Rubin responded that the two are completely different 2and does not endorse the analysis method of path diagrams. (Personally, I find it difficult to understand Rubin\u0026rsquo;s response, as in my view, the direction of arrows in SCM corresponds to the direction of addition and subtraction signs in RCM). As far as I know, causal analysis in statistics is currently divided into frequentist and Bayesian schools of thought. Research is conducted to understand causal inference through Markov chains. Personally, I am quite unfamiliar with this area of knowledge. My understanding of this topic mainly comes from educational videos by Fmajor on Bilibili. ","date":"2024-02-28","heading":"1. What are the causal frameworks?","objectID":"/en/posts/effect/:0:0","tags":["Causal Inference"],"title":"Causal Effec","uri":"/en/posts/effect/#1-what-are-the-causal-frameworks"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"2. More details about RCM\rATE (Average Treatment Effect), ATT (Average Treatment Effect for the Treated), ITT (Intention-to-Treat), and LATE (Local Average Treatment Effect) are different statistical estimators. ","date":"2024-02-28","heading":"2. More details about RCM","objectID":"/en/posts/effect/:0:0","tags":["Causal Inference"],"title":"Causal Effec","uri":"/en/posts/effect/#2-more-details-about-rcm"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"From ATE to ATT\rStarting from elementary school, we have been exposed to comparing and analyzing data using the mean of various groups. However, this type of group comparison is just the starting point for causal discussions. It is necessary to further decompose these group differences to explore causal relationships. Average Treatment Effect (ATE): The difference between the means of two groups is directly used as the estimator. It can be considered as the difference between the population means or as the mean difference between groups (e.g., in the estimation of twin data): $$\\bar Y_1-\\bar Y_0=\\sum_{i=1}^{N}\\frac{Y_{i}(1)-Y_{i}(0)}{N}$$ Treating $D_i$ as the treatment variable, where $D_i = 1$ represents the experimental group and $D_i = 0$ represents the control group, the linear equation is as follows: $$\\begin{align}Y_{i}\u0026amp;=\\begin{cases} Y_{1i} \\quad if D_i = 1 \\newline Y_{0i} \\quad if D_i = 0 \\end{cases} \\newline \u0026amp;=Y_{0i}\u0026#43;(Y_{1i}-Y_{0i})D_{i} \\end{align}$$ Subtracting the two equations, we obtain the following expression: $$\\begin{aligned} \u0026amp;\\mathbf{E}[Y_{i}\\mid D_{i}=1]-\\mathbf{E}[Y_{i}\\mid D_{i}=0]\\newline\u0026amp; =\\color{red}{\\underbrace{\\mathbf{E}\\lfloor Y_{1i}\\mid D_{i}=1\\rfloor-\\mathbf{E}[Y_{0i}\\mid D_{i}=1]}_{\\text{ATT}} } \\newline \u0026amp;\u0026#43;\\underbrace{\\mathbf{E}[Y\\_{0i}\\mid D\\_{i}=1]-\\mathbf{E}[Y\\_{0i}\\mid D\\_{i}=0]}\\_{SelectionBias} \\end{aligned}$$ Where $\\mathbf{E}[Y_{0i}\\mid D_{i}=1]$ is intentionally introduced by us, representing another \u0026ldquo;parallel universe\u0026rdquo; that we wish to explore but cannot directly observe—assuming that the subgroup represented by $\\mathbf{E}[Y_{\\color{blue}{1i}}\\mid D_{i}=1]$ did not receive the treatment in the parallel world. Their state is denoted as $\\mathbf{E}[Y_{\\color{blue}{0i}}\\mid D_{i}=1]$, which is the \u0026ldquo;potential outcome\u0026rdquo; that Rubin aims to find. $\\color{red}{\\mathbf{E}\\left[Y_{1i}\\mid D_{i}=1 \\right] - \\mathbf{E}[Y_{0i}\\mid D_{i}=1]}$ represents the Average Treatment Effect on Treated (ATT). There is no better controlled experiment than \u0026ldquo;a binary choice splitting into two parallel universes\u0026rdquo;, but no one can truly obtain such data! Therefore, economists attempt to estimate ATT through ATE, hence the introduction of randomized controlled trials (RCTs). ","date":"2024-02-28","heading":"From ATE to ATT","objectID":"/en/posts/effect/:1:0","tags":["Causal Inference"],"title":"Causal Effec","uri":"/en/posts/effect/#from-ate-to-att"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"RCT: Making ATE approach ATT\rRCT stands for Randomized Controlled Trial, representing a randomized experiment. Under the conditions of a randomized experiment, ATE = ATT. Next, let\u0026rsquo;s delve into the explanation: Subtracting the subgroup $\\mathbf{E}[Y_{0i}\\mid D_{i}=1]$ from the subgroup that has never received treatment in the real world $\\mathbf{E}[Y_{0i}\\mid D_{i}=0]$, if the result is non-zero, selection bias occurs. The reason may be sampling selection bias: for example, conducting a fitness-related survey only at gyms would definitely not achieve effective comparison; another example is the well-known survivorship bias in the military, where the returned planes are the ones that survived, making it unreliable to estimate the areas that need reinforcement based on their damages. It could also be self-selection bias: for example, an uneven gender ratio in admissions does not necessarily indicate discrimination, as this analysis overlooks the gender ratio in application tendencies. Some genders may be more inclined to apply for more challenging positions, leading to higher rejection rates; police enforcement focusing more on a certain race does not necessarily imply discrimination, as it may simply reflect higher crime rates within that race. Omitted variables, model errors, measurement errors, and insufficient sample size can all contribute to bias. If we use the method of randomized trials, the samples are randomly distributed. We hope that this randomized trial can average out some unobserved influencing variables, thereby making $D_i$ and $Y_{0i}$ independent, which means $\\mathbf{E}[Y_{0i}\\mid D_{i}=1]=\\mathbf{E}[Y_{0i}\\mid D_{i}=0]=\\mathbf{E}[Y_{0i}]$. Here, the estimation of ATE has been effectively simplified: $$\\begin{aligned} \u0026amp;\\mathbf{E}[Y\\_{1i}\\mid D\\_{i}=1]-\\mathbf{E}[Y\\_{0i}\\mid D\\_{i}=1]\\newline\u0026amp;=ATT =\\mathbf{E}[\\mathbf{Y}\\_{1i}-\\mathbf{Y}\\_{0i}\\mid D\\_{i}=1] \\newline \u0026amp;=ATE=\\mathbf{E}[Y\\_{1i}-Y\\_{0i}] \\end{aligned}$$ Further estimating through regression equations: $$\\begin{align}Y_{i}\u0026amp;=\\begin{cases} Y_{1i} \\quad if D_i = 1 \\newline Y_{0i} \\quad if D_i = 0 \\end{cases} \\newline \u0026amp;=Y_{0i}\u0026#43;(Y_{1i}-Y_{0i})D_{i} \\newline \u0026amp; =\\alpha\u0026#43;\\rho D_i\u0026#43;\\eta_i \\end{align}$$$$\\begin{aligned}\u0026amp;\\operatorname{\\mathbf{E}}[Y_i\\mid D_i=1]=\\alpha\u0026#43;\\rho\u0026#43;\\operatorname{\\mathbf{E}}[\\eta_i\\mid D_i=1]\\newline \u0026amp;\\operatorname{\\mathbf{E}}[Y_i\\mid D_i=0]=\\alpha\u0026#43;\\operatorname{\\mathbf{E}}[\\eta_i\\mid D_i=0]\\end{aligned}$$ We can obtain the difference between the two. $$\\begin{aligned}\u0026amp;\\operatorname{\\mathbf{E}}[Y\\_i\\mid D\\_i=1]-\\operatorname{\\mathbf{E}}[Y\\_i\\mid D\\_i=0]\\newline \u0026amp;=\\underbrace{\\rho}_\\text{Treatment effect}\u0026#43;\\underbrace{\\operatorname{\\mathbf{E}}[\\eta\\_i\\mid D\\_i=1]-\\operatorname{\\mathbf{E}}[\\eta\\_i\\mid D\\_i=0]}\\_\\text{secletion bias}\\end{aligned}$$ When there is selection bias $\\eta_i \\neq 0$, it means that the residual is correlated with $D_i$. We emphasize randomized trials because we hope that random intervention experiments can make the two unrelated, eliminating this selection bias. So when randomized trials are satisfied, $\\eta_i=0$, $ATE \\xrightarrow{RCT} ATT$. This also tells us why we should pay attention to residual analysis. ","date":"2024-02-28","heading":"RCT: Making ATE approach ATT","objectID":"/en/posts/effect/:2:0","tags":["Causal Inference"],"title":"Causal Effec","uri":"/en/posts/effect/#rct-making-ate-approach-att"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"From ITT to LATE\rIntention to Treat (ITT). Although randomized intervention trials are useful, the variables we want to study are not always randomly distributed. For example, industrial land tends to aggregate around certain grades of land. In this case, buyers are not randomly distributed. In such scenarios, we consider other randomly distributed variables that may influence their decisions. It\u0026rsquo;s more illustrative to first understand this using the path diagram of SCM: Angrist (2011) is a paper that examines the impact of participating in the Vietnam War on income. In this study, the variable of military enlistment was found to be problematic, so the author used enlistment eligibility as an instrumental variable. (Nostalgic for the era of short 6-page econometric papers) 2SLS\rClearly, there exists a process where an individual is first informed of their enlistment eligibility and then decides whether to enter the military. The ITT equation is as follows: It can be observed that the ITT estimate is quite similar to $\\mathbf{E}[Y_{i}\\mid D_{i}=1]-\\mathbf{E}[Y_{i}\\mid D_{i}=0]$, meaning that when $D_i$ and $Z_i$ are one-to-one corresponding, i.e., when $z=d$, ITT = ATE. $\\pi_N$: Regardless of whether I am eligible or not, I will never join the military. $\\pi_D$: Contrarian attitude, I will join the military if I am eligible, and I will refuse if I am not eligible. $\\pi_A$: Regardless of whether I am eligible or not, I will always join the military. $\\pi_C$: Compliance, I will join if eligible, and I will not join if not eligible. The source of the diagram is the Oxford courseware (Week 4 lecture): https://andy.egge.rs/teaching/causal_inference/\rDue to the non-random distribution of $Di$, as we are based on a sample of military personnel for statistics, we have only the following equation: $$\\begin{aligned} \\mathbf{E}[D_i=1|Z_i=0]=\\pi_A\u0026#43;\\pi_D\\newline \\mathbf{E}[D_i=1|Z_i=1]=\\pi_A\u0026#43;\\pi_C \\end{aligned}$$ In this case, we cannot estimate $\\pi_i$ separately for $\\pi_i$, $i∈{A, C, D, N}$. However, due to the random distribution, the results will be proportional, allowing us to derive a linear equation: The solution is to make an assumption — quite reminiscent of an economics joke. Here\u0026rsquo;s the original joke: A physicist, a chemist, and an economist are stranded on a deserted island, starving. Suddenly, a can of food washes ashore. The physicist says, \u0026ldquo;We can use rocks to apply momentum to the can, causing its surface to fatigue and rupture.\u0026rdquo; The chemist says, \u0026ldquo;We can make a fire, then heat the can, causing it to expand until it bursts.\u0026rdquo; The economist then says, \u0026ldquo;Let\u0026rsquo;s assume we have a can opener\u0026hellip;\u0026rdquo; After introducing the assumption, we directly obtain the LATE: $$\\mathrm{LATE}=\\mathrm{CATE}\\_{\\mathcal{C}}=\\frac{\\mathrm{ITT}}{\\pi\\_{\\mathcal{C}}}$$$$\\small \\hat{\\mathbf{CATE}_C}=\\frac{\\mathbf{E}\\Big[Y_i|Z_i=1\\Big]-\\mathbf{E}\\Big[Y_i|Z_i=0\\Big]}{\\mathbf{E}\\Big[D_i|Z_i=1\\Big]-\\mathbf{E}\\Big[D_i|Z_i=0\\Big]}=\\frac{\\mathrm{effect~of~}Z_i\\text{ on }Y_i}{\\mathrm{effect~of~}Z_i\\text{ on }D_i}=\\frac{\\operatorname{ITT}_Y}{\\operatorname{ITT}_D}$$ The LATE section heavily relies on the Oxford course material. For a more algebraic explanation, refer to the Harvard course material and \u0026ldquo;Mostly Harmless Econometrics.\u0026rdquo; ","date":"2024-02-28","heading":"From ITT to LATE","objectID":"/en/posts/effect/:3:0","tags":["Causal Inference"],"title":"Causal Effec","uri":"/en/posts/effect/#from-itt-to-late"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Social science attributes in mathematical economics\rThe social science attributes in mathematical economics are evident in the need to articulate assumptions that capture social phenomena. For instance, when studying unique policies, it\u0026rsquo;s essential to argue that the policy affects everyone, reflecting the assumption of monotonicity. Similarly, when using instrumental variables, it\u0026rsquo;s crucial to discuss the social relationship between the instrument and the explanatory variable. These assumptions serve as concise descriptions of social phenomena, highlighting the distinct social science nature of economic analysis. Recently, as I delve into advanced macroeconomics, I\u0026rsquo;ve come to realize the methodical nature of this field. The techniques in advanced macroeconomics, such as the variational calculus and Lagrangian method, address optimization in classical models. However, the challenge lies in navigating through the myriad of assumptions and transformations imposed on each macroeconomic model. Whether it\u0026rsquo;s manipulating formulas or introducing sudden assumptions, the goal is to distill economic phenomena into characteristic features and then formalize them mathematically. This, I believe, is the greatest challenge. Examples include the production function for knowledge (treating knowledge as a factor of production), the Cobb-Douglas production function (exhibiting constant returns to scale), household constraints (consumption discounting being less than wealth discounting), and household utility functions (risk aversion). In essence, the distinguishing factor between economists with a background in economics and those with a background in mathematics lies in the framework used to explore equilibrium, construct functions that capture economic phenomena, and formulate optimization constraints. This represents the essence of economic thinking and intuition that sets economists apart in the realm of mathematical economics. As an aside, I\u0026rsquo;d like to share my notes on advanced macroeconomics. ","date":"2024-02-28","heading":"Social science attributes in mathematical economics","objectID":"/en/posts/effect/:0:0","tags":["Causal Inference"],"title":"Causal Effec","uri":"/en/posts/effect/#social-science-attributes-in-mathematical-economics"},{"categories":["Economic Studies"],"collections":["Learning Causal Inference"],"content":"Summarize\rFurther examples illustrate that the Difference-in-Differences (DID) estimation is the Average Treatment Effect on the Treated (ATT); the Regression Discontinuity Design (RDD) estimation is the Local Average Treatment Effect (LATE); and the Instrumental Variable (IV) and RDD estimations are the same under certain conditions. ATT and LATE are what we aim for, longing for a perfect control experiment like the parallel universe, but what we have are only the Average Treatment Effect (ATE) and Intention to Treat (ITT). When the treatment variable (D) satisfies the Randomized Controlled Trial (RCT), ATE equals ATT. When D does not satisfy RCT but the instrumental variable (Z) does, and assuming monotonicity and relevance, we can construct IV or RDD, and in this case, ITT equals LATE. When neither D nor Z satisfies RCT, other methods are used to estimate counterfactual situations, such as cluster analysis (directly estimating the distribution of counterfactuals and contrasting it with the current clustering phenomenon through residual analysis), synthetic control, etc. Textbooks usually introduce matching theory to achieve these estimation assumptions. In conclusion, econometric models analyze causal relationships based on such potential outcome frameworks, advocating themselves as causal science. Seen in this light, doesn\u0026rsquo;t it embody the magic of \u0026ldquo;creating something out of nothing\u0026rdquo; and \u0026ldquo;inferring causes from effects\u0026rdquo;? Pearl J, Mackenzie D. The book of why: the new science of cause and effect[M]. Basic books, 2018.\u0026#160;\u0026#x21a9;\u0026#xfe0e;\u0026#160;\u0026#x21a9;\u0026#xfe0e; Joshua D. Angrist, Jörn-Steffen Pischke. \u0026ldquo;Mostly Harmless Econometrics: An Empiricist\u0026rsquo;s Companion\u0026rdquo; [M]. Publisher: Princeton University Press, 2008.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2024-02-28","heading":"Summarize","objectID":"/en/posts/effect/:0:0","tags":["Causal Inference"],"title":"Causal Effec","uri":"/en/posts/effect/#summarize"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":" Every mainstream journal must have a website, and there are also many hidden websites for comics, animations, and TV shows around the world. The only problem is that resources among these websites differ and are relatively obscure. So, is it possible to create a website that aggregates all the websites we want? This is where aggregation subscriptions come in! Many experts have developed tools that allow us to directly capture these websites through software, enabling one-click subscription and use of resources. Resource websites only solve immediate needs. If you truly love a work, please support the official version. ","date":"2024-02-20","heading":"","objectID":"/en/posts/dingyue/:0:0","tags":["RSS","Film and TV Resources"],"title":"Aggregated subscriptions: free movies, comics","uri":"/en/posts/dingyue/#"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"Television and film:TVbox\r","date":"2024-02-20","heading":"Television and film:TVbox","objectID":"/en/posts/dingyue/:1:0","tags":["RSS","Film and TV Resources"],"title":"Aggregated subscriptions: free movies, comics","uri":"/en/posts/dingyue/#television-and-filmtvbox"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"\u0026ldquo;Non-television platforms\u0026rdquo;\rThe playback system not only includes most of the screen and subtitle adjustment functions, but also many people maintain resources for movies and TV live broadcasts. The official website is linked here: TVbox. After downloading, click on settings, enter the subscription configuration address, and you\u0026rsquo;re good to go. As shown in the image below, this way, we can watch and collect resources from different websites within one app. TVbox\rsetting\rThe recommended subscription sources are as follows. Thanks to everyone for their maintenance! 饭太硬 http://饭太硬.top/tv 肥猫 http://肥猫.live 菜妮丝 https://tvbox.cainisi.cf 南风 https://agit.ai/Yoursmile7/TVBox/raw/branch/master/XC.json 小米 http://xhww.fun:63/小米/DEMO.json 巧儿 http://pandown.pro/tvbox/tvbox.json\r","date":"2024-02-20","heading":"\u0026ldquo;Non-television platforms\u0026rdquo;","objectID":"/en/posts/dingyue/:1:1","tags":["RSS","Film and TV Resources"],"title":"Aggregated subscriptions: free movies, comics","uri":"/en/posts/dingyue/#non-television-platforms"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"TV Installation\rNowadays, most households have digital television, and at the same time, people have long been suffering from multiple VIP subscriptions. TV casting VIP and software VIP are mostly two separate payment methods! At home, parents always worry about charges for digital television here and there, while the TV shows they like are not easy to find on TV. For example, someone in the family is obsessed with the show \u0026rsquo; 狗剩快跑 \u0026rsquo; they saw on china TikTok. So, taking this as an opportunity, I researched TVbox on the TV. The TV environment is essentially an older version of the Android environment. There are two ways to download mobile apps to the TV. Software: Install the app on the TV by linking your phone through certain TV apps (just Google it). Hardware: Install using a USB drive. my xiaomi TV\rThe image above shows the two USB ports on the back of the Xiaomi TV. Since the software environment on the TV is an older version of Android, TVbox also needs to use an older version. You can download the APK from the following GitHub link: TVBox_：The version adapted for TV. apk. When encountering playback failures on the TV, focus on version compatibility and the decoding method in the settings (I don\u0026rsquo;t understand it either, just try different ones). ","date":"2024-02-20","heading":"TV Installation","objectID":"/en/posts/dingyue/:1:2","tags":["RSS","Film and TV Resources"],"title":"Aggregated subscriptions: free movies, comics","uri":"/en/posts/dingyue/#tv-installation"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"Comics：Tachiyomi\r","date":"2024-02-20","heading":"Comics：Tachiyomi","objectID":"/en/posts/dingyue/:2:0","tags":["RSS","Film and TV Resources"],"title":"Aggregated subscriptions: free movies, comics","uri":"/en/posts/dingyue/#comicstachiyomi"},{"categories":["Software Tools"],"collections":["Reference Management with Zotero"],"content":"Tachiyomi\r\u0026ldquo;Tachiyomi\u0026rsquo;s advantage is that it can integrate with official software. For example, I have purchased paid chapters of \u0026lsquo;One Punch Man\u0026rsquo; and \u0026lsquo;Kaguya-sama: Love Is War\u0026rsquo; manga, and I can view the manga after logging in to the official website. For downloading, please visit Tachiyomi. The usage method is to download from the bottom browser.\u0026rdquo; Tachiyomi\rEach plugin in the software corresponds to scraping resources from a website. ","date":"2024-02-20","heading":"Tachiyomi","objectID":"/en/posts/dingyue/:2:1","tags":["RSS","Film and TV Resources"],"title":"Aggregated subscriptions: free movies, comics","uri":"/en/posts/dingyue/#tachiyomi"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"HLT: Lifecycle and Wage Decomposition\r","date":"2024-01-19","heading":"HLT: Lifecycle and Wage Decomposition","objectID":"/en/posts/hlt/:0:0","tags":["Stata"],"title":"HLT: Lifecycle and Wage Decomposition","uri":"/en/posts/hlt/#hlt-lifecycle-and-wage-decomposition"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"APC panel and life cycle\rThe Mincer earnings function , which was discussed earlier, examines the relationship between returns on human capital investment. 1 $$ ln(w)=\\alpha_0\u0026#43;\\beta_ss\u0026#43;\\beta_0\\exp\u0026#43;\\beta_1\\exp^2\u0026#43;\\gamma X_i\u0026#43;\\varepsilon$$ $s$ represents the level of education, $exp$ represents the level of work experience, and $X_i$ denotes other control variables. Here, it is assumed that the returns to education are linear and the returns to work experience are nonlinear for the logarithmized wages. Heckman et al. (2006) empirically tested this assumption in their related research 2. Even if we don\u0026rsquo;t discuss the specific form of the equation, such a decomposition of variables is certainly insufficient. As the famous bread hunter DIO once said—— \u0026ldquo;JOJO, in the brief span of a human life, I have discovered\u0026hellip; The more one plays with schemes, the more limited one finds the capabilities of humanity to be\u0026hellip;\u0026rdquo; Indeed! Human lifespan and physical stages are points we cannot ignore! Once we delve into labor economics, we cannot avoid discussing human age and condition. Bread Hunter——DIO\rFirstly, let\u0026rsquo;s consider the lifecycle. Even if individuals have the same education level and work experience, or even higher, the rate of return on education varies with age. Here, we estimate parameters that are age and time-related. Moreover, the historical context in which each individual exists also influences wage earnings. For instance, movements like \u0026ldquo;going to the countryside\u0026rdquo; and \u0026ldquo;reform and opening up\u0026rdquo; deeply affected specific cohorts. Here, we estimate parameters (usually categorized by birth year) that are related to individual cohorts and time. Additionally, time effects (including economic cycles and linear growth, such as wage inflation) are also related to time! All these parameters are time-dependent! Decomposing them in the econometric equation becomes a significant challenge. Hence, we have the following extended and flexible Mincer equation. $$ln(w_{ict})=\\alpha\u0026#43;\\theta(s_{ict})\u0026#43;f(x_{ict})\u0026#43;\\gamma_{t}\u0026#43;\\chi_{c}\u0026#43;\\varepsilon_{ict}$$ $i$ represents an independent number. $c$ represents the group number, for example, one group was born during the reform and opening up, one group was born when people went to the mountains and countryside, and one cohort group 3. In the life cycle, work experience is generally divided into groups. The descriptive statistics in the figure below are preliminary descriptive statistics of the life cycle carried out by comparing groups after five years of grouping. $t$ represents the time variable. $\\theta(s_{ict})$ represents the education income function, $f(x_{ict})$ represents the work experience income function, $\\gamma_t$ represents the queue effect of group $c$, $\\chi_t$ represents the group queue Effect, $\\varepsilon_{ict}$ is the paper. Individual-level panel data is often challenging to obtain directly. Therefore, Deaton proposed: \u0026ldquo;We don\u0026rsquo;t need individual tracking panels anymore! Your room has no space left for you to obtain positions! We\u0026rsquo;ll synthesize a \u0026lsquo;pseudo-panel\u0026rsquo; from repeated cross-sections of census data! Epidemiology, drug trials, social psychology, and other statistical fields all make use of such pseudo-panels. For example, in the figure below: These income comparison data are not from individual tracking panel data but rather from a pseudo-panel constructed from cross-sectional data of different ages at the same time.\u0026rdquo; Life cycle wage growth across countries(2018）\rThis type of panel data requires consideration of age, time period, and cohort as independent variables, also known as the Age-Period-Cohort Model (APC). In labor economics, the estimation of APC panel data has always been a hot topic (endorsed by the great Deaton, after all, it is a framework he established in economic analysis). For the estimation equation: $$ln(w_{ict})=\\alpha\u0026#43;\\theta(s_{ict})\u0026#4","date":"2024-01-19","heading":"APC panel and life cycle","objectID":"/en/posts/hlt/:1:0","tags":["Stata"],"title":"HLT: Lifecycle and Wage Decomposition","uri":"/en/posts/hlt/#apc-panel-and-life-cycle"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Deaton\u0026rsquo;s approach(mathematical Decomposition)\rAngus Deaton, who won the Nobel Prize in 2015 for his research on poverty, has made significant contributions to labor economics, with much discussion focused on his findings that aid may worsen conditions 4. The following method is mainly based on his work \u0026ldquo;The Analysis of Household Surveys: A Microeconometric Approach to Development Policy\u0026rdquo; (1997) (starting from page 123), to be honest, it feels a bit, well, unfriendly. For the formula: $$ln(w_{ict})=\\alpha\u0026#43;\\theta(s_{ict})\u0026#43;f(x_{ict})\u0026#43;\\gamma_{t}\u0026#43;\\chi_{c}\u0026#43;\\varepsilon_{ict}$$ Like this: $$w_{ict}=\\exp (\\alpha\u0026#43;\\theta(s_{ict})\u0026#43;f(x_{ict})\u0026#43;\\gamma_{t}\u0026#43;\\chi_{c}\u0026#43;\\varepsilon_{ict})$$ The aggregate total wage can be decomposed into sums grouped first by $c$, and within each group, summed over individuals $i$: $$\\begin{aligned} \\sum_{i=1}^{N_{ct}}w_{ict}=\u0026amp; \\sum_{i=1}^{N\\_{ct}}\\exp(\\alpha\u0026#43;\\theta(s_{ict})\u0026#43;f(x_{ict})\u0026#43;\\gamma_{t}\u0026#43;\\chi_{c}\u0026#43;\\varepsilon\\_{ict}) \\newline \u0026amp;=\\exp(\\alpha\u0026#43;\\gamma_t\u0026#43;\\chi_c)\\underbrace{\\sum_{i=1}^{N_{ct}}\\exp(\\theta(s_{ict})\u0026#43;f(x\\_{ict})\u0026#43;\\varepsilon_{ict})}\\_{F_{ct}} \\newline \u0026amp;=\\exp(\\alpha\u0026#43;\\gamma_{t}\u0026#43;\\chi\\_{c})F_{ct} \\end{aligned}$$ $F_{ct}$ at this point represents the total wage contribution of both the education experience function $\\theta(s_{ict})$ and the work experience function $f(x_{ict})$. Define $\\bar{F}\\_t = \\sum*{c\\in C\\_t} F\\_{ct}$, then proceed to separate this part out, transforming it as follows: $$\\begin{aligned} W\\_{t}=\u0026amp; \\sum\\_{c\\in C_{t}}\\sum\\_{i=1}^{N\\_{ct}}w\\_{ict} \\newline \u0026amp;=\\sum\\_{c\\in C\\_{t}}\\exp(\\alpha\u0026#43;\\gamma\\_{t}\u0026#43;\\chi\\_{c})F\\_{ct} \\newline \u0026amp;=\\exp(\\alpha)\\exp(\\gamma\\_{t})\\sum\\_{c\\in C\\_{t}}\\exp(\\chi\\_{c})F_{ct} \\newline \u0026amp;=\\exp(\\alpha)\\exp(\\gamma\\_{t})\\bar{F}\\_{t}\\sum\\_{c\\in C_{t}}\\exp(\\chi\\_{c})\\frac{F\\_{ct}}{\\bar{F}\\_{t}} \\end{aligned}$$ At this point, wages can be decomposed into three parts: time effect $\\Gamma_{t}$, the effect of work experience and education $\\bar F_{t}$, and cohort effect $\\bar X_{t}$. $$W_{t}=\\underbrace{\\exp(\\gamma_{t})}\\_{\\Gamma_{t}}\\bar F_{t}\\underbrace{\\sum\\_{c\\in C\\_{t}}\\exp(\\chi\\_{c})\\frac{F\\_{ct}}{\\overline{F\\_{t}}}}\\_{\\tilde{X\\_{t}}}$$ The effects of work experience and education can be quantified through the years of education and work, but identifying the time effect and cohort effect is challenging. Therefore, the purpose of this approach is to isolate and study the time and cohort effects separately. Hence, we define: $$\\Omega_{t}=\\frac{W_t}{\\bar F_{t}}=\\Gamma_{t}\\bar{X}_{t}$$ In studying cohort and time effects, we typically approach it from two perspectives. Time trend: Our technology always advances over time, representing a time trend that progresses on average. Cyclical variations: For example, seasonal vegetables have cyclical supply and demand patterns, or the baby boom generation—when the baby boomers reach middle age, there may be a peak in the labor force. time effects\rAt this point logarithmize again—— $\\omega_t=\\log\\Omega_t,\\bar{\\chi}_t=\\log\\bar{X}_t，\\bar{\\gamma}_t=\\log\\bar{\\Gamma}_t$ ​ At the same time, it should be emphasized that what is defined is that $\\bar{\\chi}_t$ and $\\bar{\\gamma}_t$ are the deviations of the sample mean at this time. Just like we assume that the sum of residuals after regression is 0, this assumption also requires that the sum of sample mean residuals is 0: $$\\frac1T\\sum_{t=0}^T\\gamma_t=\\frac1T\\sum_{t=0}^T\\bar{\\chi}_t=0$$ At this time, the formula is decomposed into: $\\omega_t=\\bar{\\omega}\u0026#43;\\bar \\gamma_t\u0026#43;\\bar{\\chi}_t$ The original paper only stated that $\\bar{\\omega}$ is \u0026ldquo;an appropriately chosen constant\u0026rdquo;. Personally, I think it is the sample mean, so in contrast, $\\bar{\\chi}_t$ and ${\\bar \\gamma}_t$ are the deviations from the sample mean. At this time, both the time effect and the queue effect can be decomposed into time trend$g$ and periodic change $u$, which can be expre","date":"2024-01-19","heading":"Deaton\u0026rsquo;s approach(mathematical Decomposition)","objectID":"/en/posts/hlt/:2:0","tags":["Stata"],"title":"HLT: Lifecycle and Wage Decomposition","uri":"/en/posts/hlt/#deatons-approachmathematical-decomposition"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"Quantitative decomposition\rThat is to say, the following formula is estimated: $$\\log(w_{ict})=\\alpha\u0026#43;\\theta(s_{ict})\u0026#43;\\sum_{x\\in\\mathbf{X}}\\phi_{x}D_{ict}^{x}\u0026#43;\\gamma_ {t}\u0026#43;\\chi_{c}\u0026#43;\\varepsilon_{ict}$$ $\\theta(s_{ict})$ represents the income function of educational age, which is generally expressed linearly. $D_{ict}^{x}$ is a dummy variable for each age group in the life cycle. tip\rLet’s review the knowledge points about dummy variables (dummy) in measurement: Generally, n categories are used to generate n-1 dummy variables to avoid collinearity. That is to say, if there is a period of 5 years, 30 years will be divided into 6 periods, so the period of 0-4 years is generally omitted and 5 dummy variables are generated. The generated coefficients are all conclusions drawn from comparing with the missing parts. In other words, each coefficient is compared to the growth level in the 0-4 years segment.\r$\\gamma_{t}$: time effect. $\\chi_{c}$ individual effects. Directly use this formula to regression, $D_{ict}^{x}$, $\\gamma_{t}$, $\\chi_{c}$ have collinearity, the Deaton method is to give $\\gamma_{t}$, $\\chi_{c}$ imposes an additional linear constraint. When we set only the queue effect and the time effect to 0, we need to satisfy $\\sum_{t=0}^{T}\\gamma_{t}t=0$. We can achieve this by \u0026ldquo;normalizing\u0026rdquo; $\\gamma_{t}$: Definition $$\\quad d_t^*=d_t-[(t-1)d_2-(t-2)d_1]$$ $t$ is the year label. When this data is in year $t$, it is 1, otherwise it is 0. The corresponding stata operation is tab year ,gen(d)\rFor example, mathematical Transformation\rFor $$ \\begin{align*} \u0026amp;d_1 = \\begin{bmatrix} 1 \u0026amp;0 \u0026amp;0 \u0026amp;0 \u0026amp;0 \\end{bmatrix}\\newline \u0026amp;d_2 = \\begin{bmatrix} 0 \u0026amp; 1 \u0026amp; 0 \u0026amp; 0 \u0026amp; 0 \\end{bmatrix}\\newline \u0026amp;d_3 = \\begin{bmatrix} 0 \u0026amp; 0 \u0026amp; 1 \u0026amp; 0 \u0026amp; 0\\end{bmatrix}\\newline \u0026amp;d_4 = \\begin{bmatrix} 0 \u0026amp; 0 \u0026amp; 0 \u0026amp; 1 \u0026amp; 0\\end{bmatrix}\\newline \u0026amp;d_5 = \\begin{bmatrix} 0 \u0026amp; 0 \u0026amp; 0 \u0026amp; 0 \u0026amp; 1 \\end{bmatrix} \\end{align*} $$ Generate $d^\\ast_t = d_t \u0026#43; (t-2) d_1 - (t-1)d_2$ $$ \\begin{align*} d^\\ast_3 = \\begin{bmatrix} 1 \u0026amp; -2 \u0026amp; 1 \u0026amp; 0 \u0026amp; 0\\end{bmatrix}\\newline d^\\ast_4 = \\begin{bmatrix} 2 \u0026amp; -3 \u0026amp; 0 \u0026amp; 1 \u0026amp; 0\\end{bmatrix}\\newline d^\\ast_5 = \\begin{bmatrix} 3 \u0026amp; -4 \u0026amp; 0 \u0026amp; 0 \u0026amp; 1\\end{bmatrix} \\end{align*} $$ It can be found that the sum within each $d_i^{\\*}$ group is 0, and at the same time, the sum between $d_i^{\\*}$ groups satisfies: $-(t-1) \u0026#43; (t-2) \u0026#43; 1 = 0$ 数据源（局部）：户籍制度下劳动力的经验人力资本:生命周期视角《中国工业经济》图中d3star和d4star就是估计出的年份效应标准化处理后的虚拟变量\r","date":"2024-01-19","heading":"Quantitative decomposition","objectID":"/en/posts/hlt/:3:0","tags":["Stata"],"title":"HLT: Lifecycle and Wage Decomposition","uri":"/en/posts/hlt/#quantitative-decomposition"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"High-order difference method estimation\rDeaton estimated that the year and cohort effects were actually a bit extreme, either taking them all or dividing them equally, and were criticized by later generations as having \u0026ldquo;no theoretical basis.\u0026rdquo; Some scholars have suggested that we cannot find the growth rate (first-order derivative), so we can use high-order differences to estimate the second-order and above, so that we can verify the general shape of the year and group effects! If you want to see the super-detailed derivation, it is recommended to check out \u0026ldquo;Disentangling age, cohort and time effects in the additive model\u0026rdquo; (McKenzie et al., 2006) 6. For the estimated formula:\r$$ ln(w_{ict})=\\alpha\u0026#43;\\theta(s_{ict})\u0026#43;f(x_{ict})\u0026#43;\\gamma_{t}\u0026#43;\\chi_{c}\u0026#43;\\varepsilon_{ict} $$ Direct regression will have the problem of collinearity - age + year of birth = current year. We cannot directly estimate the form of $\\gamma_t$ and $\\chi_t$ (such as concavity and convexity), but we can use the difference method to study the properties of high-order differences after group subtraction, and then estimate low-order differences. In the life cycle model here, the years of education are linear estimates and easy to decompose, so we ignore 7 for now. The individual number is $i$, and the queue is grouped $c$ according to the life cycle. $k$ is the work experience, which is equal to $t-c$. The corresponding equations for each group of queues are as follows: $$ y\\_{ct}=\\alpha\u0026#43;\\beta \\_kx_{ct}\u0026#43;\\gamma\\_{t}\u0026#43;\\chi\\_{c}\u0026#43;\\varepsilon\\_{ct} $$ **Emphasis! In other words, the estimate of $\\color{red}{k}$ of $\\beta_{\\color{red}{k}}$ is closely related to $\\color{blue}{k=t-c}$! ! ! ! We take advantage of this to perform high-order difference estimation. ** We are in the same group (for example, we select the middle-aged group $c_1$), and use the data of $y_{c_1,t_2}$ minus $y_{c_1,t_1}$ to carry out the time analysis within the group. The first difference** of: During the life cycle, the time difference of each group of queues is evenly distributed, basically every five years, that is $$ (x_{ci,t\u0026#43;1}-x_{ci,t})=(x_{cj,t\u0026#43;1}-x_{cj,t})=\\Delta x_t $$ So the formula can be transformed as follows: $$ \\begin{align} \u0026amp;y_{c_1,t_2}-y_{c_1,t_1}\\newline \u0026amp;=(\\beta_{\\color{red}{k_{2}}}- \\beta_{\\color{red}{k_{1}}})(x_{c_1,t_2}- x_{c_1,t_1})\u0026#43;(\\gamma_{t_2}-\\gamma_{t_1})\u0026#43;(\\varepsilon_{c_1,t_2}-\\varepsilon_{c_1,t_1})\\newline \u0026amp;=(\\beta_{\\color{red}{k_{2}}}- \\beta_{\\color{red}{k_{1}}})\\Delta x_t\u0026#43;(\\gamma_{t_2}-\\gamma_{t_1})\u0026#43;(\\varepsilon_{c_1,t_2}-\\varepsilon_{c_1,t_1})\\newline \\end{align} $$ The corresponding time relationship $k=t-c$, we then perform the first-order difference in time on another same group. We select a group $c_{0}$ that is younger than group $c_{1}$ (regarded as a youth group), and get $k_2=t_1-c_0,k_3=t_2-c_0$. At this point the first difference is obtained: $$ \\begin{align} \u0026amp;y_{c_0,t_2}-y_{c_0,t_1}\\newline \u0026amp;=(\\beta_{\\color{red}{k_{3}}}- \\beta_{\\color{red}{k_{2}}})\\Delta x_t\u0026#43;(\\gamma_{t_1\u0026#43;1}-\\gamma_{t_1})\u0026#43;(\\varepsilon_{c_0,t_2}-\\varepsilon_{c_0,t_1})\\newline \\end{align} $$ At this time, we subtract the first-order differences of $c_1$ and $c_0$ the two sets of time: $$ \\begin{align} \u0026amp;[y_{c_1,t_2}-y_{c_1,t_1}]-[y_{c_0,t_2}-y_{c_0,t_1}]\\newline \u0026amp;=(\\beta_{\\color{red}{k_{2}}}- \\beta_{\\color{red}{k_{1}}})\\Delta x_t\u0026#43;(\\gamma_{t_1\u0026#43;1}-\\gamma_{t_1})\u0026#43;(\\varepsilon_{c_1,t_2}-\\varepsilon_{c_1,t_1})\\newline \u0026amp;-(\\beta_{\\color{red}{k_{3}}}- \\beta_{\\color{red}{k_{2}}})\\Delta x_t-(\\gamma_{t_1\u0026#43;1}-\\gamma_{t_1})-(\\varepsilon_{c_0,t_2}-\\varepsilon_{c_0,t_1})\\newline \u0026amp;=[(\\beta_{\\color{red}{k_{2}}}- \\beta_{\\color{red}{k_{1}}})-(\\beta_{\\color{red}{k_{3}}}- \\beta_{\\color{red}{k_{2}}})]\\Delta x_t-\\Delta_{c}\\Delta_{t}\\varepsilon_{c_{0},t_{2}} \\end{align} $$ We can find that this high-order difference does not contain time effect $\\gamma_t$ and queue effect $\\chi_","date":"2024-01-19","heading":"High-order difference method estimation","objectID":"/en/posts/hlt/:3:1","tags":["Stata"],"title":"HLT: Lifecycle and Wage Decomposition","uri":"/en/posts/hlt/#high-order-difference-method-estimation"},{"categories":["Economic Studies"],"collections":["Economics Paper Notes"],"content":"HLT\rFull name heckman-lochner-taber. The introduction here mainly refers to the appendix of \u0026ldquo;\u0026ldquo;golden ages\u0026rdquo;: A tale of the labor markets in China and the united states\u0026rdquo; (Hanming et al., 2023) 8. The original text can be found in \u0026ldquo;Life cycle wage growth across countries\u0026rdquo; (Lagakos et al., 2018) The previous equation estimate decomposes the wage contribution into: work experience, cohort, age, and education. This is what leads to collinearity, but this decomposition is not permanent. If we look at people\u0026rsquo;s wage growth from a life cycle perspective, we can put forward a hypothesis: **When a person is about to retire, he will give up any human capital investment. At this time, the source of his wage growth is only the time effect. **At this time, in the two cohorts, within the same $t$ year period, the wage growth rate of the elderly group is 1%; the growth rate of the youth group is 5%, which means that 1% is contributed by the time effect, and 4% is Queue effect + work experience. Then we can study whether the time effect of each group tends to be consistent in old age by continuously adjusting the income effect. At this time, the depreciation rate $\\delta$ can be used for sensitivity testing. flow chart\rOther estimation methods include instrumental variable method, incremental data, internal revenue function (functional optimization analysis), and difference-in-difference\u0026#160;\u0026#x21a9;\u0026#xfe0e; Heckman J J, Lochner L J, Todd P E. Earnings functions, rates of return and treatment effects: The Mincer equation and beyond[J]. Handbook of the Economics of Education, 2006, 1: 307-458.\u0026#160;\u0026#x21a9;\u0026#xfe0e; 《Arrival of Young Talent: The Send- Down Movement and Rural Education in China》(Chen Yi et al., 2020) used cohort did to estimate the impact of going to the mountains and countryside on education in China.\u0026#160;\u0026#x21a9;\u0026#xfe0e; When I read about the Nobel Prize winner in 2015, most people were talking about aid, and not much about his contribution to the labor economy.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Deaton A. The analysis of household surveys: a microeconometric approach to development policy[M]. World Bank Publications, 1997.\u0026#160;\u0026#x21a9;\u0026#xfe0e; McKenzie D J. Disentangling age, cohort and time effects in the additive model[J]. Oxford bulletin of economics and statistics, 2006, 68 (4): 473-495.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Personally, I feel that the lack of detailed discussion of educational age is the weakness of this method, especially in today\u0026rsquo;s battle between work and postgraduate entrance examinations. However, under the linear assumption, the education variable will also be eliminated due to differences.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Fang H, Qiu X. \u0026ldquo;Golden Ages\u0026rdquo;: A Tale of the Labor Markets in China and the United States[J]. Journal of Political Economy Macroeconomics, 2023, 1 (4): 665-706\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2024-01-19","heading":"HLT","objectID":"/en/posts/hlt/:4:0","tags":["Stata"],"title":"HLT: Lifecycle and Wage Decomposition","uri":"/en/posts/hlt/#hlt"},{"categories":["Software Tools","Economic Studies"],"collections":["Reference Management with Zotero"],"content":" RSS: Electronic Abstract Aggregation, used to alert us to website updates and display partial information. Basically, journal websites and popular blogs all have RSS subscription addresses. Here is a list of economic journals that can be subscribed to. ","date":"2023-12-27","heading":"","objectID":"/en/posts/zoterorss/:0:0","tags":["Zotero","RSS"],"title":"Zotero: RSS Feed Aggregation Subscription","uri":"/en/posts/zoterorss/#"},{"categories":["Software Tools","Economic Studies"],"collections":["Reference Management with Zotero"],"content":"Zotero: Importing RSS Subscriptions\rZotero 6: Loading Subscriptions: Library Option - Create New Subscription - Import from URL - Enter Website Zotero: Importing RSS Subscriptions\rexample\rZotero 7 (Zotero Beta): Loading Subscriptions: Right-click Subscription 右键订阅目录标题。不过我的zotero这时候总是无法响应？解决办法是重启zotero后再右键点击这里\r","date":"2023-12-27","heading":"Zotero: Importing RSS Subscriptions","objectID":"/en/posts/zoterorss/:0:0","tags":["Zotero","RSS"],"title":"Zotero: RSS Feed Aggregation Subscription","uri":"/en/posts/zoterorss/#zotero-importing-rss-subscriptions"},{"categories":["Software Tools","Economic Studies"],"collections":["Reference Management with Zotero"],"content":"Differences in Journal RSS Subscriptions\rDifferent Types of RSS Subscriptions for the Same Journal RSS Feed-Latest/Recent: Includes only the most recent issue updates. RSS Feed-Advance Articles: Preprints. These are articles that haven\u0026rsquo;t been formally published yet but are about to be. Content may still undergo modifications before final publication. RSS Feed-Open Access: Provides access to articles freely without any subscription or payment required. While the journal may generally require a fee for access, open access articles are freely available. RSS Feed-Most cited: Highlights articles with the highest number of citations. RSS Feed-Editor\u0026rsquo;s Choice: Editor\u0026rsquo;s selected articles for showcasing. These are typically open access and provided as samples. 《The Quarterly Journal of Economics》rss\r","date":"2023-12-27","heading":"Differences in Journal RSS Subscriptions","objectID":"/en/posts/zoterorss/:0:0","tags":["Zotero","RSS"],"title":"Zotero: RSS Feed Aggregation Subscription","uri":"/en/posts/zoterorss/#differences-in-journal-rss-subscriptions"},{"categories":["Software Tools","Economic Studies"],"collections":["Reference Management with Zotero"],"content":"International Economic Journal RSS Feeds\r","date":"2023-12-27","heading":"International Economic Journal RSS Feeds","objectID":"/en/posts/zoterorss/:0:0","tags":["Zotero","RSS"],"title":"Zotero: RSS Feed Aggregation Subscription","uri":"/en/posts/zoterorss/#international-economic-journal-rss-feeds"},{"categories":["Software Tools","Economic Studies"],"collections":["Reference Management with Zotero"],"content":"Flow Conservation List:\rPersonal opinion: Many articles in JLE and JPE, both affiliated with the University of Chicago, are quite enticing based on their titles alone. Research on labor economics, including marriage, gender, and wages, is particularly intriguing. Moreover, labor economics has always been the pinnacle of endogeneity treatment in both ideology and technique. Political economy, lacking a specific focus, covers a wide range of research topics. Almost everyone can find what they are looking for within it. AEA Highlights: Research RSS Feed: https://www.aeaweb.org/research/rss-feed Econometrica: Latest Issue: https://onlinelibrary.wiley.com/feed/14680262/most-recent Most Cited Articles: https://onlinelibrary.wiley.com/feed/14680262/most-cited Journal of Political Economy (JPE): Latest Issue: https://www.journals.uchicago.edu/action/showFeed?type=etoc\u0026feed=rss\u0026jc=jpe Quarterly Journal of Economics (QJE): Latest Issue: https://academic.oup.com/rss/site_5504/3365.xml Advance Access: https://academic.oup.com/rss/site_5504/advanceAccess_3365.xml Open Access: https://academic.oup.com/rss/site_5504/OpenAccess.xml Editor's Picks: https://academic.oup.com/rss/site_5504/3365_56068.xml Review of Economic Studies (RES): Latest Issue: https://academic.oup.com/rss/site_5508/3369.xml Advance Access: https://academic.oup.com/rss/site_5508/advanceAccess_3369.xml Open Access: https://academic.oup.com/rss/site_5508/OpenAccess.xml Bank for International Settlements (BIS): Research Papers: https://www.bis.org/doclist/bis_fsi_publs.rss Datasets: https://www.bis.org/doclist/all_statistics.rss Journal of Applied Econometrics (JAE): Latest Issue: https://onlinelibrary.wiley.com/feed/10991255/most-recent Most Cited Articles: https://onlinelibrary.wiley.com/feed/10991255/most-cited Additional: Journal of Law and Economics (JLE) Latest Issue: https://www.journals.uchicago.edu/action/showFeed?type=etoc\u0026feed=rss\u0026jc=jole ******************************************* The following two journals are subscribed indirectly through RSS creation and therefore only display titles: National Bureau of Economic Research (NBER) Recent Working Papers: https://back.nber.org/rss/new.xml China Economic Review (CER) Latest Issue: https://rss.sciencedirect.com/publication/science/1043951X\r","date":"2023-12-27","heading":"Flow Conservation List:","objectID":"/en/posts/zoterorss/:1:0","tags":["Zotero","RSS"],"title":"Zotero: RSS Feed Aggregation Subscription","uri":"/en/posts/zoterorss/#flow-conservation-list"},{"categories":["Software Tools","Economic Studies"],"collections":["Reference Management with Zotero"],"content":"American Economic Review\r\u0026ldquo;American Economic Review\u0026rdquo; (abbreviated as AER) does not have its own RSS source, but it is managed by the \u0026ldquo;American Economic Association\u0026rdquo; (AEA). The AEA regularly updates research highlights summaries for its affiliated journals. RSS as follows: https://www.aeaweb.org/research/rss-feed\r","date":"2023-12-27","heading":"American Economic Review","objectID":"/en/posts/zoterorss/:1:1","tags":["Zotero","RSS"],"title":"Zotero: RSS Feed Aggregation Subscription","uri":"/en/posts/zoterorss/#american-economic-review"},{"categories":["Software Tools","Economic Studies"],"collections":["Reference Management with Zotero"],"content":"Econometrica\rResearch focused on statistical econometric analysis. RSS feeds as follows: Latest Issue: https://onlinelibrary.wiley.com/feed/14680262/most-recent Most cited: https://onlinelibrary.wiley.com/feed/14680262/most-cited\r","date":"2023-12-27","heading":"Econometrica","objectID":"/en/posts/zoterorss/:1:2","tags":["Zotero","RSS"],"title":"Zotero: RSS Feed Aggregation Subscription","uri":"/en/posts/zoterorss/#econometrica"},{"categories":["Software Tools","Economic Studies"],"collections":["Reference Management with Zotero"],"content":"Journal of Political Economy\rThe Journal of Political Economy (JPE), abbreviated as JPE, is under the management of the University of Chicago. The RSS sources for all journals under the University of Chicago can be found in the following PDF link: University of Chicago Journals RSS Feeds RSS as follows: https://www.journals.uchicago.edu/action/showFeed?type=etoc\u0026feed=rss\u0026jc=jpe\r","date":"2023-12-27","heading":"Journal of Political Economy","objectID":"/en/posts/zoterorss/:1:3","tags":["Zotero","RSS"],"title":"Zotero: RSS Feed Aggregation Subscription","uri":"/en/posts/zoterorss/#journal-of-political-economy"},{"categories":["Software Tools","Economic Studies"],"collections":["Reference Management with Zotero"],"content":"The Quarterly Journal of Economics\rThe Quarterly Journal of Economics (QJE) RSS as follows: Latest Issue: https://academic.oup.com/rss/site_5504/3365.xml Advance Access: https://academic.oup.com/rss/site_5504/advanceAccess_3365.xml Open Access: https://academic.oup.com/rss/site_5504/OpenAccess.xml Editor's Picks: https://academic.oup.com/rss/site_5504/3365_56068.xml\r","date":"2023-12-27","heading":"The Quarterly Journal of Economics","objectID":"/en/posts/zoterorss/:1:4","tags":["Zotero","RSS"],"title":"Zotero: RSS Feed Aggregation Subscription","uri":"/en/posts/zoterorss/#the-quarterly-journal-of-economics"},{"categories":["Software Tools","Economic Studies"],"collections":["Reference Management with Zotero"],"content":"Review of economic studies\rReview of Economic Studies (RES) RSS as follows: Latest Issue: https://academic.oup.com/rss/site_5508/3369.xml Advance Access: https://academic.oup.com/rss/site_5508/advanceAccess_3369.xml Open Access: https://academic.oup.com/rss/site_5508/OpenAccess.xml\r","date":"2023-12-27","heading":"Review of economic studies","objectID":"/en/posts/zoterorss/:1:5","tags":["Zotero","RSS"],"title":"Zotero: RSS Feed Aggregation Subscription","uri":"/en/posts/zoterorss/#review-of-economic-studies"},{"categories":["Software Tools","Economic Studies"],"collections":["Reference Management with Zotero"],"content":"Bank for international settlements\rBank for International Settlements (BIS), also known as the Bank for International Settlements, provides both working papers and datasets. RSS as follows: Research Papers: https://www.bis.org/doclist/bis_fsi_publs.rss Datasets: https://www.bis.org/doclist/all_statistics.rss\r","date":"2023-12-27","heading":"Bank for international settlements","objectID":"/en/posts/zoterorss/:1:6","tags":["Zotero","RSS"],"title":"Zotero: RSS Feed Aggregation Subscription","uri":"/en/posts/zoterorss/#bank-for-international-settlements"},{"categories":["Software Tools","Economic Studies"],"collections":["Reference Management with Zotero"],"content":"Publications in Subfields Beyond the Top 5 Journals\rJournal of Applied Econometrics(JAE) Latest Issue: https://onlinelibrary.wiley.com/feed/10991255/most-recent Most Cited Articles: https://onlinelibrary.wiley.com/feed/10991255/most-cited\rJournal of Labor Economics (JLE) - Labor Economics Field Latest Issue: https://www.journals.uchicago.edu/action/showFeed?type=etoc\u0026feed=rss\u0026jc=jole\r","date":"2023-12-27","heading":"Publications in Subfields Beyond the Top 5 Journals","objectID":"/en/posts/zoterorss/:1:7","tags":["Zotero","RSS"],"title":"Zotero: RSS Feed Aggregation Subscription","uri":"/en/posts/zoterorss/#publications-in-subfields-beyond-the-top-5-journals"},{"categories":["Software Tools","Economic Studies"],"collections":["Reference Management with Zotero"],"content":"National Bureau of Economic Research\rA prominent economic research organization whose papers have often appeared in top-tier journals. NBERLatest Issue: https://back.nber.org/rss/new.xml\r","date":"2023-12-27","heading":"National Bureau of Economic Research","objectID":"/en/posts/zoterorss/:1:8","tags":["Zotero","RSS"],"title":"Zotero: RSS Feed Aggregation Subscription","uri":"/en/posts/zoterorss/#national-bureau-of-economic-research"},{"categories":["Software Tools","Economic Studies"],"collections":["Reference Management with Zotero"],"content":"Foreign journals rss\rSometimes, when official journal websites do not provide RSS feeds but you still wish to follow them, you can utilize academic paper platforms to capture their RSS feeds. You can visit platforms like Elsevier\u0026rsquo;s Journal Navigator to find the journals you\u0026rsquo;re interested in and subscribe to their RSS feeds. Elsevier Elsevier\rIndeed, the drawback of such indirect subscriptions is that they often only provide titles without abstracts, dates, or author information. result\r","date":"2023-12-27","heading":"Foreign journals rss","objectID":"/en/posts/zoterorss/:2:0","tags":["Zotero","RSS"],"title":"Zotero: RSS Feed Aggregation Subscription","uri":"/en/posts/zoterorss/#foreign-journals-rss"},{"categories":["Software Tools","Economic Studies"],"collections":["Reference Management with Zotero"],"content":"Subscription Methods in China\r","date":"2023-12-27","heading":"Subscription Methods  in China","objectID":"/en/posts/zoterorss/:0:0","tags":["Zotero","RSS"],"title":"Zotero: RSS Feed Aggregation Subscription","uri":"/en/posts/zoterorss/#subscription-methods--in-china"},{"categories":["Software Tools","Economic Studies"],"collections":["Reference Management with Zotero"],"content":"How to Find RSS Feeds for Domestic Journals in China\rGenerally, in China, you can find RSS feeds for domestic journals through CNKI (China National Knowledge Infrastructure). CNKI CNKI\rrss\r","date":"2023-12-27","heading":"How to Find RSS Feeds for Domestic Journals in China","objectID":"/en/posts/zoterorss/:1:0","tags":["Zotero","RSS"],"title":"Zotero: RSS Feed Aggregation Subscription","uri":"/en/posts/zoterorss/#how-to-find-rss-feeds-for-domestic-journals-in-china"},{"categories":["Software Tools","Economic Studies"],"collections":["Reference Management with Zotero"],"content":"Flow Conservation List:\r经济研究： https://navi.cnki.net/knavi/rss/JJYJ 经济学（季刊）： https://navi.cnki.net/knavi/rss/JJXU 世界经济： https://navi.cnki.net/knavi/rss/SJJJ 中国工业经济： https://navi.cnki.net/knavi/rss/GGYY 管理世界： https://navi.cnki.net/knavi/rss/GLSJ 数量经济技术经济研究： https://navi.cnki.net/knavi/rss/SLJY\r","date":"2023-12-27","heading":"Flow Conservation List:","objectID":"/en/posts/zoterorss/:1:1","tags":["Zotero","RSS"],"title":"Zotero: RSS Feed Aggregation Subscription","uri":"/en/posts/zoterorss/#flow-conservation-list-1"},{"categories":["Software Tools","Economic Studies"],"collections":["Reference Management with Zotero"],"content":"Interesting RSS feeds:\rZhihu Daily Selection https://www.zhihu.com/rss\rTerence Tao\u0026rsquo;s Blog https://terrytao.wordpress.com/feed/\rAt the time, I was particularly curious about how Terence Tao was using GPT in mathematical research. This curiosity arose because the United States was soliciting opinions on managing AI at that time. Terence Tao\u0026rsquo;s Blog Greg Mankiw\u0026rsquo;s Blog: Yes, that\u0026rsquo;s the same person who authored the textbooks \u0026ldquo;Macroeconomics\u0026rdquo; and \u0026ldquo;Principles of Economics.\u0026rdquo; https://gregmankiw.blogspot.com/feeds/posts/default\r","date":"2023-12-27","heading":"Interesting RSS feeds:","objectID":"/en/posts/zoterorss/:0:0","tags":["Zotero","RSS"],"title":"Zotero: RSS Feed Aggregation Subscription","uri":"/en/posts/zoterorss/#interesting-rss-feeds"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Often, we emphasize the large volume of data, believing that more data means better representation, while neglecting the analysis of data structure, leading to incorrect estimates. Inappropriate estimation methods can result in conclusions that are completely opposite to reality. To better understand data structure, economics has developed fixed effects, moderating effects, heterogeneity analysis, and robustness analysis. These may seem like distinct parts of empirical paradigms, but personally, I believe they all aim to classify data structures to ensure our conclusions are truly valid. Therefore, this article seeks to reorganize the operational significance of empirical papers from the perspective of data structure and variable classification, and to distinguish between different regression commands in STATA. Below, we introduce an example from Chapter 17, \u0026ldquo;Measurement,\u0026rdquo; in Varian\u0026rsquo;s Microeconomic Analysis. ","date":"2023-12-26","heading":"","objectID":"/en/posts/ji_sata/:0:0","tags":["Stata"],"title":"Grouping and Measurement of Econometric Data (STATA Version)","uri":"/en/posts/ji_sata/#"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"1. Paradoxes in Statistics\r","date":"2023-12-26","heading":"1. Paradoxes in Statistics","objectID":"/en/posts/ji_sata/:1:0","tags":["Stata"],"title":"Grouping and Measurement of Econometric Data (STATA Version)","uri":"/en/posts/ji_sata/#1-paradoxes-in-statistics"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Simpson\u0026rsquo;s Paradox\rSuppose we want to study the relationship between \u0026ldquo;coffee consumption and income.\u0026rdquo; We have data on 4 men and 4 women, along with their income and coffee consumption. STATA data generation is as follows: clear input str6 gender income coffee \"woman\" 8 1 \"woman\" 9 2 \"woman\" 10 3 \"woman\" 11 4 \"man\" 1 6 \"man\" 2 7 \"man\" 3 8 \"man\" 4 9 end\rWe can then plot a scatter plot and perform three different sample fits: one for the overall data, one for men, and one for women. Using this style, STATA can achieve similar effects to R—plotting code is provided below:\rUsing this style, STATA can achieve similar effects to R—plotting code is provided below: *ssc install schemepack, replace //Painting style command *For more details, see: https://www.lianxh.cn/news/e76a8a7e3c6c4.html set scheme gg_w3d twoway scatter coffee income if gender == \"man\",color(blue) msize(3) || scatter coffee income if gender == \"woman\",color(green) msize(3) msymbol(triangle) || lfit coffee income if gender == \"man\",color(red) || lfit coffee income if gender == \"woman\" ,color(black) || lfit coffee income ,color(red) lpattern(dash) /// legend(order(1 \"Men\" 2 \"Women\" 3 \"Men Fit\" 4 \"Women Fit\" 5 \"Overall Fit\" )) /// xtitle(\"income\") ytitle(\"coffee\") /// title(stata style：gg_w3d) /// note(\"By 滑翔闪\")\rIf we ignore the details and directly perform regression on the overall data, we might conclude that higher income leads to lower coffee consumption. However, if we perform separate regressions for men and women, the conclusion is the opposite—higher income leads to higher coffee consumption. Clearly, the latter aligns more with reality. This is $\\boxed{Simpson\u0026#39;s Paradox}$: local correlations and overall correlations can present completely different results. Simpson\u0026rsquo;s Paradox is ubiquitous in life, such as measuring the efficacy of drugs across different age groups, gender discrimination in college admissions, or racial bias in police enforcement. We should not only care about absolute values, such as the gender ratio of a certain outcome; But also observe relative values, such as whether police focus more on people of color because they have higher crime rates; 《An alternative test of racial prejudice in motor vehicle searches: Theory and evidence》(2006)1 is based on \u0026ldquo;crime rates by race and police enforcement focus\u0026rdquo; to study racial bias in police enforcement in Florida. Since Floyd\u0026rsquo;s \u0026ldquo;I can\u0026rsquo;t breathe\u0026rdquo; went viral, many books have used this event to introduce counterfactual inference2 (e.g., Mostly Harmless Econometrics by Joshua D. Angrist). We should also pay attention to internal stratification, such as by race, region, gender\u0026hellip; as in the coffee consumption example above. One reason for Simpson\u0026rsquo;s Paradox is omitted variables and confounders3—in the case of coffee consumption and income, gender is an important factor we omitted, but by grouping and fitting, we controlled for it. Other similar paradoxes include survivorship bias and Berkson\u0026rsquo;s Paradox\u0026hellip; both involve unintentional sample selection that affects analysis results. ","date":"2023-12-26","heading":"Simpson\u0026rsquo;s Paradox","objectID":"/en/posts/ji_sata/:1:1","tags":["Stata"],"title":"Grouping and Measurement of Econometric Data (STATA Version)","uri":"/en/posts/ji_sata/#simpsons-paradox"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"2. Panel Data\rCross-sectional data: same time/object, different space; time series: same space/object, different time; panel data: different time, different space/object. Panel data naturally includes two variables worth discussing—space/object and time. Economics often uses panel data to analyze reality. $$ Data\\begin{cases} One-dimensional\\begin{cases}Time series: time\\newline Cross-sectional data: space \\end{cases}\\newline Two-dimensional (panel data): time \u0026#43; space\\newline High-dimensional: more dimensions \\end{cases}\\newline $$ $$ Panel data\\begin{cases} Balanced/unbalanced (whether the ratio of time to space is consistent)\\newline Long/short (whether the number of spaces is less than the number of times) \\end{cases}\\newline $$ For panel data, we first need to clarify which dimension corresponds to time and which corresponds to space/object. It\u0026rsquo;s essentially a grouping process—you can group by industry or assign each individual a unique ID. In STATA terms, this is: xtset id year\r","date":"2023-12-26","heading":"2. Panel Data","objectID":"/en/posts/ji_sata/:2:0","tags":["Stata"],"title":"Grouping and Measurement of Econometric Data (STATA Version)","uri":"/en/posts/ji_sata/#2-panel-data"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"3. Residuals: Economic, Mathematical, and Statistical Meanings\rThe ordinary regression equation OLS is: $$ Y=\\alpha X \u0026#43;u $$ This directly fits the overall data. Knowing Simpson\u0026rsquo;s Paradox, we understand that such regression is an overall fit and may yield completely different results from local fits. The residual $ \\color{red}{u} $ omits too much information we haven\u0026rsquo;t considered, such as gender classification. Therefore, we need to group the data and decompose the gender variable M from the residual $\\color{red}{u}$. $$ Y=\\alpha X \u0026#43;\\beta M\u0026#43;u $$ Here, we introduce $\\boxed{control variables}$. Note! This is my personal perspective on control variables from a grouping viewpoint, emphasizing their role in selection bias. This grouping requires careful consideration of the practical economic significance of control variables in our study. For example, numerous studies show that coffee consumption habits indeed differ by gender. The selection of control variables also serves to reduce confounding factors; additionally, we must consider optimal fitting, unbiased estimation, and other statistical mathematical meanings. With panel data, our equation becomes two-dimensional, with object/space coding i and time coding t. The ordinary regression equation OLS becomes: $$ Y\\_{\\color{red}{it}}=\\alpha X\\_{\\_{\\color{red}{it}}}\u0026#43;\\beta M\\_{\\_{\\color{red}{it}}}\u0026#43;u\\_{\\_{\\color{red}{it}}} $$ To further decompose the economic interpretation of residuals across time and space/object dimensions, we continue to decompose: $$ Y\\_{\\color{red}{it}}=\\alpha X \\_{_{\\color{red}{it}}}\u0026#43;\\beta M\\_{\\_{\\color{red}{it}}}\u0026#43;\\lambda\\_{\\color{red}{i}}\u0026#43;\\gamma\\_{\\color{red}{t}}\u0026#43;u^{\\prime } $$ Thus, the equation becomes: $$ Y\\_{\\color{red}{it}}=\\alpha X \\_{\\_{\\color{red}{it}}}\u0026#43;\\beta M\\_{\\_{\\color{red}{it}}}\u0026#43;\\lambda\\_{\\color{red}{i}}\u0026#43;\\gamma\\_{\\color{red}{t}}\u0026#43;u^{\\prime } $$ First, let\u0026rsquo;s analyze their economic meaning—variables: $\\boxed{\\gamma_{\\color{red}{t}}}:$ This part of the residual is the decomposition of the time dimension, indicating that this variation is only related to time, representing time effects. For example, seasonal vegetable yields are clearly related to seasons, and technology naturally progresses steadily over the long term. These effects are shared by all individuals, meaning all samples change synchronously over time. $\\boxed{\\lambda_{\\color{red}{i}}}:$ This part of the residual is the decomposition of the space/object dimension, indicating that this variation is only related to the individual, representing individual effects. For example, Apple took a long time to adopt USB-C, which is part of their corporate culture. Only Apple had this idea, and for a long time, they were the only company in their industry to insist on this. $\\boxed{u_{\\color{red}{it}}^{\\prime }}:$ The deviation between the actual value and the estimated value, outside our model\u0026rsquo;s explanation, is the residual. Causes include measurement errors, omitted variables, and models not aligning with reality\u0026hellip; Next, let\u0026rsquo;s analyze their mathematical meaning—intercepts: $$ Y\\_{\\color{red}{it}}=\\alpha X\\_{\\_{\\color{red}{it}}}\u0026#43;\\beta D\\_{\\_{\\color{red}{it}}}\u0026#43;(\\lambda\\_{\\color{red}{i}}\u0026#43;\\gamma\\_{\\color{red}{t}}\u0026#43;u^{\\prime }) $$ Clearly, $(\\lambda_{\\color{red}{i}}\u0026#43;\\gamma_{\\color{red}{t}}\u0026#43;u^{\\prime })$ as a constant is the intercept in the linear equation structure! Finally, let\u0026rsquo;s analyze their statistical meaning—residuals: Whether there are different intercepts is closely related to the distribution of residuals, heteroscedasticity, and correlation. Fixed effects, random effects, and pooled regressions differ in how they decompose residuals, determining whether our model can explain individual and time effects. $$ Y\\_{\\color{red}{it}}=\\alpha X \\_{\\_{\\color{red}{it}}}\u0026#43;\\beta M\\_{\\_{\\color{red}{it}}}\u0026#43;(\\lambda\\_{\\color{red}{i}}\u0026#43;\\gamma\\_{\\color{red}{t}}\u0026#43;u^{\\prime }) \\newline ","date":"2023-12-26","heading":"3. Residuals: Economic, Mathematical, and Statistical Meanings","objectID":"/en/posts/ji_sata/:3:0","tags":["Stata"],"title":"Grouping and Measurement of Econometric Data (STATA Version)","uri":"/en/posts/ji_sata/#3-residuals-economic-mathematical-and-statistical-meanings"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"1. Pooled OLS\r$\\boxed{Pooled OLS}$: When $Y\\_{\\color{red}{it}}=\\alpha X \\_{\\_{\\color{red}{it}}}\u0026#43;\\beta M\\_{\\_{\\color{red}{it}}}\u0026#43;(\\lambda\\_{\\color{red}{i}}\u0026#43;\\gamma\\_{\\color{red}{t}}\u0026#43;u^{\\prime })=\\alpha X \\_{\\_{\\color{red}{it}}}\u0026#43;\\beta M\\_{\\_{\\color{red}{it}}}\u0026#43;u$, even though we have many methods, such as grouping by year or by individual, we still treat each as a unique data point and pool them together for regression. This can be seen as all data points sharing a single intercept. Here, we assume no individual effects: $\\lambda_{\\color{red}{i}}=0$. We also assume that the remaining residuals are uncorrelated with explanatory and control variables: $Cov（u|M\\_{\\_{\\color{red}{it}}}, X\\_{\\_{\\color{red}{it}}}） =0$, and the residuals follow a normal distribution. $$ Y\\_{\\color{red}{it}}=\\alpha X \\_{\\_{\\color{red}{it}}}\u0026#43;\\beta M\\_{\\_{\\color{red}{it}}}\u0026#43;u $$ Pooled OLS uses the least squares method to perform an overall regression on all points, with all data points sharing a single intercept u4. Therefore, pooled OLS is also called \u0026ldquo;longitudinal cross-sectional regression\u0026rdquo; or \u0026ldquo;pooled cross-sectional regression.\u0026rdquo; The first column groups by year, with each time section\u0026rsquo;s data points sharing an intercept; the second column groups by individual, with each individual section\u0026rsquo;s data points sharing an intercept; the third column\u0026rsquo;s chart is pooled OLS, where all data points are directly fitted on a single plane.\rThe first column groups by year, with each time section\u0026rsquo;s data points sharing an intercept; the second column groups by individual, with each individual section\u0026rsquo;s data points sharing an intercept; the third column\u0026rsquo;s chart is pooled OLS, where all data points are directly fitted on a single plane. ","date":"2023-12-26","heading":"1. Pooled OLS","objectID":"/en/posts/ji_sata/:3:1","tags":["Stata"],"title":"Grouping and Measurement of Econometric Data (STATA Version)","uri":"/en/posts/ji_sata/#1-pooled-ols"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"2. Fixed Effects\rDivided into individual fixed effects and time fixed effects (double fixed). Individual Fixed Effects: $\\boxed{LSDV}:$ Pooled OLS treats all $\\lambda\\_{it}$ equally. Imagine observing the same person multiple times—pooled OLS treats each repeated observation as equally valuable. Fixed effects disagree, believing that individuals have certain traits, and repeated observations provide limited value. Therefore, we need to generate dummy individual variables (n-1) to identify each individual and estimate each individual\u0026rsquo;s effect separately, known as the \u0026ldquo;Least Square Dummy Variable Model\u0026rdquo; (LSDV). This generates many control variables, so $R^2$ is high. $$ \\begin{align} Y\\_{\\color{red}{it}}\u0026amp;=\\alpha X\\_{\\color{red}{it}}\u0026#43;\\beta M\\_{\\_{\\color{red}{it}}}\u0026#43;\\alpha_{1}D_{1}\u0026#43;\\alpha\\_{2}D\\_{2}\u0026#43;\\cdots\u0026#43;\\alpha\\_{N}D\\_{N}\u0026#43;u\\_{\\color{red}{it}}\\newline \\end{align} $$ Individual effects—causal relationship diagram. Treating individual effects as confounders, we control for them to truncate. $\\boxed{Within-group estimation}$, fixed effects assume that individual effects are correlated with explanatory variables, so we use within-group deviation to eliminate this correlation, similar to de-meaning—subtracting the within-group mean5. The average is taken for the same variable, averaging values across different years: $\\bar X_i = \\frac{\\sum_{t=n}^{t=1}{X_{it}}}{t}$ Supplement\rVariance analysis of panel data. After setting xtset id year, id could be a spatial, industry, or individual identifier, giving us n groups. Each group has internal variance, which is within-group variance; there is also variance between groups, which is between-group variance. Variance analysis helps confirm whether our grouping is appropriate. Here, within-group estimation is used, which is more effective than between-group estimation. The argument is from Wooldridge\u0026rsquo;s econometrics textbook exercises and won\u0026rsquo;t be expanded here.\r$$ Y\\_{\\color{red}{it}}-\\bar Y\\_{\\color{red}{i}}=\\alpha (X \\_{\\_{\\color{red}{it}}}-\\bar X \\_{\\color{red}{i}})\u0026#43;\\beta (M\\_{\\_{\\color{red}{it}}}-\\bar M \\_{\\color{red}{i}})\u0026#43;(u\\_{\\_{\\color{red}{it}}}-\\bar u \\_{\\color{red}{i}}) $$ This equation can also be understood as the lagged $\\boxed{first-difference method}$. $$ Y\\_{\\color{red}{it}}-\\bar Y\\_{\\color{red}{i}}=Y_{\\color{red}{i,t}}-Y\\_{\\color{red}{i,t-1}} \\=\\alpha (X \\_{\\_{\\color{red}{it}}}-X \\_{\\color{red}{i,t-1}})\u0026#43;\\beta (M\\_{\\_{\\color{red}{it}}}- M \\_{\\color{red}{i,t-1}})\u0026#43;(u\\_{\\_{\\color{red}{it}}}- u \\_{\\color{red}{i,t-1}}) $$ In summary, there are currently three estimation equations for individual fixed effects: dummy variable least squares, within-group estimation, and first-difference. Their estimates are largely consistent, with differences mainly in data assumptions. First-difference eliminates individual effects, so it cannot estimate effects that do not change over time. Dummy least squares (LSDV) requires that the constructed dummy variables be strictly exogenous, and too many dummy variables may exceed STATA\u0026rsquo;s operational limits. $$ \\begin{cases} Y\\_{\\color{red}{it}}=\\alpha X\\_{\\color{red}{it}}\u0026#43;\\beta M\\_{\\_{\\color{red}{it}}}\u0026#43;\\sum\\_{1}^{N}{\\alpha\\_{j}D\\_{j}}\u0026#43;u\\_{\\color{red}{it}}\\newline Y\\_{\\color{red}{it}}-\\bar Y\\_{\\color{red}{i}}=\\alpha (X \\_{\\_{\\color{red}{it}}}-\\bar X \\_{\\color{red}{i}})\u0026#43;\\beta (M\\_{\\_{\\color{red}{it}}}-\\bar M \\_{\\color{red}{i}})\u0026#43;(u\\_{\\_{\\color{red}{it}}}-\\bar u \\_{\\color{red}{i}})\\newline Y\\_{\\color{red}{i,t}}-Y\\_{\\color{red}{i,t-1}} =\\alpha (X \\_{\\_{\\color{red}{it}}}-X \\_{\\color{red}{i,t-1}})\u0026#43;\\beta (M\\_{\\_{\\color{red}{it}}}- M \\_{\\color{red}{i,t-1}})\u0026#43;(u\\_{\\_{\\color{red}{it}}}- u \\_{\\color{red}{i,t-1}}) \\end{cases} $$ The goal is to correctly estimate the coefficient $\\alpha$ of the explained variable when individual effects are correlated with control variables, and the parameters $ \\alpha $ in the above four estimation equations are the same: $$ Y\\_{\\col","date":"2023-12-26","heading":"2. Fixed Effects","objectID":"/en/posts/ji_sata/:3:2","tags":["Stata"],"title":"Grouping and Measurement of Econometric Data (STATA Version)","uri":"/en/posts/ji_sata/#2-fixed-effects"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"*Supplement: Frisch-Waugh-Lovell Theorem\rThe lemma proving that dummy variable least squares and within-group estimation have the same coefficient $\\alpha$ is the \u0026ldquo;Frisch-Waugh-Lovell Theorem.\u0026rdquo; Here\u0026rsquo;s a minimal example: The real equation is: $$ \u0026gt; Y=\\beta_1 X_1\u0026#43; \\beta_2 X_2 \u0026#43;u_1 \u0026gt; $$ We want to estimate $\\beta_1$, but we omitted variable $X_1$ and only regressed $X_2$, resulting in: $$ \u0026gt; Y=\\alpha X_2\u0026#43;u_2 \u0026gt; $$ Now, we regress $X_2$ and $X_1$ to get: $$ \u0026gt; X_1=\\gamma X_2\u0026#43;u_3 \u0026gt; $$ Finally, we regress the residuals: $$ \u0026gt; u_2=\\dot \\beta u_3\u0026#43;u \u0026gt; $$ Based on the residuals from the two regressions, we get: $$ \u0026gt; \\begin{cases} \u0026gt; u_2=Y-\\alpha X_2\\newline \u0026gt; u_3 = X_1 - \\gamma X_2 \u0026gt; \\end{cases} \u0026gt; $$ Expanding and transforming, we directly obtain: $$ \u0026gt; Y=\\dot \\beta X_1 \u0026#43; (\\alpha-\\gamma)X_2\u0026#43;u \u0026gt; $$ We find that $\\dot \\beta=\\beta_1$, and through this indirect estimation, we estimate the desired coefficient $\\beta_1$. Dummy regression first regresses $Y$ with dummy variables $D$, then regresses $X_1$ with $D$, and finally uses residuals for estimation, so the coefficients are consistent with within-group estimation. FWL proves that first-difference estimation and dummy variable estimation are equal. If you want to try it yourself, you can use STATA\u0026rsquo;s built-in data for testing[^6]: *Use STATA's built-in xtpcse command example data webuse grunfeld,clear *If there's no network import, it might be a network issue; you need a VPN. *Database site: *https://www.stata-press.com/data/r10/xt.html *You can also download it directly. reg mvalue invest kstock i.company xtreg mvalue invest kstock ,fe areg mvalue invest kstock , absorb(company) reghdfe mvalue invest kstock , absorb(company)\rThe code blocks use four commands to perform fixed effects, fixing individual effects but not time effects. The results are shown below, and you can see that their coefficient estimates are identical. Why are the intercepts (constant terms) different?—No explanation was found in any practical books. Personally, I believe[^7] it\u0026rsquo;s due to different residual calculation methods across commands. (1) Pooled OLS calculates residuals for one regression equation and all points. (2) (3) (4) Cluster many regression equations with the same coefficients but different intercepts, and each point calculates variance with its corresponding regression equation, then sums them up. Why are $R^2$ different: (1) (3) (4) All use LSDV, so many dummy variables are generated. (2) Uses between-group estimation, so no dummy variables are generated. Regression Table\rBy the way, when we change the code to the following, the situation also changes: reg mvalue invest kstock i.company xtreg mvalue invest kstock ,fe r areg mvalue invest kstock , absorb(company) vce(cluster company) reghdfe mvalue invest kstock , absorb(company) xtreg laborinput did i.year, fe robust\rRegression Table\rFrom the image, we can see that the coefficient estimates are the same, but the standard deviations are different. Default regression uses ordinary standard deviation, requiring data to satisfy homoscedasticity; Adding r, i.e., robust, uses robust standard deviation to address heteroscedasticity; Adding vce (cluster company) uses clustered robust standard deviation to address heteroscedasticity + internal autocorrelation. ","date":"2023-12-26","heading":"*Supplement: Frisch-Waugh-Lovell Theorem","objectID":"/en/posts/ji_sata/:3:3","tags":["Stata"],"title":"Grouping and Measurement of Econometric Data (STATA Version)","uri":"/en/posts/ji_sata/#supplement-frisch-waugh-lovell-theorem"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"4. Mechanism Testing\r","date":"2023-12-26","heading":"4. Mechanism Testing","objectID":"/en/posts/ji_sata/:4:0","tags":["Stata"],"title":"Grouping and Measurement of Econometric Data (STATA Version)","uri":"/en/posts/ji_sata/#4-mechanism-testing"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"1. The Gray Area of Mechanism Testing in Empirical Studies\rSimpson\u0026rsquo;s Paradox teaches us that grouped regression and overall regression can yield completely different results, partly due to omitted variables. Therefore, we need to add control variables. When using \u0026ldquo;panel data,\u0026rdquo; the data includes \u0026ldquo;time\u0026rdquo; and \u0026ldquo;space\u0026rdquo; dimensions, which can still affect our research. Thus, we need to separate \u0026ldquo;individual effects\u0026rdquo; and \u0026ldquo;time effects.\u0026rdquo; Answering Simpson\u0026rsquo;s Paradox—here, we address causality, requiring avoidance of endogeneity. In mechanism testing, some use grouped regression or interaction terms to extend conclusions, assuming—the new variable in mechanism testing is not an omitted control variable. There\u0026rsquo;s a big problem here—how do you ensure there\u0026rsquo;s no endogeneity in mechanism testing? For example, in the figure below, the leftmost path is a collision path in causality, while the right side shows moderating and mediating effects in mechanism testing. Clearly, collision effects with confounders can still satisfy moderating and mediating effects. This introduces a new endogeneity issue!!!! Therefore, Zhu Jiaxiang and Zhang Wenrui (2021)[^8] state that moderating effects do not satisfy statistical causality testing. On this basis, Jiang Ting (2022)[^9] even calls for abandoning the three-step mediation method, as it\u0026rsquo;s meaningless—it neither proves nor disproves endogeneity. Thus, our mechanism testing is left with only two options: 1. Further prove no endogeneity. This requires another controlled experiment (feels like another mini economic empirical comparison); or discuss the correlation between residuals and the explained variable after grouped regression. Use correlation + theoretical explanation to approach causality. 《Causal Inference in Empirical Research: Mediation and Moderation Effects》Jiang Ting (2022)\r2. No need to prove, my variable is naturally exogenous. The variable has no endogeneity in practical terms, meaning more theoretical and economic explanations are needed. The most common \u0026ldquo;filler\u0026rdquo; in domestic research is the four major regions and the Hu Line, as these classifications are naturally exogenous variables in practical terms. It seems that mechanism testing is essentially an incomplete mini-empirical study, extending conclusions through incomplete empirical steps. Personally, I feel that no econometrics textbook emphasizes so-called \u0026ldquo;mechanism analysis,\u0026rdquo; but it has become a specific requirement domestically. It seems that quantitative economics ultimately relies on a mix of practical theory and quantitative analysis. ","date":"2023-12-26","heading":"1. The Gray Area of Mechanism Testing in Empirical Studies","objectID":"/en/posts/ji_sata/:4:1","tags":["Stata"],"title":"Grouping and Measurement of Econometric Data (STATA Version)","uri":"/en/posts/ji_sata/#1-the-gray-area-of-mechanism-testing-in-empirical-studies"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"2. Mediation Effects: Differences from Psychological Statistics\rThe views on mediation effects mainly reference The Book of Why by Judea Pearl. When we ask why, there are two types of logical chains: one is principle, and the other is process. $$ Eating oranges\\rightarrow Vitamin C\\rightarrow Resisting scurvy\\newline Elderly\\rightarrow Falling\\rightarrow Hospitalization\\\\ $$ Taking the above two path diagrams as examples, the first one—eating vitamin C to resist scurvy—sounds more like a principle-based answer, while the elderly falling seems more like a process. I\u0026rsquo;ve seen many forums and social science自媒体 videos claiming that \u0026ldquo;economics stole mediation effects from psychology\u0026rdquo;—this is not the case. Psychology can widely apply mediation effects because its path diagrams are: $external stimuli\\rightarrow human reactions, hormonal changes\\rightarrow behavioral changes$, which align more with principles. Economics, on the other hand, answers with $variable1\\rightarrow variable2\\rightarrow variable3$, which is more like a process description, broader, and less aligned with principles, hence the skepticism. Psychology restricts mediation variables to human performance, while economics has no such strict restrictions, making spurious correlations highly likely. For example, in the case of vitamin C and scurvy, people long believed it was \u0026ldquo;fruit—oranges\u0026rdquo; that mattered. The Kost Arctic expedition thought the key was fresh fruit, so they prepared no fruit but only fresh meat, and everyone ended up with scurvy. To address \u0026ldquo;Simpson\u0026rsquo;s Paradox,\u0026rdquo; we still need mediation effects because of the $\\boxed{mediation fallacy}$. Take the Science paper Sex Bias in Graduate Admissions: Data from Berkeley[^10] as an example. We get the following causal path diagram. Gender affects admission rates through two paths. 《Sex Bias in Graduate Admissions: Data from Berkeley》\rDirect effect: $gender\\rightarrow admission rate$ Indirect effect: $gender\\rightarrow department\\rightarrow admission rate$, where \u0026ldquo;department\u0026rdquo; is the mediating variable. If we directly control for \u0026ldquo;department,\u0026rdquo; we show the direct effect of gender on admission rates, and the regression will indicate discrimination against women. If we only control for \u0026ldquo;state of residence,\u0026rdquo; we show the direct effect of gender on admission rates and the indirect effect of gender-department-admission rates, indicating no discrimination against women. The completely different results are precisely Simpson\u0026rsquo;s Paradox. In the coffee example, we made a mistake by omitting a variable; here, the mistake is controlling for a \u0026ldquo;mediating variable\u0026rdquo;. The final conclusion is that because women are more likely to apply to the most competitive departments, their admission rates appear lower, so department is an important mediating variable and should not be casually controlled. Thus, mediating variables should not be used as control variables, and if we want to distinguish between direct and mediating effects, further differentiation is needed. ","date":"2023-12-26","heading":"2. Mediation Effects: Differences from Psychological Statistics","objectID":"/en/posts/ji_sata/:4:2","tags":["Stata"],"title":"Grouping and Measurement of Econometric Data (STATA Version)","uri":"/en/posts/ji_sata/#2-mediation-effects-differences-from-psychological-statistics"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"3. Moderating Effects: Grouped Regression or Interaction Terms\rFound a comprehensive summary This section mainly references Regression Analysis by Xie Yu. For variables $Y$, $X_1$, $X_2$, and $D$, we have different estimation strategies. Grouped regression: $Y=\\beta_1 X_1\u0026#43;\\beta_2 X_2\u0026#43;u$, then group by D. Introduce interaction terms, with two estimation methods: $$ \\begin{cases} Y=\\beta\\_1 X\\_1\u0026#43;\\beta\\_2 X\\_2\u0026#43;\\beta\\_3D\u0026#43;\\beta\\_4 DX\\_1\u0026#43;u \\newline Y=\\beta\\_1 X\\_1\u0026#43;\\beta\\_2 X\\_2\u0026#43;\\beta\\_3DX \u0026#43;u \\end{cases} $$ What\u0026rsquo;s the difference between interaction terms and grouped regression?\rGenerally, interaction terms emphasize moderating effects, while grouped regression emphasizes heterogeneity. Jiang Ting (2022) believes they are the same. However, there are still some differences: First, there are cases where grouped regression is necessary, such as when discussing regional heterogeneity across east, west, north, south, and central regions. We cannot quantify their roles in interaction terms with 1-4, and repeatedly using 0-1 coding doesn\u0026rsquo;t align with control logic, so grouped regression is needed. Second, there are cases where we need to study interaction terms, i.e., substitution and complementary effects. When the equation becomes $Y=\\beta_1 X_1\u0026#43;\\beta_2 X_2\u0026#43;\\beta_3DX \u0026#43;u$, studying marginal effects, each other\u0026rsquo;s marginal effects are influenced by the other. Finally, when group coefficients are similar, grouped regression can also serve as a robustness test. Here are some common conclusions (though I feel these conclusions lack authoritative paper support): Statistical testing favors interaction terms because they have significance tests (though now grouped regression can also test coefficient differences for significance), are more sensitive, and use the entire sample, while grouped regression reduces sample size; Data assumptions differ, interaction terms assume only interaction-related groups have between-group differences, requiring stricter assumptions. Interaction terms require control variable coefficients to be consistent across groups, while grouped regression does not. An extended conclusion—when a variable interacts with all control variables, interaction term estimation and grouped regression are completely consistent. Different variables require different discussions; interaction terms can be divided into dummy-dummy interactions (recommended reference), dummy-continuous interactions, and continuous-continuous interactions, requiring specific analysis. (Basic Econometrics by Gujarati supports dummy-dummy interactions—no controversy given the prevalence of difference-in-differences.) Interaction term assumptions remain a gray area in mechanism testing. As long as your variable logic makes sense, use whichever is significant—grouped or interaction—or better yet, use both. What kind of variables are suitable for interactions?\rFrom a mathematical perspective, addition affects intercepts, while multiplication affects slopes. From the figure, moderating effects emphasize interactions because they affect slopes along with X.\rFrom the figure, moderating effects emphasize interactions because they affect slopes along with X. Grouped regression emphasizes that X\u0026rsquo;s slope is the same, only intercepts differ, with no moderating effects, making it more suitable as a control variable. Can we delete lower-order terms?\rWhich of the following two estimation equations should we choose? Can we remove the lower-order terms $X$ and $D$ after including the interaction term $XD$? $$ \\begin{cases} Y=\\beta_1 X_1\u0026#43;\\beta_2 X_2\u0026#43;\\beta_3 D\u0026#43;\\beta_4 DX_1\u0026#43;u\\newline Y=\\beta_1 X_1\u0026#43;\\beta_2 X_2\u0026#43;\\beta_3DX_2 \u0026#43;u\\end{cases} $$ The answer is that $\\beta_3 D$ should be included. In the first equation, $\\beta_4$ is indeed the net effect after controlling for $X_1$ and $D$. This can lead to \u0026ldquo;multicollinearity,\u0026rdquo; which can be addressed by de-meaning (subtracting the","date":"2023-12-26","heading":"3. Moderating Effects: Grouped Regression or Interaction Terms","objectID":"/en/posts/ji_sata/:4:3","tags":["Stata"],"title":"Grouping and Measurement of Econometric Data (STATA Version)","uri":"/en/posts/ji_sata/#3-moderating-effects-grouped-regression-or-interaction-terms"},{"categories":["Film and TV"],"collections":[],"content":"\u0026ldquo;Counterfeit\u0026rdquo;: A Matter of Human Agency\r","date":"2023-12-10","heading":"\u0026ldquo;Counterfeit\u0026rdquo;: A Matter of Human Agency","objectID":"/en/posts/zyw/:0:0","tags":["Anime Culture"],"title":"On Motivation: The Genuine and Counterfeit in Anime and Manga","uri":"/en/posts/zyw/#counterfeit-a-matter-of-human-agency"},{"categories":["Film and TV"],"collections":[],"content":"The Genuine and the Counterfeit\rWhat is \u0026ldquo;counterfeit\u0026rdquo;—it is human-made. The counterfeit is a product infused with attributes of human intervention, perceived as unnatural. For instance, many mock the trendy normies—when Marvel hits, they\u0026rsquo;re Marvel fans; when Spy × Family becomes popular, they become old-school otaku; when variety shows with Wang Xinling go viral, they become her girls; when The Wandering Earth explodes in popularity, they\u0026rsquo;re suddenly long-time Liu Cixin fans. All such behaviors, imbued with artificial attributes, carry the taint of bandwagoning. Then there are traits that only manifest in social interactions—\u0026ldquo;checking in to show focused study, emphasizing one\u0026rsquo;s soaring enthusiasm for learning\u0026rdquo; or \u0026ldquo;claiming to love xx genre of books, yet never discussing any specific insights gained.\u0026rdquo; \u0026ldquo;It\u0026rsquo;s not so much loving a certain thing as loving the self that yearns for that thing\u0026rdquo;—in reality, they enjoy the state of being fanatical; toward what that fanaticism is directed becomes irrelevant. Conversely, the \u0026ldquo;genuine\u0026rdquo; is a pure, natural attribute, requiring no deliberate human effort to maintain or display. China has not lacked similar concepts, such as the Song-Ming Neo-Confucian principle of \u0026ldquo;preserving heavenly principles and extinguishing human desires,\u0026rdquo; yet whether in depth of meaning or grandeur of scope, Neo-Confucianism stands on a higher plane. The distinction between genuine and counterfeit exists merely on the level of personal fulfillment. ","date":"2023-12-10","heading":"The Genuine and the Counterfeit","objectID":"/en/posts/zyw/:1:0","tags":["Anime Culture"],"title":"On Motivation: The Genuine and Counterfeit in Anime and Manga","uri":"/en/posts/zyw/#the-genuine-and-the-counterfeit"},{"categories":["Film and TV"],"collections":[],"content":"Discussions in Anime and Manga Works\rDrawing upon anime and manga works like Oregairu and Monogatari Series, I wish to summarize the boundary between counterfeit and genuine in traditional anime and manga. In the perspective of viewing things: The \u0026ldquo;genuine\u0026rdquo; requires acceptance in its entirety, with the implicit requirement of seeing the many facets, even the essence, of things; the counterfeit is partial, remaining at the surface. In Oregairu, Hachiman\u0026rsquo;s classic statement about why he hates kind-hearted girls stems precisely from the fact that this kindness extends to everyone—it is a politeness extended without knowing one\u0026rsquo;s full circumstances. The conclusion is that this kindness is neither unique nor lasting. Oregairu — Hikigaya\u0026rsquo;s classic discourse on counterfeit youth: I hate kind-hearted girls. Kind-hearted girls are actually kind to everyone, yet I would mistakenly believe they are kind only to me, then become complacent and arrogant, and finally part on bad terms with both sides hurt. That\u0026rsquo;s why I hate kind-hearted girls. In the duration of maintaining passion: The genuine is enduring, loyal, and scarce; even after a long separation, mutual understanding persists—it is unique and irreplaceable. The counterfeit is transient, requiring constant, deliberate human effort to maintain; it fears being replaced by others and can itself be replaced. For instance, in Rascal Does Not Dream, the protagonist stands against social atmosphere, believing that such atmosphere amounts to nothing before precious people. From now on, my enemy is the atmosphere. Echoing what others say is effortless; judging right and wrong entirely by one\u0026rsquo;s own will burns calories. Bearing one\u0026rsquo;s own judgment, when met with denial, inflicts pain. In the motivation of inner expression: The genuine is pure, natural, a feeling springing spontaneously from the depths of the heart; the counterfeit is impure in motive, harboring other utilitarian purposes. The debate over \u0026ldquo;what is human nature at birth\u0026rdquo; can be considered a discussion of the genuine. In narrative construction: The genuine and the counterfeit reflect one another in pairs, and contradictions exist within them. Perhaps one believes that friendship requires accommodation, so the author writes that true friends can quarrel; one believes that the species distinction between humans and demons is their essence, yet the author states that goodness of character is the more important measure; some believe that朋友圈 (social media posts) prove happiness and joy that begs sharing, yet the author writes that the contented do not proclaim their satisfaction to the outside world. In character portrayal, counterfeit and genuine are often intertwined with \u0026ldquo;self-awareness,\u0026rdquo; \u0026ldquo;envy,\u0026rdquo; \u0026ldquo;disgust,\u0026rdquo; and \u0026ldquo;inferiority.\u0026rdquo; Japanese anime displays such adeptness in this regard, inseparable from their early creation of campus youth anime—these emotions are the normative state of adolescent students. If a person is self-aware (feels that they) can distinguish between \u0026ldquo;counterfeit\u0026rdquo; and \u0026ldquo;genuine,\u0026rdquo; such characters often feel inferior for being counterfeit. For example, in Oshi no Ko, in the early stages, Ai Hoshino dares not express \u0026ldquo;love\u0026rdquo; to her children—she is unwilling to falsely speak loving words to them. Oshi no Ko\rFrom this perspective, it is evident that most authors write characters who consider themselves \u0026ldquo;counterfeit\u0026rdquo; with a sympathetic attitude. Considering oneself counterfeit has a premise: having never attained the \u0026ldquo;genuine\u0026rdquo; while yearning for it, at which point they are self-aware, self-aware of their ability to distinguish between genuine and counterfeit. The pain of yearning without attainment, and a past devoid of happiness, can both become sources of counterfeit inferiority, and also the entry point for sympathetic perspective. Manga Oshi no Ko\rIf a per","date":"2023-12-10","heading":"Discussions in Anime and Manga Works","objectID":"/en/posts/zyw/:2:0","tags":["Anime Culture"],"title":"On Motivation: The Genuine and Counterfeit in Anime and Manga","uri":"/en/posts/zyw/#discussions-in-anime-and-manga-works"},{"categories":["Film and TV"],"collections":[],"content":"The Stance of Exalting the Counterfeit\rA vast number of works, in the end, express an existentialist viewpoint—the counterfeit is not a disguise; artificiality is not necessarily evil. The center of definition lies in human emotion. ","date":"2023-12-10","heading":"The Stance of Exalting the Counterfeit","objectID":"/en/posts/zyw/:3:0","tags":["Anime Culture"],"title":"On Motivation: The Genuine and Counterfeit in Anime and Manga","uri":"/en/posts/zyw/#the-stance-of-exalting-the-counterfeit"},{"categories":["Film and TV"],"collections":[],"content":"First Layer of Meaning\rThe counterfeit is \u0026ldquo;human-made,\u0026rdquo; but \u0026ldquo;human-made\u0026rdquo; need not be a source of inferiority. Pursuing \u0026ldquo;non-artificial purity\u0026rdquo; in such works is regarded as human nature. The pain lies in \u0026ldquo;the fair maiden, sought but not obtained.\u0026rdquo; The genuine is either god-made or human heart-made, meaning that as long as human interaction is involved, the genuine is impossible. Past philosophers pursued \u0026ldquo;objectivity,\u0026rdquo; yet regrettably, philosophy has only subjectivity-objectivity, not objectivity-objectivity, because it is humans observing, humans interacting. Then, where lies the sought non-artificial, absolute objectivity? Philosophy\u0026rsquo;s answer is utilitarianism or dialectics. The common answer in anime and manga works is this—like drawing a circle according to an ideal. Reality cannot have a perfect circle. Teacher Luo Xiang seems to greatly enjoy this metaphor—there is never perfect justice, just as there is never a perfect circle. What has always been worth praising in humans is not the magnificent feat of drawing the circle, but the human heart that creates the ideal circle, as well as the eternally maintained posture of pursuit—infinitely approaching the genuine amidst futility, like the rolling stone borne by Sisyphus—that is the genuine of brief life. For example, in Hyouka, from the \u0026ldquo;Jumonji Incident\u0026rdquo; to numerous sports anime (Run with the Wind, Haikyuu!!, Slam Dunk, SK8 the Infinity, Ping Pong: The Animation, etc.), a genius embracing the genuine without awareness is pursued by an inferiority-stricken bosom friend. Powerlessness and inferiority simultaneously strike the \u0026ldquo;self-aware counterfeit\u0026rdquo; character. In Ping Pong: The Animation, Chinese player \u0026ldquo;Kong\u0026rdquo; is eliminated and comes to Japan, filled with resentment, then is defeated by a Japanese player. The airplane scene symbolizes that the wish to defeat Japan and return home is blocked. Later, he accepts everything and trains with the Japanese player to improve himself. The final method of resolution is also cliché—binding the relationship of the two into one, or that love transcends all. Suppressing utilitarian competition, understanding that what matters most is the attitude of mutual pursuit—there is no counterfeit and no genuine, only genuine heart exchanged for genuine heart. When SK8 the Infinity came out, I expected it to offer new insights on \u0026ldquo;effort and unsurpassable talent,\u0026rdquo; but it still gave the same formulaic answer—love is greater than everything. Real athletic competition is far more ruthless; in this regard, Ping Pong: The Animation portrays it more authentically. ","date":"2023-12-10","heading":"First Layer of Meaning","objectID":"/en/posts/zyw/:3:1","tags":["Anime Culture"],"title":"On Motivation: The Genuine and Counterfeit in Anime and Manga","uri":"/en/posts/zyw/#first-layer-of-meaning"},{"categories":["Film and TV"],"collections":[],"content":"Second Layer of Meaning\rThe counterfeit may not fail to become genuine. Conversely, the genuine may not fail to become counterfeit. \u0026ldquo;When false becomes true, true also becomes false; when true becomes false, false also becomes true.\u0026rdquo; Japan also has a famous concept called \u0026ldquo;twilight.\u0026rdquo; At twilight, the sun sets, day and night interweave, and the boundary between false and real blurs, overlapping together—Labyrinth of Magic. Mahua FunAge\u0026rsquo;s Too Cool to Kill is a remake of Labyrinth of Magic. In Your Name, Mitsuha and Taki meet across displaced time and space also at twilight, and the BGM is also called Twilight. The \u0026ldquo;Monogatari Series\u0026rdquo; directly and vividly demonstrates both types. In Nisemonogatari, Koyomi Araragi genuinely treats the counterfeit Karen as his sister—whether genuine or not has already become irrelevant. There are many similar concepts in Buddhism, broadly speaking, \u0026ldquo;phenomena arise from the mind.\u0026rdquo; Once there was a famous reading comprehension passage \u0026ldquo;Again the Year When Zongzi Fragrance Floats\u0026rdquo;, in which the author ate everywhere to find the taste of his mother\u0026rsquo;s zongzi, but in the end, the more he compared, the less he found it. The question asks: did he find it in the end? The answer is yes: because the taste of his mother\u0026rsquo;s zongzi became clearer in the contrast of memories. (This is Chinese reading comprehension! I gradually understand everything) In Kizumonogatari, it is the genuine becoming counterfeit. Nadeko Sengoku cannot obtain Araragi Koyomi\u0026rsquo;s love, and in grief and indignation, becomes a god. Fraud master and logical genius Kaiki Deishu uses \u0026ldquo;talk therapy\u0026rdquo; (talking no jutsu), making Sengoku pretend to be deceived and give up romantic feelings—\u0026ldquo;there is no irreplaceable love in this world; if he doesn\u0026rsquo;t love you, find another.\u0026rdquo; Kaiki\u0026rsquo;s counterfeit logic: there is no irreplaceable genuine in this world, only counterfeits, because everything can be replaced. Therefore, the so-called unattainable genuine is actually irrelevant; cherishing oneself is most important. (Kaiki is a fraud master; he defrauded Sengoku and also defrauded himself—in the work, he too pursues the genuine) Below is an example of counterfeit becoming genuine. It is mainly a false shell plus sincere emotion. Sincerity is number one. For instance, Emiya Shirou\u0026rsquo;s counterfeit overpowering the King\u0026rsquo;s Treasury. Whether in The Unpromised Garden of Words or Fate/stay night, Emiya\u0026rsquo;s overpowering of the King\u0026rsquo;s Treasury is because he protects important people with counterfeits—this is a sincerity that enemies who merely attack with genuine items lack. In The Unpromised Garden of Words and Fate/stay night, Emiya Shirou battles the King\u0026rsquo;s Treasury through reproductions; here is my favorite excerpt from The Unpromised Garden of Words. In Oregairu, even in the middle-to-late stages, Hachiman refers to his relationship with Yukino as \u0026ldquo;parasitic,\u0026rdquo; but after mutual confession of feelings, I believe he attains the genuine. Even more famous is the plot of Nisekoi—the classic \u0026ldquo;girl who falls from the sky\u0026rdquo; versus childhood friend, where the initial true love is forcibly isolated by the author\u0026rsquo;s \u0026ldquo;hand of plot,\u0026rdquo; and the bickering couple unknowingly become unable to leave each other, while the childhood friend Onodera becomes the queen of \u0026ldquo;loser dogs\u0026rdquo; voiced by Hikasa Yō. (I am very dissatisfied with such handling! I can only say that triangular relationships are most prone to blowing up. The Silent Pavilion, Stealing Star September Sky, Work! Demon Lord! have all blown up—let\u0026rsquo;s see whether Conan can safely emerge) Gradually默契的 bickering couple in Nisekoi\rSaekano: How to Raise a Boring Girlfriend is also typical—Megumi always buries her emotions deep in her heart; though she is the heroine, the setting is that of a \u0026ldquo;background character\u0026rdquo; makin","date":"2023-12-10","heading":"Second Layer of Meaning","objectID":"/en/posts/zyw/:3:2","tags":["Anime Culture"],"title":"On Motivation: The Genuine and Counterfeit in Anime and Manga","uri":"/en/posts/zyw/#second-layer-of-meaning"},{"categories":["Film and TV"],"collections":[],"content":"Returning to Reality\rOnce, my high school math teacher said meaningfully in class, \u0026ldquo;In our class, no one likes mathematics, including myself.\u0026rdquo; I understand the meaning of these words was to let our class (I am typical) not片面 pursue the final problems of the college entrance exam and clever solutions, but to value basic methods and aim for scores. At the same time, the mathematics we learn now is not truly abstract mathematics in the genuine sense; we are far from witnessing genuine mathematics. This current idea of liking偏, difficult, strange college entrance exam problems is merely a form of adolescent中二. Perhaps the teacher has long forgotten this matter, but I have constantly reflected on this mindset. From the perspective of the college entrance exam system, finding the rhythm and method that suits oneself is another discussion; the teacher undoubtedly meant well for us. However, what I want to contemplate is: what is \u0026ldquo;love for a subject\u0026rdquo;? In fact, the distinction between genuine and counterfeit is a standard. Yet, in reality, using \u0026ldquo;motive\u0026rdquo; as a standard for judgment does not accord with reality, so I remain an exalter of the counterfeit. As Stove-side Night Talk says, \u0026ldquo;All evils begin with lust; judge by deeds, not by heart; judge by heart, and there are few perfect people in this world\u0026rdquo;—this is roughly the principle being spoken of. In the end, the distinction between genuine and counterfeit is whether humans consciously identify or even negate the \u0026ldquo;artificial\u0026rdquo; side, to pursue beautiful ideals that are closer to nature, eternal, and irreplaceable. This process is painful, relative, and memories of failure or success will be etched in one\u0026rsquo;s bones and heart. I used to scoff at such meaningless subjective judgments, but now I feel they can be accepted. In an era where everyone upholds \u0026ldquo;it doesn\u0026rsquo;t matter\u0026rdquo; and numbness, finding something to pour one\u0026rsquo;s passion into is painful self-mutilation, but it can also become a ladder toward greatness. Using the一贯 \u0026ldquo;affectation\u0026rdquo; of Japanese anime—artificially creating pain, transcending pain, then living with self-righteous arrogance. Or in Japanese anime sentence structure—in the end, humans are just such creatures, living waveringly, awkward, inferior yet arrogant. Although I have summarized numerous standards from anime and manga works, reality is, after all, not anime or literary works—artificiality, duration, and natural purity are actually unimportant, as long as they aid one\u0026rsquo;s development and can enrich the inner heart—what does it matter if I deceive myself? What does it matter if passion is brief? The authenticity of emotion comes entirely from the human heart. Whether negating the genuine and exalting the counterfeit; or obstinately pursuing the genuine, in the end it is merely a choice. Sincere heart is the standard of judgment in traditional works, but reality is far more complex. In short! Promote existentialism and anthropocentrism! Offer a sincere heart, obtain what one desires—what harm is there? ","date":"2023-12-10","heading":"Returning to Reality","objectID":"/en/posts/zyw/:4:0","tags":["Anime Culture"],"title":"On Motivation: The Genuine and Counterfeit in Anime and Manga","uri":"/en/posts/zyw/#returning-to-reality"},{"categories":["Reading"],"collections":[],"content":"Recently I reread Wang Xiaobo\u0026rsquo;s essay collection The Silent Majority. It is full of black humor, yet beneath that surface runs a deep admiration for science. His essays on Sinology, science, and logic enlightened me once again. Looking back now, I realize that one reason I have always resisted describing my original motivation for studying economics as \u0026ldquo;serving the world and benefiting the people\u0026rdquo; is precisely Wang Xiaobo\u0026rsquo;s influence. People often ask: what is the use of so many social-science papers? Economics studies money in order to guide monetary policy; finance is for making money. Many people say, \u0026ldquo;I study economics to serve society and strengthen the country.\u0026rdquo; Others speak of the humanities as disciplines that \u0026ldquo;carry forward the learning of the sages and bring peace to future generations.\u0026rdquo; Taken in ordinary terms, these are all respectable reasons. They may arise from personal survival, social responsibility, or the hope of collective prosperity. But once such reasons are treated as the only legitimate ones, the logic changes. A discipline becomes valuable only insofar as it performs some concrete social function. And then one has to ask: if a problem has no obvious practical use, are we simply not supposed to study it? Ask someone whether studying black holes is useful, and they may not be able to give a clear answer. Yet most people still feel that the natural sciences, however abstract they seem, will eventually prove useful. Social science can of course answer in the same way. But I have never found that answer satisfying. At bottom, it still says: we persist only because the discipline may someday become useful. That is still the language of utility, pragmatism, and \u0026ldquo;usefulness above all else.\u0026rdquo; It is still, in another form, the mentality of \u0026ldquo;serving the world.\u0026rdquo; I think that what ultimately drives people to learn, whether in the natural sciences or the social sciences, is something more common and more fundamental. It is not utilitarianism. It is the human ideal celebrated again and again in literature: why climb the mountain? Because it is there. Liu Cixin\u0026rsquo;s \u0026ldquo;Seeking the Truth,\u0026rdquo; The Climbers, and Hemingway\u0026rsquo;s The Old Man and the Sea all point in this direction. Common sense tells us to weigh costs and benefits and choose the lesser harm, yet there are always people who make choices that exceed narrow calculations of utility. As a science-fiction reader, my position is simple: research is for solving problems, and solving problems is for answering questions. Many questions arise from practical concerns, of course. But some questions simply stand before us whether they are useful or not, and once they do, we want to answer them. That is why a problem does not need some grand external justification. Sometimes you pursue it simply because you want to know the answer. You want to follow it to the root. You do not need to wrap that desire in slogans about righteousness or suffering. Curiosity is enough. This is also why Wang Xiaobo opposed certain attempts to over-glorify \u0026ldquo;Sinology,\u0026rdquo; why he pushed back against the moral prestige surrounding Confucian orthodoxy, and why he admired Russell. One of the Cheng brothers once described \u0026ldquo;benevolence\u0026rdquo; as something like a fluffy newborn duckling, and many people become so enchanted by such mysterious formulations that they can no longer free themselves from them. But do we really need to rediscover benevolence by meditating on duck feathers? Likewise, many people treat the I Ching as the summit of predictive wisdom and therefore stop pursuing actual answers. In all these cases, what they really seek is usefulness. They hope to reach useful ends through mysterious means, caring little for process, explanation, or proof, as long as the result appears lofty, correct, and sanctified by tradition. I used to wonder why the phrase \u0026ldquo;because the mountain is there\u0026rd","date":"2023-12-10","heading":"","objectID":"/en/posts/wxb/:0:0","tags":["Scientific Spirit"],"title":"Pursuing Scholarship: Beyond 'Serving the World' and 'Because the Mountain Is There'","uri":"/en/posts/wxb/#"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Hupu is popular for \u0026ldquo;I post pictures, you rate them.\u0026rdquo; Economics often uses weighting to establish indicators for scoring and comparison. Currently, online tutorials seem to lack one of the three parts: \u0026ldquo;code-data-derivation\u0026rdquo;. Here, we aim to cover all three parts at once. This article first discusses the three most common methods in Chinese journals: \u0026ldquo;Entropy Weight Method\u0026rdquo;, \u0026ldquo;Coefficient of Variation Method\u0026rdquo;, and \u0026ldquo;Principal Component Method\u0026rdquo;. Other methods will be added to this article in the future. A general overview of weighting methods (Source: http://www.huaxuejia.cn/ism/CESAISM/coupling-coordination.php)\r","date":"2023-11-20","heading":"","objectID":"/en/posts/kgfq/:0:0","tags":["Stata"],"title":"Economic weighting and scoring methods: PCA, CRITIC, EWM","uri":"/en/posts/kgfq/#"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"1. \u0026ldquo;Standardization\u0026rdquo; and \u0026ldquo;Normalization\u0026rdquo;\rThis section mainly refers to the following blog: Why are most coupling coordination degree papers wrong? $\\boxed{ Dimensionless }$: No matter how many strange indicators we have initially, we need to present a total score without \u0026ldquo;units\u0026rdquo; in the end. This process is called dimensionless. $\\boxed{ Normalization }$: Both \u0026ldquo;standardization\u0026rdquo; and \u0026ldquo;normalization\u0026rdquo; are used to normalize data, scaling the data into the desired form while preserving the comparative ranking characteristics of the data as much as possible. $$ \\small A\u0026gt;B\u0026gt;C\u0026gt;0\\xrightarrow{Normalization}\\frac{A}{A\u0026#43;B\u0026#43;C}\u0026gt;\\frac{B}{A\u0026#43;B\u0026#43;C}\u0026gt;\\frac{C}{A\u0026#43;B\u0026#43;C} $$ \u0026ldquo;Normalization\u0026rdquo; deals with the range of values, while \u0026ldquo;standardization\u0026rdquo; deals with the distribution of values. The comparative ranking characteristics are not changed because they are both linear transformations. ","date":"2023-11-20","heading":"1. \u0026ldquo;Standardization\u0026rdquo; and \u0026ldquo;Normalization\u0026rdquo;","objectID":"/en/posts/kgfq/:1:0","tags":["Stata"],"title":"Economic weighting and scoring methods: PCA, CRITIC, EWM","uri":"/en/posts/kgfq/#1-standardization-and-normalization"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"1. Normalization\rTransforming data to a specific range to eliminate the impact of different units and numerical gaps on weight analysis. The commonly used formula in economics is as follows: $$ \\small \\begin{cases} X_{positive\\ indicator}=\\frac{X_{ij}-\\min X_j }{\\max X_j-\\min X_j}\\newline X_{negative\\ indicator}=\\frac{\\max X_j-X_{ij}}{\\max X_j-\\min X_j} \\end{cases}\\in\\{0,1\\} $$ The range is limited to (0,1). Similarly, to limit the range to a specific interval—(a, b), the transformation is: $$ \\small f(x)\\in\\{0,1\\} \\xrightarrow {Transformation} (b-a)f(x)\u0026#43;a \\in \\{a,b\\} $$ Tip 1: Positive and negative indicators require different formulas and should be handled separately. Tip 2: There are other normalization methods. Source: http://www.huaxuejia.cn/ism/CESAISM/coupling-coordination.php\r","date":"2023-11-20","heading":"1. Normalization","objectID":"/en/posts/kgfq/:1:1","tags":["Stata"],"title":"Economic weighting and scoring methods: PCA, CRITIC, EWM","uri":"/en/posts/kgfq/#1-normalization"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"1-1. Normalization Stata Code\rHere, we provide practice data. The data source is Zhao Tao et al. (2020) on digital economy indicators[^1]. Baidu Netdisk Panel data, five indicators measuring the digital economy|542\rPanel data, five indicators measuring the digital economy There are many ways to achieve range normalization. Method 1: Norm Command Group ssc install norm // Command installation norm x1 x2 x3 , method(mmx) * The corresponding calculation method is: [Xi - X(min)]/ [X(max)-X(min)] * If you want to standardize by group for each cross-section, the command is norm x1 x2 x3, by(year) method(mmx)\rThe disadvantage of this command is that mmx only provides linear transformation for positive indicators and cannot be used for negative indicators. That is, only $\\small X_{positive\\ indicator}=\\frac{X_{ij}-\\min X_j }{\\max X_j-\\min X_j}$ is available, and there is no transformation for negative indicators $\\small X_{negative\\ indicator}=\\frac{\\max X_j-X_{ij}}{\\max X_j-\\min X_j} $. Theoretically, there is a solution: Transform negative indicators into positive indicators through $1-x_{negative\\ indicator}$ or $\\frac{1}{x_{negative\\ indicator}}$ and then perform the transformation uniformly. Reminder: All data should be positive for scoring. Method 2: Loop and Group (General) * Define positive and negative indicators global positive_var x1 x3 x4 x5 x6 x8 x9 x10 // Define positive indicators, pack x1 x3 x5 x7 into positive_var global negative_var x2 x7 // Define negative indicators, pack x2 x4 x6 x8 into negative_var global xlist x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 // Pack all the above indicators into xlist * Normalization foreach i in $positive_var { qui sum `i' gen x_`i'=(`i'-r(min))/(r(max)-r(min)) // Positive indicator normalization replace x_`i'=0.000001 if x_`i'==0 // Avoid zero values } foreach i in $negative_var { qui sum `i' gen x_`i'=(r(max)-`i')/(r(max)-r(min)) // Negative indicator normalization replace x_`i'=0.000001 if x_`i'==0 // Avoid zero values }\r","date":"2023-11-20","heading":"1-1. Normalization Stata Code","objectID":"/en/posts/kgfq/:1:2","tags":["Stata"],"title":"Economic weighting and scoring methods: PCA, CRITIC, EWM","uri":"/en/posts/kgfq/#1-1-normalization-stata-code"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"2. Standardization\r$\\boxed{Z-score}:$ The central limit theorem tells us that the distribution function tends to be normal. We commonly use standard normalization in probability statistics. $$ \\begin{cases} X_{positive\\ indicator}=\\frac{x-\\mu}\\sigma \\newline X_{negative\\ indicator}=\\frac{\\mu-x}\\sigma \\end{cases} $$","date":"2023-11-20","heading":"2. Standardization","objectID":"/en/posts/kgfq/:1:3","tags":["Stata"],"title":"Economic weighting and scoring methods: PCA, CRITIC, EWM","uri":"/en/posts/kgfq/#2-standardization"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"2-1. Standardization Stata Code\rzscore x1 * The standardized variable is named z_x1 * Negative indicators need to be transformed and then prefixed with a negative sign\r","date":"2023-11-20","heading":"2-1. Standardization Stata Code","objectID":"/en/posts/kgfq/:1:4","tags":["Stata"],"title":"Economic weighting and scoring methods: PCA, CRITIC, EWM","uri":"/en/posts/kgfq/#2-1-standardization-stata-code"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"When to use standardization and normalization?\rTLDR: For machine learning, it depends on the specific object and requirements. For economics, using them without much thought is generally fine. ","date":"2023-11-20","heading":"When to use standardization and normalization?","objectID":"/en/posts/kgfq/:1:5","tags":["Stata"],"title":"Economic weighting and scoring methods: PCA, CRITIC, EWM","uri":"/en/posts/kgfq/#when-to-use-standardization-and-normalization"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"2. Entropy Weight Method (EWM)\r","date":"2023-11-20","heading":"","objectID":"/en/posts/kgfq/:2:0","tags":["Stata"],"title":"Economic weighting and scoring methods: PCA, CRITIC, EWM","uri":"/en/posts/kgfq/#2-entropy-weight-method-ewm"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"1. Theoretical Steps\rFirst, ensure that the data is normalized and greater than 0. $$ \\small \\begin{cases} X_{positive\\ indicator}=\\frac{X_{ij}-\\min X_j }{\\max X_j-\\min X_j} \\newline X_{negative\\ indicator}=\\frac{\\max X_j-X_{ij}}{\\max X_j-\\min X_j} \\end{cases}\\in\\{0,1\\} $$ Then, determine the weights based on the definition of information entropy (from the paper \u0026ldquo;A mathematical theory of communication\u0026rdquo;)[^2]. Source: \u0026ldquo;A mathematical theory of communication\u0026rdquo; (Shannon, 2001)\rEntropy is actually the mathematical expectation of the bit quantity of a random variable multiplied by the sequential probability of occurrence[^3]. The calculation of information entropy is: $$ \\mathrm{E_{j}=-\\frac{1}{\\ln n}\\sum_{i=1}^{n}p_{ij}\\ln p_{ij}} $$ $p\\_{ij} $ is the proportion of each sample in the overall indicator. $$ p_{ij}=\\frac{X_{ij}}{\\sum_{i=1}^{n}X_{i}} $$ When $p_{ij}=0$, this formula is not applicable. You can directly supplement the normalized value with a small number to avoid zero values. Finally, the indicator weight is obtained: $$ W_{i}=\\frac{1-E_{i}}{k-\\sum E_{i}}(i=1,2,\\ldots,k) $$","date":"2023-11-20","heading":"","objectID":"/en/posts/kgfq/:2:1","tags":["Stata"],"title":"Economic weighting and scoring methods: PCA, CRITIC, EWM","uri":"/en/posts/kgfq/#1-theoretical-steps"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"2. Entropy Weight Method Stata Code\r*Step0: Define positive and negative indicators * Define positive and negative indicators global positive_var x1 x3 x5 x7 // Define positive indicators, pack x1 x3 x5 x7 into positive_var global negative_var x2 x4 x6 x8 // Define negative indicators, pack x2 x4 x6 x8 into negative_var global xlist x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 // Pack all the above indicators into xlist * Normalization foreach i in $positive_var { qui sum `i' gen x_`i'=(`i'-r(min))/(r(max)-r(min)) // Positive indicator normalization replace x_`i'=0.000001 if x_`i'==0 // Avoid zero values } foreach i in $negative_var { qui sum `i' gen x_`i'=(r(max)-`i')/(r(max)-r(min)) // Negative indicator normalization replace x_`i'=0.000001 if x_`i'==0 // Avoid zero values } ************************************Entropy Weight Method*****************************************// *Step2: Calculate the proportion Pij of the i-th sample value in the j-th indicator to the sum of all sample values of the indicator foreach i in $xlist { egen `i'_sum=sum(x_`i') // Sum each indicator gen y_`i'=x_`i'/`i'_sum } gen k=_N // This code can be modified according to the data type foreach i in $xlist { gen y_lny_`i'=y_`i'*ln(y_`i') // Indicator proportion multiplied by ln(indicator proportion) } *Step3: Calculate the information entropy ej of the j-th indicator foreach i in $xlist { egen y_lny_`i'_sum=sum(y_lny_`i') // Sum the indicator proportion multiplied by ln(indicator proportion) } foreach i in $xlist { gen e_`i'= -1/ln(k)*y_lny_`i'_sum } *Step4: Calculate the redundancy degree dj of information entropy foreach i in $xlist { gen d_`i'= 1-e_`i' } *Step5: Calculate the weight wj of the evaluation indicator egen d_sum = rowtotal(d_*) foreach i in $xlist { gen w_`i'= d_`i'/d_sum } *Step6: Calculate the comprehensive score s foreach i in $xlist { gen Score_`i'= w_`i'*x_`i' // Weight multiplied by normalized value } egen Score=rowtotal(Score_*) // Sum ******************************************************************\r","date":"2023-11-20","heading":"2. Entropy Weight Method Stata Code","objectID":"/en/posts/kgfq/:2:2","tags":["Stata"],"title":"Economic weighting and scoring methods: PCA, CRITIC, EWM","uri":"/en/posts/kgfq/#2-entropy-weight-method-stata-code"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"3. Coefficient of Variation Method (COV)\r","date":"2023-11-20","heading":"3. Coefficient of Variation Method (COV)","objectID":"/en/posts/kgfq/:3:0","tags":["Stata"],"title":"Economic weighting and scoring methods: PCA, CRITIC, EWM","uri":"/en/posts/kgfq/#3-coefficient-of-variation-method-cov"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"1. Theoretical Steps\rSave time and effort. The coefficient of variation $\\boxed{Coefficient\\ of\\ Variation} $ is the ratio of the standard deviation to the mean for each group. Calculate the coefficient of variation for each indicator, and then use the proportion of the coefficient of variation as the weight. $$ v\\_i=\\frac{\\delta}{\\bar x\\_{i}} $$$$ w\\_i = \\frac{v\\_i}{\\sum \\_{i}^{n} v\\_i} $$","date":"2023-11-20","heading":"1. Theoretical Steps","objectID":"/en/posts/kgfq/:3:1","tags":["Stata"],"title":"Economic weighting and scoring methods: PCA, CRITIC, EWM","uri":"/en/posts/kgfq/#1-theoretical-steps-1"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"2. Coefficient of Variation Method Stata Code\r*Step0: Define positive and negative indicators * Define positive and negative indicators global positive_var x1 x3 x5 x7 // Define positive indicators, pack x1 x3 x5 x7 into positive_var global negative_var x2 x4 x6 x8 // Define negative indicators, pack x2 x4 x6 x8 into negative_var global xlist x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 // Pack all the above indicators into xlist * Normalization foreach i in $positive_var { qui sum `i' gen x_`i'=(`i'-r(min))/(r(max)-r(min)) // Positive indicator normalization replace x_`i'=0.000001 if x_`i'==0 // Avoid zero values } foreach i in $negative_var { qui sum `i' gen x_`i'=(r(max)-`i')/(r(max)-r(min)) // Negative indicator normalization replace x_`i'=0.000001 if x_`i'==0 // Avoid zero values } ************************************Coefficient of Variation Method***************************************** *Step2: Calculate the coefficient of variation foreach i in $xlist { egen sd_`i'= sd(x_`i') // Calculate standard deviation } foreach i in $xlist { egen mean_`i'= mean(x_`i') // Calculate mean } foreach i in $xlist { gen v_`i'= sd_`i'/ mean_`i' // Calculate coefficient of variation } egen v_sum = rowtotal(v_*) // Sum of coefficients of variation *Step3: Calculate the weight of each indicator foreach i in $xlist { gen w_b_`i'=v_`i'/v_sum } *Step4: Calculate the comprehensive score foreach i in $xlist { gen Score_b_`i'= x_`i'*w_b_`i' } egen Score_b=rowtotal(Score_b_*)\rPersonally, I feel that the differences are not significant. Digital economy indicators, personally extended the data to 2021, and additionally performed grouped plotting. (Left: Coefficient of Variation, Right: Principal Component Method, overall ranking is generally stable)\r","date":"2023-11-20","heading":"2. Coefficient of Variation Method Stata Code","objectID":"/en/posts/kgfq/:3:2","tags":["Stata"],"title":"Economic weighting and scoring methods: PCA, CRITIC, EWM","uri":"/en/posts/kgfq/#2-coefficient-of-variation-method-stata-code"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"4. CRITIC Method\rTo be added. ","date":"2023-11-20","heading":"4. CRITIC Method","objectID":"/en/posts/kgfq/:4:0","tags":["Stata"],"title":"Economic weighting and scoring methods: PCA, CRITIC, EWM","uri":"/en/posts/kgfq/#4-critic-method"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"5. Principal Component Score (PCA)\r","date":"2023-11-20","heading":"5. Principal Component Score (PCA)","objectID":"/en/posts/kgfq/:5:0","tags":["Stata"],"title":"Economic weighting and scoring methods: PCA, CRITIC, EWM","uri":"/en/posts/kgfq/#5-principal-component-score-pca"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"1. Theoretical Steps\rRefer to the following articles, which are very well explained. Principal Component Analysis (PCA) Explained in Detail CodingLabs - The Mathematical Principles of PCA To further visualize the process, we can use two-dimensional data to demonstrate the PCA decomposition process[^4]. When the data is standardized (standard normal distribution), we obtain a dataset that forms an ellipse. Dataset\rHere, we draw a line parallel to the x-axis, making it correspond to the direction with the maximum variance. This principal component $PC_1$ is a linear combination of the two. $$ PC_1=a_{11}X_1\u0026#43;a_{12}X_2 $$ Decomposition\rSimilarly, we draw a line parallel to the y-axis, noting that the y-axis is perpendicular to the x-axis to ensure that the two principal components are independent. The y-axis is perpendicular to the x-axis to ensure that the two principal components are independent\rWith n indicators, there are n dimensions, and thus n mutually perpendicular directions. $\\boxed{Eigenvector}:$ The eigenvector is the direction of the axis with the maximum variance (most information), known as the principal component. $\\boxed{Eigenvalue}:$ The eigenvalue is the variance of a principal component, and its relative proportion can be understood as the explained variance or contribution value. The eigenvalue decreases from the first principal component. $\\boxed{Loading}:$ The loading is the eigenvector multiplied by the square root of the eigenvalue. The loading is the weight coefficient of each original variable on each principal component. $\\boxed{Dimension}:$ Dimension in data refers to the number of indicators. With n indicators, there are n dimensions, and thus n mutually perpendicular directions, i.e., n principal components that can be decomposed. However, in practice, we only need a few with significant contributions, so we take k. The process from n to k is $\\boxed{Dimensionality\\ Reduction} $. $$ \\small \\begin{cases} Indicator\\ sample\\ 1\\newline ...\\newline Indicator\\ sample\\ n \\end{cases} \\xrightarrow{Dimensionality\\ Reduction} \\begin{cases} PC_1=\\alpha_1\\times f_1\u0026#43;\\alpha_2 \\times f_2 \u0026#43;...\\alpha_3 \\times f_n\\newline ...\\newline PC_k=\\beta_k \\times f_1\u0026#43;\\beta_2 \\times f_2 \u0026#43;...\\beta_n \\times f_n \\end{cases} $$","date":"2023-11-20","heading":"1. Theoretical Steps","objectID":"/en/posts/kgfq/:5:1","tags":["Stata"],"title":"Economic weighting and scoring methods: PCA, CRITIC, EWM","uri":"/en/posts/kgfq/#1-theoretical-steps-2"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"2. Principal Component Method Stata Code\rDivided into two parts: necessary operations for obtaining scores and non-essential plotting operations. Important Notes!!!!!!!!!!!!!!!!!!!! Stata\u0026rsquo;s pca command automatically standardizes data, so no additional preprocessing is needed. Negative indicators in the analysis data need to be transformed into positive indicators: $\\small 1-x_{negative\\ indicator}, \\small \\frac{1}{x_{negative\\ indicator}}......$ The principal component method provides principal components $PC_k$, meaning n indicators are decomposed into k principal components, ","date":"2023-11-20","heading":"2. Principal Component Method Stata Code","objectID":"/en/posts/kgfq/:5:2","tags":["Stata"],"title":"Economic weighting and scoring methods: PCA, CRITIC, EWM","uri":"/en/posts/kgfq/#2-principal-component-method-stata-code"},{"categories":["Film and TV"],"collections":[],"content":"On the riverside, what are the errors we see?\rIs there anything greater than hardship in the world of Cthulhu? Unknowable, unseen, incomprehensible, unstoppable. When the absurd logic descends upon the flesh, the transcendent hardships of the era become like a cold and stern mountain. Mazhe attempted to untangle the ripples of fate, believing that reason was the driving force behind the essence of these murders. But what if the murders originated from chaos and disorder themselves? Thus, the looming behemoth behind the tangle of yarn overwhelmed him, and we were horrified to discover that the error lay in our self-assumption that \u0026ldquo;life contains no errors beyond reason\u0026rdquo;; the error lay in our refusal to acknowledge that life indeed harbors a corner of \u0026ldquo;disorder and chaos\u0026rdquo;. Why do we criticize Erjiu for not handling internal conflicts well in \u0026ldquo;In the Heat of the Sun,\u0026rdquo; but \u0026ldquo;To Live,\u0026rdquo; \u0026ldquo;Brothers,\u0026rdquo; \u0026ldquo;My Life as Emperor,\u0026rdquo; and \u0026ldquo;The Seventh Day\u0026rdquo; do not elicit the same backlash? As absurd films, I am inclined to believe that \u0026ldquo;He bian de cuo wu\u0026rdquo; surpasses \u0026ldquo;Yu zhou tan suo bian ji bu\u0026rdquo; in terms of its thematic depth. Like Erjiu\u0026rsquo;s ending, the latter also finds solace and inspiration from survivors, empathizing with them as they await the arrival of spring after enduring hardship. Hence, people extol phrases like \u0026ldquo;the good days are still ahead\u0026rdquo; and \u0026ldquo;there is no winter that cannot be crossed,\u0026rdquo; because we are destined to overcome, and Therefore, we face the future without fear. This is evidently a circular argument. But outside of this cycle, who will question the winter? Yu Hua\u0026rsquo;s works confront the source of suffering directly—a Cthulhu without an object to speak of. Yu zhou tan suo bian ji bu\r\u0026ldquo;The Mistake by the River\u0026rdquo;? Where exactly does the mistake lie? On a concrete level, Ma Zhe refuses to acknowledge the randomness of the madman\u0026rsquo;s killings, thus deviating from the truth from the outset. This exposes the villagers\u0026rsquo; reality of not being accepted by society: Ma Zhe does not believe that the madman would commit murder, so he indirectly uncovers the taboo love affairs after poetry creation, the secret cross-dressing after unjust cases, and the perverse motives behind kind adoption. The more Ma Zhe denies madness, the more madness he uncovers. As a police officer, Ma Zhe\u0026rsquo;s pursuit of truth and adherence to logic seemed unquestionable, yet it led to greater pain and death. Ma Zhe believed in the logic of life, but the reality of this logic crushed him and his world. His clues only led from one person\u0026rsquo;s madness to another\u0026rsquo;s. A person who refused to acknowledge the rationality of madness ended up surrounded by it, and eventually succumbed to madness himself. This was the mistake he made. From an abstract perspective, what is madness? It is suffering, akin to good people not receiving their due rewards, efforts not being reciprocated, and people seeking pain amidst happiness. It is the kind-hearted family giving birth to a disabled child. Ma Zhe refused to believe that the madman was the murderer, just as he refused to believe that his own child could become a madman. When Ma Zhe finally accepted the reality that the madman was the culprit, he had to raise his own child, who had become mad. The river is the bond of fate. Xu Liang from the Director\u0026rsquo;s Cut runs by the river, the old lady dies by the river, the poet-teacher dies by the river, the child dies by the river. They bury their secrets by the riverside. \u0026ldquo;Madman, murder case, riverside, rain curtain, life\u0026rdquo; are strung together in a strange, low-probability manner. The audience may question how such low-probability events could be coincidental; there must be the hand of a double destiny! We try to understand fate, but in the end, we are trapped by fate. So paranoia issued a warning early in the f","date":"2023-10-29","heading":"On the riverside, what are the errors we see?","objectID":"/en/posts/h/:0:0","tags":["Movies"],"title":" Only the River Flows","uri":"/en/posts/h/#on-the-riverside-what-are-the-errors-we-see"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":" In economics courses, most concepts often undergo \u0026ldquo;mathematical meaning - economic meaning - statistical meaning\u0026rdquo; three re-understandings. We often see the same thing in different places, but we rarely take the time to fully understand it in one go, for example, three calculation formulas. This article will summarize the concept of \u0026ldquo;convergence\u0026rdquo; as it runs through these three stages (although the connections may seem weak, I still want to go through it all at once). ","date":"2023-10-01","heading":"","objectID":"/en/posts/shounian/:0:0","tags":["Economic Growth"],"title":"Convergence: From the Limit of Equations to the Limit of Growth","uri":"/en/posts/shounian/#"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"I. Advanced Mathematics: Limits and Convergence\rLimits and convergence are essentially the same thing from the start. Main reference: Tongji Edition \u0026ldquo;Advanced Mathematics\u0026rdquo;1, where convergence is introduced as a description of the state of a limit: In the limit of a sequence (page 21, Volume I), the sequence $x_n$ converges to $a$, denoted as $\\lim_{n \\rightarrow \\infty}{x_n=a}$. In the limit of a function (page 33, Volume I), the function converges, denoted as $\\small \\lim_{n \\rightarrow \\infty}{f(x_n)}=\\lim_{n \\rightarrow x_0}{f(x)}$. In the limit of a series (page 252, Volume II), $\\small s=u_1\u0026#43;u_2\u0026#43;u_3\u0026#43;... u_i\u0026#43;...$ an infinite series converges if $\\lim_{n \\rightarrow \\infty}{s_n=s}$, otherwise it diverges. $$ \\text{Convergence Classification} \\begin{cases} \\text{Content} \\begin{cases} \\text{Absolute Convergence} \\\\ \\text{Conditional Convergence} \\end{cases} \\\\ \\text{Form} \\begin{cases} \\text{Pointwise Convergence} \\\\ \\text{Uniform Convergence} \\end{cases} \\end{cases} $$ Where series convergence is further divided into absolute convergence and conditional convergence; pointwise convergence and uniform convergence. Absolute Convergence: If $\\small \\sum_{n=1}^{\\infty}{|u_n|}$ converges, then $\\small \\sum_{n=1}^{\\infty}{u_n}$ is absolutely convergent. Conditional Convergence: If $\\small \\sum_{n=1}^{\\infty}{|u_n|}$ does not converge, but $\\sum_{n=1}^{\\infty}{u_n}$ converges, then $\\small \\sum_{n=1}^{\\infty}{u_n}$ is conditionally convergent. Pointwise Convergence: $\\small \\exists{0\u0026lt;x\u0026lt;\\delta},\\forall\\varepsilon\u0026gt;0, |f(x)-A|\u0026lt;\\varepsilon$, $\\small \\exists{0\u0026lt;x\u0026lt;\\delta},\\forall\\varepsilon\u0026gt;0, |f(x)-A|\u0026lt;\\varepsilon$ Uniform Convergence: $\\small \\exists{0\u0026lt;|x_1-x_2|\u0026lt;\\delta},\\forall\\varepsilon\u0026gt;0,|f(x_1)-f(x_2)|\u0026lt;\\varepsilon$, $\\small \\exists{0\u0026lt;|x_1-x_2|\u0026lt;\\delta},\\forall\\varepsilon\u0026gt;0,|f(x_1)-f(x_2)|\u0026lt;\\varepsilon$ By the way, convergence radius, which is the range of $x$ values that allow the series $\\small u_n(x)$ to converge. Is there a shortcut for judging convergence or divergence? My advanced mathematics teacher mentioned a \u0026ldquo;humorous\u0026rdquo; method, which I also came across on Zhihu: Look at these two characters, aren\u0026rsquo;t they both convergent and divergent? Convergent and Divergent\r","date":"2023-10-01","heading":"I. Advanced Mathematics: Limits and Convergence","objectID":"/en/posts/shounian/:1:0","tags":["Economic Growth"],"title":"Convergence: From the Limit of Equations to the Limit of Growth","uri":"/en/posts/shounian/#i-advanced-mathematics-limits-and-convergence"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"II. Probability Theory: Law of Large Numbers and Central Limit Theorem\rWhat you think of as \u0026ldquo;chance\u0026rdquo; is often embedded in \u0026ldquo;necessity.\u0026rdquo; Someone necessarily wins the lottery; it\u0026rsquo;s just that person chance is you. Reference: Mao Shisong\u0026rsquo;s \u0026ldquo;Probability Theory and Mathematical Statistics\u0026rdquo;2, sequences of random variables have two modes of convergence: convergence in probability and convergence in distribution. Convergence in Probability: $\\bbox[#def,5px, border: 1px solid]{ x\\stackrel{P}{\\longrightarrow}c }$ For example, when flipping a coin, the initial frequency of heads may deviate greatly from $\\frac{1}{2}$, but as the number of flips increases, the frequency approaches the probability. Frequency statistics have become one of the methods to determine probability3. Various versions of the Law of Large Numbers, $\\boxed{ Law of Large Numbers }$ essentially say the same thing: as the number of experiments $n$ increases, the probability of the deviation $\\small \\frac{S_n}{n}-P$ being greater than a predetermined value $\\varepsilon$ decreases. Whether it\u0026rsquo;s the Bernoulli (Bernoulli) Law of Large Numbers, Chebyshev\u0026rsquo;s Law of Large Numbers, Markov\u0026rsquo;s Law of Large Numbers, or Khinchin\u0026rsquo;s Law of Large Numbers, they all essentially describe the same thing4. Convergence in Distribution: $\\bbox[#def,5px, border: 1px solid]{ x\\stackrel{F}{\\longrightarrow}c }$ Strong convergence in distribution is pointwise convergence, while weak convergence removes discontinuities and only considers the continuous distribution of $F(x)$. Denoted as $ \\mathbb{P}(X_n\\leqslant a)\\to\\mathbb{P}(X\\leqslant a) $, which is $ \\lim_{n\\to\\infty}F_n (x)=F (x)$. The $\\boxed{ Central Limit Theorem }$ states that under certain conditions5, the distribution function of the sum of independent random variables $Y_n=\\sum_{i=1}^{n}{X_i}$ approaches a normal distribution. Interesting knowledge about function distributions6 Assume there is a random variable that follows a binomial distribution. When it tends to the limit, with the expectation equal to the variance, it becomes a Poisson distribution. The intervals between random variables follow an exponential distribution. The nth variable corresponds to the gamma distribution in the horizontal coordinate. ","date":"2023-10-01","heading":"II. Probability Theory: Law of Large Numbers and Central Limit Theorem","objectID":"/en/posts/shounian/:2:0","tags":["Economic Growth"],"title":"Convergence: From the Limit of Equations to the Limit of Growth","uri":"/en/posts/shounian/#ii-probability-theory-law-of-large-numbers-and-central-limit-theorem"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"III. Economic Significance: Convergence Effect\rMoney ≠ Numbers, Operations ≠ Problems, Economics ≠ Mathematics ","date":"2023-10-01","heading":"III. Economic Significance: Convergence Effect","objectID":"/en/posts/shounian/:3:0","tags":["Economic Growth"],"title":"Convergence: From the Limit of Equations to the Limit of Growth","uri":"/en/posts/shounian/#iii-economic-significance-convergence-effect"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"1. Convergence Hypothesis (Convergence)\rFrom the资料 used by the teacher in the \u0026ldquo;Regional Economics\u0026rdquo; course 《Advanced Economic Geography》 (He Canfei著). With the proposal of the Solow model, development economics researchers raised questions: Since each economy has its own steady state and balanced growth path, and at the same time, less developed economies grow quickly while advanced economies slow down, the question is, will the economic growth of all economies converge in the end? $$ \\begin{cases} \\beta\\text{-convergence} \\begin{cases} \\text{Absolute Convergence} \\\\ \\text{Conditional Convergence} \\\\ \\text{Club Convergence} \\end{cases} \\\\ \\sigma\\text{-convergence} \\end{cases} $$ $\\beta$-convergence: $\\boxed{\\beta\\text{ Absolute Convergence}}$ assumes that regardless of the initial conditions of the economy, due to the faster development of the weaker and slower development of the stronger, the economy will eventually converge to the same level. All we need is a little patience. $\\boxed{\\beta\\text{ Conditional Convergence}}$ assumes that the growth rate of the economy is influenced by certain structural factors (such as population structure, endowments of factors, growth rates of factors), so different economies converge to different steady states, and the final outcomes of development differ. $\\boxed{\\text{Club Convergence}}$ assumes that within economic groups with initially similar levels of economic development and among richer country groups, there is conditional convergence within each group, but no signs of convergence between the two groups. $\\sigma$-convergence: $\\boxed{\\sigma\\text{-convergence}}$ assumes that the standard deviation $\\sigma$ between different economies is constantly decreasing. ","date":"2023-10-01","heading":"1. Convergence Hypothesis (Convergence)","objectID":"/en/posts/shounian/:3:1","tags":["Economic Growth"],"title":"Convergence: From the Limit of Equations to the Limit of Growth","uri":"/en/posts/shounian/#1-convergence-hypothesis-convergence"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"2. Convergence Speed\rIt seems like a mathematical concept from real analysis, but I first learned it in Romer\u0026rsquo;s \u0026ldquo;Advanced Macroeconomics,\u0026rdquo; so I\u0026rsquo;ve categorized it under economics. I looked it up on Wikipedia (Rate of convergence), which is mainly applied in algorithm optimization and deep learning fields. If a sequence $x_k$ converges to $L$, the expression $\\mu$ is the rate of convergence. $$ \\lim_{k\\to\\infty}\\frac{|x_{k\u0026#43;1}-L|}{|x_k-L|^q}=\\mu $$ When $q=1$ in the equation, it is linear convergence, where the convergence speed is the ratio of the numerical difference to the convergence point between times $t$ and $t\u0026#43;1$. Imagine a race. We measure speed by comparing the distance from the starting point. Convergence is like anxiously waiting for the school bell. We care about how long it will take to reach the endpoint. Convergence Together\r![Solow Model actually just added a factor on the horizontal axis](/img/收敛：从\u0026quot;算式的极限\u0026quot;到\u0026quot;增长的极限\u0026quot;.zh ","date":"2023-10-01","heading":"2. Convergence Speed","objectID":"/en/posts/shounian/:3:2","tags":["Economic Growth"],"title":"Convergence: From the Limit of Equations to the Limit of Growth","uri":"/en/posts/shounian/#2-convergence-speed"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"IV. Econometric Analysis\r","date":"2023-10-01","heading":"IV. Econometric Analysis","objectID":"/en/posts/shounian/:4:0","tags":["Economic Growth"],"title":"Convergence: From the Limit of Equations to the Limit of Growth","uri":"/en/posts/shounian/#iv-econometric-analysis"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"1. Econometric Equations\r(1) Absolute Convergence Barro and Martin (1991)7 proposed the test equation for absolute $\\beta$ convergence based on Baumol (1986)8. $$ \\small \\frac{1}{T}\\left[\\log(y_{i,t\u0026#43;T}) - \\log(y_{i,t})\\right] = \\alpha - \\frac{(1 - e^{-\\beta T})}{T} \\log(y_{i,t}) \u0026#43; \\varepsilon_i $$ Where $i$ represents the $i$th region, $t$ is the initial period, $t\u0026#43;T$ is the final period, $T$ is the length of the observation period, $y_{i, t}$ is the per capita GDP of region $i$ in period $t$, and $\\beta$ represents the convergence speed. If $\\beta \u0026gt; 0$, it indicates that the differences in economic development between regions will gradually disappear, eventually reaching the same steady state. OLS Regression Statistics Chart, Data from EU Regions (Source: Barro and Martin, 1991)\rThe above formula is derived from the neoclassical growth model (i.e., the Solow model). Personally, I find that domestic descriptions of convergence regression variance are much clearer and more concise. Here, I refer to Peng Guohua (2005)9\u0026rsquo;s regression equation: $$ g = c \u0026#43; \\beta \\ln y_0 \u0026#43; \\varepsilon $$ Where $g$ is the growth rate, $c$ is the constant term, $y_0$ is the actual output, and $\\varepsilon$ is the error term. When $\\beta \u0026lt; 0$, it indicates that the growth rate $g$ is negatively correlated with the economic level $y_0$, consistent with our assumption that \u0026ldquo;high-level economies grow slower, while low-level economies grow faster.\u0026rdquo; (2) Conditional Convergence Barro and Martin (1992)10 proposed the test equation for conditional $\\beta$ convergence based on the absolute $\\beta$ convergence test equation: $$ \\small \\frac{1}{T}\\left[\\log(y_{i,t\u0026#43;T}) - \\log(y_{i,t})\\right] = \\alpha - \\frac{(1 - e^{-\\beta T})}{T} \\log(y_{i,t}) \u0026#43; \\lambda X_{i,t} \u0026#43; \\varepsilon_{i,t} $$ The conclusions and parameter meanings are the same as those for absolute convergence, as conditional convergence implies that economic growth is related to the structural environment of the economy, hence the inclusion of $X_{i, t}$ as control variables. The inconvenience of introducing control variables $X_{i,t}$ is that we have to study exogeneity again. (3) Club Convergence In groups with similar economic characteristics and similar growth paths, convergence exists within the group, but not between different economic groups. This phenomenon is called club convergence (Durlauf, 1995; Galor, 1996). $$ \\frac{1}{T}\\left[\\log(y_{i,t\u0026#43;T}) - \\log(y_{i,t})\\right] = \\alpha \u0026#43; \\beta \\log(y_{i,t}) \u0026#43; \\lambda D \u0026#43; \\varepsilon_{i,t} $$ The variable meanings are the same as above, except that convergence is indicated only when $\\beta \u0026lt; 0$, where $D_{i, t}$ is a dummy variable, i.e., grouping, such as all of East Asia following the same development path, or several cities developing as port cities. An interesting study I found is modeling based on clustering criteria, such as using the \u0026ldquo;middle-income trap\u0026rdquo; as a clustering criterion11. Du (2017) (who is from Shandong University) introduced a Stata package to perform the econometric convergence test and club clustering algorithm by Phillips and Sul (2007)1213. The grouping basis idea is roughly as follows: $$ \u0026gt; \\lim_{x \\rightarrow \u0026#43;\\infty} \\frac{X_j}{X_i} \\rightarrow 1 \u0026gt; $$ For detailed mathematical derivations, please click on the hyperlinks to their names. Regarding club clustering operations in Stata, there are excellent tutorials available on YouTube and GitHub. I have translated and added details to his do file: Note: Use cd to adjust the Stata working environment (already noted in the do file comments) BDY do file dta file ***************** This do file and accompanying data sources are from: * https://github.com/quarcs-lab/mendez2020-convergence-clubs-code-data * This file mainly translates part of the content and adds explanations for operations and details. *------------------------------------------------------- ***************** Loading plotting","date":"2023-10-01","heading":"1. Econometric Equations","objectID":"/en/posts/shounian/:4:1","tags":["Economic Growth"],"title":"Convergence: From the Limit of Equations to the Limit of Growth","uri":"/en/posts/shounian/#1-econometric-equations"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"2. Empirical Results (Examples)\rChina\u0026rsquo;s current empirical results basically satisfy $\\sigma$ convergence14 and club convergence (classification is generally regional, such as eastern, central, and western regions)15. The standards of GDP, total factors, and industrial output basically lead to the same conclusions16. img\rimg\rPersonally, I think Tongji Edition\u0026rsquo;s calculus part is still quite good, but absolutely do not use its linear algebra part. The definitions, Tongji Edition\u0026rsquo;s directional derivatives differ from some mathematical analysis textbooks.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Personally, I think the best domestic statistics textbook, especially in the probability theory section, is captivating. The mathematical statistics section is relatively less interesting.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Other methods include geometric methods, subjective methods, and algebraic methods.\u0026#160;\u0026#x21a9;\u0026#xfe0e; If I were to explain each of these laws of large numbers individually, I honestly can\u0026rsquo;t remember them.\u0026#160;\u0026#x21a9;\u0026#xfe0e; I have forgotten what specific conditions they are; in machine learning applications, it seems quite difficult to satisfy.\u0026#160;\u0026#x21a9;\u0026#xfe0e; So I say, the probability theory textbooks for economics and management are not good; if you don\u0026rsquo;t look at statistics textbooks, you miss out on such a coherent understanding of knowledge points. So these distributions have evolved step by step. If you don\u0026rsquo;t know this development, you\u0026rsquo;d think they were sent from nowhere.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Barro R J, Sala-i-Martin X, Blanchard O J, et al. Convergence across states and regions[J]. Brookings papers on economic activity, 1991: 107-182.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Baumol, W. J. (1986). Productivity Growth, Convergence, and Welfare: What the Long-Run Data Show. The American Economic Review, 76 (5), 1072–1085. http://www.jstor.org/stable/1816469\u0026#160;\u0026#x21a9;\u0026#xfe0e; Peng Guohua. China\u0026rsquo;s regional income disparity, total factor productivity, and convergence analysis[J]. Economic Research, 2005 (9): 11. DOI: CNKI:SUN: JJYJ. 0.2005-09-003.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Barro R J, Mankiw N G, Sala-i-Martin X. Capital mobility in neoclassical models of growth[R]. National Bureau of Economic Research, 1992.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Xu Yonghui, Li Yue, Deng Hongtu. Club convergence and the middle-income trap[J]. Modern Finance (Tianjin University of Finance and Economics Journal), 2022, 42 (11): 48-62. DOI: 10.19559/j.cnki. 12-1387.2022.11.004.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Du, K. (2017). Econometric convergence test and club clustering using Stata. The Stata Journal, 17 (4), 882-900.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Phillips, P. C., \u0026amp; Sul, D. (2007). Transition modeling and econometric convergence tests. Econometrica, 75 (6), 1771-1855.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Lin Yifu, Liu Mingxing. China\u0026rsquo;s economic growth convergence and income distribution[J]. World Economy, 2003 (08): 3-14+80.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Shen Kunrong, Ma Jun. China\u0026rsquo;s economic growth \u0026ldquo;club convergence\u0026rdquo; characteristics and cause analysis[J]. Economic Research, 2002 (01): 33-39+94-95.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Tang Xuebing, Chen Xiushan. Convergence of economic growth in China\u0026rsquo;s eight major regions and its influencing factors analysis[J]. Journal of Renmin University of China, 2007 (01): 106-113.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2023-10-01","heading":"2. Empirical Results (Examples)","objectID":"/en/posts/shounian/:4:2","tags":["Economic Growth"],"title":"Convergence: From the Limit of Equations to the Limit of Growth","uri":"/en/posts/shounian/#2-empirical-results-examples"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Microeconomics: Roy\u0026rsquo;s Identity, Hotelling\u0026rsquo;s Lemma, and Shephard\u0026rsquo;s Lemma\r\u0026ldquo;Microeconomic Theory: Eighteen Lectures by Ping Xinqiao\u0026rdquo; directly uses the above three as calculation methods for post-class exercises, but \u0026ldquo;Microeconomics: A Modern Approach\u0026rdquo; (Varian) does not mention this part of the knowledge (the mathematics in Ping Xinqiao feels quite challenging), so this is a supplementary record. \u0026gt; \u0026ldquo;Microeconomic Theory: Eighteen Lectures\u0026rdquo; (Ping Xinqiao) is available in the attachment (from Z-Library). Microeconomic Theory: Eighteen Lectures (Ping Xinqiao) (Z-Library).pdf ","date":"2023-09-13","heading":"Microeconomics: Roy\u0026rsquo;s Identity, Hotelling\u0026rsquo;s Lemma, and Shephard\u0026rsquo;s Lemma","objectID":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/:0:0","tags":["Microeconomics"],"title":"Microeconomics: Roy Hotelling Shephard","uri":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/#microeconomics-roys-identity-hotellings-lemma-and-shephards-lemma"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Overall Understanding Framework\rA Hicksian demand function spanning various knowledge points\rShepard\u0026rsquo;s lemma, given production functions, minimizes costs; Roy\u0026rsquo;s identity, given budget constraints, maximizes utility; Hotelling\u0026rsquo;s lemma is about unconstrained profit functions. They are all analyses of envelope problems. ","date":"2023-09-13","heading":"Overall Understanding Framework","objectID":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/:1:0","tags":["Microeconomics"],"title":"Microeconomics: Roy Hotelling Shephard","uri":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/#overall-understanding-framework"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"I. Shepard\u0026rsquo;s Lemma\r","date":"2023-09-13","heading":"I. Shepard\u0026rsquo;s Lemma","objectID":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/:2:0","tags":["Microeconomics"],"title":"Microeconomics: Roy Hotelling Shephard","uri":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/#i-shepards-lemma"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Production Theory, Cost Minimization\rGiven the production function, minimize cost: $$ \\min \\sum_{i=1}^{n} w_i x_i \\\\\\\\ \\text{subject to } \\bar{y} = f(x_1, x_2, \\ldots, x_n) $$ We construct the Lagrangian function to solve: $$ \\mathcal{L} = \\sum_{i=1}^{n} w_i x_i - \\lambda (\\bar{y} - f(x_1, x_2, \\ldots, x_n)) $$ Taking partial derivatives with respect to $x_i$ and $\\lambda$ and setting them to zero, we solve for the optimal input $x_i^\\*$ and substitute it into the cost function to obtain the minimum cost $\\sum_{i=1}^{n} w_i x_i^\\*$. Varian\u0026rsquo;s textbook often uses geometric methods: $$ \\large \\bbox[#def,10px,border: 5px solid]{\\frac{\\Delta x_2}{\\Delta x_1} = -\\frac{MP_1(x_1^\\*, x_2^\\*)}{MP_2(x_1^\\*, x_2^\\*)} = -\\frac{w_1}{w_2}} $$","date":"2023-09-13","heading":"Production Theory, Cost Minimization","objectID":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/:2:1","tags":["Microeconomics"],"title":"Microeconomics: Roy Hotelling Shephard","uri":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/#production-theory-cost-minimization"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Proof Process:\r$$ \\begin{align} x_j(\\mathbf{w}, y) \u0026amp;= \\frac{\\partial c(\\mathbf{w}, y)}{\\partial w_j} \\\\\\\\ \u0026amp;= \\frac{\\partial \\sum_{i=1}^{n} w_i x_i}{\\partial w_j} \\\\\\\\ \u0026amp;= x_j \u0026#43; \\sum_{i=1}^{n} w_i \\frac{\\partial x_i}{\\partial w_j} \\end{align} $$ Given the first-order condition from the Lagrangian: $$ \\frac{\\partial \\mathcal{L}}{\\partial x_i} = w_i - \\lambda f(x_1, \\ldots, x_n) = 0 \\\\\\\\ \\Rightarrow w_i = \\lambda f(x_1, \\ldots, x_n) $$ Substituting back, we get: $$ x_j \u0026#43; \\lambda \\sum_{i=1}^{n} f(x, \\ldots, x) \\frac{\\partial x_i}{\\partial w_j} $$ Given the production function constraint: $$ \\bar{y} = f(x_1, x_2, \\ldots, x_n) $$ Thus, the derivative with respect to $w_j$ is zero: $$ \\frac{\\partial \\bar{y}}{\\partial w_j} = \\frac{\\partial f(x_1, x_2, \\ldots, x_n)}{\\partial w_j} = 0 $$","date":"2023-09-13","heading":"Proof Process:","objectID":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/:2:2","tags":["Microeconomics"],"title":"Microeconomics: Roy Hotelling Shephard","uri":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/#proof-process"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Application Example:\rTotal cost function: $C = qv^{2/3}v^{1/3}$ (1) Use Shepard\u0026rsquo;s lemma to calculate the factor demand functions for kk and ll. (2) Derive the potential production function based on the results from (1). (1) $$ \\begin{aligned} l \u0026amp;= \\frac{\\partial C}{\\partial w} = \\frac{2}{3} q \\left(\\frac{v}{w}\\right)^{1/3} \\\\\\\\ k \u0026amp;= \\frac{\\partial C}{\\partial v} = \\frac{1}{3} q \\left(\\frac{w}{v}\\right)^{2/3} \\end{aligned} $$ (2) Eliminate $\\frac{v}{w}$ from (1): $$ q = \\left(\\frac{3}{2}\\right)^{2/3} 3^{1/3} l^{2/3} k^{1/3} = B l^{2/3} k^{1/3} $$ where $B = \\left(\\frac{3}{2}\\right)^{2/3} 3^{1/3}$. ","date":"2023-09-13","heading":"Application Example:","objectID":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/:2:3","tags":["Microeconomics"],"title":"Microeconomics: Roy Hotelling Shephard","uri":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/#application-example"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"II. Roy\u0026rsquo;s Identity\r","date":"2023-09-13","heading":"II. Roy\u0026rsquo;s Identity","objectID":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/:3:0","tags":["Microeconomics"],"title":"Microeconomics: Roy Hotelling Shephard","uri":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/#ii-roys-identity"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Consumption Theory, Utility Maximization\rGiven budget constraints, maximize utility: $$ \\max u = f(x_1, x_2, \\ldots, x_n) \\\\\\\\ \\text{subject to } \\sum_{i=1}^{n} x_i p_i = m $$ Varian often uses geometric methods: $$ \\large \\bbox[#def,10px,border: 5px solid]{\\frac{\\Delta x_2}{\\Delta x_1} = -\\frac{MU_1(x_1^\\*, x_2^\\*)}{MU_2(x_1^\\*, x_2^\\*)} = -\\frac{p_1}{p_2}} $$","date":"2023-09-13","heading":"Consumption Theory, Utility Maximization","objectID":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/:3:1","tags":["Microeconomics"],"title":"Microeconomics: Roy Hotelling Shephard","uri":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/#consumption-theory-utility-maximization"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Proof Process:\rThe Lagrangian function is: $$ \\mathcal{L} = u(\\mathbf{x}) - \\lambda (\\mathbf{p} \\cdot \\mathbf{x} - m) $$ Taking partial derivatives with respect to $x_i$: $$ \\frac{\\partial \\mathcal{L}(\\mathbf{x}^f, \\lambda^f)}{\\partial x_i} = \\frac{\\partial u(\\mathbf{x}^f)}{\\partial x_i} - \\lambda^f p_i = 0 $$ The shadow price $\\lambda$ is: $$ \\lambda = \\frac{\\partial v(\\mathbf{p}, m)}{\\partial m} $$ Using Roy\u0026rsquo;s identity: $$ x_i^m = -\\frac{\\partial v / \\partial p_i}{\\partial v / \\partial m} $$","date":"2023-09-13","heading":"Proof Process:","objectID":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/:3:2","tags":["Microeconomics"],"title":"Microeconomics: Roy Hotelling Shephard","uri":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/#proof-process-1"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Application Example:\rPing Xinqiao\u0026rsquo;s \u0026ldquo;Microeconomic Theory: Eighteen Lectures,\u0026rdquo; Lecture 16, \u0026ldquo;General Equilibrium and Two Fundamental Principles of Welfare Economics\u0026rdquo; Given: $$ \\begin{aligned} u^1(x_1, x_2) \u0026amp;= \\min\\{x_1, x_2\\} \u0026amp; e^1 = (30, 0) \\\\\\\\ v^2(p, y) \u0026amp;= \\frac{y}{2 \\sqrt{p_1 p_2}} \u0026amp; e^2 = (0, 20) \\end{aligned} $$ Find the Walrasian equilibrium. ","date":"2023-09-13","heading":"Application Example:","objectID":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/:3:3","tags":["Microeconomics"],"title":"Microeconomics: Roy Hotelling Shephard","uri":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/#application-example-1"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"III. Hotelling\u0026rsquo;s Lemma\rHotelling\u0026rsquo;s lemma is about unconstrained profit functions. ","date":"2023-09-13","heading":"III. Hotelling\u0026rsquo;s Lemma","objectID":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/:4:0","tags":["Microeconomics"],"title":"Microeconomics: Roy Hotelling Shephard","uri":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/#iii-hotellings-lemma"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Production Theory, Profit Maximization\rGiven the profit function: $$ \\pi(p) = \\max_x p \\cdot f(x(p, w)) - w \\cdot x(p, w) $$ Hotelling\u0026rsquo;s lemma: $$ \\large \\bbox[#def,10px,border: 5px solid]{y^\\*(p) = \\frac{d \\pi(p)}{dp}} $$","date":"2023-09-13","heading":"Production Theory, Profit Maximization","objectID":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/:4:1","tags":["Microeconomics"],"title":"Microeconomics: Roy Hotelling Shephard","uri":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/#production-theory-profit-maximization"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Proof Process:\rGiven: $$ \\pi(p) = \\max_x p \\cdot f(x(p, w)) - w \\cdot x(p, w) $$ First-order condition: $$ p \\frac{\\partial f(x(p, w))}{\\partial x} - w = 0 $$ Differentiating the profit function with respect to $p$: $$ \\frac{\\partial \\pi(p, w)}{\\partial p} = f(x(p, w)) \u0026#43; p \\frac{d f(x(p, w))}{dx} \\cdot \\frac{\\partial x(p, w)}{\\partial p} - w \\frac{\\partial x(p, w)}{\\partial p} $$ The blue part equals zero: $$ (p \\frac{\\partial f(x(p, w))}{\\partial x} - w) \\frac{\\partial x(p, w)}{\\partial p} = 0 $$","date":"2023-09-13","heading":"Proof Process:","objectID":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/:4:2","tags":["Microeconomics"],"title":"Microeconomics: Roy Hotelling Shephard","uri":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/#proof-process-2"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Application Example:\rPing Xinqiao\u0026rsquo;s \u0026ldquo;Microeconomic Theory: Eighteen Lectures,\u0026rdquo; Lecture 7, \u0026ldquo;Factor Demand Functions, Cost Functions, Profit Functions, and Supply Functions\u0026rdquo; Given production function: $$ f(x_1, x_2) = 0.5 \\ln x_1 \u0026#43; 0.5 \\ln x_2 $$ Find the profit function $\\pi(w_1, w_2, p)$ and derive the supply function using two methods. ","date":"2023-09-13","heading":"Application Example:","objectID":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/:4:3","tags":["Microeconomics"],"title":"Microeconomics: Roy Hotelling Shephard","uri":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/#application-example-2"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"IV. Supplement\rThese lemmas are based on envelope analysis in mathematical economics. The dual problems of cost minimization and profit maximization are dual problems, with parameters $\\lambda$ being reciprocals. ","date":"2023-09-13","heading":"IV. Supplement","objectID":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/:5:0","tags":["Microeconomics"],"title":"Microeconomics: Roy Hotelling Shephard","uri":"/en/posts/%E5%BE%AE%E8%A7%82%E7%BB%8F%E6%B5%8E%E7%BD%97%E4%BC%8A%E9%9C%8D%E5%A4%AA%E6%9E%97%E8%B0%A2%E6%B3%BC%E5%BE%B7/#iv-supplement"},{"categories":["Reading"],"collections":[],"content":" Behind every act of madness lies a resilient and pure heart. The key to understanding Goodbye, Eri is not seeing how Yuta creates memories but realizing that he was always filming himself. As the title suggests — Words fail to convey how much effort I’ve poured into loving this world. In a short story, Tatsuki Fujimoto directed four films, each overturning the purpose of the previous one, blending reality and fiction. It’s essentially a story that demolishes another story, culminating in a complete narrative reversal. As for this piece—I admire Fujimoto’s values more than his storytelling techniques (including the cinematic style of the manga). This article will introduce the interwoven stories in the order of film division – subversion – foreshadowing and callbacks. ","date":"2023-09-12","heading":"","objectID":"/en/posts/zjhl/:0:0","tags":["Manga"],"title":"Goodbye, Eri: Not Remembering Others, but Knowing Oneself","uri":"/en/posts/zjhl/#"},{"categories":["Reading"],"collections":[],"content":"The First Layer: The Mother\u0026rsquo;s Film\rThe first film belongs to the mother. The protagonist (Yuta)’s mother is diagnosed with cancer and asks her son to film her. In her final moments, the protagonist refuses to visit her and blows up the hospital. The protagonist, who creates this film, is considered a lunatic by his classmates. A classic \u0026ldquo;girl meets boy\u0026rdquo; narrative unfolds— Just when Yuta plans to end his life, he meets the heroine, Eri. Eri loves his film and takes him to watch movies, hoping he can one day create a universally recognized film of his own. ","date":"2023-09-12","heading":"The First Layer: The Mother\u0026rsquo;s Film","objectID":"/en/posts/zjhl/:1:0","tags":["Manga"],"title":"Goodbye, Eri: Not Remembering Others, but Knowing Oneself","uri":"/en/posts/zjhl/#the-first-layer-the-mothers-film"},{"categories":["Reading"],"collections":[],"content":"The Second Layer: Eri’s Film\r","date":"2023-09-12","heading":"The Second Layer: Eri’s Film","objectID":"/en/posts/zjhl/:2:0","tags":["Manga"],"title":"Goodbye, Eri: Not Remembering Others, but Knowing Oneself","uri":"/en/posts/zjhl/#the-second-layer-eris-film"},{"categories":["Reading"],"collections":[],"content":"Plot Subversion\rIn the first film, the mother is portrayed positively. In the second film, the mother’s true personality begins to emerge. Here, Fujimoto starts reversing all the characters. Why does Eri like Yuta’s film? Eri: \u0026ldquo;Isn\u0026rsquo;t it cruel for a mother to ask her middle school son to document her final moments in a film? Yet, in your film, she still looks beautiful.\u0026rdquo; Why does Yuta’s father appreciate his work? Yuta’s father: \u0026ldquo;Yuta, your mother had a terrible temper. Even when you refused to see her at the end, she resented you, yet you portrayed her so beautifully. You have the power to create memories.\u0026rdquo; Yuta’s father: \u0026ldquo;Yuta, your mother had a terrible temper. Even when you refused to see her at the end, she resented you, yet you portrayed her so beautifully. You have the power to create memories.\u0026rdquo;\r","date":"2023-09-12","heading":"Plot Subversion","objectID":"/en/posts/zjhl/:2:1","tags":["Manga"],"title":"Goodbye, Eri: Not Remembering Others, but Knowing Oneself","uri":"/en/posts/zjhl/#plot-subversion"},{"categories":["Reading"],"collections":[],"content":"Foreshadowing and Callbacks\rRevisit the foreshadowing from the first story—why was Yuta unwilling to visit his mother? Because he couldn’t bear the emotional weight and sought escape through an explosion. The seemingly absurd plot twist completes the first reversal, raising a profound question: How does one escape pain? By shaping their memories. ","date":"2023-09-12","heading":"Foreshadowing and Callbacks","objectID":"/en/posts/zjhl/:2:2","tags":["Manga"],"title":"Goodbye, Eri: Not Remembering Others, but Knowing Oneself","uri":"/en/posts/zjhl/#foreshadowing-and-callbacks"},{"categories":["Reading"],"collections":[],"content":"Elevating the Narrative\rEri dies, and Yuta’s film about her gains widespread acclaim. Eri’s friend: \u0026ldquo;Eri always wore glasses and didn’t have such a great personality. You idealized her too much, but still, thank you. That’s the Eri I’ll remember.\u0026rdquo; Eri’s friend: \u0026ldquo;Eri always wore glasses and didn’t have such a great personality. You idealized her too much, but still, thank you. That’s the Eri I’ll remember.\u0026rdquo;\rFantasy is a gift, but also a burden. ","date":"2023-09-12","heading":"Elevating the Narrative","objectID":"/en/posts/zjhl/:2:3","tags":["Manga"],"title":"Goodbye, Eri: Not Remembering Others, but Knowing Oneself","uri":"/en/posts/zjhl/#elevating-the-narrative"},{"categories":["Reading"],"collections":[],"content":"The Third Layer: Yuta’s Film\r","date":"2023-09-12","heading":"The Third Layer: Yuta’s Film","objectID":"/en/posts/zjhl/:3:0","tags":["Manga"],"title":"Goodbye, Eri: Not Remembering Others, but Knowing Oneself","uri":"/en/posts/zjhl/#the-third-layer-yutas-film"},{"categories":["Reading"],"collections":[],"content":"Plot Subversion\rYuta reveals that everything before was just a movie. Years later, as an adult suffering from misfortunes, Yuta returns to the place where he and Eri once watched movies, intending to end his life, only to find her there! It turns out she’s a vampire. After saying goodbye, Yuta blows up the building. ","date":"2023-09-12","heading":"Plot Subversion","objectID":"/en/posts/zjhl/:3:1","tags":["Manga"],"title":"Goodbye, Eri: Not Remembering Others, but Knowing Oneself","uri":"/en/posts/zjhl/#plot-subversion-1"},{"categories":["Reading"],"collections":[],"content":"Foreshadowing and Callbacks\rThe first film about the mother captures Yuta’s perception of her. The second film about Eri captures Yuta’s perception of her. The answer is clear: from beginning to end, Yuta was filming himself. More importantly, the entire narrative is about Yuta filming how he perceives himself. In the second story, Eri once said—\u0026quot;What I want you to film is a movie about yourself, Yuta.\u0026quot; Thus, the third act can be interpreted as Yuta’s father’s role—because vampires cannot exist in reality. ","date":"2023-09-12","heading":"Foreshadowing and Callbacks","objectID":"/en/posts/zjhl/:3:2","tags":["Manga"],"title":"Goodbye, Eri: Not Remembering Others, but Knowing Oneself","uri":"/en/posts/zjhl/#foreshadowing-and-callbacks-1"},{"categories":["Reading"],"collections":[],"content":"Yuta’s Film: What Is My Fantasy?\rThe key to understanding Goodbye, Eri is not seeing how Yuta remembers others but realizing — Yuta was always filming himself 🤧. The three films are distinct but connected by recurring elements (characters, explosions, death). The manga’s panel design deliberately mimics film reels to echo the thematic message. Each subsequent film subverts the previous one, and the three together form a complete story. The technique is simple: use the film-making setup to deconstruct characters across segments, ultimately presenting a story about the act of filming itself. ","date":"2023-09-12","heading":"Yuta’s Film: What Is My Fantasy?","objectID":"/en/posts/zjhl/:4:0","tags":["Manga"],"title":"Goodbye, Eri: Not Remembering Others, but Knowing Oneself","uri":"/en/posts/zjhl/#yutas-film-what-is-my-fantasy"},{"categories":["Reading"],"collections":[],"content":"The Three Films’ Explosions\rMother’s film: Yuta portrays only her best side, adding an explosion as an unconscious response to his fear of her death. Eri’s film: Yuta shows only her best side, omitting any explosion. Yuta’s film: Adds vampires and an explosion as the final act. At this point, Yuta finally understands himself. The explosion was his choice, just as he chose to leave only the best memories for his family and friends. The repetition of explosions across the three films mirrors Yuta’s personal growth. ","date":"2023-09-12","heading":"The Three Films’ Explosions","objectID":"/en/posts/zjhl/:4:1","tags":["Manga"],"title":"Goodbye, Eri: Not Remembering Others, but Knowing Oneself","uri":"/en/posts/zjhl/#the-three-films-explosions"},{"categories":["Reading"],"collections":[],"content":"Why Is Tatsuki Fujimoto a Genius?\rHe shows that expressing the sorrow of parting doesn’t require depicting agonizing deathbed scenes; avoiding reality can also be an act of love. He demonstrates that cameras deceive, as memories are subjective creations, not objective records. He reveals a world beyond the lens filled with death and devoid of fantasy, portraying humans as nothing more than cranky, tantrum-prone kids. In your darkest moments, after peeling back the layers of your mother and Eri, you finally see Yuta’s truth— His mother transforms from a demanding parent into a gentle, caring figure. Eri transforms from a grumpy girl with glasses into a kind, understanding friend. Yuta fears losing his mother, so he resorts to explosions. Yuta fears losing Eri, so he turns her into a vampire. Reality has no explosions or vampires. The nested stories form a narrative trick—a reflection of how Yuta perceives himself, his growth, and his values. Life is an inevitably futile struggle. Adding a touch of fantasy is one of our few comforting choices. Isn’t it beautiful to pursue that fantasy, even if it doesn’t exist? If it’s not real, does that mean it’s not worth pursuing? Isn’t it beautiful?\rBut I won’t be moved by someone’s pursuit of fantasy or insistence on idealism. In times of economic stagnation, everyone seeks reasons to keep living, which isn’t so different from chasing fantasy. I don’t need someone to persuade me to pursue fantasy. I need to understand what I’m doing. Through this story, Tatsuki Fujimoto narrates the quiet process of self-discovery. A psychologist might choose a warm story to encourage realism. A madman kicks down the door, barges in, and, after breaking you with grim realities, scams you into believing in fantasies. This is the kind of creator Fujimoto is—a madman. No matter how cruel the world is, even if through the self-hypnosis of fantasy, please fall in love with it at all costs. This is the hypnosis Fujimoto, the peddler of fantasy films, performs on his readers. Humans seek nonexistent fantasy to survive—don’t resist this inevitability. Thus—Yuta sees himself as: Words fail to convey how much effort I’ve poured into loving this world. Please understand yourself too. Now, do you understand? To live in this world, one creates a mindset. Fantasy and films are just manifestations. Recognize this fantasy—not to shape others, but to know yourself.\r","date":"2023-09-12","heading":"Why Is Tatsuki Fujimoto a Genius?","objectID":"/en/posts/zjhl/:5:0","tags":["Manga"],"title":"Goodbye, Eri: Not Remembering Others, but Knowing Oneself","uri":"/en/posts/zjhl/#why-is-tatsuki-fujimoto-a-genius"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"Because the \u0026ldquo;Frontiers of Public Finance\u0026rdquo; course required writing a feedback paper, I took the chance to learn CiteSpace for bibliometric visualization. This post also briefly introduces some other web-based visualization tools, but the focus is CiteSpace. I wrote this post to record some points the online tutorials leave out and some finer operational details for the new version (6.2.2). Below are the guides written by Jie Li and Chaomei Chen; they also cover the discipline of knowledge graphs, but I\u0026rsquo;ll show the basic operations directly in this post. CiteSpace: Tech Text Mining and Visualization Chinese Guide to CiteSpace, 7th Edition ","date":"2023-09-06","heading":"","objectID":"/en/posts/citespace/:0:0","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"1. The result\rCiteSpace is developed in Java, and the basic version is free while the advanced version is paid; here I only cover the free basic version. The basic version is actually enough. Visualization of the top 500 cited CNKI papers using \u0026ldquo;fiscal budget\u0026rdquo; as the keyword.\rVisualization of the top 500 cited CNKI papers using \u0026ldquo;fiscal budget\u0026rdquo; as the keyword. An anime/2D theme; you can see that Bilibili and Hatsune Miku are also third-level keywords (that\u0026rsquo;s homo for you)\rAn anime/2D theme; you can see that Bilibili and Hatsune Miku are also third-level keywords (that\u0026rsquo;s homo for you). This is a timeline view, and it actually surfaces some things — for example the shifts in the \u0026ldquo;fiscal budget\u0026rdquo; theme: fiscal reform, budget disclosure, budget procedures, expenditure structure, debt management\rTrend of hot keywords; the red parts are the periods when the topic keywords concentrate\r","date":"2023-09-06","heading":"1. The result","objectID":"/en/posts/citespace/:1:0","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#1-the-result"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"2. Download and the Chinese UI\r1. Download page: Page As said earlier, CiteSpace is developed in Java, so early versions required downloading Java first1. The latest version bundles jre, so no extra download is needed. Just click in, and like installing ordinary software, click \u0026ldquo;yes\u0026rdquo; all the way through. 2. On the install location: I\u0026rsquo;d suggest keeping the install path free of Chinese characters; it feels like this applies to all foreign software. Personally I feel it doesn\u0026rsquo;t use much memory, so installing on the C drive is fine too. 3. Chinese UI: Good news: the new CiteSpace has a Chinese UI. Bad news: not much of it. First a black box, then after waiting, the initial page pops up; every time you\u0026rsquo;ll start from this page again\rBy the way, from the top you can see my computer username is \u0026ldquo;pluck\u0026rdquo;; I first learned this word because of JOJO\rBy the way, from the top you can see my computer username is \u0026ldquo;pluck\u0026rdquo;; I first learned this word because of JOJO. ","date":"2023-09-06","heading":"2. Download and the Chinese UI","objectID":"/en/posts/citespace/:2:0","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#2-download-and-the-chinese-ui"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"3. Data import\rSource: CiteSpace: Tech Text Mining and Visualization (3rd edition)\rFirst create three folders: in, data, project Personally I suggest saving them in a shallow location that\u0026rsquo;s easy to click into from \u0026ldquo;My Computer\u0026rdquo;; later data processing requires repeatedly clicking to confirm folder locations. $$ Folder\\begin{cases} in: saves the literature information in txt format\\newline data: saves the cleaned text literature information from the in folder\\newline project: saves the visualization operations \\end{cases} $$","date":"2023-09-06","heading":"3. Data import","objectID":"/en/posts/citespace/:3:0","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#3-data-import"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"(1) CNKI data import\r1. The CNKI data-selection stage Note when filtering: \u0026ldquo;Select all\u0026rdquo; only selects all results on the current page. CNKI supports exporting at most 500 records, and CiteSpace (free version) supports processing at most 500 records. To speed things up, first change the display to 50 per page, then select all across 10 pages to pick out 500 literature records. To switch CNKI pages, just click where the arrow points in the upper right; no need to scroll down to look. CNKI\rChoose to export the literature as RefWorks, exporting as a .txt file: Refworks\rAt the same time, CNKI has its own visualization page; we also need to enter CNKI\u0026rsquo;s visualization analysis following the path in the figure below, and remember the time range of the 500 papers we selected. The time range is very important and will be used later. Selecting the path\rCNKI\u0026rsquo;s built-in visualization analysis; note the time\r2. The folder-cleaning stage Change the .txt file names to the format download_x so CiteSpace can recognize them. For example: download_1, download_i\u0026hellip;\u0026hellip; After cleaning, the download_x.txt in the in folder is processed into the data folder; you can check whether the data folder contains the processed text files as a verification. Do it in order\rOnce the txt files in data are processed, click \u0026ldquo;New\u0026rdquo; on the initial page, name it in the new popup, and enter the paths for data and project2 then choose the literature language (English\\Chinese) and the database format (usually WoS). Selection\r3. The data-analysis page As shown, the bottom-right is where you choose the pruning path, trimming unnecessary branches from the relationship graph and keeping the core related literature. The top-right is the literature time range, which is why I stressed earlier that you must first use CNKI\u0026rsquo;s built-in visualization to determine the time range. The middle-right is the visualization element selection; usually choose keywords. Once selected, click start on the left. If all goes well, a popup with a \u0026ldquo;Visualize\u0026rdquo; button will appear; click it to start the analysis. Start the analysis\r","date":"2023-09-06","heading":"(1) CNKI data import","objectID":"/en/posts/citespace/:3:1","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#1-cnki-data-import"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"(2) WoS data import\rWoS is web of science Note: since CiteSpace filters journal articles rather than books, you must select the Core Collection; otherwise if there are books later, it may be impossible to proceed! Selecting the Core Collection\rAfter that it\u0026rsquo;s the same as CNKI. Export as plain text files; the export limit is also 500 records. The exported record content needs to be \u0026ldquo;Full Record and Cited References\u0026rdquo;. (If this option doesn\u0026rsquo;t appear, it means books have gotten mixed in, which is why I reminded you earlier to filter within the \u0026ldquo;Core Collection\u0026rdquo;)\rAfter that, the data input just means choosing WoS; the main thing here is deduplication, and everything else is the same as CNKI. Note that in CNKI\u0026rsquo;s cleaned data folder, there\u0026rsquo;s only one .txt file, but in WoS\u0026rsquo;s cleaned data folder, the .txt files correspond to the article\u0026rsquo;s DOI, keywords, and so on. So don\u0026rsquo;t doubt whether you made a mistake, or click \u0026ldquo;Deduplicate\u0026rdquo; multiple times — that will produce duplicate files! ","date":"2023-09-06","heading":"(2) WoS data import","objectID":"/en/posts/citespace/:3:2","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#2-wos-data-import"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"(3) Supported data sources\rSource: CiteSpace: Tech Text Mining and Visualization (2nd edition); the latest is the 3rd edition\r","date":"2023-09-06","heading":"","objectID":"/en/posts/citespace/:3:3","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#3-supported-data-sources"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"Deduplication\rDuplicate txt records will affect node computation. The deduplication function is under the WoS option. Convert the txt documents according to their database source, then deduplicate them in the WoS option. As shown\r","date":"2023-09-06","heading":"Deduplication","objectID":"/en/posts/citespace/:4:0","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#deduplication"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"4. Visualization in practice\r","date":"2023-09-06","heading":"4. Visualization in practice","objectID":"/en/posts/citespace/:5:0","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#4-visualization-in-practice"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"(1) Keyword graph\rThe big watermark behind the new version can\u0026rsquo;t be removed. The big watermark behind the new version can\u0026rsquo;t be removed\rIn the graph stage, we usually operate as follows:\rIn the graph stage, we usually operate as follows: $$ \\begin{align} \u0026amp;Set nodes to circles:\\newline \u0026amp;Nodes\\Rightarrow \\text{Node Shape for Keywords and Terms} \\Rightarrow Circle \\newline \u0026amp;Cluster-analysis optimization:\\newline \u0026amp;Clusters \\Rightarrow \\text{Convex Hull: Show/Hide}\\newline \u0026amp;Cluster color blocks:\\newline \u0026amp;Clusters \\Rightarrow \\text{Visual Encoding: Advanced Settings} \\Rightarrow \\text{Areas: Fil/Border Only} \\end{align} $$ This way you can clearly see the color-block boundaries; if it looks too flashy, click again and it becomes hide, removing the color blocks. The style as shown\rFor the format, I usually pick one of the two below; choose LLR for the title and straight lines for the links. Selection\rFiner operations: also the most important control page Finer operations\r","date":"2023-09-06","heading":"(1) Keyword graph","objectID":"/en/posts/citespace/:5:1","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#1-keyword-graph"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"(2) Timeline view\rThe controls for the number of keywords and the weighting method in the timeline view are still as shown below. Timeline view\rimg\r","date":"2023-09-06","heading":"(2) Timeline view","objectID":"/en/posts/citespace/:5:2","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#2-timeline-view"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"(3) Burst terms\r$Hotspots\\Rightarrow View$, and they\u0026rsquo;ll appear; the popup that appears at the same time can be treated as a Word table environment, so you can copy-paste directly. Pasting into Word with the original format gives you a table that keeps its colors. This page can be copied and pasted; it\u0026rsquo;s a Word table format\rThis page can be copied and pasted; it\u0026rsquo;s a Word table format. ","date":"2023-09-06","heading":"(3) Burst terms","objectID":"/en/posts/citespace/:5:3","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#3-burst-terms"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"(4) Advanced-version operations (pay to win)\rIt seems the ordinary version used to be able to draw time-zone maps too, but now it can\u0026rsquo;t; you have to pay for the advanced version. Same for some coupling analyses. ","date":"2023-09-06","heading":"(4) Advanced-version operations (pay to win)","objectID":"/en/posts/citespace/:5:4","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#4-advanced-version-operations-pay-to-win"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"(5) txt tools\rIf you upgrade to the advanced version, it seems you can process more than 500 literature records3, but CNKI and WoS still cap exports at 500 per batch. In that case you can use a txt merge tool. ","date":"2023-09-06","heading":"(5) txt tools","objectID":"/en/posts/citespace/:5:5","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#5-txt-tools"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"(6) Export\rYou can see there are two watermarks (a big one behind and a small one in the bottom-left); the big watermark behind is new in the new version and can\u0026rsquo;t be removed. To remove the bottom-left watermark, do this: img\r$Labels \\Rightarrow \\text{overlay Labels: Show/Hide}$ img\rFile export supports .png and .jpg. Click the \u0026ldquo;File\u0026rdquo; menu in the top-left and a save as pdf will pop up. Although the bottom-left watermark is superficially removed, it still appears on export,,,,, so if you don\u0026rsquo;t want any watermark, I\u0026rsquo;d suggest adjusting the view and taking a direct screenshot. ","date":"2023-09-06","heading":"(6) Export","objectID":"/en/posts/citespace/:5:6","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#6-export"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"5. Other bibliometric visualization sites\r","date":"2023-09-06","heading":"5. Other bibliometric visualization sites","objectID":"/en/posts/citespace/:6:0","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#5-other-bibliometric-visualization-sites"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"1. CNKI\u0026rsquo;s and WoS\u0026rsquo;s built-in data visualization\rimg\r","date":"2023-09-06","heading":"1. CNKI\u0026rsquo;s and WoS\u0026rsquo;s built-in data visualization","objectID":"/en/posts/citespace/:6:1","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#1-cnkis-and-woss-built-in-data-visualization"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"2. If you\u0026rsquo;re a Zotero veteran, that works too.\rCNKI\u0026rsquo;s visualization looks nice; can you take it home? Of course you can. In another post I introduced Zotero\u0026rsquo;s visualization plugin, which has a CNKI-like visualization built in. The petal icon is the toggle; you can resize the window, and there are four visualization relationships. Move to the bottom of the page and the switch options will float up. Only supports Zotero 6; Zotero 7 has removed this feature\rGet a visualization of the literature you\u0026rsquo;ve collected in Zotero. There\u0026rsquo;s also a word cloud, though it\u0026rsquo;s a word cloud of the whole Zotero library\u0026rsquo;s literature. img\r","date":"2023-09-06","heading":"","objectID":"/en/posts/citespace/:6:2","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#2-if-youre-a-zotero-veteran-that-works-too"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"3. bibliometric\rSupports only the SCI database ","date":"2023-09-06","heading":"3. bibliometric","objectID":"/en/posts/citespace/:6:3","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#3-bibliometric"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"4. connectpaper\rJust search a keyword directly, and it will associate related literature to form a graph, including sites like arXiv. img\r","date":"2023-09-06","heading":"4. connectpaper","objectID":"/en/posts/citespace/:6:4","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#4-connectpaper"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"5. researchrabbit\rWebsite: www.researchrabbit.ai/ ","date":"2023-09-06","heading":"5. researchrabbit","objectID":"/en/posts/citespace/:6:5","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#5-researchrabbit"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"6. Literature reviews?\rCan you use CiteSpace to churn out papers? I feel it\u0026rsquo;s not easy; at least in recent years C-journal papers like that seem rare. But for homework and small projects it seems okay? Though used too much it becomes too formulaic and bland. Personally, I think a good review should be: Having a unique understanding of the whole topic\u0026rsquo;s depth and prospects: not just describing trends, but grasping the era background behind the hotspots. So when writing my feedback paper, I tried to combine hotspots and discuss \u0026ldquo;fiscal budget\u0026rdquo; and \u0026ldquo;real-world needs.\u0026rdquo; Keyword\rFiscal extraction\rState capital\rBudget disclosure\rExpenditure structure\rDebt management\rBackground\rSeeking development\rLoss of state capital\rCorruption\rHigh-quality development\\public choice\\official tournament model\rEconomic conditions\rTime\rFounding of the PRC\raround 2010\raround 2014\raround 2017\raround 2022\rCleverly classify the existing research directions and theoretical development stages with a framework. Grasp the topic\u0026rsquo;s breadth and timeliness (this is CiteSpace\u0026rsquo;s strength). In sum, I personally prefer using CiteSpace to do hidden background work — for example, sorting out the induction route and logic of a literature review\u0026rsquo;s keywords to help me choose a better topic. ","date":"2023-09-06","heading":"6. Literature reviews?","objectID":"/en/posts/citespace/:7:0","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#6-literature-reviews"},{"categories":["Software Tools","Economic Studies"],"collections":[],"content":"References\rI\u0026rsquo;d already installed Java locally because I play the Java edition of Minecraft, which is one reason I picked up CiteSpace so readily.\u0026#160;\u0026#x21a9;\u0026#xfe0e; So try to pick a folder location that\u0026rsquo;s easy to click into here; otherwise you\u0026rsquo;ll get tired of clicking through it later.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Though I haven\u0026rsquo;t tried it myself.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2023-09-06","heading":"References","objectID":"/en/posts/citespace/:8:0","tags":["CiteSpace"],"title":"CiteSpace Bibliometric Visualization","uri":"/en/posts/citespace/#references"},{"categories":["Reading"],"collections":[],"content":"I. The \u0026ldquo;Selfishness\u0026rdquo; in the Meaning of Natural Selection\r","date":"2023-08-30","heading":"I. The \u0026ldquo;Selfishness\u0026rdquo; in the Meaning of Natural Selection","objectID":"/en/posts/selfishgene/:1:0","tags":["Evolution"],"title":"The Selfish Gene: The Question of Altruistic Morality","uri":"/en/posts/selfishgene/#i-the-selfishness-in-the-meaning-of-natural-selection"},{"categories":["Reading"],"collections":[],"content":"1. What is \u0026ldquo;Selfishness\u0026rdquo; in the Book?\rAnthropomorphic descriptions often lead to misunderstandings. The phrase \u0026ldquo;Heaven and Earth are not benevolent, treating all things as straw dogs\u0026rdquo; originally meant that natural laws treat all species equally, yet many use it to condemn the heartlessness of nature. \u0026ldquo;The Selfish Gene\u0026rdquo; aims to argue for a perspective on \u0026ldquo;evolutionary theory\u0026rdquo; akin to natural law—that genes are the fundamental unit of natural selection (the concepts of \u0026ldquo;fundamental,\u0026rdquo; \u0026ldquo;optimal,\u0026rdquo; and \u0026ldquo;sole\u0026rdquo; are entirely different, and the controversy in understanding lies here). Natural selection and genes possess no subjective consciousness; what intrigues us is the mechanism through which they drive species transformation. The author, Dawkins, himself complained in the 30th-anniversary introduction1: \u0026ldquo;The Selfish Gene has been criticized for anthropomorphizing genes, which requires explanation (if not apology).\u0026rdquo; In this book, the meaning of selfishness is taking all actions to enhance survival probability in nature—implying no subjective consciousness, moral standards, or cultural phenomena, merely quantified as increased genetic inheritance probability. The author also considered titles like \u0026ldquo;The Cooperative Gene\u0026rdquo; or \u0026ldquo;The Immortal Gene,\u0026rdquo; ultimately choosing \u0026ldquo;The Selfish Gene\u0026rdquo; likely to create a stark contrast with biological altruistic behaviors, but with two requirements: Genes are purposeless and unconscious Selfish behavior refers to enhancing one\u0026rsquo;s own natural survival probability The laws of species evolution ≠ the laws of societal operation. The author advocates distinguishing evolutionary theory from social development, emphasizing that this book focuses on explaining biological behaviors through natural selection. ","date":"2023-08-30","heading":"1. What is \u0026ldquo;Selfishness\u0026rdquo; in the Book?","objectID":"/en/posts/selfishgene/:1:1","tags":["Evolution"],"title":"The Selfish Gene: The Question of Altruistic Morality","uri":"/en/posts/selfishgene/#1-what-is-selfishness-in-the-book"},{"categories":["Reading"],"collections":[],"content":"2. Natural Selection and Evolutionary Theory\rForty years ago, gene-related research wasn\u0026rsquo;t as widespread as today; now, the importance of genes is self-evident, but we must avoid \u0026ldquo;genetic determinism\u0026rdquo; thinking. Although Darwin left us \u0026ldquo;natural selection,\u0026rdquo; its mechanisms remained enigmatic. Is the unit of evolution the individual, population, or gene? How to explain animal altruistic behaviors? Do You Truly Understand Evolutionary Theory?\rAnalyze the motivation behind parental favoritism? Why are animal conflicts ritualistic—why do they drive away intruders rather than exterminate them? Does animal camouflage constitute conscious deception? What drives cooperation and competition among individuals? If reproduction is the pursuit of survival, why do aging and death exist? Beyond these, the greatest question: how can the above issues be unified within the framework of \u0026ldquo;natural selection\u0026rdquo;??? Taking \u0026ldquo;use and disuse\u0026rdquo; as an example, this represents individual selection: Giraffes\u0026rsquo; necks gradually lengthen with environmental changes, with natural selection manifesting as the evolutionary development of individual traits. Internet image, Digimon evolution path: For individual selection theory, natural selection resembles Digimon super-evolution—individual traits change for survival\rThe \u0026ldquo;selfish gene selection\u0026rdquo; perspective in this book differs: Genes initially combine randomly, mutations are accidental, and genes pursue stability. This means both long-necked and short-necked giraffes existed initially, but short-necked ones couldn\u0026rsquo;t reach food, were eliminated, leaving only long-necked individuals. Self-drawn image, a genetic hourglass: For gene selection theory, individuals are merely gene carriers; natural selection filters existing genes, then recombines them into more stable states. This book terms organisms as \u0026ldquo;survival machines\u0026rdquo; for genes.\rThe author chooses to treat \u0026ldquo;genes\u0026rdquo; as the fundamental unit of natural selection2. As shown below, studying biological evolution can expand infinitely from genes, individuals, races, communities, to civilizations. The author believes it\u0026rsquo;s better to focus on the smallest unit to study evolutionary processes. Any changes at higher levels essentially originate from changes in fundamental constituent units (this view remains controversial in evolutionary theory circles). Self-drawn image: Resembles choosing an observation coordinate. Everyone knows natural selection exists, but from what perspective should we observe it? This too presents a significant challenge\r","date":"2023-08-30","heading":"","objectID":"/en/posts/selfishgene/:1:2","tags":["Evolution"],"title":"The Selfish Gene: The Question of Altruistic Morality","uri":"/en/posts/selfishgene/#2-natural-selection-and-evolutionary-theory"},{"categories":["Reading"],"collections":[],"content":"II. The Argumentative Approach from Phenomenon to Essence\rAlthough this book is a popular science work on \u0026ldquo;evolutionary theory,\u0026rdquo; I perceive shadows of economics within it. Darwin left us \u0026ldquo;natural selection\u0026rdquo;; Adam Smith left us \u0026ldquo;the invisible hand.\u0026rdquo; How does natural selection occur? Kinship unit, racial unit, and individual unit advocates argue incessantly; Is the market mechanism omnipotent? Liberals and Keynesians attack each other over this. Selfish genes ≠ all assumptions in this book; Rational economic man ≠ all assumptions in economics; Both essentially make theoretical assumptions about real-world phenomena that are difficult to verify, merely providing an explanatory perspective. The difficulty with social science viewpoints lies in: even if you discover an elegant theory to explain reality, in a world full of friction, how do you prove their causal relationship?3 Economics employs experiments and econometrics for proof; this book primarily establishes frameworks and argues through logical deduction—exposing contradictions in other individualist and populationist theories, yet seems somewhat lacking in positive evidence for its own viewpoint (hence this book\u0026rsquo;s perspective doesn\u0026rsquo;t appear mainstream in biology, with somewhat insufficient positive evidence). The chapter logic essentially follows4: $$ \\begin{align} \u0026amp; \\text{Biological behavior} \\Rightarrow \\text{why race/individual selection is wrong} \\Rightarrow \\text{gene selection} \\newline \u0026amp; \\text{Altruistic behavior motivation} \\Rightarrow \\text{profit} - \\text{cost} \\geq 0 \\end{align} $$ Whenever the author discusses gene selection, this book resembles a comprehensive modeling manual, offering unique perspectives and eloquent language. Dawkins extensively employs \u0026ldquo;game theory\u0026rdquo; to explore survival strategies in animal behavior, uses \u0026ldquo;equilibrium\u0026rdquo; to describe genetic inheritance steady states, \u0026ldquo;sorting\u0026rdquo; to depict kinship relationships, and \u0026ldquo;operations research\u0026rdquo; to analyze parenting strategies. Overall positive arguments lean toward logical deduction. I fully agree with the deductive logic emphasized in this book: This book avoids illustrative arguments, circular reasoning, and using biology to argue sociology, employing logical deduction instead. Some say: Baboons are human ancestors, baboons are selfish, therefore humans are even more so. This confuses biological relationships. Some say: Animals A, B, C, D all behave this way, therefore humans do too. Such illustrative arguments easily manipulate viewpoints. Some say: Only superior individuals can reproduce. This is circular reasoning, with \u0026ldquo;superior\u0026rdquo; and \u0026ldquo;reproduction\u0026rdquo; mutually justifying each other. (Actually, \u0026ldquo;effort leads to success\u0026rdquo; and \u0026ldquo;heaven rewards diligence\u0026rdquo; also constitute circular reasoning. I prefer to term such inspirational logic as survivalist philosophy—manifestations of survival wisdom used for self-affirmation, self-promotion, and self-comfort, often beneficial for individual growth. Rather than absolute rules of societal operation, they represent ideal environments social sciences aim to shape—environments conducive to developing forward-looking5 moral perspectives.) Initially reading like many readers, I found the argumentative logic in certain chapters ambiguous. Later summarizing revealed each chapter\u0026rsquo;s structure essentially follows: Self-drawn image, logical paradigm: This book\u0026rsquo;s logic isn\u0026rsquo;t observing b from a, but comparing nature\u0026rsquo;s filtering of all species, examining genes from evolutionary processes, first identifying correlations between genes and behaviors, then conducting mental model interventions, finally screening for causality.\rFirst proposing new definitions and animal behavior questions, then refuting errors in other theoretical levels, followed by deducing gene selection logic. Seemingly selfless choices to hel","date":"2023-08-30","heading":"","objectID":"/en/posts/selfishgene/:2:0","tags":["Evolution"],"title":"The Selfish Gene: The Question of Altruistic Morality","uri":"/en/posts/selfishgene/#ii-the-argumentative-approach-from-phenomenon-to-essence"},{"categories":["Reading"],"collections":[],"content":"III. Discussions Beyond the Book\rGiven my relatively limited knowledge in biology, I primarily conducted brief searches on Google Scholar, Quora, Wikipedia, and WOS. The conclusion is that this book mainly popularizes a perspective for viewing the world, but positive research and direct applications appear somewhat limited. ","date":"2023-08-30","heading":"III. Discussions Beyond the Book","objectID":"/en/posts/selfishgene/:3:0","tags":["Evolution"],"title":"The Selfish Gene: The Question of Altruistic Morality","uri":"/en/posts/selfishgene/#iii-discussions-beyond-the-book"},{"categories":["Reading"],"collections":[],"content":"1. Evolutionary Theory (evolution)\rBased on current research, evolutionary theory seems to emphasize non-genetic individual changes and doesn\u0026rsquo;t deny trait development beyond individual genes. This doesn\u0026rsquo;t mean the book\u0026rsquo;s viewpoint is incorrect, merely that the gene perspective is no longer unique. Since the beginning of the 21st century, some biologists have argued for an extended evolutionary synthesis, which would account for the effects of non-genetic inheritance modes, such as epigenetics, parental effects, ecological inheritance and cultural inheritance, and evolvability (Wikipedia). Searching WOS with \u0026ldquo;selfish gene\u0026rdquo; as the subject6, then visualizing recent research through CiteSpace. (May not be entirely rigorous—cell science papers are numerous; greater rigor might require further precision to evolutionary theory and natural selection.) Appears to have limited positive research\r","date":"2023-08-30","heading":"1. Evolutionary Theory (evolution)","objectID":"/en/posts/selfishgene/:3:1","tags":["Evolution"],"title":"The Selfish Gene: The Question of Altruistic Morality","uri":"/en/posts/selfishgene/#1-evolutionary-theory-evolution"},{"categories":["Reading"],"collections":[],"content":"2. Beyond Zoology: MEME (Memes)\rWhat\u0026rsquo;s remarkable is that beyond evolutionary theory, this book has made significant contributions! To analogize \u0026ldquo;gene\u0026rdquo; transmission, Dawkins coined \u0026ldquo;meme\u0026rdquo; from the Greek root \u0026ldquo;mimeme\u0026rdquo; (to mimic) (to create lexical parallelism with \u0026ldquo;gene\u0026rdquo;). Often called \u0026ldquo;memes\u0026rdquo;; in the CITIC Publishing version I read, it\u0026rsquo;s translated as \u0026ldquo;觅母\u0026rdquo; (seeking mother).\rWe frequently encounter various meme images on the internet: meme\rMeme images and other popular symbols represent certain cultures or events, possessing heritability yet potentially varying among individuals—sharing, spreading, mutating. This transmission phenomenon resembles gene propagation and is termed MEME. \u0026ldquo;The Selfish Gene\u0026rdquo; already clarifies it\u0026rsquo;s not \u0026ldquo;social Darwinism,\u0026rdquo; but in Chapter 11 \u0026ldquo;The New Replicators,\u0026rdquo; elaborates the author\u0026rsquo;s perspective on culture. Society operates and develops under the dual-track system of \u0026ldquo;genes\u0026rdquo; and \u0026ldquo;memes.\u0026rdquo; Animal deception appears unconscious, more instinctual for survival, manifesting as genetic behaviors and appearance deception. Humanity\u0026rsquo;s uniqueness lies in culture—some cultures even appear anti-genetic! ","date":"2023-08-30","heading":"2. Beyond Zoology: MEME (Memes)","objectID":"/en/posts/selfishgene/:3:2","tags":["Evolution"],"title":"The Selfish Gene: The Question of Altruistic Morality","uri":"/en/posts/selfishgene/#2-beyond-zoology-meme-memes"},{"categories":["Reading"],"collections":[],"content":"3. Humanity\u0026rsquo;s Uniqueness\r\u0026ldquo;Sapiens: A Brief History of Humankind\u0026rdquo; introduced me to de-anthropocentrism. Homo sapiens is merely one species in human evolution; humanity might not be particularly remarkable. You could say humans domesticated rice, but equally, rice domesticated humans—once freely roaming mountains, humans became confined around fields. Many works\u0026rsquo; \u0026ldquo;de-anthropocentrism\u0026rdquo; views humans as Earth\u0026rsquo;s ecological destroyers, even considering humanity Earth\u0026rsquo;s pests7. From a clear Marxist political economy stance, it\u0026rsquo;s genuine anthropocentrism—environmental protection aims to preserve biodiversity (symbiosis rather than harmful parasitism), ultimately maintaining this diversity to protect humanity. Human-world interaction constitutes subject-object relationships; transforming the world is natural. This work appears as gene-controlled organisms\u0026rsquo; \u0026ldquo;de-anthropocentrism,\u0026rdquo; yet by distinguishing natural selection from social development, humans still seem unique. Kinship selection and individual selection theories inevitably face dilemmas explaining \u0026ldquo;altruistic behaviors.\u0026rdquo; Gene selection theory patches this theoretically as follows: $$ \\begin{cases} Superficially\\ altruistic: P_{individual} - C_{individual} \\leq 0 \\newline Actually\\ selfish: P_{gene} - C_{gene} \\geq 0 \\end{cases} \\newline $$$$ \\begin{cases} Finite\\ game: selfish\\ strategy \\newline Infinite\\ game: selfish\\ strategy \\rightarrow cooperative\\ strategy \\end{cases} $$ From a moral perspective, I find this intriguing. Subjectively perceived altruism and natural selection-driven altruism intersect. Setting aside evolutionary theory in social development and examining moral behaviors alone: does purely conscious altruistic morality exist in humans? $B - A \\sim \\varnothing$: Is the set difference A minus B empty? If not empty, what causes it? This likely closely relates to dilemmas faced by gene selection theory. The article\u0026rsquo;s most incisive viewpoint suggests all assumed altruistic behaviors are actually genetically selfish. Does this truly encompass all morality?\rGene selection theory\u0026rsquo;s own dilemma is explaining useless traits: Examples include cross-species affection, homosexuality, moths flying into flames, zebra stripes\u0026hellip; If viewed as gene-driven, numerous hypotheses exist. Perhaps we cannot comprehend special traits, but they\u0026rsquo;re actually beneficial; perhaps elimination requires time; such traits might emerge because they represent evolutionary transitional phases or unfinished products; certain pressures might cause genetic dysregulation (e.g., genes providing random hormone levels in humans)\u0026hellip; If viewed as gene-independent behaviors, we generally default to human uniqueness. Genes lack purpose and consciousness; compared to genes and animals, humans possess remarkable foresight. Human behaviors and societal operations stem from dual influences of nature and culture. Rather than worrying about human nature, what we can do is vigorously transmit altruistic ideologies through memes (MEMEs). (For me personally, whether de-anthropocentric or anthropocentric, the major premise seems difficult to prove.) ","date":"2023-08-30","heading":"3. Humanity\u0026rsquo;s Uniqueness","objectID":"/en/posts/selfishgene/:3:3","tags":["Evolution"],"title":"The Selfish Gene: The Question of Altruistic Morality","uri":"/en/posts/selfishgene/#3-humanitys-uniqueness"},{"categories":["Reading"],"collections":[],"content":"IV. Detailed Reflections: Primarily Interesting Viewpoints\r(Currently updated to Chapter 8) ","date":"2023-08-30","heading":"IV. Detailed Reflections: Primarily Interesting Viewpoints","objectID":"/en/posts/selfishgene/:4:0","tags":["Evolution"],"title":"The Selfish Gene: The Question of Altruistic Morality","uri":"/en/posts/selfishgene/#iv-detailed-reflections-primarily-interesting-viewpoints"},{"categories":["Reading"],"collections":[],"content":"Chapters 1-4: Mainly explaining what genes are\rGene quality: Genes exist in specific environments; quality depends on overall compatibility. Being good in environment a doesn\u0026rsquo;t guarantee goodness in environment b. Death genes: Is individual death a manifestation of racial selection altruism? The key lies in how death genes are viewed. Viewpoint: Many death genes exist worldwide; currently retained death genes are beneficial—they function to delay host reproduction. Further speculation: Death genes within bodies are good genes that have aged, while another good gene works to postpone this aging process until after reproduction accelerates. Further speculation: Deception genes—delayed reproduction might enable longer survival. (Here too, the author only conducts logical deduction without evidence indicating the above viewpoints are correct.) Cloning vs. reproduction: Since asexual reproduction exists, why do human genes choose sexual reproduction? Genes continuously experiment with combinations to find optimal arrangements. Asexual reproduction resembles growth without distinction; reproduction manifests differences, comparing original team combinations\u0026rsquo; quality, allowing each to find its optimal destiny8. Genes exhibit free-riding and opportunistic behaviors; sexual reproduction carries some useless genes. ","date":"2023-08-30","heading":"Chapters 1-4: Mainly explaining what genes are","objectID":"/en/posts/selfishgene/:4:1","tags":["Evolution"],"title":"The Selfish Gene: The Question of Altruistic Morality","uri":"/en/posts/selfishgene/#chapters-1-4-mainly-explaining-what-genes-are"},{"categories":["Reading"],"collections":[],"content":"Chapter 5: Aggression\rAn interesting \u0026ldquo;animal ethology\u0026rdquo; question: \u0026ldquo;Animal conflicts are actually ritualistic. Fighting over territory, losers leave rather than being exterminated. Is this racial unit altruism?\u0026rdquo; This chapter argues: gene combinations create biological survival strategies; different survival strategies interact; failed strategies recombine to refine survival approaches until various strategies reach equilibrium (ESS). The argumentative approach resembles economics\u0026rsquo; \u0026ldquo;duopoly Swigert model\u0026rdquo; and \u0026ldquo;game theory\u0026rdquo; (from grim strategies—hawkish, dovish—to delayed, mixed strategy games) discussing steady-state outcomes under different strategies. Intraspecies competition is symmetrical; extermination isn\u0026rsquo;t steady-state. For example, the Three Kingdoms period persisted long; if three identical countries existed, they might endure indefinitely9. Interspecies competition is asymmetrical; extermination is steady-state. Lions hunting deer represents genetically determined hunting and escape strategies—this is steady-state equilibrium. ","date":"2023-08-30","heading":"","objectID":"/en/posts/selfishgene/:4:2","tags":["Evolution"],"title":"The Selfish Gene: The Question of Altruistic Morality","uri":"/en/posts/selfishgene/#chapter-5-aggression"},{"categories":["Reading"],"collections":[],"content":"Chapter 6: Gene Race\rParents love children; biology terms this \u0026ldquo;kin\u0026rdquo; selection. Is this racial unit altruism? \u0026ldquo;Kin selection\u0026rdquo; only explains direct relationships, not collateral relationships or assistance to strangers. $R_i$ represents kinship closeness, $P_i$ represents probability increase of similar gene continuation after assistance, $C$ is assistance cost, $n$ is number of common ancestors, $k$ is generations between relatives. When altruistic behavior occurs, cost-benefit analysis satisfies: $$ \\begin{align} R_i \u0026amp;= n \\times \\left(\\frac{1}{2}\\right)^{k} \\newline \\text{s.t.} \u0026amp; \\sum_{i=1}^{n} R_i \\times P_i - C \\geq 0 \\end{align} $$\rThen according to this view, should inbreeding be prevalent?\rThe author\u0026rsquo;s response (the author doesn\u0026rsquo;t directly answer; from indirect discussion I infer his viewpoint): Recessive genetic disease outbreaks cause inbreeding resistance. Thus, second-best becomes \u0026ldquo;individual altruism,\u0026rdquo; actually \u0026ldquo;genetic selfishness.\u0026rdquo;\rHow to explain cross-species altruistic behaviors like dolphins saving humans or wolf children?\rThe author considers these extreme behaviors, unrepresentative, requiring further statistics. Genes lack consciousness and mathematical ability, thus this calculation occurs through trait-manifested appearance judgments, also producing deceptive survival strategies. For example, the famous \u0026ldquo;cuckoo parasitism.\u0026rdquo; Inference: Your maternal uncle might exhibit more \u0026ldquo;altruistic behavior\u0026rdquo; toward you than your father, because your uncle knows you\u0026rsquo;re his sister\u0026rsquo;s child with family genes, but your father cannot be certain\u0026hellip;\u0026hellip;\u0026hellip; ","date":"2023-08-30","heading":"Chapter 6: Gene Race","objectID":"/en/posts/selfishgene/:4:3","tags":["Evolution"],"title":"The Selfish Gene: The Question of Altruistic Morality","uri":"/en/posts/selfishgene/#chapter-6-gene-race"},{"categories":["Reading"],"collections":[],"content":"Chapter 7: Family Planning\rAnimals often regulate their population\u0026rsquo;s reproduction numbers. Is this racial selection altruism? Traditional racial selection theory\u0026rsquo;s two explanations: Conspicuous display: Some researchers believe birds gather to observe current population size and control reproduction numbers. Territory: Many animals first compete for territory, then reproduce. Limited territory means those without territory don\u0026rsquo;t reproduce, controlling population numbers. Essentially, territory serves as animals\u0026rsquo; reproduction certificates. Traditional theories treat parental love as exceptional, distinguishing it from ordinary altruistic behaviors. The author believes all reproducers \u0026ldquo;choose\u0026rdquo; between birthing and rearing. On one hand, each individual attempts maximal reproduction to perpetuate genes. On the other, more reproduction increases survival pressure. Thus, individuals choose between reproduction numbers and rearing pressure, not based on population size. I think the difference becomes clearer using common economic representation: Self-drawn image, economic approach to equilibrium points: Racial selection theory involves individual reproduction demand versus others\u0026rsquo; reproduction supply; gene selection involves individual allocation between reproduction and rearing. Personally, it\u0026rsquo;s refinement rather than refutation. Analogous to economics, gene selection theory\u0026rsquo;s rearing cost changes partly stem from others\u0026rsquo; reproduction situations.\rSelf-drawn image, economic approach to equilibrium points: Racial selection theory involves individual reproduction demand versus others\u0026rsquo; reproduction supply; gene selection involves individual allocation between reproduction and rearing. Personally, it\u0026rsquo;s refinement rather than refutation. Analogous to economics, gene selection theory\u0026rsquo;s rearing cost changes partly stem from others\u0026rsquo; reproduction situations. If individuals choose reproduction based on population numbers, as birds, optimal strategy would be pretending to reproduce heavily, making others reproduce less, then secretly reproducing more. But eventually everyone reproduces heavily, leading to collapse. Animals without territory don\u0026rsquo;t lose reproductive capacity but wait until having territory to reproduce. The key isn\u0026rsquo;t just \u0026ldquo;how many\u0026rdquo; but also \u0026ldquo;when.\u0026rdquo; Some Reflection\rThey say economics is the best catalyst. Reflecting on today, I find the author\u0026rsquo;s analysis quite reasonable. Current situations resemble inverted U-curves: the poor reproduce more, the rich reproduce more, the middle class reproduces less. \u0026ldquo;Poor Economics\u0026rdquo; essentially reaches similar conclusions—the poor\u0026rsquo;s expectations for changing survival pressures differ from the middle class, each class\u0026rsquo;s survival pressures and expectations closely related. In places like Africa, the poorer have more children hoping for change—why is reversal difficult? The 2020 Nobel laureate\u0026rsquo;s answer: poor people\u0026rsquo;s funds prioritize solving survival pressures like food, water, slightly better—television, while the middle class seeks more human capital investment, making reversal difficult. Essentially, the poor start negative, the middle class accumulates from zero. this surpasses \u0026ldquo;The Selfish Gene\u0026rdquo; topics. The selfish gene doesn\u0026rsquo;t consider conscious expectations or \u0026ldquo;social welfare\u0026rdquo; enhancement.\r","date":"2023-08-30","heading":"Chapter 7: Family Planning","objectID":"/en/posts/selfishgene/:4:4","tags":["Evolution"],"title":"The Selfish Gene: The Question of Altruistic Morality","uri":"/en/posts/selfishgene/#chapter-7-family-planning"},{"categories":["Reading"],"collections":[],"content":"Chapter 8: Intergenerational Conflict\rChapter 7 involved parents weighing \u0026ldquo;reproduction\u0026rdquo; versus \u0026ldquo;rearing\u0026rdquo;; Chapter 8 involves parents weighing rearing strategies. \u0026ldquo;Within a family, what causes parental favoritism? How do favored individuals respond?\u0026rdquo; Notably, this favoritism exhibits intergenerational characteristics. Among siblings, parents might favor the strongest, the weakest, or the youngest. Among descendants, compared to children, parents might favor grandchildren. Essentially maximizing expected genetic benefits. For example, a mother\u0026rsquo;s total resources are $c$, $U_i(C_i)$ represents genetic continuation benefits from allocating $C_i$ to the $i$th child. $$ \\begin{align} \\max E(X) \u0026amp;= \\sum_{i=1}^{n} U_i(C_i) \\newline st. \\sum_{i=1}^{n} C_i \u0026amp;= c \\end{align} $$ Parental favoritism motivation: $U_a(C) - U_b(C) \u0026gt; 0 \\Rightarrow E(X)_{max}$ How to explain female \u0026ldquo;menopause\u0026rdquo;?10 For parents, children have closer kinship than grandchildren, but grandchildren have longer expected lifespans, thus tending to invest in grandchildren $U_{grandchild}(C) - U_{child}(C) \u0026gt; 0$. If parents could reproduce at any age, motivation for investing in grandchildren would diminish; selfish genes would disrupt reproductive genes. Does favoritism only create sibling rivalry? From a genetic perspective, siblings share identical genetic content with me—genetic interest community. If allocating resources to a yields greater utility than to b, b understands, just as older brothers care for younger brothers. How do weaker, potentially abandoned offspring respond to such favoritism? How do weaker, potentially abandoned offspring respond to such favoritism? If parents don\u0026rsquo;t feed them, constant crying might attract predators. Thus parents decide: \u0026ldquo;Is feeding value greater than killing cost?\u0026rdquo; Their game: \u0026ldquo;Is obtaining food value greater than predator attraction risk?\u0026rdquo; Hence \u0026ldquo;only children truly feel secure in being loved\u0026rdquo; (tongue-in-cheek). Another hypothesis: Selfish birds, for self-survival, push their own siblings out of the nest immediately after hatching? Verifying the above hypothesis cleverly uses symmetry (this should be problem-solving techniques middle school teachers mention in solving equations—the rarity lies in transcending equations to see problems). For equations $\\begin{cases} x\u0026#43;y=3 \\newline xy=2 \\end{cases}$, since $x$ and $y$ play identical roles, solutions must satisfy $x=y$. A bird is both previous generation\u0026rsquo;s child and next generation\u0026rsquo;s parent. If truly selfish enough to harm siblings, yet genetically they\u0026rsquo;re identical, then this genetic individual highly values itself. Loving itself more than its own children, it wouldn\u0026rsquo;t reproduce—such genes inevitably go extinct. The author refutes this viewpoint; I increasingly see resemblance to contemporary \u0026ldquo;marriage-free\u0026rdquo; ideology. ","date":"2023-08-30","heading":"Chapter 8: Intergenerational Conflict","objectID":"/en/posts/selfishgene/:4:5","tags":["Evolution"],"title":"The Selfish Gene: The Question of Altruistic Morality","uri":"/en/posts/selfishgene/#chapter-8-intergenerational-conflict"},{"categories":["Reading"],"collections":[],"content":"Chapter 9: Battle of the Sexes: Children as Genetic Strategy Stakes\rReturning to Chapter 5\u0026rsquo;s steady state: deer genes choose fleeing; lion genes choose hunting—forming a game equilibrium state. Many mating genetic strategies exist worldwide: one chooses pursuing quantity, actively seeking mates, not providing nourishment; another chooses providing nourishment, passively attracting mates. Theoretically polygynous, yet men and women employ different strategies seeking equilibrium. Genetically, children inherit $\\frac{1}{2}$ genes from each parent, but parents\u0026rsquo; initial investments differ. Each aims to maximize gene transmission with minimal expected cost. This involves multiple decisions: reproduction methods, rearing methods (investment in offspring), rearing goals (gender, traits\u0026hellip;) $P$ represents genetic inheritance benefits after having children, $C$ represents personal costs. Regarding reproduction methods, first-mover advantage exists. For marine life, females typically release eggs into water first, then males seek them—females possess sufficient advantage to leave early, leaving males to rear alone. For terrestrial life, males possess first-leaving advantage. Regarding rearing methods, assuming males have loyal and disloyal strategies, females have testing and non-testing strategies. Game outcome: various characteristic male-female strategies maintain specific proportions. The book decomposes this game into two; here directly integrated into one\rRegarding rearing goals, genes promote certain traits continuously filtered and strengthened—feather color, body structure\u0026hellip; If division-of-labor traits like gender, they maintain fluctuating balance. Such division-of-labor advantages emerge relative to other resources, like capital flowing into all profitable areas until various industry profit rates converge11. ","date":"2023-08-30","heading":"Chapter 9: Battle of the Sexes: Children as Genetic Strategy Stakes","objectID":"/en/posts/selfishgene/:4:6","tags":["Evolution"],"title":"The Selfish Gene: The Question of Altruistic Morality","uri":"/en/posts/selfishgene/#chapter-9-battle-of-the-sexes-children-as-genetic-strategy-stakes"},{"categories":["Reading"],"collections":[],"content":"Chapter 10: You Scratch My Back, I\u0026rsquo;ll Ride on Yours\rEncountering predators, birds call out, antelopes leap high, insects form mutual assistance systems. Animal groups: The author directly judges (I feel almost no argumentation) to avoid companions attracting more animals or showing off leaping ability to make predators chase others. Animal group movement resembles flow from edges squeezing into center, because edges are more easily attacked first. Insect groups: Insects form altruistic societies because not all individuals can reproduce. Worker bees cannot reproduce, thus their goal becomes genetically similar companions. Insect reproduction cycle diagram essentially as follows; red represents genetic similarity. Male ants have only one chromosome set—unfertilized eggs directly developing, cannot reproduce. Female ants have two chromosome sets, can reproduce. Since sister female ant similarity is $\\frac{3}{4}$, higher than mother similarity $\\frac{1}{2}$ (because they also share father-transmitted identical genes), second-generation female ant relationships surpass mother relationships. Since brother male ant similarity is $\\frac{1}{4}$, lower than mother similarity $\\frac{1}{2}$, second-generation male ant relationships are weaker than mother relationships. Insect reproduction cycle diagram\rSymbiosis: Two game strategies reach equilibrium point; species cooperate for greater benefits. But cooperating parties both have two options: selflessly help each other, or help each other but if the other doesn\u0026rsquo;t help, stop helping. Game equilibrium is the latter. In economics, Mandeville published a book titled \u0026ldquo;The Fable of the Bees,\u0026rdquo; arguing \u0026ldquo;market economy transforms private vices into public benefits\u0026rdquo;—he compares human society to beehives, somewhat similar. Steven Cheung also has a paper \u0026ldquo;The Fable of the Bees: An Economic Investigation\u0026rdquo;12, but that paper doesn\u0026rsquo;t study bee structure\u0026rsquo;s inspiration for human society, but investigates spontaneous transaction systems between fruit farmers and beekeepers under market mechanisms, where no \u0026ldquo;market failure\u0026rdquo; occurs. Previously I thought both arguments identical, but apart from sharing liberal stance, most aspects differ. Final chapters already integrated into previous discussions; here brief summary only. Chapter 11: MEME: Cultural inheritance \u0026ldquo;memes\u0026rdquo; Chapter 12: Nice Guys Finish First: Single prisoner\u0026rsquo;s dilemma leads to selfishness; infinite repeated prisoner\u0026rsquo;s dilemma games lead to cooperation Chapters 13-14: Natural society ≠ human society, gene selection ≠ genetic determinism Chapter 15: Constraints on Perfection: Explaining gene selection theory\u0026rsquo;s dilemmas ","date":"2023-08-30","heading":"Chapter 10: You Scratch My Back, I\u0026rsquo;ll Ride on Yours","objectID":"/en/posts/selfishgene/:4:7","tags":["Evolution"],"title":"The Selfish Gene: The Question of Altruistic Morality","uri":"/en/posts/selfishgene/#chapter-10-you-scratch-my-back-ill-ride-on-yours"},{"categories":["Reading"],"collections":[],"content":"References\rNow equivalent to 5 prefaces: 40th anniversary, 30th anniversary, second edition, preface, foreword\u0026#160;\u0026#x21a9;\u0026#xfe0e; Actually gives me a feeling of choosing observation coordinate systems\u0026#160;\u0026#x21a9;\u0026#xfe0e; This question comes from \u0026ldquo;THE BOOK OF WHY\u0026rdquo;\u0026#160;\u0026#x21a9;\u0026#xfe0e; First three chapters introduce and explain concepts\u0026#160;\u0026#x21a9;\u0026#xfe0e; Huang Zongzhi. Establishing Forward-Looking Practical Social Science Research: Starting from an Important Shortcoming of Substantivist Theory[J]. Open Times, 2020(1): 18.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Title searches yield very few results\u0026#160;\u0026#x21a9;\u0026#xfe0e; : Not symbiotic relationships, but harmful parasitism. Visiting Central Academy of Fine Arts exhibitions, many artworks seem to reflect this\u0026#160;\u0026#x21a9;\u0026#xfe0e; Evokes welfare economics first theorem\u0026#160;\u0026#x21a9;\u0026#xfe0e; I\u0026rsquo;m contemplating explaining European nations\u0026rsquo; coexistence and China\u0026rsquo;s unification based on this\u0026#160;\u0026#x21a9;\u0026#xfe0e; Unable to reproduce after certain age\u0026#160;\u0026#x21a9;\u0026#xfe0e; Marx\u0026rsquo;s famous derivation: average profit rate formation. This derivation shows proletariat must first liberate everyone before liberating themselves.\u0026#160;\u0026#x21a9;\u0026#xfe0e; Cheung S N S. The fable of the bees: An economic investigation[J]. The Journal of Law and Economics, 1973, 16(1): 11-33.\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2023-08-30","heading":"References","objectID":"/en/posts/selfishgene/:5:0","tags":["Evolution"],"title":"The Selfish Gene: The Question of Altruistic Morality","uri":"/en/posts/selfishgene/#references"},{"categories":["Travel"],"collections":[],"content":" The process of stylistic evolution in character portrayal is akin to the process of human self-awareness. The thematic exhibition titled \u0026ldquo;Faces of Time\u0026rdquo; encapsulates this sentiment aptly. Whether it\u0026rsquo;s the subject matter or the techniques employed in painting, they are essentially products of human quest for understanding in the waves of time. ","date":"2023-08-20","heading":"","objectID":"/en/posts/art/:0:0","tags":["Art"],"title":"Faces of Time","uri":"/en/posts/art/#"},{"categories":["Travel"],"collections":[],"content":"On the Subject:\rInitially, only the divine could be depicted in art. Painting served as a medium for the dissemination of religious and mythological stories. Painting as a Medium for the Dissemination of Religious and Mythological Stories\rDuring the era of humanism, divinities acquired human features. The boundary between humans and gods gradually blurred under the artist\u0026rsquo;s brush. Later on, courtly elites also became subjects of paintings. Rather than realism, the nobility sought to showcase the refinement of their spirits. Consequently, artists began retouching their works, with one of the most famous examples being Napoleon Crossing the Alps. In the composition, the French flag is positioned behind Napoleon, faintly revealing advanced artillery, while cleverly concealing Napoleon\u0026rsquo;s actual height. The reality is that he rode a donkey\r","date":"2023-08-20","heading":"On the Subject:","objectID":"/en/posts/art/:0:1","tags":["Art"],"title":"Faces of Time","uri":"/en/posts/art/#on-the-subject"},{"categories":["Travel"],"collections":[],"content":"On Painting Techniques:\rThe techniques employed in painting showcase the artist\u0026rsquo;s perception of the world. Before the advent of the camera, painters pursued realism. Correspondingly, the Romanticism of the Renaissance was a style characterized by exaggerated creativity. Romanticism isn\u0026rsquo;t just a genre; it\u0026rsquo;s an impulse! Any work can have a touch of romanticism. With the emergence of the camera, painters began to contemplate the differences between painting and photography. People started to deliberately emphasize rough brushstrokes and \u0026ldquo;mental tones.\u0026rdquo; Among them is a unique brushstroke\rMost styles of painting in the modern era are essentially \u0026ldquo;reconstructions\u0026rdquo; of the real world, combining brushstrokes with the artist\u0026rsquo;s understanding of the world\u0026rsquo;s essence. Futurists: Science can explain everything; it\u0026rsquo;s a symbol of order. We should use orderly geometric shapes to compose our works and showcase the beauty of rationality. Symbolists: All cognition is a product of society. To stimulate people\u0026rsquo;s thinking on a topic, we need to transfer the same object to different scenarios. For example, moving a spoon from a table to the ceiling, or replacing actors in a stage play with wooden stakes in an open-air mine. Our inexplicability is precisely to alienate things, thus provoking people\u0026rsquo;s reflection (classic anthropological alienation). Impressionists: Colors, light, and time are constantly changing. What we paint is just the light atmosphere at a specific moment in time. We need to learn to observe, to observe the changes in color and light of an object under various conditions. (That\u0026rsquo;s why Monet painted over 300 versions of \u0026ldquo;Water Lilies\u0026rdquo;). Pointillists: The colors of light can be expressed by the three primary colors. By letting the three primary colors form dots that overlap and eventually create an image. Collage Art: Reassemble everyday objects to express ideas, and materials such as newspapers and posters can also be reassembled into a new work. Dada Art: Gradually entering the realm of conceptual deconstruction and reflection. All concepts should be deconstructed and reexamined. So, in the eyes of Dadaists, a toilet becomes a fountain, and a clothes hanger becomes an octopus. apple man\rOnce we understand the artists\u0026rsquo; principles and backgrounds, previously perplexing images seem to become more understandable. Nowadays, many \u0026ldquo;performance art\u0026rdquo; pieces and inexplicable paintings may make people feel that art is just empty boasting. I think, In practice, discussions about painting concepts ultimately lead to abstraction. Just like some branches of mathematics, when taken to certain depths, lose the concept of numbers. Painters abstract concepts and expressions themselves, and then use incomprehensible actions to express themselves. It seems that abstraction through paintings is a trend in the so-called avant-garde. First-class art is intoxicating in appearance, or concise and easy to understand, and the icing on the cake is understanding the connotation. Second-rate art is incomprehensible in appearance, but once you understand the connotation, you can see the light. Third-rate art is boring in appearance and pretends to be sophisticated. I believe that aesthetic appreciation in art is also a process of interaction between knowledge and images. Therefore, interpreting the same painting with the background of the times can lead to different personal perceptions. Perhaps, the reader\u0026rsquo;s perspective on the appreciation of the work itself becomes an art alongside the era. The main benefit an artist or authority brings is simply that their status allows us to have the patience to think about and try to understand their actions. Therefore, when facing artists, we choose to think rather than blindly follow them. ","date":"2023-08-20","heading":"On Painting Techniques:","objectID":"/en/posts/art/:0:2","tags":["Art"],"title":"Faces of Time","uri":"/en/posts/art/#on-painting-techniques"},{"categories":["Economic Studies"],"collections":[],"content":"Plenty of people online have already computed the expected value, but no one seems to have computed the variance, so I\u0026rsquo;ll fill that in here. ","date":"2023-08-09","heading":"","objectID":"/en/posts/genshin/:0:0","tags":["Genshin Impact","Probability Theory"],"title":"Genshin Impact Probability: For Material Crafting, Should You Pick the 10% Double Output or the 25% Refund?","uri":"/en/posts/genshin/#"},{"categories":["Economic Studies"],"collections":[],"content":"1. Setup\rIn Genshin Impact, three low-level materials can be crafted into one high-level material. We denote this as $a \\xrightarrow{\\text{转化}}\\dfrac{b}{3}$ To keep units consistent, we uniformly use b for both input and output, assuming both sides start with initial material a, which is equivalent to $\\dfrac{b}{3}$. There are two talents, as shown below The two talents\rOne has a 10% chance of double output. Each time you use a materials, i.e. $\\dfrac{b}{3}$ material, there is a 10% chance of directly producing $\\dfrac{2}{3}b$ material. The other has a 25% chance of refunding some low-level materials. Each time you use a materials, i.e. $\\dfrac{b}{3}$ material, there is a 25% chance of returning $\\dfrac{1}{3} \\times \\dfrac{1}{4}b$ material. In terms of a random variable, that is: $$X_{总产出}=\\frac{b}{3}\u0026#43;Y_{额外产出}$$","date":"2023-08-09","heading":"1. Setup","objectID":"/en/posts/genshin/:1:0","tags":["Genshin Impact","Probability Theory"],"title":"Genshin Impact Probability: For Material Crafting, Should You Pick the 10% Double Output or the 25% Refund?","uri":"/en/posts/genshin/#1-setup"},{"categories":["Economic Studies"],"collections":[],"content":"2. Computing Expectation and Variance\rPlenty of people online have already computed the expected value, but no one seems to have computed the variance, so I\u0026rsquo;ll fill that in here as well. ","date":"2023-08-09","heading":"","objectID":"/en/posts/genshin/:2:0","tags":["Genshin Impact","Probability Theory"],"title":"Genshin Impact Probability: For Material Crafting, Should You Pick the 10% Double Output or the 25% Refund?","uri":"/en/posts/genshin/#2-computing-expectation-and-variance"},{"categories":["Economic Studies"],"collections":[],"content":"(1) Expectation and Variance of the 10% Double Output\r1. Expectation This is a binomial discrete distribution. 10% chance of double output, 90% chance of ordinary output. As in Table 1: Binomial discrete distribution\r$$ \\mathrm{E}\\_{{双倍}}[X]=\\mathrm{E}\\_{{双倍}}[\\frac{b}{3}\u0026#43;Y\\_{额外}]=\\frac{b}{3}\u0026#43;np=10\\% \\times\\frac{2}{3}b\u0026#43;90\\% \\times\\frac{1}{3}b $$ So investing a materials is equivalent to investing $\\dfrac{b}{3}$ material, and the expectation of the 10% double talent is $E_{\\text{双倍}}(\\dfrac{b}{3})=\\dfrac{11 b}{30} $ . 2. Variance $$ \\mathrm{Var}[X]=\\mathrm{Var}[\\frac{b}{3}\u0026#43;Y\\_{额外产出}]=\\mathrm{Var}[Y\\_{额外产出}] $$$$ \\mathrm{Var}[Y]=np(1-p)=\\frac{b}{3}\\times0.1\\times0.9=\\frac{3}{100}b $$ So investing a materials is equivalent to investing $\\dfrac{b}{3}$ material, and the variance of the 10% double talent is $Var_{\\text{双倍}}(\\dfrac{b}{3})=\\dfrac{1}{100}b^2$. ","date":"2023-08-09","heading":"","objectID":"/en/posts/genshin/:2:1","tags":["Genshin Impact","Probability Theory"],"title":"Genshin Impact Probability: For Material Crafting, Should You Pick the 10% Double Output or the 25% Refund?","uri":"/en/posts/genshin/#1-expectation-and-variance-of-the-10-double-output"},{"categories":["Economic Studies"],"collections":[],"content":"(2) Expectation and Variance of the 25% Refund\r1. Two ways to compute the expectation Method 1: geometric series $$ \\begin{align*} E_{\\text{返回}}\\left(\\frac{b}{3}\\right) \u0026amp;= \\frac{b}{3} \u0026#43; \\frac{b}{3} \\times 25\\\\% \\times \\frac{1}{3} \u0026#43; \\ldots \u0026#43; \\frac{b}{3} \\times \\left(\\frac{1}{12}\\right)^n \\newline \u0026amp;= \\frac{b}{3} \\times (1\u0026#43;{\\frac{1}{12}}\u0026#43;{\\frac{1}{12}}^2\u0026#43;...\u0026#43;{\\frac{1}{12}}^n) \\newline \u0026amp;= \\frac{b}{3} \\times \\frac{1 \\times (1-{\\frac{1}{12}}^n)}{1-\\frac{1}{12}} \\newline \\end{align*} $$$$ \\lim_{n\\rightarrow \u0026#43; \\infty}E_{\\text{返回}}\\left(\\frac{b}{3}\\right)=\\frac{b}{3} \\times \\frac{1 \\times (1-{\\frac{1}{12}}^n)}{1-\\frac{1}{12}}=\\frac{4b}{11} $$ The illustration is as follows: Tree diagram\rWe can verify whether this classification has covered all cases by summing all the probabilities: $$ \\lim_{n\\rightarrow \u0026#43;\\infty}75\\\\%\u0026#43;...\u0026#43;{(25\\\\%)}^{n-1}75\\\\%=1 $$ All the corresponding probabilities sum to 1, which to some extent verifies that this classification is correct. Method 2: recursion Because the refunded materials are refined again, a recursion forms, so we get: $$ E_{\\text{返回}}\\left(\\frac{b}{3}\\right)=\\frac{b}{3} \u0026#43;E_{\\text{返回}}\\left(\\frac{b}{3}\\right)\\times 25\\% \\times \\frac{1}{3} $$ The answer is the same as above: So investing a materials is equivalent to investing $\\dfrac{b}{3}$ material, and the expectation of the 25% refund talent is $E_{\\text{返回}}(\\frac{b}{3} )=\\frac{4b}{11}$. 2. Variance The following approach to computing the variance comes from A More Refined Calculation of Whether to Pick the 10% Double or 25% Refund for the Material Crafting Talent Now we continue by introducing a recurrence, and we have the following recurrence. $$\\mathrm{E}(a_k)=\\mathrm{E}(a_{k-1})\\times 25\\% \\times \\dfrac{1}{3}$$ Meaning: Before the $k$-th craft, you have $a_k$ low-level materials in hand. The condition for being able to do the $k$-th craft is: the $(k-1)$-th craft triggered the effect and refunded some low-level materials. Using the law of total expectation, this is $$ \\mathrm{E}(a_k)=\\mathrm{E}[\\mathrm{E}[a_k| a_{k-1}]]=\\mathrm{E}[\\frac{1}{12}a_{k-1}]=\\frac{1}{12}\\mathrm{E}[a_{k-1}] $$$$ \\mathrm{E}[X]=\\sum_1^{k}a_k=\\sum_1^{k}\\frac{1}{12^k}a_0 $$ This expression can be expanded as a recursion or as a geometric series — the two methods for computing the expectation above. After introducing conditional expectation, next we introduce the variance decomposition formula: $$ \\mathrm{Var}[X]=\\mathrm{E}[X^2]-[\\mathrm{E}(X)]^2 $$ Rearranging and adding conditional expectation, we can get two expressions involving $\\mathrm{E}(X|Y)$. $$ \\mathrm{Var}[\\mathrm{E}(X|Y)]=\\mathrm{E}\\left\\\\{\\left[\\mathrm{E}(X|Y)\\right]^{2}\\right\\\\}-\\left\\\\{\\mathrm{E}\\left[\\mathrm{E}(X|Y)\\right]\\right\\\\}^{2}=\\mathrm{E}\\left\\\\{\\left[\\mathrm{E}(X|Y)\\right]^{2}\\right\\\\}-\\left[\\mathrm{E}(X)\\right]^{2} $$$$ \\mathrm{E}[\\mathrm{Var}(X|Y)]=\\mathrm{E}\\left\\\\{\\mathrm{E}(X^{2}|Y)-[\\mathrm{E}(X|Y)]^{2}\\right\\\\}=\\mathrm{E}(X^2)-\\mathrm{E}\\left\\\\{\\left[\\mathrm{E}(X|Y)\\right]^2\\right\\\\} $$ Adding the two expressions above gives the variance decomposition formula: $$ \\mathrm{Var}(X)=\\mathrm{Var}[\\mathrm{E}(X|Y)]\u0026#43;\\mathrm{E}[\\mathrm{Var}(X|Y)] $$ Substituting $a_k, a_{k-1}$ into this formula: $$ \\mathrm{Var}(a_k)=\\mathrm{Var}[\\mathrm{E}(a_k|a_{{k-1}})]\u0026#43;\\mathrm{E}[\\mathrm{Var}(a_k|a_{k-1})] $$ where $$ \\mathrm{Var}[\\mathrm{E}(a_k|a_{{k-1}})]=\\mathrm{Var}[\\frac{1}{12}a_{k-1}] $$ $$ \\mathrm{E}[\\mathrm{Var}(a_k|a_{k-1})]=\\mathrm{E}[np(1-p)]=\\mathrm{E}[np(1-p)]=\\mathrm{E}\\left[\\frac{a_{k-1}}{16}\\right] $$ We get: $$ \\begin{aligned}\\mathrm{Var}\\left[a_k\\right]=\\frac{3}{4} \\frac{a_0}{12^k}\u0026#43;\\frac{1}{12^2} \\mathrm{Var}\\left[a_{k-1}\\right]\\end{aligned} $$ Since $\\mathrm{Var}(a_0)=0$, using the recursion we get the general term: I tossed it to GPT to compute and then verified it; it also satisfies the 144-fold relationship between variance terms: $$ \\mathrm{Var}[a_k]=\\frac{9}{143}a_0\\left(1-\\frac{1}{144^k}\\right)=a_0\\times \\frac{1}{16\\","date":"2023-08-09","heading":"(2) Expectation and Variance of the 25% Refund","objectID":"/en/posts/genshin/:2:2","tags":["Genshin Impact","Probability Theory"],"title":"Genshin Impact Probability: For Material Crafting, Should You Pick the 10% Double Output or the 25% Refund?","uri":"/en/posts/genshin/#2-expectation-and-variance-of-the-25-refund"},{"categories":["Economic Studies"],"collections":[],"content":"3. Conclusion and Computer Simulation\rFitting with code, it also matches the computed result: The 10% has a slightly higher expectation, but within 1000 materials the difference in expectation isn\u0026rsquo;t large. The 25% has smaller variance fluctuation; it just needs more crafts, so the Mora cost is a bit higher. Considering Genshin Impact\u0026rsquo;s 999 material cap, the expected high-level materials differ by only about 2-3. 100 times\r1000 times\r800-1000 times\rExperiment code import random import matplotlib.pyplot as plt import numpy as np # set matplotlib's font so it supports Chinese display plt.rcParams['font.sans-serif'] = ['SimHei'] # used to display Chinese labels correctly plt.rcParams['axes.unicode_minus'] = False # used to display the minus sign correctly # function that simulates crafting high-level items def synthesize_items(low_items, strategy): high_items = 0 while low_items \u003e= 3: 合成结果 = random.random() if strategy == 1: if 合成结果 \u003c 0.1: high_items += 2 # additionally gain one high-level item else: high_items += 1 elif strategy == 2: if 合成结果 \u003c 0.25: low_items += 1 # refund one low-level item high_items += 1 low_items -= 3 return low_items, high_items # simulate many crafts and compute the mean return and variance def simulate_synthesis(low_items, strategy, trials=10000): results = [] for _ in range(trials): _, high_items = synthesize_items(low_items, strategy) results.append(high_items) mean = np.mean(results) variance = np.var(results) return mean, variance # plot the charts def plot_results(means, variances, strategies): plt.figure(figsize=(14, 6)) # plot the mean comparison chart plt.subplot(1, 2, 1) for strategy, data in means.items(): plt.plot(data, label=f'策略{strategy}均值') plt.xlabel('低级道具数量') plt.ylabel('高级道具均值') plt.title('均值比较') plt.legend() # plot the variance comparison chart plt.subplot(1, 2, 2) for strategy, data in variances.items(): plt.plot(data, label=f'策略{strategy}方差') plt.xlabel('低级道具数量') plt.ylabel('高级道具方差') plt.title('方差比较') plt.legend() plt.tight_layout() plt.savefig('results.png') # save the chart as an image file # main function def main(): num_items = range(1, 1001) # range of the number of low-level items invested trials = 100000 # number of simulations strategy1_means = [] strategy1_variances = [] strategy2_means = [] strategy2_variances = [] for items in num_items: mean1, variance1 = simulate_synthesis(items, 1, trials) mean2, variance2 = simulate_synthesis(items, 2, trials) strategy1_means.append(mean1) strategy1_variances.append(variance1) strategy2_means.append(mean2) strategy2_variances.append(variance2) plot_results({ 1: strategy1_means, 2: strategy2_means }, { 1: strategy1_variances, 2: strategy2_variances }, [1, 2]) if __name__ == '__main__': main()\rFor more discussion, see: Genshin Impact Probability ","date":"2023-08-09","heading":"3. Conclusion and Computer Simulation","objectID":"/en/posts/genshin/:3:0","tags":["Genshin Impact","Probability Theory"],"title":"Genshin Impact Probability: For Material Crafting, Should You Pick the 10% Double Output or the 25% Refund?","uri":"/en/posts/genshin/#3-conclusion-and-computer-simulation"},{"categories":["Reading"],"collections":[],"content":" #　HOW TO SLAY A DRAGON: A Fantasy Hero\u0026rsquo;s Guide to the Real Middle Ages In the medieval era, where swords and sorcery once reigned supreme, tales of dragons and warriors have captured the imagination. People yearn for the medieval times much like they long for the idyllic countryside—a utopia that exists solely in the realm of imagination. Strangely enough, there are those who find solace in pursuing a different path, even if it leads them astray—people like myself, who revel in the unconventional. Such individuals find joy in this \u0026ldquo;quirky\u0026rdquo; compendium. What I mean to say is, if you\u0026rsquo;re not the type to delve into \u0026ldquo;strict history\u0026rdquo; or merely a gamer seeking entertainment, then perhaps you\u0026rsquo;re the kind to seek philosophy in games and dark humor in history. Well, congratulations, you\u0026rsquo;re ready to embark on your journey through the medieval world. This book is not suited for those seeking a detailed understanding of the medieval period. It follows the main theme of \u0026ldquo;heroic dragon-slaying role-playing,\u0026rdquo; presenting popular medieval tales and literature in a digestible format. This implies that there\u0026rsquo;s no obligation to provide a comprehensive educational framework covering the economic, cultural, and political aspects of the era. Unlike traditional history books that offer analytical viewpoints, this book occasionally offers the author\u0026rsquo;s perspective on the use of historical sources. Are laws reliable? People of that time didn\u0026rsquo;t necessarily follow them; the focus lies more on exploring the motives behind lawmaking. Are diaries sincere? Many medieval individuals clandestinely recorded their mastery of magic or their various exploits, yet some narratives and their subsequent personal records harbor hidden contradictions. HOW TO SLAY A DRAGON: A Fantasy Hero\u0026rsquo;s Guide to the Real Middle Ages\rThis book primarily focuses on elucidating the everyday aspects of life during the medieval period: From unicorns to the fantastical creatures of the time, From troubadours to the ballads of the era, From cursed marshes to poorly managed latrines, From courtship to the moral codes of the time. It delves into topics such as medieval bathroom practices, dental hygiene, road systems, inns, and even rustic romance. What captivates the reader is the contrast between the titles and the content, drawing them into the next intriguing chapter. The examples provided by the author are remarkably close to life and imbued with humor. For instance, were there really records of religious miracles and magical occurrences in the medieval period? Indeed, there are documented instances of individuals keeping diaries (in the form of autobiographies) detailing their studies in magic, which were later studied by others—resulting in a profound sense of shame. As for the various daily occurrences in medieval life, the author doesn\u0026rsquo;t shy away from employing witty and satirical language. Take, for instance, the scenario of the three individuals in a duel, where the one who initially arrived naked ends up surviving—a lesson for all: \u0026ldquo;In the medieval times, always carry a weapon in secret.\u0026rdquo; Regarding unclean neighbors, the sentiment is expressed as \u0026ldquo;Neighbors will be neighbors; they\u0026rsquo;re not cursed until their excrement blocks the streets, at which point perhaps they do become cursed—curses may be false, but filth is real.\u0026rdquo; And in the Byzantine Empire, where bizarre tragedies are anything but unusual, nothing seems out of the ordinary. As the author doubles as a narrator and a guide through the adventures of the hero, these humorous remarks infuse the book with a strong sense of interactivity. Moreover, the titles themselves carry a distinct flavor reminiscent of Japanese anime RPGs. While microhistory books like \u0026ldquo;Soulstealers: The Chinese Sorcery Scare of 1768\u0026rdquo; and \u0026ldquo;1587, a Year of No Significance: The Ming Dynasty in Decline\u0026rdquo; meticulously anal","date":"2023-08-05","heading":"","objectID":"/en/posts/tl/:0:0","tags":["Economic History","Sociology"],"title":"HOW TO SLAY A DRAGON","uri":"/en/posts/tl/#"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"I have been reading Mao Shisong\u0026rsquo;s \u0026ldquo;Probability Theory and Mathematical Statistics\u0026rdquo; these days. Initially, I read the electronic version, but after finishing it, I was so impressed that I immediately bought the physical book. The book truly lives up to its preface in the first edition: the examples are vivid and interesting, and it skillfully explains the tricky variations of each exam point, leaving a deep impression. Special thanks to the github re-book project team (2019) for the $\\LaTeX$ typesetting of the book. As an introductory book on probability theory and mathematical statistics, we do not want to lead students directly into the mathematical paradise. Instead, we first explore the various landscapes of probability and statistics in the \u0026ldquo;wild,\u0026rdquo; and then enter the mathematical paradise, making various concepts and theorems well-grounded and meaningful. This approach allows students to find the book interesting and feel that it is different from reading a typical mathematics textbook. Of course, we also pay great attention to the proofs and discussions of some regularities extracted from randomness, as only by understanding these can one feel them more profoundly. (First Edition Preface) Because it is so fascinating, I couldn\u0026rsquo;t help but record some of the excellent examples from the book on Zhihu. ","date":"2023-08-01","heading":"","objectID":"/en/posts/probability/:0:0","tags":["Probability Theory"],"title":"Estimating π with a Needle? Notes on Probability Theory (Mao Shisong Edition)","uri":"/en/posts/probability/#"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"1. Estimating π with a Needle?\r","date":"2023-08-01","heading":"","objectID":"/en/posts/probability/:1:0","tags":["Probability Theory"],"title":"Estimating π with a Needle? Notes on Probability Theory (Mao Shisong Edition)","uri":"/en/posts/probability/#1-estimating-π-with-a-needle"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"1.1 Introduction: Geometric Probability\rFor basic notes on classical probability, you can refer to my other answer: The formula for classical probability is as follows: $$ P(A)=\\frac{\\text{Number of sample points in event A}}{\\text{Total number of sample points in } \\Omega}=\\frac{k}{n} $$ Geometric probability transforms algebraic formulas into areas (similar to high school linear programming): $$ P=\\frac{S_{\\text{Area }k}}{S_{\\text{Area }n}} $$ Example of Geometric Probability\rDivide a line segment of length $a$ into three parts by randomly selecting two points. What is the probability that these three parts can form a triangle? First, divide the line segment into three parts with lengths $x$, $y$, and $a-x-y$. Divide the line segment into three parts\rThe necessary and sufficient condition for forming a triangle is that the sum of any two sides is greater than the third side, and the difference of any two sides is less than the third side. Thus, we get the inequality constraints: $$ \\begin{cases} 0\u0026lt;a-x-y\u0026lt;x\u0026#43;y\\\\\\\\ 0\u0026lt;x\u0026lt;a-x-y\\\\\\\\ 0\u0026lt;y\u0026lt;x\u0026#43;(a-x-y) \\end{cases} \\stackrel{\\text{Simplified}}{\\longrightarrow} \\begin{cases} \\frac{a}{2}\u0026lt;x\u0026#43;y\u0026lt;a\\\\\\\\ 0\u0026lt;x\u0026lt;\\frac{a}{2}\\\\\\\\ 0\u0026lt;y\u0026lt;\\frac{a}{2} \\end{cases} $$ Now, use $x$ and $y$ to establish a coordinate system and look at the area (similar to linear programming). Similar to linear programming\r$$ P=\\frac{\\frac{a^2}{8}}{\\frac{a}{2}^2}=\\frac{1}{4} $$\r","date":"2023-08-01","heading":"","objectID":"/en/posts/probability/:1:1","tags":["Probability Theory"],"title":"Estimating π with a Needle? Notes on Probability Theory (Mao Shisong Edition)","uri":"/en/posts/probability/#11-introduction-geometric-probability"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"1.2 Estimating $\\pi$ with a Needle\rBuffon\u0026rsquo;s Needle Problem (famous because the answer is related to $\\pi$): On a plane with parallel lines spaced $d(d\u0026gt;0)$ apart, a needle of length $l(l\u0026lt;d)$ is randomly dropped. What is the probability that the needle will intersect one of the parallel lines? As shown in the figure, the red line represents the needle, and its angle with the horizontal line is $\\alpha$. When the needle intersects a parallel line, take the midpoint of the needle and project it vertically. The projected vertical line segment is divided into two parts. When the needle intersects a parallel line, take the midpoint of the needle and project it vertically. The projected vertical line segment is divided into two parts.\rThe necessary and sufficient condition for intersection becomes: $x\\leq\\frac{1}{2}l \\! sin\\alpha$, where the unknown parameters are $x$ and $\\alpha$. The constraints for the parameters are: $$ \\begin{cases} 0 \\le x \\le d/2\\\\\\\\ 0 \\le \\alpha \\le \\pi \\end{cases} $$ Establish a coordinate system using these two parameters. Establish a coordinate system using these two parameters.\rThen, use calculus to find the area of the shaded region and divide it by the area of the rectangle to get the corresponding probability. $$ P (A) = \\frac{S_A}{S_\\Omega} = \\frac{\\int_0^\\pi \\frac{l}{2} \\!sin \\alpha \\, \\mathrm{d} \\alpha}{\\frac{d}{2} \\pi} = \\frac{2l}{d\\pi}\\\\\\\\ $$ When $2l=d$, $P (A) =\\frac{1}{\\pi}$. Therefore, by conducting more and more experiments and dividing the results, we can estimate $\\pi$. ","date":"2023-08-01","heading":"1.2 Estimating $\\pi$ with a Needle","objectID":"/en/posts/probability/:1:2","tags":["Probability Theory"],"title":"Estimating π with a Needle? Notes on Probability Theory (Mao Shisong Edition)","uri":"/en/posts/probability/#12-estimating--with-a-needle"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"1.3 Supplement: How to Determine Probability\rThe so-called \u0026ldquo;Monte Carlo simulation\u0026rdquo; is a sampling model designed in a computer, where many random values are input and output, and the final frequency is used to approximate the probability. In Mao Shisong\u0026rsquo;s textbook, a section is dedicated to discussing methods for determining probability: Frequency statistics approximating probability Classical methods (permutations, combinations, addition and multiplication principles, etc.) Geometric methods Subjective methods (e.g., it seems like there\u0026rsquo;s a 50% chance of rain tomorrow, but the weather forecast says there\u0026rsquo;s an 85% chance; or saying you have a 60% chance of succeeding at something\u0026hellip; these are subjective probabilities) ","date":"2023-08-01","heading":"1.3 Supplement: How to Determine Probability","objectID":"/en/posts/probability/:1:3","tags":["Probability Theory"],"title":"Estimating π with a Needle? Notes on Probability Theory (Mao Shisong Edition)","uri":"/en/posts/probability/#13-supplement-how-to-determine-probability"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"2. Estimating the Truth in Sensitive Questionnaire Questions\rOne of the challenges in designing questionnaires is that some questions people are unwilling to answer or provide truthful answers to. For example, \u0026ldquo;How often do couples argue?\u0026rdquo;, \u0026ldquo;Have you visited inappropriate websites?\u0026rdquo;, \u0026ldquo;What is your household income?\u0026rdquo;\u0026hellip; Due to \u0026ldquo;answers damaging dignity\u0026rdquo; or \u0026ldquo;dishonest answers\u0026rdquo; being beneficial for free-riding (thinking that reporting lower income will result in more government assistance), it is difficult to obtain accurate answers. Mao Shisong\u0026rsquo;s probability textbook provides an example when explaining conditional probability, which might make respondents\u0026rsquo; answers more effective. (Although constrained by efficiency, it is probably impractical, but using conditional probability in questionnaire design is an impressive approach.) ","date":"2023-08-01","heading":"2. Estimating the Truth in Sensitive Questionnaire Questions","objectID":"/en/posts/probability/:2:0","tags":["Probability Theory"],"title":"Estimating π with a Needle? Notes on Probability Theory (Mao Shisong Edition)","uri":"/en/posts/probability/#2-estimating-the-truth-in-sensitive-questionnaire-questions"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"2.1 Introduction: Conditional Probability\r$$ P(A|B)=\\frac{P(AB)}{P(B)}\\stackrel{\\text{Multiplication Formula}}{\\longrightarrow} P(AB) = P(B) P(A|B)\\\\\\\\ $$$$ \\text{Total Probability Formula: } P(A) = \\sum_{i=1}^n P(B_i) P(A | B_i)\\\\\\\\ $$$$ \\text{Bayes\u0026#39; Formula: } P (B_i | A) = \\frac{P(B_i) P(A|B_i)}{\\sum_{j=1}^n P(B_j) P(A|B_j)} \\newline $$$$ i = 12,\\dotsc,n $$ Among the three formulas of conditional probability: Multiplication Formula is used to find the probability of the intersection of events. Total Probability Formula is used to find the probability of a complex event. Bayes\u0026rsquo; Formula is used to find a conditional probability. Venn diagram, left: ordinary conditional probability, right: total probability formula (drawn using LaTeX\u0026rsquo;s tikz)\r","date":"2023-08-01","heading":"2.1 Introduction: Conditional Probability","objectID":"/en/posts/probability/:2:1","tags":["Probability Theory"],"title":"Estimating π with a Needle? Notes on Probability Theory (Mao Shisong Edition)","uri":"/en/posts/probability/#21-introduction-conditional-probability"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"2.2 How to Operate\rThe respondent only needs to answer one of the following two questions, with options being \u0026ldquo;Yes\u0026rdquo; or \u0026ldquo;No.\u0026rdquo; Question A: Is your birthday before July 1st? Question B: Have you visited inappropriate websites? The respondent only needs to answer one of the following two questions.\r(1) The respondent is in a closed room with no other observers, operating and answering questions alone. (2) The respondent draws a blind box, answering A if a red ball is drawn, and B if a white ball is drawn. First, we can roughly estimate the probability of \u0026ldquo;a randomly selected person\u0026rsquo;s birthday being before July 1st,\u0026rdquo; which we assume to be 0.5. Now, with $n$ questionnaires, we have $k$ responses with \u0026ldquo;Yes,\u0026rdquo; and the probability of drawing a red ball in the blind box is $\\pi$. That is, we have four data points ($n$, $k$, $\\pi$, 0.5). Now, using the total probability formula: $$ P(\\text{Yes})P(\\text{White Ball})P(\\text{Yes}|\\text{White Ball})\u0026#43;P(\\text{Red Ball})P(\\text{Yes}|\\text{Red Ball}) \\stackrel{\\text{Substitute Values}}{\\longrightarrow} $$$$ \\frac{k}{n}=0.5(1-\\pi)\u0026#43;{p_{\\text{Yes}|\\text{Red Ball}}}\\pi \\stackrel{\\text{Solve}}{\\longrightarrow} $$$$ {p_{\\text{Yes}|\\text{Red Ball}}}=\\frac{\\frac{n}{k}-0.5(1-\\pi)}{\\pi} $$ A cross-disciplinary design of psychology and statistics! A beautiful deception ends here! ","date":"2023-08-01","heading":"2.2 How to Operate","objectID":"/en/posts/probability/:2:2","tags":["Probability Theory"],"title":"Estimating π with a Needle? Notes on Probability Theory (Mao Shisong Edition)","uri":"/en/posts/probability/#22-how-to-operate"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"3. The Fable of \u0026ldquo;The Boy Who Cried Wolf\u0026rdquo; and Bayes\u0026rsquo; Formula\r","date":"2023-08-01","heading":"","objectID":"/en/posts/probability/:3:0","tags":["Probability Theory"],"title":"Estimating π with a Needle? Notes on Probability Theory (Mao Shisong Edition)","uri":"/en/posts/probability/#3-the-fable-of-the-boy-who-cried-wolf-and-bayes-formula"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"3.1 Introduction: Bayes\u0026rsquo; Formula\rBayes\u0026rsquo; Formula: $$ \\text{Bayes\u0026#39; Formula: } P (B_i | A) = \\frac{P(B_i) P(A|B_i)}{\\sum_{j=1}^n P(B_j) P(A|B_j)} $$$$ i = 1,2,\\dotsc,n $$ In Bayes\u0026rsquo; formula, if $ P (B_i)$ is called the prior probability of $B_i$, and $P (B_i |A) $ is called the posterior probability of $B_i$, then Bayes\u0026rsquo; formula is specifically used to calculate the posterior probability, which is the correction of the probability of $B_i$ based on the new information that $A$ has occurred. For example, in the story of \u0026ldquo;The Boy Who Cried Wolf,\u0026rdquo; the villagers have an initial level of trust in the boy, but after repeated lies, their trust decreases, leading them to not believe the boy even when he tells the truth. ","date":"2023-08-01","heading":"","objectID":"/en/posts/probability/:3:1","tags":["Probability Theory"],"title":"Estimating π with a Needle? Notes on Probability Theory (Mao Shisong Edition)","uri":"/en/posts/probability/#31-introduction-bayes-formula"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"3.2 The Fable of \u0026ldquo;The Boy Who Cried Wolf\u0026rdquo;\rLet event $A$ be \u0026ldquo;the boy lies,\u0026rdquo; and event $B$ be \u0026ldquo;the boy is trustworthy.\u0026rdquo; Assume the villagers\u0026rsquo; initial impression of the boy is $P(B)=0.8$, $P(\\overline{B})=0.2$. First, substitute the villagers\u0026rsquo; perspective of conditional probability, and assume initial values: $$ \\begin{cases} \\text{The boy is trustworthy and lies: } P(A|B)=0.1\\\\\\\\ \\text{The boy is untrustworthy and lies: } P(A|\\overline{B})=0.5 \\end{cases}\\\\ $$ After the boy lies, the villagers will reassess their trust in the boy, so the premise is that the boy has lied, and trust is represented as $P(B|A)$. After the first lie, substitute into Bayes\u0026rsquo; equation: $$ \\begin{align*} P(B|A) \u0026amp; = \\frac{P(B)P(A|B)}{P(B)P(A|B) \u0026#43; P(\\bar B)P(A|\\bar B) } \\\\\\\\ \u0026amp; = \\frac{0.8\\times0.1}{0.8\\times0.1 \u0026#43; 0.2\\times0.5} = 0.444 \\end{align*} $$ That is, the villagers\u0026rsquo; trust in the boy changes as follows: $$ \\text{Prior Probability} \\begin{cases} P(B)=0.8\\\\\\\\ P(\\overline{B})=0.2 \\end{cases} \\stackrel{\\text{After one lie}}{\\longrightarrow}\\text{Posterior Probability} \\begin{cases} P(B|A)=0.444\\\\\\\\ P(\\overline{B}|A)=0.556 \\end{cases} $$ That is, after one lie, the villagers\u0026rsquo; trust in the boy becomes $P({B})=0.444$ and $P({B})=0.556$. Similarly, after the second lie, trust becomes: $$ P(B|A) = \\frac{0.444\\times0.1}{0.444\\times0.1 \u0026#43; 0.556\\times0.5} = 0.138 $$ In summary, after two lies, the villagers\u0026rsquo; trust in the boy changes from $P(B)=0.8$ to $P(B)=0.138$. This is how repeated lies lead to a loss of trust. Why Bayesian Estimation is Great\rThe meaning of Bayesian estimation is to adjust probability values based on parameters at any time. Like Sherlock Holmes\u0026rsquo; reasoning, first list all possibilities, and as evidence increases, update the belief values for each possibility. Another school of thought is the frequentist approach, where the real parameters are fixed, and a large amount of data is used to estimate the real parameters. From this perspective, Bayesian estimation is even a worldview. ","date":"2023-08-01","heading":"3.2 The Fable of \u0026ldquo;The Boy Who Cried Wolf\u0026rdquo;","objectID":"/en/posts/probability/:3:2","tags":["Probability Theory"],"title":"Estimating π with a Needle? Notes on Probability Theory (Mao Shisong Edition)","uri":"/en/posts/probability/#32-the-fable-of-the-boy-who-cried-wolf"},{"categories":["Travel"],"collections":[],"content":"Everything You Need to Know About Huawei Member Day\rI experienced Huawei Member Day at the authorized store in Wudaokou, and here’s everything I know. ","date":"2023-07-07","heading":"Everything You Need to Know About Huawei Member Day","objectID":"/en/posts/hw/:1:0","tags":["Huawei"],"title":"Everything You Need to Know About Huawei Member Day","uri":"/en/posts/hw/#everything-you-need-to-know-about-huawei-member-day"},{"categories":["Travel"],"collections":[],"content":"1. Huawei Member Day Schedule:\rThe first Friday, Saturday, and Sunday of every month. If the end of the previous month falls on a Friday, Saturday, or Sunday, it will be postponed by one week. If you’re unsure, you can search for \u0026ldquo;20xx (year) Huawei Member Day,\u0026rdquo; as shown in the link below: For example, today, July 7, 2023, is the result of a one-week postponement. 2023 Huawei Service Day Promotion Guide ","date":"2023-07-07","heading":"1. Huawei Member Day Schedule:","objectID":"/en/posts/hw/:1:1","tags":["Huawei"],"title":"Everything You Need to Know About Huawei Member Day","uri":"/en/posts/hw/#1-huawei-member-day-schedule"},{"categories":["Travel"],"collections":[],"content":"2. Do I Need to Make an Appointment?\rUnder normal circumstances, on-site appointments should be fine, as Member Day happens every month and isn’t usually crowded. However, I originally planned to go in June, but the \u0026ldquo;Huawei Terminal Customer Service\u0026rdquo; (official account for advance booking) was fully booked, so I didn’t go. In July, I made on-site appointments, and there weren’t many people. (Probably because it’s been too hot in Beijing recently.) After making an online or on-site appointment, you’ll get a number, and you can go to the corresponding service counter when your number is called. ","date":"2023-07-07","heading":"2. Do I Need to Make an Appointment?","objectID":"/en/posts/hw/:1:2","tags":["Huawei"],"title":"Everything You Need to Know About Huawei Member Day","uri":"/en/posts/hw/#2-do-i-need-to-make-an-appointment"},{"categories":["Travel"],"collections":[],"content":"3. What Services Are Available on Member Day?\r1. Free Screen Protector Application: Soft films are free, while hard films cost 99 RMB—so the staff will try to upsell you on the hard film. 2. Free Computer Cleaning. Note: Not all stores have the authority to disassemble computers, so smaller stores may only offer free screen protector replacement. 3. Free Labor Costs for Phone Repairs. For example, replacing a battery only costs the price of the battery (99 RMB or 129 RMB). If you go on other days, there may be additional labor fees. It’s best to make an appointment in advance for battery replacement so the staff can prepare the battery for your specific phone model. ","date":"2023-07-07","heading":"3. What Services Are Available on Member Day?","objectID":"/en/posts/hw/:1:3","tags":["Huawei"],"title":"Everything You Need to Know About Huawei Member Day","uri":"/en/posts/hw/#3-what-services-are-available-on-member-day"},{"categories":["Travel"],"collections":[],"content":"4. On-Site Experience\rPhone and computer repairs usually take about an hour, so you can pass the time by checking out the display products. There are other products to experience on-site, such as Huawei watches, tablets, earphones, and phones. However, these devices are locked with system and hardware locks, so they only display promotional content. You can probably only kill about 10 minutes here, so I recommend exploring the nearby area. Bread and mints are provided, but I was too shy to take any. There might also be a TV playing some boring programs. There are sofas in the waiting area where you can sit, and there might be charging cables available for free. The picture is of the Huawei store in Wudaokou. As shown, there’s even a building block area for kids.\r","date":"2023-07-07","heading":"4. On-Site Experience","objectID":"/en/posts/hw/:1:4","tags":["Huawei"],"title":"Everything You Need to Know About Huawei Member Day","uri":"/en/posts/hw/#4-on-site-experience"},{"categories":["Travel"],"collections":[],"content":"5. Which Stores Are Recommended?\rI’m located in Haidian District, Beijing. At the time, I was choosing between Zhongguancun, Wudaokou, and Wanliu. I first went to Wanliu (because I heard about the \u0026ldquo;Wanliu Young Master\u0026rdquo; incident and wanted to check it out), but it was a small store without the capability to clean computers, and they didn’t have the battery for my phone model!!! So either go to Wudaokou or Zhongguancun! That’s the advantage of big stores! Between the two, I recommend Wudaokou, as it’s one of the few nightlife spots in Haidian. Below the Wudaokou store is the Zhan Tianyou \u0026ldquo;Jingzhang Railway\u0026rdquo; Heritage Park, where you can spend some time exploring. ","date":"2023-07-07","heading":"5. Which Stores Are Recommended?","objectID":"/en/posts/hw/:1:5","tags":["Huawei"],"title":"Everything You Need to Know About Huawei Member Day","uri":"/en/posts/hw/#5-which-stores-are-recommended"},{"categories":["Travel"],"collections":[],"content":"6. About Zhan Tianyou \u0026ldquo;Jingzhang Railway\u0026rdquo; Heritage Park\rThe security guards are very friendly and willing to explain the park layout to visitors. Note that bicycles can ride on the red track and asphalt road, but cycling is prohibited in the main part of the park. Incidentally, there is a strong holdout at the Qinghuayuan Station site within the park. Monument? There’s a lawn and a slide, but I couldn’t find a good angle for a wide shot.\rRailway Relics\rTrain Model at the End of the Park\r","date":"2023-07-07","heading":"6. About Zhan Tianyou \u0026ldquo;Jingzhang Railway\u0026rdquo; Heritage Park","objectID":"/en/posts/hw/:1:6","tags":["Huawei"],"title":"Everything You Need to Know About Huawei Member Day","uri":"/en/posts/hw/#6-about-zhan-tianyou-jingzhang-railway-heritage-park"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"In the classic textbook \u0026ldquo;Intermediate Microeconomics: A Modern Approach\u0026rdquo; by Varian, there is a famous \u0026ldquo;tax refund case\u0026rdquo; in Chapter 8, \u0026ldquo;Slutsky Equation\u0026rdquo; (9th Edition, Page 100). The key concepts examined are income effect and substitution effect. ","date":"2023-07-06","heading":"","objectID":"/en/posts/fla/:0:0","tags":["Microeconomics"],"title":"Analysis of the Tax Refund Case in Varian's Microeconomics","uri":"/en/posts/fla/#"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"1. Introduction\rIn 1974, OPEC imposed an oil embargo on the United States. To reduce oil dependence, some proposed taxing oil, but taxing would hurt consumers\u0026rsquo; wallets and was politically unfeasible. Therefore, some suggested taxing oil and then refunding the tax to consumers. Critics argued that \u0026ldquo;taxing first and then refunding\u0026rdquo; would change nothing, as people would increase consumption after receiving the refund. Counterintuitively, The textbook argues that taxing first and then refunding would actually make consumers worse off, reducing oil consumption from $x$ to $x\\prime$. ","date":"2023-07-06","heading":"","objectID":"/en/posts/fla/:1:0","tags":["Microeconomics"],"title":"Analysis of the Tax Refund Case in Varian's Microeconomics","uri":"/en/posts/fla/#1-introduction"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"2. A Non-Mathematical Explanation:\r","date":"2023-07-06","heading":"","objectID":"/en/posts/fla/:2:0","tags":["Microeconomics"],"title":"Analysis of the Tax Refund Case in Varian's Microeconomics","uri":"/en/posts/fla/#2-a-non-mathematical-explanation"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"First: The Deposit Perspective (Personal View)\rHere, I will first explain Varian\u0026rsquo;s logic with minimal mathematical language. Taxing first and then refunding sounds like a bizarre plan, but think about it: what if we consider the deposit for \u0026ldquo;shared bikes or shared power banks\u0026rdquo; as a tax? The deposit, like Varian\u0026rsquo;s oil tax, is paid first and then refunded. The deposit is an additional charge on top of the shared bike or power bank usage fee, just as the oil tax is an additional charge on gasoline consumption. Both the deposit and the oil tax are fully refunded. The original question: Will taxing oil and then refunding it to consumers change their consumption? Transformed into: If the deposit for shared bikes or power banks increases, will consumers\u0026rsquo; consumption change? Let\u0026rsquo;s assume there are two types of people in the market: One is a wealthy person who has 100 dollars a day, spends 50 dollars on personal consumption, and can even spend the other 50 dollars on \u0026ldquo;Crazy Fridays\u0026rdquo; for others. The other is a worker who only has 50 dollars a day, barely enough for personal consumption, with no extra money for KFC. For both groups, when the deposit for shared power banks is 0 dollars, each consumes two power banks a day. But one day, the deposit for power banks increases to 50 dollars! The wealthy person doesn\u0026rsquo;t care; they still spend 100 dollars on two power banks and continue to enjoy life after receiving the refund. The worker, however, is in trouble. The deposit has increased from 0 dollars to 100 dollars, but they only have 50 dollars! Unless they borrow money, they can\u0026rsquo;t afford the deposit. As a result, the worker reduces their consumption from two power banks a day to one. So in this market, even though the deposit is refunded, the number of power banks rented daily has decreased from 4 to 3. The increase in deposit has no effect on the wealthy person\u0026rsquo;s consumption $x$, but the worker\u0026rsquo;s consumption has decreased from $x$ to $x\\prime$. The average market consumption change: $\\frac{x\u0026#43;x}{2} \\Rightarrow\\frac{x\u0026#43;x^{\\prime}}{2}$, and indeed, market consumption has decreased! This is why Varian says in the book (Original English textbook link: Intermediate Microeconomics) That’s because he is average, not because of any causal connection Varian distinguishes between \u0026ldquo;consumers\u0026rdquo; and \u0026ldquo;average consumers.\u0026rdquo; That is, the wealthy person (consumer) in the market is not affected by the deposit, but the worker is, and as a result, the overall market (average consumer) consumption decreases. ","date":"2023-07-06","heading":"","objectID":"/en/posts/fla/:2:1","tags":["Microeconomics"],"title":"Analysis of the Tax Refund Case in Varian's Microeconomics","uri":"/en/posts/fla/#first-the-deposit-perspective-personal-view"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"Second: Tax Friction, Intertemporal Perspective\rThe deposit analogy explores how policies affect different groups differently, ultimately leading to an overall decrease in consumption, which is also a one-time effect. But there is another explanatory perspective, treating the policy as forcing everyone to engage in intertemporal consumption. Before the refund, consumption is considered as a price increase, where the price is the tax burden, increasing from $p$ to $(1\u0026#43;t)p$, and consumption naturally decreases from $x$ to $x^\\prime$. The second refund is $tx^\\prime$. ","date":"2023-07-06","heading":"Second: Tax Friction, Intertemporal Perspective","objectID":"/en/posts/fla/:2:2","tags":["Microeconomics"],"title":"Analysis of the Tax Refund Case in Varian's Microeconomics","uri":"/en/posts/fla/#second-tax-friction-intertemporal-perspective"},{"categories":["Economic Studies"],"collections":["Mathematics and Economics"],"content":"3. Mathematical Explanation\rOnce the \u0026ldquo;non-mathematical explanation\u0026rdquo; is understood, we can look at the mathematical analysis provided in the book. The entire tax burden is shifted to consumers, meaning the price of gasoline rises. (Because some workers cannot afford the deposit, even though it will be refunded.) Taxing and then refunding ultimately leaves income unchanged. The first point indicates that the substitution effect occurs: as the price of gasoline rises, consumers are willing to spend more on other goods instead of gasoline. Therefore, the final consumption of oil by consumers must be $x^\\prime$ after the price change, not the original $x$. The second point indicates that, overall, income has not changed, so there is no income effect. This is why the book distinguishes between \u0026ldquo;consumers\u0026rdquo; and \u0026ldquo;average consumers.\u0026rdquo; The average consumer\u0026rsquo;s reaction to taxing and refunding is to reduce consumption, as they perceive gasoline as more expensive, with the tax burden shifted as $t$. $$ \\begin{cases} \\text{Before: }px\u0026#43;y=m\\newline \\text{Now: }(p\u0026#43;t)x\\prime\u0026#43;y\\prime=m\u0026#43;tx\\prime \\end{cases} $$ Diagram\r","date":"2023-07-06","heading":"","objectID":"/en/posts/fla/:3:0","tags":["Microeconomics"],"title":"Analysis of the Tax Refund Case in Varian's Microeconomics","uri":"/en/posts/fla/#3-mathematical-explanation"},{"categories":["Commentary"],"collections":[],"content":" Words are my only weapon, and they will be my greatest strength. This is the hero's opening self-introduction, but if the player has the patience to reach the third layer's true ending, they'll discover the tragedy, the hidden story, and the love behind those words. It\u0026rsquo;s precisely the game\u0026rsquo;s three endings that made me feel the whole game is like the Chinese character \u0026ldquo;回\u0026rdquo; — a \u0026ldquo;return\u0026rdquo; in meaning, and a loop-shaped circle in its level structure. Form and meaning fused into one: no beauty in a game exceeds this. ","date":"2023-07-01","heading":"","objectID":"/en/posts/wzyy/:0:0","tags":["Games"],"title":"Word Game: Back to the Written Word","uri":"/en/posts/wzyy/#"},{"categories":["Commentary"],"collections":[],"content":"An Audiovisual Experience No Foreign Language Can Copy\rThe most brilliant audiovisual experience in the whole game is, without doubt, its masterful use of \u0026ldquo;characters.\u0026rdquo; The three-dot water radical in \u0026ldquo;溪\u0026rdquo; (stream) ripples and flows; the two dots flanking \u0026ldquo;火\u0026rdquo; (fire) send up drifting smoke; the symmetrical character \u0026ldquo;門\u0026rdquo; (door) can fold inward on both sides and slowly knock shut. Word Game\rThese strokes of genius make the game impossible to translate into English; only learners of Chinese can get the purest experience — this is the sediment of five thousand years of Chinese pictographic characters. Of course, pure text has another benefit: there\u0026rsquo;s no picture-making more wonderful than the one in your head. ( Also worth mentioning are the transitions and animations. For example, when the \u0026ldquo;giant\u0026rdquo; reaches out to grab a friend, it uses the 2D nature to cast a shadow at his feet — a natural transition. When the dragon appears, the scene change is done with a text-flipping effect, achieving perfect unity with the dragon\u0026rsquo;s rolling eyes! The Giant Dragon\r","date":"2023-07-01","heading":"An Audiovisual Experience No Foreign Language Can Copy","objectID":"/en/posts/wzyy/:1:0","tags":["Games"],"title":"Word Game: Back to the Written Word","uri":"/en/posts/wzyy/#an-audiovisual-experience-no-foreign-language-can-copy"},{"categories":["Commentary"],"collections":[],"content":"Gameplay Second, Cleverness First\rThe whole game is built around taking Chinese characters apart: Delete negation words to change the sentence\u0026rsquo;s meaning. Rearrange the word order to change the meaning. Break apart and reassemble radicals to rebuild characters. Through further permutations and combinations, the deeper puzzles of Word Game are like twisting a \u0026ldquo;text-based Rubik\u0026rsquo;s cube\u0026rdquo; to spell out the \u0026ldquo;key line.\u0026rdquo; There are mainly two techniques: assembling and rotating. The Text Rubik\u0026rsquo;s Cube\rBut it\u0026rsquo;s also because of the flexibility of character combinations that some words and sentences feel forced. And after the initial amazement of the first puzzle, later puzzles can feel a bit long-winded and dull. More than its mediocre gameplay, the game\u0026rsquo;s core is its cleverness: constantly digging into item and scene descriptions to distill interesting combinations. For example, the \u0026ldquo;门\u0026rdquo; (door) in \u0026ldquo;五花八门的颜色\u0026rdquo; (colors of all kinds) is the exit the player has been searching for, and the protagonist \u0026ldquo;我\u0026rdquo; (I) can pop out of other characters\u0026rsquo; mouths at any moment. It\u0026rsquo;s these text puzzles, built on the misalignment between item descriptions and visual form, that fill the game with wit and humor. ","date":"2023-07-01","heading":"Gameplay Second, Cleverness First","objectID":"/en/posts/wzyy/:2:0","tags":["Games"],"title":"Word Game: Back to the Written Word","uri":"/en/posts/wzyy/#gameplay-second-cleverness-first"},{"categories":["Commentary"],"collections":[],"content":"Clever Puns and References\rThe key characters and items are actually homophonic puns on Word editing terms; the whole adventure \u0026ldquo;loops back\u0026rdquo; to the text itself, from playing a character to creating characters, and this also foreshadows the third ending. The three mentors: Bold, Italic, and Underline. Items: the Sword of Backspace, also known as the \u0026ldquo;Sword of Delete,\u0026rdquo; and the Undo Potion — Word\u0026rsquo;s undo: the cheat code: Ctrl+Z. ","date":"2023-07-01","heading":"Clever Puns and References","objectID":"/en/posts/wzyy/:3:0","tags":["Games"],"title":"Word Game: Back to the Written Word","uri":"/en/posts/wzyy/#clever-puns-and-references"},{"categories":["Commentary"],"collections":[],"content":"An Ending That Isn\u0026rsquo;t Necessarily Happy\rThe short boss fights make the arrival of the three endings feel too rushed, and the mystery of the friend \u0026ldquo;Ace\u0026rsquo;s\u0026rdquo; teleportation is never really explained (for a few levels I was amazed at how fast Ace moved and thought it was foreshadowing, but it turned out to be nothing)\r, which rather sours the experience. Even the true hidden ending isn\u0026rsquo;t a complete and happy one. To avoid spoilers, I won\u0026rsquo;t say much here. But I believe that after playing this \u0026ldquo;looping\u0026rdquo; word game, players will all feel: \u0026ldquo;Hero, words are my only weapon, and they will be my greatest strength.\u0026rdquo; The three endings are also three transformations of the characters. \"我\" (I) becomes \"人\" (person), and \"人\" becomes the \"input cursor: |\" in a text editor. It\u0026rsquo;s because of \u0026ldquo;only\u0026rdquo; that \u0026ldquo;greatest\u0026rdquo; appears, so I call this story\u0026rsquo;s ending a tragic one. But even in hardship, words can still be used, which seems like an invincible redemption. If you feel pain, then why not write down your feelings and create. Words won\u0026rsquo;t 100% become the weapon that rescues reality, but the faith and thought contained in words may redeem the soul — just that, yet it is already everything that Chinese characters express. Writing Your Own Story\r","date":"2023-07-01","heading":"An Ending That Isn\u0026rsquo;t Necessarily Happy","objectID":"/en/posts/wzyy/:4:0","tags":["Games"],"title":"Word Game: Back to the Written Word","uri":"/en/posts/wzyy/#an-ending-that-isnt-necessarily-happy"},{"categories":["Reading"],"collections":[],"content":" This archive is SSS-Class Revival Hunter (Chapter 84), found purely by chance. The original is a Korean novel, and the column someone posted on Bilibili was only a machine translation. I stumbled on it, thought it was good, so I asked my classmate cc to polish the language and archived it. In the end I trimmed it to my own taste. The machine translation unexpectedly produced a kind of stream-of-consciousness feel, \u0026ldquo;Here is a rose, and a rose, and a rose, and a rose.\u0026rdquo; Winter. It was snowing. The master\u0026rsquo;s steps were light, like a gust of wind sweeping across the ice. In the white world, the master\u0026rsquo;s black robes and the ground seemed to flow like brushstrokes. \u0026ldquo;How long do you intend to keep running?\u0026rdquo; \u0026ldquo;When it comes to lightness kung fu, I won\u0026rsquo;t lose.\u0026rdquo; \u0026ldquo;Everything ends sooner or later.\u0026rdquo; \u0026ldquo;Can\u0026rsquo;t you see? This world has become an endless field of snow. Heaven and earth are vast — I can go anywhere!\u0026rdquo; \u0026ldquo;You can\u0026rsquo;t go anywhere.\u0026rdquo; The spirit behind him surged with strength, its great sword sweeping across to part the wind and snow and close the distance. \u0026ldquo;If you were at your peak, I might have no way to stop you. Now there\u0026rsquo;s barely any life left in you. Less than an hour, isn\u0026rsquo;t it? Do you still plan to keep fighting?\u0026rdquo; \u0026ldquo;Aha, how despicable.\u0026rdquo; \u0026ldquo;Truly despicable.\u0026rdquo; The spirit swung its great sword. \u0026ldquo;Fine, I admit it.\u0026rdquo; The master turned aside and dodged lightly. \u0026ldquo;My allotted life is nearly spent; indeed I can no longer run.\u0026rdquo; \u0026ldquo;So you can be reasoned with.\u0026rdquo; The spirit laughed and swung its sword. The master gripped the sword hilt. \u0026ldquo;Then let me show you my strongest ultimate technique.\u0026rdquo; The master gripped the sword hilt: \u0026ldquo;Then let me show you my strongest ultimate technique.\u0026rdquo;\rThe Heavenly Demon Divine Art, first form — Starvation Sword. \u0026ldquo;A great famine is the starved corpses strewn across the fields in a year of disaster; it is the desperate gesture of emaciated parents exchanging their children to eat.\u0026rdquo; The blades sliced through the winter wind, giving off a piercing shriek. \u0026ldquo;That lord said to dry the neighbor\u0026rsquo;s child\u0026rsquo;s body into jerky and bury it in the snow. Have you heard the rumor in town? Have you heard the stories in the village? When you dig through the snow with a shovel in winter, the children\u0026rsquo;s flesh jams the shovel.\u0026rdquo; \u0026ldquo;Bang!\u0026rdquo; The master\u0026rsquo;s blade landed on the spirit\u0026rsquo;s great sword. \u0026ldquo;I think that was a year of famine.\u0026rdquo; \u0026ldquo;Yes, a famine year. A famine year is like a disease; it returns at any time.\u0026rdquo; \u0026ldquo;But this is chance.\u0026rdquo; The spirit swung its great sword against the winter wind. \u0026ldquo;Some years happen to be abundant, some happen to be poor; everything in this world follows its own course. Demonic cult leader, since you grieve for accidental tragedy, you should also smile for accidental joy. The depth to which a person sinks in sorrow is no different from the height to which they wander in happiness.\u0026rdquo; \u0026ldquo;Clang!\u0026rdquo; The long sword and the broad sword crossed; snowflakes drifted down and the red plum blossoms all fell. \u0026ldquo;There was a day when I wandered down the road, and the boundless wheat fields surged and rolled from the horizon, spreading all the way before my eyes. It was a bright day, when even the wind carried warmth. The wheat waves rose and fell, revealing a few frolicking children, jumping, running, breathing. Wave after wave of laughter, overflowing with joy and vitality, now appeared and now vanished among the full, drooping ears of wheat.\u0026rdquo; Deep autumn; the wind rose. Red leaves blazed like fire across the hills and plains; the open fields stretched wide, golden waves reaching the sky. \u0026ldquo;You speak to me of the wailing of children buried in the snow? Then let me tell you of the laughter of children ","date":"2023-06-27","heading":"","objectID":"/en/posts/sss/:0:0","tags":["Novels"],"title":"Archive: SSS-Class Revival Hunter, Chapter 84","uri":"/en/posts/sss/#"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":" Archiving material I think is good, including advice on literary aesthetics and economic research. Under the advance of economic imperialism, no one knows where economics is heading. Some say economics is a skill for slaying dragons, but this world has no dragons to slay; some say economics is over-mathematized and has long drifted from the reality of the world; some say economists only use assumptions to solve problems\u0026hellip; Positivism, post-positivism, constructivism — research paradigms crisscross without a single certain answer. Today, economics increasingly resembles the fable genre of constructivism, using data and examples to tell well a fable we need. From this angle, economics and literature have quite a few similarities, so here I collect and arrange articles I like, as reference. ","date":"2023-06-11","heading":"","objectID":"/en/posts/xz/:0:0","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":"Literature\r","date":"2023-06-11","heading":"Literature","objectID":"/en/posts/xz/:1:0","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#literature"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":"Maugham\u0026rsquo;s \u0026ldquo;Writing Advice\u0026rdquo;\rYou must become bored before your audience does. The writer\u0026rsquo;s motto must be: cut what can be cut, cut again, straight to the peak of the audience\u0026rsquo;s attention. What we writers must study is still the ordinary person. Ordinary people are the writer\u0026rsquo;s more fertile soil. He preferred strong, forceful words to pleasant-sounding ones. Only years later did I understand that writing is a delicate art, acquired only through hard work. It is useless to strive at something for which one has no talent. Surprised at the poverty of my vocabulary, I took paper and pen to the British Museum, wrote down the names of curios, the Byzantine colors of old enamel, the feel of fabrics against the body, and then carefully devised sentences to put all of it into. Fortunately, I found no occasion to use this material; it still lies in that old notebook, ready for anyone who wants to write nonsense. I wanted to cast aside ornate phrasing and write as plainly and unaffectedly as I could. I discovered my own limits, and the only sensible thing for me was to set my goal at the best I could achieve within those limits. I knew I had no gift for lyricism. I thought to myself that I should aim at clarity, simplicity, and euphony. In a writer\u0026rsquo;s work one can find two kinds of obscurity, one arising from carelessness, the other deliberate. People write obscurely often because they have not taken the trouble to learn how to write clearly. Another cause of obscurity is that the author is not quite certain of his own meaning. Many writers do not think before writing but only as they write — the pen itself gives birth to the thought. This is indeed a danger the writer must constantly guard against. It is easy to persuade oneself that a word one does not quite understand contains far more meaning than one realizes. To achieve clarity requires strict training. Simplicity and naturalness are the truest marks of excellence. Euphony is the last of the three qualities I mentioned, and a good many readers, as well as many respected writers, lack it. Words have weight, sound, and appearance; only by taking these into account can you write sentences that are graceful and pleasing. I do not write as I wish; I write as I am able. A far-fetched, worn-out, even affected word is not unsuitable in my eyes as long as it sounds better than a plain, clear one, or gives a sentence better balance. Though you may yield to pleasing sound without hesitation, you should never give way to a word that blurs the meaning. I think the author had best have a stronger faculty of boredom than the reader, so that he senses boredom before the reader does. Once people labor to form a style, they can rarely afterwards write with complete freedom. If you can write clearly, simply, euphoniously, and vividly, you will write perfectly; you will write like Voltaire. Good style shows no trace of effort; what you write should look as though it came to you by a happy accident. If in the end I achieved an effect of ease, it was only through hard effort. People should write in the manner of their own time. Language is living and changing; striving to write like authors of the distant past can only lead to unnaturalness. I would rather a writer be worldly than affected; for life is worldly, and what the writer pursues is life. In my view, many writers do not observe life at all but merely create their characters, as they already are, out of the many figures of their imagination. They are like draftsmen who draw patterns from memory of antiques and never try to draw a living model. At best they can only give their inner fantasies a plausible shape. The stupid prejudice of the intellectual lies in thinking that only their knowledge matters. Truth, goodness, and beauty are not the privilege of those who attend expensive schools, haunt libraries, or frequent museums. The artist has no excuse for thinking himself superior. If an artist thinks his kno","date":"2023-06-11","heading":"Maugham\u0026rsquo;s \u0026ldquo;Writing Advice\u0026rdquo;","objectID":"/en/posts/xz/:1:1","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#maughams-writing-advice"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":"Camus\u0026rsquo;s 1957 Nobel Speech, \u0026ldquo;The Artist and His Time\u0026rdquo;\rYour Majesties, Your Royal Highnesses, ladies and gentlemen: Your Academy, in the spirit of freedom, has generously bestowed this honor on me, and since I feel my achievements fall far short of its weight, I am all the more sincerely grateful. Everyone longs for recognition, and the artist more than anyone. I am no different. Only after comparing the effect of your decision with my real self did I truly understand why you made such a decision. A still-young man who has nothing but doubts, whose work is not yet formed, who is used to living alone in his work and shrinking from every friendly advance — for such a recluse, suddenly seized and thrown into this dazzling spotlight, how could he not feel a kind of panic? When the other writers of Europe, even some of the greatest among them, are forced into silence, when his homeland is suffering endless affliction, with what feelings is he to accept this honor? I experienced just such inner dread and unease. To regain calm, I could only accept this generous gift of fate. Since my achievements cannot match this award, I can only lean on the conviction that has sustained my life and that I have never abandoned even in the hardest circumstances: my view of my art and of the writer\u0026rsquo;s role. Allow me, with gratitude and friendship, to express this thought to you as briefly as I can. For me, without art I could not survive. But I have never placed this art above everything else; on the contrary, it is indispensable to me precisely because it is closely bound to everyone and allows someone like me to live as everyone does. Art, in my view, is not a solitary celebration. Art is a means that, in its own way, presents the common suffering and joy of humanity and thereby moves the majority of people. So it forces the artist not to isolate himself and makes him submit to the simplest and most universal truth. And usually, the person who chooses an artistic career thinking himself different soon finds that only by acknowledging what he shares with all beings can his art and his distinctive talent draw nourishment. It is in this constant coming and going between himself and others, in his dealings with the beauty he cannot set aside and the community from which he cannot be detached, that the artist tempers himself. That is why true artists despise nothing; they demand of themselves that they understand everything, not judge everything. If they must choose a side in this world, they can perhaps belong only to the kind of society built in Nietzsche\u0026rsquo;s great words: a society ruled by creators rather than judges, whether those creators are laborers or intellectuals. Likewise, the writer\u0026rsquo;s role is burdened with a difficult duty. As a writer, in times like ours, he should not serve those who make history; he should serve those who endure it. Otherwise he will be isolated and will also lose his art. A writer who keeps company with a tyrant cannot escape that loneliness even if the tyrant marches with a host of thousands. But at the other end of the world, a nameless prisoner abandoned to humiliation — his silence is enough, again and again, to rescue the writer from this lonely exile, as long as, while enjoying the rights of freedom, he never forgets that silence and, through the means of art, makes it resound. None of us is great enough to take up this mission. But in all the circumstances of his life, whether neglected or celebrated for a time, whether crushed under the yoke of tyranny or enjoying a momentary freedom of speech, only by serving truth and freedom loyally and to the best of his ability can the writer\u0026rsquo;s profession become great and can he win from the people a vindication that comes from the heart. The writer\u0026rsquo;s mission is to unite as many people as possible; this mission must not yield to lies and servitude, for in lands ruled by lies and servitude, lonely souls are imprisoned everywhere. Wh","date":"2023-06-11","heading":"Camus\u0026rsquo;s 1957 Nobel Speech, \u0026ldquo;The Artist and His Time\u0026rdquo;","objectID":"/en/posts/xz/:1:2","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#camuss-1957-nobel-speech-the-artist-and-his-time"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":"Chuck Palahniuk\u0026rsquo;s (author of Fight Club) Writing Guide\rIn six seconds, you\u0026rsquo;ll hate me. But in six months, you\u0026rsquo;ll be a better writer. From now on — for at least the next six months — you may not use \u0026ldquo;thought\u0026rdquo; verbs. These include: think, know, understand, realize, believe, want, remember, imagine, desire, and the hundred others you love to use. The list also includes: love and hate. It also includes: be and have, but let\u0026rsquo;s get to those two in a moment. Until around Christmas, you can\u0026rsquo;t write: Kenny thought Monica probably didn\u0026rsquo;t like him going out at night\u0026hellip; Instead, you have to unpack that sentence into: \u0026ldquo;Some mornings Kenny stayed out late, missed the last bus, until he had to hitchhike or pay for a cab, and came home to find Monica pretending to be asleep, because she never slept that quietly; those mornings she would only put her own cup of coffee in the microwave. Never his.\u0026rdquo; Instead of writing what your character knows, you must now provide details that let the reader know those things. Instead of writing that a character wants something, you must now describe that thing so the reader wants it too. Instead of saying: \u0026ldquo;Adam knew Gwen liked him.\u0026rdquo; you have to say: \u0026ldquo;Between classes, when he went to open his locker, Gwen was always leaning against it. She\u0026rsquo;d roll her eyes, push herself off with one foot, leaving a black heel print on the painted metal, but she also left her perfume. On the combination lock there was still the warmth of her hip. Next period, Gwen would be leaning there again.\u0026rdquo; Simply put, there are no shortcuts anymore. Only concrete sensory details: action, smell, taste, sound, and feeling. Typically, authors use these \u0026ldquo;thought\u0026rdquo; verbs at the start of a paragraph (you can call them \u0026ldquo;thesis sentences\u0026rdquo; here; I\u0026rsquo;ll complain about that in a bit). In a sense, they point out the whole paragraph\u0026rsquo;s intent. What follows explains those intents in detail. For example: \u0026ldquo;Brenda knew she couldn\u0026rsquo;t make the deadline. She was coming from the bridge, past eight or nine exits. Her phone was dead. At home, the dog needed to be walked or it would make a mess to clean up. Plus she\u0026rsquo;d promised to water the neighbor\u0026rsquo;s flowers\u0026hellip;\u0026rdquo; Do you see how that opening thesis sentence steals the thunder from the paragraph that follows? Don\u0026rsquo;t do that. At the very least, cut the opening line and put it after all the other sentences. Better yet, move it somewhere else and change it to: Brenda couldn\u0026rsquo;t make the deadline. Thinking is abstract. Knowing and believing are invisible. If you show only physical actions and the details of the character, and let your reader do the thinking and knowing, as well as the loving and hating, your story will always be stronger. Don\u0026rsquo;t tell your reader \u0026ldquo;Lisa hated Tom.\u0026rdquo; Instead, argue your case like a courtroom lawyer, speak through details, and present every piece of evidence. For example: \u0026ldquo;At roll call, in the breath after the teacher called Tom\u0026rsquo;s name, in the instant before he answered, right then, Lisa would whisper \u0026lsquo;jerk.\u0026rsquo; Just as Tom said \u0026lsquo;here.\u0026rsquo;\u0026rdquo; One of the most common mistakes of beginning authors is leaving their characters alone. When you write, you can be alone. When they read, your readers can be alone. But your characters should very, very rarely be alone. Because a lonely character will start thinking, worrying, or wondering. For example: \u0026ldquo;While waiting for the bus, Mark started to worry about how long the trip would take\u0026hellip;\u0026rdquo; A better way to show it: \u0026ldquo;The schedule said the bus would arrive at noon, but Mark\u0026rsquo;s watch showed it was already 11:57. You could see to the end of the road, all the way to the mall — not a single bus. No doubt the driver had stopped at the transfer station, at the far end of the route, and was dozing. The driver was relax","date":"2023-06-11","heading":"Chuck Palahniuk\u0026rsquo;s (author of Fight Club) Writing Guide","objectID":"/en/posts/xz/:1:3","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#chuck-palahniuks-author-of-fight-club-writing-guide"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":"Economics\r","date":"2023-06-11","heading":"Economics","objectID":"/en/posts/xz/:2:0","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#economics"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":"Advice on Choosing a Topic\rHow to choose a topic for empirical economics research? — He Xiaobo, Shanghai Finance University How to get started on research in economics? — Steve Pischke (2009) You can also look here: Resources for Economics PhD Students ","date":"2023-06-11","heading":"Advice on Choosing a Topic","objectID":"/en/posts/xz/:2:1","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#advice-on-choosing-a-topic"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":"Samuelson | Why Am I the One Who Wrote Economics?\rSource: Tales of the Economics World This article was written by Samuelson for the fiftieth anniversary of the publication of Economics, from Scientific Papers of Paul Samuelson No. 587. Translator: Lü Ji\u0026rsquo;er, forwarded by teacher Lai Jiancheng. Wang Laohu revised parts of the text, hoping not to have run counter to the translator\u0026rsquo;s original meaning. It is shared here because I like the article; the original-protection mark is added to protect teacher Lü\u0026rsquo;s rights as translator. Teacher Lü invites friends to offer corrections so the translation can be improved. For your corrections, the translator expresses heartfelt thanks! Translator\u0026rsquo;s email: zjjier@163.com Economics Turns Fifty\rEconomics has reached its fiftieth birthday, and over this half century it has witnessed the considerable development of economics. Economics has come a long way, yet to this day it has no right to boast of having reached the state of an exact science — as is probably true of any social science. Economics is forever a discipline that merges science and art, and there is a world of difference between a vigorous economics and a pedantic, outdated one. Today, the things economists can do are increasing day by day, whether in government, the private sector, or academia. Compared with the late 1940s, the volume of data in statistical databases has grown explosively. Now computers can obtain and process statistical information and all kinds of knowledge at the speed of light, and we can obtain information quickly. Whether theoretical or applied economics, research in political economy has benefited enormously from advances in computer hardware and software — more, perhaps, than any other field. Even so, the foundational areas of economics have barely moved forward. The world has learned some economic principles from history (at least from economic history) and has studied and tested them diligently. Economists treat fickle economic slumps and the inflation that produces false prosperity as laboratory mice, conducting controlled experiments like chemists in a lab. (The translator omits one sentence here.) At the same time, the perfectly competitive free market has failed to bring humanity equality of opportunity and equality of income. The fact that \u0026ldquo;poverty is always with us\u0026rdquo; forces democracies around the world to evolve into a \u0026ldquo;mixed economy\u0026rdquo; — neither a laissez-faire market nor a Robin Hood utopia. Only after studying the basic principles of economics can the public understand and be convinced of how to strike the right middle course between self-interested individual initiative on the one hand and government regulation, the maintenance of stability, and redistribution on the other. Willingly or not, a mixed economy must be a \u0026ldquo;limited mixed economy.\u0026rdquo; Looking Back\rA fiftieth birthday is an excellent occasion for looking back. What story can we see in the popularity of this best-selling textbook, which has led the field? How was this textbook born? We have to pull our gaze back to 1945. The Second World War ended with the defeat of Germany and Japan, and the people returning home filled American universities to overflowing. At that time, economics happened to be entering a golden age. The Great Depression of 1929 to 1935 turned economics around, casting aside the old ideas that had once held orthodoxy and replacing them with ambitious plans, with strong monetary and fiscal policies. Britain and the United States adopted new ways of mobilizing their economies for war, something Hitler, Mussolini, and Hirohito could never have dreamed of. At the time, we could not yet know of the later Marshall Plan and the American occupation of Japan, but they were about to set the stage for decades of postwar economic growth. Students should understand all of this. Yet we teachers of that generation all knew that the best-selling economics textbooks of the time were","date":"2023-06-11","heading":"Samuelson | Why Am I the One Who Wrote Economics?","objectID":"/en/posts/xz/:2:2","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#samuelson--why-am-i-the-one-who-wrote-economics"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":"Samuelson | Why Am I the One Who Wrote Economics?\rSource: Tales of the Economics World This article was written by Samuelson for the fiftieth anniversary of the publication of Economics, from Scientific Papers of Paul Samuelson No. 587. Translator: Lü Ji\u0026rsquo;er, forwarded by teacher Lai Jiancheng. Wang Laohu revised parts of the text, hoping not to have run counter to the translator\u0026rsquo;s original meaning. It is shared here because I like the article; the original-protection mark is added to protect teacher Lü\u0026rsquo;s rights as translator. Teacher Lü invites friends to offer corrections so the translation can be improved. For your corrections, the translator expresses heartfelt thanks! Translator\u0026rsquo;s email: zjjier@163.com Economics Turns Fifty\rEconomics has reached its fiftieth birthday, and over this half century it has witnessed the considerable development of economics. Economics has come a long way, yet to this day it has no right to boast of having reached the state of an exact science — as is probably true of any social science. Economics is forever a discipline that merges science and art, and there is a world of difference between a vigorous economics and a pedantic, outdated one. Today, the things economists can do are increasing day by day, whether in government, the private sector, or academia. Compared with the late 1940s, the volume of data in statistical databases has grown explosively. Now computers can obtain and process statistical information and all kinds of knowledge at the speed of light, and we can obtain information quickly. Whether theoretical or applied economics, research in political economy has benefited enormously from advances in computer hardware and software — more, perhaps, than any other field. Even so, the foundational areas of economics have barely moved forward. The world has learned some economic principles from history (at least from economic history) and has studied and tested them diligently. Economists treat fickle economic slumps and the inflation that produces false prosperity as laboratory mice, conducting controlled experiments like chemists in a lab. (The translator omits one sentence here.) At the same time, the perfectly competitive free market has failed to bring humanity equality of opportunity and equality of income. The fact that \u0026ldquo;poverty is always with us\u0026rdquo; forces democracies around the world to evolve into a \u0026ldquo;mixed economy\u0026rdquo; — neither a laissez-faire market nor a Robin Hood utopia. Only after studying the basic principles of economics can the public understand and be convinced of how to strike the right middle course between self-interested individual initiative on the one hand and government regulation, the maintenance of stability, and redistribution on the other. Willingly or not, a mixed economy must be a \u0026ldquo;limited mixed economy.\u0026rdquo; Looking Back\rA fiftieth birthday is an excellent occasion for looking back. What story can we see in the popularity of this best-selling textbook, which has led the field? How was this textbook born? We have to pull our gaze back to 1945. The Second World War ended with the defeat of Germany and Japan, and the people returning home filled American universities to overflowing. At that time, economics happened to be entering a golden age. The Great Depression of 1929 to 1935 turned economics around, casting aside the old ideas that had once held orthodoxy and replacing them with ambitious plans, with strong monetary and fiscal policies. Britain and the United States adopted new ways of mobilizing their economies for war, something Hitler, Mussolini, and Hirohito could never have dreamed of. At the time, we could not yet know of the later Marshall Plan and the American occupation of Japan, but they were about to set the stage for decades of postwar economic growth. Students should understand all of this. Yet we teachers of that generation all knew that the best-selling economics textbooks of the time were","date":"2023-06-11","heading":"Economics Turns Fifty","objectID":"/en/posts/xz/:2:2","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#economics-turns-fifty"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":"Samuelson | Why Am I the One Who Wrote Economics?\rSource: Tales of the Economics World This article was written by Samuelson for the fiftieth anniversary of the publication of Economics, from Scientific Papers of Paul Samuelson No. 587. Translator: Lü Ji\u0026rsquo;er, forwarded by teacher Lai Jiancheng. Wang Laohu revised parts of the text, hoping not to have run counter to the translator\u0026rsquo;s original meaning. It is shared here because I like the article; the original-protection mark is added to protect teacher Lü\u0026rsquo;s rights as translator. Teacher Lü invites friends to offer corrections so the translation can be improved. For your corrections, the translator expresses heartfelt thanks! Translator\u0026rsquo;s email: zjjier@163.com Economics Turns Fifty\rEconomics has reached its fiftieth birthday, and over this half century it has witnessed the considerable development of economics. Economics has come a long way, yet to this day it has no right to boast of having reached the state of an exact science — as is probably true of any social science. Economics is forever a discipline that merges science and art, and there is a world of difference between a vigorous economics and a pedantic, outdated one. Today, the things economists can do are increasing day by day, whether in government, the private sector, or academia. Compared with the late 1940s, the volume of data in statistical databases has grown explosively. Now computers can obtain and process statistical information and all kinds of knowledge at the speed of light, and we can obtain information quickly. Whether theoretical or applied economics, research in political economy has benefited enormously from advances in computer hardware and software — more, perhaps, than any other field. Even so, the foundational areas of economics have barely moved forward. The world has learned some economic principles from history (at least from economic history) and has studied and tested them diligently. Economists treat fickle economic slumps and the inflation that produces false prosperity as laboratory mice, conducting controlled experiments like chemists in a lab. (The translator omits one sentence here.) At the same time, the perfectly competitive free market has failed to bring humanity equality of opportunity and equality of income. The fact that \u0026ldquo;poverty is always with us\u0026rdquo; forces democracies around the world to evolve into a \u0026ldquo;mixed economy\u0026rdquo; — neither a laissez-faire market nor a Robin Hood utopia. Only after studying the basic principles of economics can the public understand and be convinced of how to strike the right middle course between self-interested individual initiative on the one hand and government regulation, the maintenance of stability, and redistribution on the other. Willingly or not, a mixed economy must be a \u0026ldquo;limited mixed economy.\u0026rdquo; Looking Back\rA fiftieth birthday is an excellent occasion for looking back. What story can we see in the popularity of this best-selling textbook, which has led the field? How was this textbook born? We have to pull our gaze back to 1945. The Second World War ended with the defeat of Germany and Japan, and the people returning home filled American universities to overflowing. At that time, economics happened to be entering a golden age. The Great Depression of 1929 to 1935 turned economics around, casting aside the old ideas that had once held orthodoxy and replacing them with ambitious plans, with strong monetary and fiscal policies. Britain and the United States adopted new ways of mobilizing their economies for war, something Hitler, Mussolini, and Hirohito could never have dreamed of. At the time, we could not yet know of the later Marshall Plan and the American occupation of Japan, but they were about to set the stage for decades of postwar economic growth. Students should understand all of this. Yet we teachers of that generation all knew that the best-selling economics textbooks of the time were","date":"2023-06-11","heading":"Looking Back","objectID":"/en/posts/xz/:2:2","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#looking-back"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":"Samuelson | Why Am I the One Who Wrote Economics?\rSource: Tales of the Economics World This article was written by Samuelson for the fiftieth anniversary of the publication of Economics, from Scientific Papers of Paul Samuelson No. 587. Translator: Lü Ji\u0026rsquo;er, forwarded by teacher Lai Jiancheng. Wang Laohu revised parts of the text, hoping not to have run counter to the translator\u0026rsquo;s original meaning. It is shared here because I like the article; the original-protection mark is added to protect teacher Lü\u0026rsquo;s rights as translator. Teacher Lü invites friends to offer corrections so the translation can be improved. For your corrections, the translator expresses heartfelt thanks! Translator\u0026rsquo;s email: zjjier@163.com Economics Turns Fifty\rEconomics has reached its fiftieth birthday, and over this half century it has witnessed the considerable development of economics. Economics has come a long way, yet to this day it has no right to boast of having reached the state of an exact science — as is probably true of any social science. Economics is forever a discipline that merges science and art, and there is a world of difference between a vigorous economics and a pedantic, outdated one. Today, the things economists can do are increasing day by day, whether in government, the private sector, or academia. Compared with the late 1940s, the volume of data in statistical databases has grown explosively. Now computers can obtain and process statistical information and all kinds of knowledge at the speed of light, and we can obtain information quickly. Whether theoretical or applied economics, research in political economy has benefited enormously from advances in computer hardware and software — more, perhaps, than any other field. Even so, the foundational areas of economics have barely moved forward. The world has learned some economic principles from history (at least from economic history) and has studied and tested them diligently. Economists treat fickle economic slumps and the inflation that produces false prosperity as laboratory mice, conducting controlled experiments like chemists in a lab. (The translator omits one sentence here.) At the same time, the perfectly competitive free market has failed to bring humanity equality of opportunity and equality of income. The fact that \u0026ldquo;poverty is always with us\u0026rdquo; forces democracies around the world to evolve into a \u0026ldquo;mixed economy\u0026rdquo; — neither a laissez-faire market nor a Robin Hood utopia. Only after studying the basic principles of economics can the public understand and be convinced of how to strike the right middle course between self-interested individual initiative on the one hand and government regulation, the maintenance of stability, and redistribution on the other. Willingly or not, a mixed economy must be a \u0026ldquo;limited mixed economy.\u0026rdquo; Looking Back\rA fiftieth birthday is an excellent occasion for looking back. What story can we see in the popularity of this best-selling textbook, which has led the field? How was this textbook born? We have to pull our gaze back to 1945. The Second World War ended with the defeat of Germany and Japan, and the people returning home filled American universities to overflowing. At that time, economics happened to be entering a golden age. The Great Depression of 1929 to 1935 turned economics around, casting aside the old ideas that had once held orthodoxy and replacing them with ambitious plans, with strong monetary and fiscal policies. Britain and the United States adopted new ways of mobilizing their economies for war, something Hitler, Mussolini, and Hirohito could never have dreamed of. At the time, we could not yet know of the later Marshall Plan and the American occupation of Japan, but they were about to set the stage for decades of postwar economic growth. Students should understand all of this. Yet we teachers of that generation all knew that the best-selling economics textbooks of the time were","date":"2023-06-11","heading":"Refined and Polished","objectID":"/en/posts/xz/:2:2","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#refined-and-polished"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":"Samuelson | Why Am I the One Who Wrote Economics?\rSource: Tales of the Economics World This article was written by Samuelson for the fiftieth anniversary of the publication of Economics, from Scientific Papers of Paul Samuelson No. 587. Translator: Lü Ji\u0026rsquo;er, forwarded by teacher Lai Jiancheng. Wang Laohu revised parts of the text, hoping not to have run counter to the translator\u0026rsquo;s original meaning. It is shared here because I like the article; the original-protection mark is added to protect teacher Lü\u0026rsquo;s rights as translator. Teacher Lü invites friends to offer corrections so the translation can be improved. For your corrections, the translator expresses heartfelt thanks! Translator\u0026rsquo;s email: zjjier@163.com Economics Turns Fifty\rEconomics has reached its fiftieth birthday, and over this half century it has witnessed the considerable development of economics. Economics has come a long way, yet to this day it has no right to boast of having reached the state of an exact science — as is probably true of any social science. Economics is forever a discipline that merges science and art, and there is a world of difference between a vigorous economics and a pedantic, outdated one. Today, the things economists can do are increasing day by day, whether in government, the private sector, or academia. Compared with the late 1940s, the volume of data in statistical databases has grown explosively. Now computers can obtain and process statistical information and all kinds of knowledge at the speed of light, and we can obtain information quickly. Whether theoretical or applied economics, research in political economy has benefited enormously from advances in computer hardware and software — more, perhaps, than any other field. Even so, the foundational areas of economics have barely moved forward. The world has learned some economic principles from history (at least from economic history) and has studied and tested them diligently. Economists treat fickle economic slumps and the inflation that produces false prosperity as laboratory mice, conducting controlled experiments like chemists in a lab. (The translator omits one sentence here.) At the same time, the perfectly competitive free market has failed to bring humanity equality of opportunity and equality of income. The fact that \u0026ldquo;poverty is always with us\u0026rdquo; forces democracies around the world to evolve into a \u0026ldquo;mixed economy\u0026rdquo; — neither a laissez-faire market nor a Robin Hood utopia. Only after studying the basic principles of economics can the public understand and be convinced of how to strike the right middle course between self-interested individual initiative on the one hand and government regulation, the maintenance of stability, and redistribution on the other. Willingly or not, a mixed economy must be a \u0026ldquo;limited mixed economy.\u0026rdquo; Looking Back\rA fiftieth birthday is an excellent occasion for looking back. What story can we see in the popularity of this best-selling textbook, which has led the field? How was this textbook born? We have to pull our gaze back to 1945. The Second World War ended with the defeat of Germany and Japan, and the people returning home filled American universities to overflowing. At that time, economics happened to be entering a golden age. The Great Depression of 1929 to 1935 turned economics around, casting aside the old ideas that had once held orthodoxy and replacing them with ambitious plans, with strong monetary and fiscal policies. Britain and the United States adopted new ways of mobilizing their economies for war, something Hitler, Mussolini, and Hirohito could never have dreamed of. At the time, we could not yet know of the later Marshall Plan and the American occupation of Japan, but they were about to set the stage for decades of postwar economic growth. Students should understand all of this. Yet we teachers of that generation all knew that the best-selling economics textbooks of the time were","date":"2023-06-11","heading":"The Crucial Moment","objectID":"/en/posts/xz/:2:2","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#the-crucial-moment"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":"Samuelson | Why Am I the One Who Wrote Economics?\rSource: Tales of the Economics World This article was written by Samuelson for the fiftieth anniversary of the publication of Economics, from Scientific Papers of Paul Samuelson No. 587. Translator: Lü Ji\u0026rsquo;er, forwarded by teacher Lai Jiancheng. Wang Laohu revised parts of the text, hoping not to have run counter to the translator\u0026rsquo;s original meaning. It is shared here because I like the article; the original-protection mark is added to protect teacher Lü\u0026rsquo;s rights as translator. Teacher Lü invites friends to offer corrections so the translation can be improved. For your corrections, the translator expresses heartfelt thanks! Translator\u0026rsquo;s email: zjjier@163.com Economics Turns Fifty\rEconomics has reached its fiftieth birthday, and over this half century it has witnessed the considerable development of economics. Economics has come a long way, yet to this day it has no right to boast of having reached the state of an exact science — as is probably true of any social science. Economics is forever a discipline that merges science and art, and there is a world of difference between a vigorous economics and a pedantic, outdated one. Today, the things economists can do are increasing day by day, whether in government, the private sector, or academia. Compared with the late 1940s, the volume of data in statistical databases has grown explosively. Now computers can obtain and process statistical information and all kinds of knowledge at the speed of light, and we can obtain information quickly. Whether theoretical or applied economics, research in political economy has benefited enormously from advances in computer hardware and software — more, perhaps, than any other field. Even so, the foundational areas of economics have barely moved forward. The world has learned some economic principles from history (at least from economic history) and has studied and tested them diligently. Economists treat fickle economic slumps and the inflation that produces false prosperity as laboratory mice, conducting controlled experiments like chemists in a lab. (The translator omits one sentence here.) At the same time, the perfectly competitive free market has failed to bring humanity equality of opportunity and equality of income. The fact that \u0026ldquo;poverty is always with us\u0026rdquo; forces democracies around the world to evolve into a \u0026ldquo;mixed economy\u0026rdquo; — neither a laissez-faire market nor a Robin Hood utopia. Only after studying the basic principles of economics can the public understand and be convinced of how to strike the right middle course between self-interested individual initiative on the one hand and government regulation, the maintenance of stability, and redistribution on the other. Willingly or not, a mixed economy must be a \u0026ldquo;limited mixed economy.\u0026rdquo; Looking Back\rA fiftieth birthday is an excellent occasion for looking back. What story can we see in the popularity of this best-selling textbook, which has led the field? How was this textbook born? We have to pull our gaze back to 1945. The Second World War ended with the defeat of Germany and Japan, and the people returning home filled American universities to overflowing. At that time, economics happened to be entering a golden age. The Great Depression of 1929 to 1935 turned economics around, casting aside the old ideas that had once held orthodoxy and replacing them with ambitious plans, with strong monetary and fiscal policies. Britain and the United States adopted new ways of mobilizing their economies for war, something Hitler, Mussolini, and Hirohito could never have dreamed of. At the time, we could not yet know of the later Marshall Plan and the American occupation of Japan, but they were about to set the stage for decades of postwar economic growth. Students should understand all of this. Yet we teachers of that generation all knew that the best-selling economics textbooks of the time were","date":"2023-06-11","heading":"A Bumpy Road","objectID":"/en/posts/xz/:2:2","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#a-bumpy-road"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":"Samuelson | Why Am I the One Who Wrote Economics?\rSource: Tales of the Economics World This article was written by Samuelson for the fiftieth anniversary of the publication of Economics, from Scientific Papers of Paul Samuelson No. 587. Translator: Lü Ji\u0026rsquo;er, forwarded by teacher Lai Jiancheng. Wang Laohu revised parts of the text, hoping not to have run counter to the translator\u0026rsquo;s original meaning. It is shared here because I like the article; the original-protection mark is added to protect teacher Lü\u0026rsquo;s rights as translator. Teacher Lü invites friends to offer corrections so the translation can be improved. For your corrections, the translator expresses heartfelt thanks! Translator\u0026rsquo;s email: zjjier@163.com Economics Turns Fifty\rEconomics has reached its fiftieth birthday, and over this half century it has witnessed the considerable development of economics. Economics has come a long way, yet to this day it has no right to boast of having reached the state of an exact science — as is probably true of any social science. Economics is forever a discipline that merges science and art, and there is a world of difference between a vigorous economics and a pedantic, outdated one. Today, the things economists can do are increasing day by day, whether in government, the private sector, or academia. Compared with the late 1940s, the volume of data in statistical databases has grown explosively. Now computers can obtain and process statistical information and all kinds of knowledge at the speed of light, and we can obtain information quickly. Whether theoretical or applied economics, research in political economy has benefited enormously from advances in computer hardware and software — more, perhaps, than any other field. Even so, the foundational areas of economics have barely moved forward. The world has learned some economic principles from history (at least from economic history) and has studied and tested them diligently. Economists treat fickle economic slumps and the inflation that produces false prosperity as laboratory mice, conducting controlled experiments like chemists in a lab. (The translator omits one sentence here.) At the same time, the perfectly competitive free market has failed to bring humanity equality of opportunity and equality of income. The fact that \u0026ldquo;poverty is always with us\u0026rdquo; forces democracies around the world to evolve into a \u0026ldquo;mixed economy\u0026rdquo; — neither a laissez-faire market nor a Robin Hood utopia. Only after studying the basic principles of economics can the public understand and be convinced of how to strike the right middle course between self-interested individual initiative on the one hand and government regulation, the maintenance of stability, and redistribution on the other. Willingly or not, a mixed economy must be a \u0026ldquo;limited mixed economy.\u0026rdquo; Looking Back\rA fiftieth birthday is an excellent occasion for looking back. What story can we see in the popularity of this best-selling textbook, which has led the field? How was this textbook born? We have to pull our gaze back to 1945. The Second World War ended with the defeat of Germany and Japan, and the people returning home filled American universities to overflowing. At that time, economics happened to be entering a golden age. The Great Depression of 1929 to 1935 turned economics around, casting aside the old ideas that had once held orthodoxy and replacing them with ambitious plans, with strong monetary and fiscal policies. Britain and the United States adopted new ways of mobilizing their economies for war, something Hitler, Mussolini, and Hirohito could never have dreamed of. At the time, we could not yet know of the later Marshall Plan and the American occupation of Japan, but they were about to set the stage for decades of postwar economic growth. Students should understand all of this. Yet we teachers of that generation all knew that the best-selling economics textbooks of the time were","date":"2023-06-11","heading":"Forever Young","objectID":"/en/posts/xz/:2:2","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#forever-young"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":"Samuelson | Why Am I the One Who Wrote Economics?\rSource: Tales of the Economics World This article was written by Samuelson for the fiftieth anniversary of the publication of Economics, from Scientific Papers of Paul Samuelson No. 587. Translator: Lü Ji\u0026rsquo;er, forwarded by teacher Lai Jiancheng. Wang Laohu revised parts of the text, hoping not to have run counter to the translator\u0026rsquo;s original meaning. It is shared here because I like the article; the original-protection mark is added to protect teacher Lü\u0026rsquo;s rights as translator. Teacher Lü invites friends to offer corrections so the translation can be improved. For your corrections, the translator expresses heartfelt thanks! Translator\u0026rsquo;s email: zjjier@163.com Economics Turns Fifty\rEconomics has reached its fiftieth birthday, and over this half century it has witnessed the considerable development of economics. Economics has come a long way, yet to this day it has no right to boast of having reached the state of an exact science — as is probably true of any social science. Economics is forever a discipline that merges science and art, and there is a world of difference between a vigorous economics and a pedantic, outdated one. Today, the things economists can do are increasing day by day, whether in government, the private sector, or academia. Compared with the late 1940s, the volume of data in statistical databases has grown explosively. Now computers can obtain and process statistical information and all kinds of knowledge at the speed of light, and we can obtain information quickly. Whether theoretical or applied economics, research in political economy has benefited enormously from advances in computer hardware and software — more, perhaps, than any other field. Even so, the foundational areas of economics have barely moved forward. The world has learned some economic principles from history (at least from economic history) and has studied and tested them diligently. Economists treat fickle economic slumps and the inflation that produces false prosperity as laboratory mice, conducting controlled experiments like chemists in a lab. (The translator omits one sentence here.) At the same time, the perfectly competitive free market has failed to bring humanity equality of opportunity and equality of income. The fact that \u0026ldquo;poverty is always with us\u0026rdquo; forces democracies around the world to evolve into a \u0026ldquo;mixed economy\u0026rdquo; — neither a laissez-faire market nor a Robin Hood utopia. Only after studying the basic principles of economics can the public understand and be convinced of how to strike the right middle course between self-interested individual initiative on the one hand and government regulation, the maintenance of stability, and redistribution on the other. Willingly or not, a mixed economy must be a \u0026ldquo;limited mixed economy.\u0026rdquo; Looking Back\rA fiftieth birthday is an excellent occasion for looking back. What story can we see in the popularity of this best-selling textbook, which has led the field? How was this textbook born? We have to pull our gaze back to 1945. The Second World War ended with the defeat of Germany and Japan, and the people returning home filled American universities to overflowing. At that time, economics happened to be entering a golden age. The Great Depression of 1929 to 1935 turned economics around, casting aside the old ideas that had once held orthodoxy and replacing them with ambitious plans, with strong monetary and fiscal policies. Britain and the United States adopted new ways of mobilizing their economies for war, something Hitler, Mussolini, and Hirohito could never have dreamed of. At the time, we could not yet know of the later Marshall Plan and the American occupation of Japan, but they were about to set the stage for decades of postwar economic growth. Students should understand all of this. Yet we teachers of that generation all knew that the best-selling economics textbooks of the time were","date":"2023-06-11","heading":"Science? Art?","objectID":"/en/posts/xz/:2:2","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#science-art"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":"Lu Ming: Experience and Advice for Scholars Doing Empirical Research\rSource: Econometrics Circle \u0026ldquo;Carrying Empirical Research Through to the End\u0026rdquo; is an article I wrote back in 2004, published in The Economist\u0026rsquo;s Teahouse. It drew a certain response, beyond my expectations, which also shows that empirical research is receiving more and more attention in China. At such a time, we do need some articles like this to help everyone clarify some understandings about econometrics. Today I especially want to help everyone clear up several misunderstandings — misunderstandings that happen to be ones I heard from students myself in the course of working with them, so they are not something I invented. The first misunderstanding is that empirical research is applied, and applied work is not academic enough and has little value, as if it only answers a question in reality and the conclusions found seem to be things we already knew. The second is a phrase everyone often says: empirical research is easy to do, easier than theoretical research, and when you can\u0026rsquo;t continue with theory you switch to empirical research. Speaking of which, this winter vacation I was just reunited with one of my former students, now a PhD student at KU Leuven in Belgium. Her recent work is related to social economics, and she does theory. When we met over the winter break and talked, I asked her, why don\u0026rsquo;t you do empirical work on this topic? She said empirical work is too hard. So I think that on some questions, it is not as everyone imagines — that when you can\u0026rsquo;t do theory you do empirics; it may well be the reverse: when you can\u0026rsquo;t do empirics you do theory. I\u0026rsquo;ll talk about the relationship between empirics and theory later, and I\u0026rsquo;ll tell everyone that both theory and empirics are very important and complementary. Third, students often think empirical research is very simple: just put the data into the computer, the results come out, and you can write a paper. Once, a colleague said, with some self-deprecation: he felt very uneasy, because the data wasn\u0026rsquo;t collected by himself — much of the large-sample data we use was collected by others — and the idea wasn\u0026rsquo;t very new, not his own; then the programs were ready-made, Stata already coded. After that, we put data we didn\u0026rsquo;t collect and an idea that wasn\u0026rsquo;t too new into Stata, the results came out, and we felt very uneasy. And our students think that a master of economic research should be full of mathematical symbols plus programs they wrote themselves, and then draw very fancy figures — that\u0026rsquo;s what counts as high level. The fourth misunderstanding is that many students think that when we now study China\u0026rsquo;s problems, we should do theory, because theory is in line with international standards. Especially for beginners: when taking the master\u0026rsquo;s and doctoral entrance exams in economics, you are tested on micro and macro, and in your first year you take a great deal of micro and macro theory, so you feel that is the mainstream of economics and only that is prestigious; even when doing research on China, you should write China\u0026rsquo;s problems as mathematics, or simply not do research related to China at all. Is that really so? Should Chinese economics research really do theory first? The questions I\u0026rsquo;m going to talk about next are an attempt to clear away the misunderstandings in everyone\u0026rsquo;s minds. Today I will cover these questions: first, why do we do empirical research? Second, what is the relationship between empirics and theory, including ideas? Third, what is the relationship between empirical research and the development of Chinese economics? Fourth, how do you complete a piece of empirical research? 1. Why Do Empirical Research?\rI think the functions of empirical research in the process of modern economic research and development are as follows: First, empirical research is used to test theory. Because for econ","date":"2023-06-11","heading":"Lu Ming: Experience and Advice for Scholars Doing Empirical Research","objectID":"/en/posts/xz/:2:3","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#lu-ming-experience-and-advice-for-scholars-doing-empirical-research"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":"Lu Ming: Experience and Advice for Scholars Doing Empirical Research\rSource: Econometrics Circle \u0026ldquo;Carrying Empirical Research Through to the End\u0026rdquo; is an article I wrote back in 2004, published in The Economist\u0026rsquo;s Teahouse. It drew a certain response, beyond my expectations, which also shows that empirical research is receiving more and more attention in China. At such a time, we do need some articles like this to help everyone clarify some understandings about econometrics. Today I especially want to help everyone clear up several misunderstandings — misunderstandings that happen to be ones I heard from students myself in the course of working with them, so they are not something I invented. The first misunderstanding is that empirical research is applied, and applied work is not academic enough and has little value, as if it only answers a question in reality and the conclusions found seem to be things we already knew. The second is a phrase everyone often says: empirical research is easy to do, easier than theoretical research, and when you can\u0026rsquo;t continue with theory you switch to empirical research. Speaking of which, this winter vacation I was just reunited with one of my former students, now a PhD student at KU Leuven in Belgium. Her recent work is related to social economics, and she does theory. When we met over the winter break and talked, I asked her, why don\u0026rsquo;t you do empirical work on this topic? She said empirical work is too hard. So I think that on some questions, it is not as everyone imagines — that when you can\u0026rsquo;t do theory you do empirics; it may well be the reverse: when you can\u0026rsquo;t do empirics you do theory. I\u0026rsquo;ll talk about the relationship between empirics and theory later, and I\u0026rsquo;ll tell everyone that both theory and empirics are very important and complementary. Third, students often think empirical research is very simple: just put the data into the computer, the results come out, and you can write a paper. Once, a colleague said, with some self-deprecation: he felt very uneasy, because the data wasn\u0026rsquo;t collected by himself — much of the large-sample data we use was collected by others — and the idea wasn\u0026rsquo;t very new, not his own; then the programs were ready-made, Stata already coded. After that, we put data we didn\u0026rsquo;t collect and an idea that wasn\u0026rsquo;t too new into Stata, the results came out, and we felt very uneasy. And our students think that a master of economic research should be full of mathematical symbols plus programs they wrote themselves, and then draw very fancy figures — that\u0026rsquo;s what counts as high level. The fourth misunderstanding is that many students think that when we now study China\u0026rsquo;s problems, we should do theory, because theory is in line with international standards. Especially for beginners: when taking the master\u0026rsquo;s and doctoral entrance exams in economics, you are tested on micro and macro, and in your first year you take a great deal of micro and macro theory, so you feel that is the mainstream of economics and only that is prestigious; even when doing research on China, you should write China\u0026rsquo;s problems as mathematics, or simply not do research related to China at all. Is that really so? Should Chinese economics research really do theory first? The questions I\u0026rsquo;m going to talk about next are an attempt to clear away the misunderstandings in everyone\u0026rsquo;s minds. Today I will cover these questions: first, why do we do empirical research? Second, what is the relationship between empirics and theory, including ideas? Third, what is the relationship between empirical research and the development of Chinese economics? Fourth, how do you complete a piece of empirical research? 1. Why Do Empirical Research?\rI think the functions of empirical research in the process of modern economic research and development are as follows: First, empirical research is used to test theory. Because for econ","date":"2023-06-11","heading":"1. Why Do Empirical Research?","objectID":"/en/posts/xz/:2:3","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#1-why-do-empirical-research"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":"Lu Ming: Experience and Advice for Scholars Doing Empirical Research\rSource: Econometrics Circle \u0026ldquo;Carrying Empirical Research Through to the End\u0026rdquo; is an article I wrote back in 2004, published in The Economist\u0026rsquo;s Teahouse. It drew a certain response, beyond my expectations, which also shows that empirical research is receiving more and more attention in China. At such a time, we do need some articles like this to help everyone clarify some understandings about econometrics. Today I especially want to help everyone clear up several misunderstandings — misunderstandings that happen to be ones I heard from students myself in the course of working with them, so they are not something I invented. The first misunderstanding is that empirical research is applied, and applied work is not academic enough and has little value, as if it only answers a question in reality and the conclusions found seem to be things we already knew. The second is a phrase everyone often says: empirical research is easy to do, easier than theoretical research, and when you can\u0026rsquo;t continue with theory you switch to empirical research. Speaking of which, this winter vacation I was just reunited with one of my former students, now a PhD student at KU Leuven in Belgium. Her recent work is related to social economics, and she does theory. When we met over the winter break and talked, I asked her, why don\u0026rsquo;t you do empirical work on this topic? She said empirical work is too hard. So I think that on some questions, it is not as everyone imagines — that when you can\u0026rsquo;t do theory you do empirics; it may well be the reverse: when you can\u0026rsquo;t do empirics you do theory. I\u0026rsquo;ll talk about the relationship between empirics and theory later, and I\u0026rsquo;ll tell everyone that both theory and empirics are very important and complementary. Third, students often think empirical research is very simple: just put the data into the computer, the results come out, and you can write a paper. Once, a colleague said, with some self-deprecation: he felt very uneasy, because the data wasn\u0026rsquo;t collected by himself — much of the large-sample data we use was collected by others — and the idea wasn\u0026rsquo;t very new, not his own; then the programs were ready-made, Stata already coded. After that, we put data we didn\u0026rsquo;t collect and an idea that wasn\u0026rsquo;t too new into Stata, the results came out, and we felt very uneasy. And our students think that a master of economic research should be full of mathematical symbols plus programs they wrote themselves, and then draw very fancy figures — that\u0026rsquo;s what counts as high level. The fourth misunderstanding is that many students think that when we now study China\u0026rsquo;s problems, we should do theory, because theory is in line with international standards. Especially for beginners: when taking the master\u0026rsquo;s and doctoral entrance exams in economics, you are tested on micro and macro, and in your first year you take a great deal of micro and macro theory, so you feel that is the mainstream of economics and only that is prestigious; even when doing research on China, you should write China\u0026rsquo;s problems as mathematics, or simply not do research related to China at all. Is that really so? Should Chinese economics research really do theory first? The questions I\u0026rsquo;m going to talk about next are an attempt to clear away the misunderstandings in everyone\u0026rsquo;s minds. Today I will cover these questions: first, why do we do empirical research? Second, what is the relationship between empirics and theory, including ideas? Third, what is the relationship between empirical research and the development of Chinese economics? Fourth, how do you complete a piece of empirical research? 1. Why Do Empirical Research?\rI think the functions of empirical research in the process of modern economic research and development are as follows: First, empirical research is used to test theory. Because for econ","date":"2023-06-11","heading":"2. What Is the Relationship Between Empirics and Theory?","objectID":"/en/posts/xz/:2:3","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#2-what-is-the-relationship-between-empirics-and-theory"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":"Lu Ming: Experience and Advice for Scholars Doing Empirical Research\rSource: Econometrics Circle \u0026ldquo;Carrying Empirical Research Through to the End\u0026rdquo; is an article I wrote back in 2004, published in The Economist\u0026rsquo;s Teahouse. It drew a certain response, beyond my expectations, which also shows that empirical research is receiving more and more attention in China. At such a time, we do need some articles like this to help everyone clarify some understandings about econometrics. Today I especially want to help everyone clear up several misunderstandings — misunderstandings that happen to be ones I heard from students myself in the course of working with them, so they are not something I invented. The first misunderstanding is that empirical research is applied, and applied work is not academic enough and has little value, as if it only answers a question in reality and the conclusions found seem to be things we already knew. The second is a phrase everyone often says: empirical research is easy to do, easier than theoretical research, and when you can\u0026rsquo;t continue with theory you switch to empirical research. Speaking of which, this winter vacation I was just reunited with one of my former students, now a PhD student at KU Leuven in Belgium. Her recent work is related to social economics, and she does theory. When we met over the winter break and talked, I asked her, why don\u0026rsquo;t you do empirical work on this topic? She said empirical work is too hard. So I think that on some questions, it is not as everyone imagines — that when you can\u0026rsquo;t do theory you do empirics; it may well be the reverse: when you can\u0026rsquo;t do empirics you do theory. I\u0026rsquo;ll talk about the relationship between empirics and theory later, and I\u0026rsquo;ll tell everyone that both theory and empirics are very important and complementary. Third, students often think empirical research is very simple: just put the data into the computer, the results come out, and you can write a paper. Once, a colleague said, with some self-deprecation: he felt very uneasy, because the data wasn\u0026rsquo;t collected by himself — much of the large-sample data we use was collected by others — and the idea wasn\u0026rsquo;t very new, not his own; then the programs were ready-made, Stata already coded. After that, we put data we didn\u0026rsquo;t collect and an idea that wasn\u0026rsquo;t too new into Stata, the results came out, and we felt very uneasy. And our students think that a master of economic research should be full of mathematical symbols plus programs they wrote themselves, and then draw very fancy figures — that\u0026rsquo;s what counts as high level. The fourth misunderstanding is that many students think that when we now study China\u0026rsquo;s problems, we should do theory, because theory is in line with international standards. Especially for beginners: when taking the master\u0026rsquo;s and doctoral entrance exams in economics, you are tested on micro and macro, and in your first year you take a great deal of micro and macro theory, so you feel that is the mainstream of economics and only that is prestigious; even when doing research on China, you should write China\u0026rsquo;s problems as mathematics, or simply not do research related to China at all. Is that really so? Should Chinese economics research really do theory first? The questions I\u0026rsquo;m going to talk about next are an attempt to clear away the misunderstandings in everyone\u0026rsquo;s minds. Today I will cover these questions: first, why do we do empirical research? Second, what is the relationship between empirics and theory, including ideas? Third, what is the relationship between empirical research and the development of Chinese economics? Fourth, how do you complete a piece of empirical research? 1. Why Do Empirical Research?\rI think the functions of empirical research in the process of modern economic research and development are as follows: First, empirical research is used to test theory. Because for econ","date":"2023-06-11","heading":"3. What Is the Relationship Between Empirical Research and the Development of Chinese Economics?","objectID":"/en/posts/xz/:2:3","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#3-what-is-the-relationship-between-empirical-research-and-the-development-of-chinese-economics"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":"Lu Ming: Experience and Advice for Scholars Doing Empirical Research\rSource: Econometrics Circle \u0026ldquo;Carrying Empirical Research Through to the End\u0026rdquo; is an article I wrote back in 2004, published in The Economist\u0026rsquo;s Teahouse. It drew a certain response, beyond my expectations, which also shows that empirical research is receiving more and more attention in China. At such a time, we do need some articles like this to help everyone clarify some understandings about econometrics. Today I especially want to help everyone clear up several misunderstandings — misunderstandings that happen to be ones I heard from students myself in the course of working with them, so they are not something I invented. The first misunderstanding is that empirical research is applied, and applied work is not academic enough and has little value, as if it only answers a question in reality and the conclusions found seem to be things we already knew. The second is a phrase everyone often says: empirical research is easy to do, easier than theoretical research, and when you can\u0026rsquo;t continue with theory you switch to empirical research. Speaking of which, this winter vacation I was just reunited with one of my former students, now a PhD student at KU Leuven in Belgium. Her recent work is related to social economics, and she does theory. When we met over the winter break and talked, I asked her, why don\u0026rsquo;t you do empirical work on this topic? She said empirical work is too hard. So I think that on some questions, it is not as everyone imagines — that when you can\u0026rsquo;t do theory you do empirics; it may well be the reverse: when you can\u0026rsquo;t do empirics you do theory. I\u0026rsquo;ll talk about the relationship between empirics and theory later, and I\u0026rsquo;ll tell everyone that both theory and empirics are very important and complementary. Third, students often think empirical research is very simple: just put the data into the computer, the results come out, and you can write a paper. Once, a colleague said, with some self-deprecation: he felt very uneasy, because the data wasn\u0026rsquo;t collected by himself — much of the large-sample data we use was collected by others — and the idea wasn\u0026rsquo;t very new, not his own; then the programs were ready-made, Stata already coded. After that, we put data we didn\u0026rsquo;t collect and an idea that wasn\u0026rsquo;t too new into Stata, the results came out, and we felt very uneasy. And our students think that a master of economic research should be full of mathematical symbols plus programs they wrote themselves, and then draw very fancy figures — that\u0026rsquo;s what counts as high level. The fourth misunderstanding is that many students think that when we now study China\u0026rsquo;s problems, we should do theory, because theory is in line with international standards. Especially for beginners: when taking the master\u0026rsquo;s and doctoral entrance exams in economics, you are tested on micro and macro, and in your first year you take a great deal of micro and macro theory, so you feel that is the mainstream of economics and only that is prestigious; even when doing research on China, you should write China\u0026rsquo;s problems as mathematics, or simply not do research related to China at all. Is that really so? Should Chinese economics research really do theory first? The questions I\u0026rsquo;m going to talk about next are an attempt to clear away the misunderstandings in everyone\u0026rsquo;s minds. Today I will cover these questions: first, why do we do empirical research? Second, what is the relationship between empirics and theory, including ideas? Third, what is the relationship between empirical research and the development of Chinese economics? Fourth, how do you complete a piece of empirical research? 1. Why Do Empirical Research?\rI think the functions of empirical research in the process of modern economic research and development are as follows: First, empirical research is used to test theory. Because for econ","date":"2023-06-11","heading":"4. How Do You Complete a Piece of Empirical Research?","objectID":"/en/posts/xz/:2:3","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#4-how-do-you-complete-a-piece-of-empirical-research"},{"categories":["Reading","Economic Studies"],"collections":["Academic Rhetoric"],"content":"Lu Ming: Experience and Advice for Scholars Doing Empirical Research\rSource: Econometrics Circle \u0026ldquo;Carrying Empirical Research Through to the End\u0026rdquo; is an article I wrote back in 2004, published in The Economist\u0026rsquo;s Teahouse. It drew a certain response, beyond my expectations, which also shows that empirical research is receiving more and more attention in China. At such a time, we do need some articles like this to help everyone clarify some understandings about econometrics. Today I especially want to help everyone clear up several misunderstandings — misunderstandings that happen to be ones I heard from students myself in the course of working with them, so they are not something I invented. The first misunderstanding is that empirical research is applied, and applied work is not academic enough and has little value, as if it only answers a question in reality and the conclusions found seem to be things we already knew. The second is a phrase everyone often says: empirical research is easy to do, easier than theoretical research, and when you can\u0026rsquo;t continue with theory you switch to empirical research. Speaking of which, this winter vacation I was just reunited with one of my former students, now a PhD student at KU Leuven in Belgium. Her recent work is related to social economics, and she does theory. When we met over the winter break and talked, I asked her, why don\u0026rsquo;t you do empirical work on this topic? She said empirical work is too hard. So I think that on some questions, it is not as everyone imagines — that when you can\u0026rsquo;t do theory you do empirics; it may well be the reverse: when you can\u0026rsquo;t do empirics you do theory. I\u0026rsquo;ll talk about the relationship between empirics and theory later, and I\u0026rsquo;ll tell everyone that both theory and empirics are very important and complementary. Third, students often think empirical research is very simple: just put the data into the computer, the results come out, and you can write a paper. Once, a colleague said, with some self-deprecation: he felt very uneasy, because the data wasn\u0026rsquo;t collected by himself — much of the large-sample data we use was collected by others — and the idea wasn\u0026rsquo;t very new, not his own; then the programs were ready-made, Stata already coded. After that, we put data we didn\u0026rsquo;t collect and an idea that wasn\u0026rsquo;t too new into Stata, the results came out, and we felt very uneasy. And our students think that a master of economic research should be full of mathematical symbols plus programs they wrote themselves, and then draw very fancy figures — that\u0026rsquo;s what counts as high level. The fourth misunderstanding is that many students think that when we now study China\u0026rsquo;s problems, we should do theory, because theory is in line with international standards. Especially for beginners: when taking the master\u0026rsquo;s and doctoral entrance exams in economics, you are tested on micro and macro, and in your first year you take a great deal of micro and macro theory, so you feel that is the mainstream of economics and only that is prestigious; even when doing research on China, you should write China\u0026rsquo;s problems as mathematics, or simply not do research related to China at all. Is that really so? Should Chinese economics research really do theory first? The questions I\u0026rsquo;m going to talk about next are an attempt to clear away the misunderstandings in everyone\u0026rsquo;s minds. Today I will cover these questions: first, why do we do empirical research? Second, what is the relationship between empirics and theory, including ideas? Third, what is the relationship between empirical research and the development of Chinese economics? Fourth, how do you complete a piece of empirical research? 1. Why Do Empirical Research?\rI think the functions of empirical research in the process of modern economic research and development are as follows: First, empirical research is used to test theory. Because for econ","date":"2023-06-11","heading":"5. Some Comments","objectID":"/en/posts/xz/:2:3","tags":["Literature"],"title":"Repost: Writing Advice","uri":"/en/posts/xz/#5-some-comments"},{"categories":["Film and TV"],"collections":[],"content":" It was only after a long, long time that I began to understand—in the sorrow of the last emperor, \u0026ldquo;the last\u0026rdquo; far outweighs \u0026ldquo;the emperor.\u0026rdquo; When the whip of history drives forward, it does not stop lashing because of the traveler\u0026rsquo;s identity; it simply, monotonously repeats the actions of closing and opening doors, always ready to close the next one. History has no emotions; the suffering and happiness of life merely push people forward, adding fuel to an indifferent flame. This carriage does not care who is outside, brushing off the rising dust, even though those lingering outside were once the masters of the carriage. This \u0026ldquo;door\u0026rdquo; is the spokesperson of history in the film, embodying the dual meanings of \u0026ldquo;connection and separation.\u0026rdquo; It is majestic, for we cannot see the other side of the era; It is stern, capable of isolating a person at the end of an era; It is merciful, allowing everyone to sense the possibility of crossing over. The Last Emperor—the noblest person, the one who cannot catch up, the door that cannot be opened; Suzume—the distance between death and everyday life is just a door; The Whale—does the self-saver have the courage to cross the threshold of sorrow? It’s just that during this period, I abruptly watched a series of movies, all of which involved doors, so much so that when I began to look back, a tall door always appeared before my eyes. And the reality of the siege, the surge of artificial intelligence, feels like another opening and closing of a door, leaving people from two eras staring at each other. If the wise have already sensed the existence of the door, what would they say about their own powerlessness? Perhaps only when a person passes through doors of various shapes and sizes can they get closer to the door of history, but they will also be blocked by the next door they cannot pass through. Just a sigh: In the vastness of life, we are but fleeting travelers. ———————— By the way: They say this AI is the next industrial revolution. Although I use GPT very happily, I still have doubts. Because an industrial revolution requires an energy revolution as its foundation, and currently, GPT Plus is constantly shrinking and halting sales due to reaching a bottleneck in computing power. 5G is strong, but the cost of materials greatly limits its spread. Without an energy revolution, AI\u0026rsquo;s computing power is insufficient, which greatly restricts its potential. Also, everything about AI is currently in the experimental stage, like Go. AI has not brought much displacement; the industries it has spawned are mostly tools. Recently, the most popular thing is that a simple bug can defeat KATAgo by exploiting a small weakness, showing that once a bug in AI is found, it can paralyze everything. Therefore, AI can only be a tool. For example, no matter how much autonomous vehicle technology develops, as long as the road shape remains unchanged, it will never pass review. Language models are only a part of intelligence, and it is hard to say directly that they can surpass humans. ","date":"2023-05-29","heading":"","objectID":"/en/posts/moviedoor/:0:0","tags":["Movies"],"title":"2023 Movie Talk: The Other Side of the Door","uri":"/en/posts/moviedoor/#"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Microdata example\rThe predecessors have covered it thoroughly; I\u0026rsquo;ve only lightly stepped in a few pits. Main software: stata, EXCEL, SAS. ","date":"2023-03-14","heading":"","objectID":"/en/posts/data/:0:0","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"1. Popular domestic databases:\rMost microdata database files are mainly in DTA, SAS, and EXCEL formats. They\u0026rsquo;re split by subject (community questionnaire, household questionnaire, social files) and by theme (background info, health, economy\u0026hellip;). Each year\u0026rsquo;s cross-section data is also separate, so you need to process it into panel data yourself. Apply on the official site with a student email. Application experience: CFPS\\CHARLS\\CHIP\\CGSS have a very good application experience. It\u0026rsquo;s just that the site occasionally crashes and won\u0026rsquo;t open, so once your application is approved, I suggest downloading all the data right away. ","date":"2023-03-14","heading":"1. Popular domestic databases:","objectID":"/en/posts/data/:1:0","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#1-popular-domestic-databases"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Large, comprehensive databases\rCFPS: www.isss.pku.edu.cn/cfps/ China Education Panel Survey: CFPS is implemented by the Institute of Social Science Survey (ISSS) at Peking University. It tracks data at three levels — individual, household, and community — reflecting changes in Chinese society, economy, population, education, and health, and provides a data foundation for academic research and public policy analysis. CMDS: Data application (chinaldrk.org.cn) China Migrants Dynamic Survey: A large-scale annual national sampling survey of the migrant population conducted by the National Health Commission since 2009. Its content covers basic information about the migrant population and their family members, migration range and trends, employment and social security, income and expenditure and housing, basic public health services, marriage/childbearing and family planning service management, children\u0026rsquo;s migration and education, psychological culture, and more. CMDS has stopped updating\rCHARLS: China Health and Retirement Longitudinal Study (pku.edu.cn) China Health and Retirement Longitudinal Study: China Health and Retirement Longitudinal Study. A large interdisciplinary survey project hosted by the National School of Development at Peking University and executed by the Institute of Social Science Survey, representing high-quality microdata on households and individuals aged 45 and above in China. CSS: Chinese Social Survey (http://css.cssn.cn/css_sy/) Chinese Social Survey: A nationwide large-scale continuous sampling survey project initiated by the Institute of Sociology at the Chinese Academy of Social Sciences in 2005. Its purpose is to obtain data on social change in China during the transitional period through long-term longitudinal surveys of the public\u0026rsquo;s employment, family and social life, social attitudes, and more, thereby providing detailed and scientific basic information for social science research and government decision-making. Currently, eight waves of CSS data — 2006, 2008, 2022, 2013, 2015, 2017, 2019, and 2021 — have been made open to the public. CHIP: China Household Income Project (http://www.ciidbnu.org/) China Household Income Project: Launched by the Income Distribution Research Institute at Beijing Normal University1. The project aims to collect household survey data for potentially useful empirical analysis of trends in China after reform and opening up, such as income, inequality, and poverty. CGSS: China Household Income Survey (http://www.cnsda.org/) Chinese General Social Survey (CGSS) is China\u0026rsquo;s first nationwide, comprehensive, and continuous large-scale social survey project. Its purpose is to periodically and systematically collect data on all aspects of Chinese people and Chinese society, summarize the long-term trends of social change, explore social issues of major theoretical and practical significance, promote the openness and sharing of domestic social science research, and provide data for government decision-making and international comparative research. China Statistical Yearbook: city data, regional data\u0026hellip; The panel data organized from this is all over the internet. Others: for example, there\u0026rsquo;s also the China Household Finance Survey CHFS (https://chfser.swufe.edu.cn/datasso/Home/Login?4813085540248732983). We can also use some small specialized databases to supplement the main databases for analysis. For example, the Peking University Digital Inclusive Finance Index: Peking University Digital Inclusive Finance Index, the Innovation and Entrepreneurship Index, the Government Governance Index\u0026hellip; For example, when it comes to measuring urban digital economy nowadays, most people use Zhao Tao\u0026rsquo;s (2020)2 method, taking the urban statistical yearbook + inclusive finance data as indicators. With the \u0026ldquo;digital economy\u0026rdquo; craze, who knows how many people\u0026rsquo;s first econometrics paper started with digital economy, urban resilience,,,,,, There are","date":"2023-03-14","heading":"Large, comprehensive databases","objectID":"/en/posts/data/:1:1","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#large-comprehensive-databases"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"2. Cleaning approach and its purpose\rWhat exactly does cleaning data involve? Basically these tasks. Table matching: match and merge different database tables, aiming to integrate and screen indicators, divided into horizontal and vertical matching. Removing bad data: remove bad data. For example, blank data, extreme data, unneeded data\u0026hellip; Filling in blank data: fill in data. For panel data and time series, we often use linear interpolation to fill in missing values in the middle or at the edges. Data aggregation: build indicators through specific methods, like principal components, entropy weighting, analytic hierarchy process\u0026hellip; The most important thing is to master the W!O!R!K!F!L!O!W! When running regressions, \u0026ldquo;not enough variables\u0026rdquo;, \u0026ldquo;lost variables\u0026rdquo; and other disasters usually happen; we may need to go back at any time to update variables and check where mistakes happened, so keeping a complete workflow folder is very necessary. Workflow\rRule of thumb!!!!! Keep one folder for raw data, one folder for after table matching, and one more folder for the cleaning process! Writing code so that it runs smoothly from data cleaning all the way to outputting results in one breath — that\u0026rsquo;s the highest level of a pipeline! First, it lets us present each work step for easy checking; second, it makes it convenient to \u0026ldquo;redo\u0026rdquo; from any intermediate step. ","date":"2023-03-14","heading":"2. Cleaning approach and its purpose","objectID":"/en/posts/data/:2:0","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#2-cleaning-approach-and-its-purpose"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"3. STATA operations\r","date":"2023-03-14","heading":"3. STATA operations","objectID":"/en/posts/data/:3:0","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#3-stata-operations"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Recommended tutorials\rOne tutorial video is enough (two hours): The intro mentions this uploader\u0026rsquo;s personal github homepage (screen recordings and do files) ","date":"2023-03-14","heading":"Recommended tutorials","objectID":"/en/posts/data/:3:1","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#recommended-tutorials"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"Some situations I\u0026rsquo;ve encountered personally\r","date":"2023-03-14","heading":"Some situations I\u0026rsquo;ve encountered personally","objectID":"/en/posts/data/:3:2","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#some-situations-ive-encountered-personally"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"1. Transcoding when importing Chinese databases\rChinese garbled text — either upgrade your statastata version, or use code The two methods actually do the same thing. Method 1: encountered when processing cmdscmds ** clear cd \"C:\\Users\\Desktop\\转码\" // create a new transcoding folder, then change to your own path unicode encoding set gb18030 unicode analyze 流动人口数据个人问卷2018.dta // adjust the filename to your own data unicode translate 流动人口数据个人问卷2018.dta, invalid // adjust the filename to your own data\rMethod 2: encountered when processing the PSU. Dta4 of charlscharls , where provinces and cities were garbled cd \"D:\\household_and_community_questionnaire_data\" //set the file storage location unicode analyze PSU.dta //replace PSU.dta with the file to be compiled unicode encoding set \"GB18030\" unicode retranslate psu.dta, transutf8\r","date":"2023-03-14","heading":"1. Transcoding when importing Chinese databases","objectID":"/en/posts/data/:3:3","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#1-transcoding-when-importing-chinese-databases"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"2. Matching databases\rIt basically revolves around integrating around the sample\u0026rsquo;s ID, yearID, and year. img\rStata matching code — only brief explanations below //master_data.dta is the base database, using_data.dta is the database we want to match onto it //m:n id means m ids in the first data can correspond to n sample ids in the second database //In short, m:n is many-to-one, n:n is 1-to-1, m:m is many-to-many // So we can also add multiple matching conditions, e.g. merge 1:1 id year treat ...... ************horizontal match 1************************** use \"master_data.dta\" merge m:n id using \"using_data.dta\" drop _merge save \"new_data.dta\" ************horizontal match 2************************** use \"master_data.dta\" joinby id using \"using_data.dta\" ************vertical match************************** use \"data1.dta\" append using \"data2.dta\" save \"new_data.dta\"\rAbout horizontal matching\rmerge is suitable when the identifier of the matching side or the matched side is unique. For one-to-many matching, e.g. when the master data\u0026rsquo;s identifier is unique but the matched data repeats, with each repeated identifier row missing different variables, you can use merge\u0026rsquo;s append-match subcommand to only update the missing part each time. use \"master_data.dta\" merge 1:m id using \"using_data.dta\", update nogen force\rFor many-to-many matching, you need to use joinby. For details, see: Many-to-many merge - merge - joinby ","date":"2023-03-14","heading":"2. Matching databases","objectID":"/en/posts/data/:3:4","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#2-matching-databases"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"3. Quickly selecting variables\rShortcuts like Shift\\ctrl are basically universal in software design; once you use them a lot, you can apply them to other software too. There\u0026rsquo;s a variable window in the top-right of Stata. Right-click to get select-all and other options; it can also serve as a search box. Simultaneous selection is ctrl+multiple clicks. If you need to select a dozen scattered variables at once, use it actively. To select a middle range, click one variable, then shift+click another variable, and it selects the middle range. For example, you can first right-click, select all, then ctrl+click to remove the variables you don\u0026rsquo;t want; For example, to check the completeness of specific data, name them \u0026ldquo;x_i\u0026rdquo; first during processing, then filter for those named x and select all. Before python has this kind of window, I won\u0026rsquo;t consider running regressions superior to stata\r","date":"2023-03-14","heading":"3. Quickly selecting variables","objectID":"/en/posts/data/:3:5","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#3-quickly-selecting-variables"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"4. Interpolation\rLinear interpolation, panel data. As usual for panel data, first mark the individual id and year id, xtset id year by id: ipolate YY year,gen(YYY) //interpolation, middle missing values, named as new variable YYY after filling by id: ipolate XX year,gen(XXX) epolate //extrapolation, edge missing values, named as new variable XXX after filling\rMy suggestion is, use forvalues whenever you can5, and make good use of variable macros. Once you know the basic loop commands + variable nesting + conditional filter commands, writing code becomes free-flowing. For example, the following batch interpolation loop: $var_i \\stackrel{interpolate}{\\longrightarrow}varx_i\\stackrel{extrapolate}{\\longrightarrow}varn_i\\stackrel{replace}{\\longrightarrow}var_i\\stackrel{delete}{\\longrightarrow}varx_i $ global var var0 var1 var2 var3 genshin *pack up all the variables to be interpolated foreach i in $var { by id: ipolate `i' year,gen(varx`i') by id: ipolate varx`i' year,gen(varn`i') epolate replace `i' = varn`i' drop varx`i' varn`i' } Similarly, cleaning bad data in questionnaire data is the same loop global var var0 var1 var2 var3 genshin *pack up all the variables to be interpolated foreach i in $var { drop if `i' == -88 drop if `i' == -99 drop if `i' ==. drop if `i' \u003c=0 } The internet also circulates a \u0026ldquo;one-click significance\u0026rdquo; cleaning. The idea is to brute-force permute the control variables, and later even start screening samples. My view: you can look at the control-variable-selection code, but don\u0026rsquo;t casually touch the samples. A core soul of econometrics is the \u0026ldquo;randomized experiment\u0026rdquo;; interfering with sample selection easily breaks data randomness, which is basically fabrication. (Though purely in terms of code thinking, this does show that once you\u0026rsquo;ve mastered the filtering, judging, and looping commands, there\u0026rsquo;s already a lot you can do. The same cleaning task — how you combine the algorithms is what tests the person.) ","date":"2023-03-14","heading":"4. Interpolation","objectID":"/en/posts/data/:3:6","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#4-interpolation"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"5. Converting characters to numbers:\rFor example, the communityID in the charls database exists in character form. Although Chinese can be used as a variable name to match, when it\u0026rsquo;s too long stata seems unable to process it. Use the command to force convert to numbers: destring ID householdID communityID , replace force *add force, justice is served!\r","date":"2023-03-14","heading":"5.","objectID":"/en/posts/data/:3:7","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#5-converting-characters-to-numbers"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"6. Date transcoding6\rSometimes the date codes we download can\u0026rsquo;t be recognized by stata, in which case we need the date function. For example, in a class assignment, I wanted to show China\u0026rsquo;s confidence! Give the teacher a little Chinese shock. (This is China.jpg) I used iiMedia\u0026rsquo;s Huawei and Apple laptop Taobao data. ps: at the time I also found export trade data for China, Japan, Russia, and the US; data source World Bank. But awkwardly, the date format loaded from Excel was Y-M-D, which stata can\u0026rsquo;t directly recognize. 2 is Huawei, 1 is Apple; sales is number, date is the year column\rUsing the code (I found it on the Jinggu forum): clear import excel \"E:\\桌面\\笔记本.xlsx\", sheet(\"Sheet1\") firstrow generate date=date(year,\"YMD\") //recognize the date format date %td //further conversion\rGreen is Apple, gold is Huawei. You can see that after processing, date becomes a special date form, and it can be directly used to draw scatter plots in stata. The original plot is gone, so I just redrew it simply; please ignore this garish color scheme\rGreen is Apple, gold is Huawei. You can see that after processing, date becomes a special date form, and it can be directly used to draw scatter plots in stata. The original plot is gone, so I just redrew it simply; please ignore this garish color scheme. Another example, a dataset about air pollution. In Excel, the date column is in \u0026ldquo;short date format\u0026rdquo; img\rImport into stata, use the date function to plot generate year=date(date, \"YMD\") //recognize the date format year %td //further conversion\rFrom this plot it\u0026rsquo;s easy to see seasonality\rFrom descriptive statistics plotting, we can see air pollution has seasonality. So we want to slice out the month separately for season numbering. generate month = month(year) //slice the month from the already-processed year date //for a more detailed explanation, see: https://stata-club.github.io/stata_article/2017-10-29.html gen spring = 1 if month == 3 |month == 4 | month == 5 replace spring = 0 if spring != 1 gen summer = 1 if month == 6 |month == 7 | month == 8 replace summer = 0 if summer != 1 gen fall = 1 if month == 9 |month == 10 | month == 11 replace fall = 0 if fall != 1 gen winter = 1 if month == 12 |month == 1 | month == 2 replace winter = 0 if winter != 1\rFitting by season classification shows the linear trend is more obvious. We find temperature and pollution are correlated, which is why the previous plot shows periodicity; we can also hypothesize that the lower the temperature, the more heating, heated beds, and coal use, leading to more air pollution\r","date":"2023-03-14","heading":"","objectID":"/en/posts/data/:3:8","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#6-date-transcoding"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"7. Deletion and conditional statements\rStata\u0026rsquo;s command to delete specific columns is the drop command. I suggest directly typing \u0026ldquo;h drop\u0026rdquo; to view the help. Making good use of if conditions and forvalues loops is when algorithmic ability is tested! What kind of data do you need to process, and what is your goal? How can the goal be decomposed, into what flow, which if conditions filter faster, and which forvalues loops can simplify your cleaning steps as quickly as possible? Make good use of stata\u0026rsquo;s do files and consider code reusability, so that after writing code, it can be reused in loops later, e.g. by only changing variable names. ","date":"2023-03-14","heading":"7. Deletion and conditional statements","objectID":"/en/posts/data/:3:9","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#7-deletion-and-conditional-statements"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"8. Winsorizing\rUse the winsor2 command, written by Lian Yujun. histogram var, ylabel(, angle(0)) xtitle(\"x-axis label\") name(image filename, replace) \\\\draw a frequency histogram to see the distribution winsor2 var, cut(0 97.5) trim replace \\\\remove the 2.5% extreme data on the right side of variable var\r","date":"2023-03-14","heading":"8. Winsorizing","objectID":"/en/posts/data/:3:10","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#8-winsorizing"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"9. Grouping\rGroup by the variable \u0026ldquo;border\u0026rdquo;, compute the corresponding variable for each group bysort 国界: egen 乡村振兴边境 = mean(乡村振兴) bysort 国界: egen 产业兴旺边境 = mean(产业兴旺) bysort 国界: egen 生态宜居边境 = mean(生态宜居) bysort 国界: egen 治理有效边境 = mean(治理有效) bysort 国界: egen 乡风文明边境 = mean(乡风文明) bysort 国界: egen 生活富裕边境 = mean(生活富裕)\r","date":"2023-03-14","heading":"9. Grouping","objectID":"/en/posts/data/:3:11","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#9-grouping"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"10. Sorting\rTo sort data from small to large according to some criteria, use the sort command sort year age income //first sort by year; within the same year, sort by age; same year and age, sort by income\r","date":"2023-03-14","heading":"10. Sorting","objectID":"/en/posts/data/:3:12","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#10-sorting"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"11. Removing duplicate rows\rduplicates drop var，force\r","date":"2023-03-14","heading":"11. Removing duplicate rows","objectID":"/en/posts/data/:3:13","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#11-removing-duplicate-rows"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"12. Extracting characters\rA Chinese character takes three positions gen x=substr(var,1,4)\r","date":"2023-03-14","heading":"12. Extracting characters","objectID":"/en/posts/data/:3:14","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#12-extracting-characters"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"12. Some descriptive statistics plots\rSome visualization code sites\rSDAS Stata Graph Gallery StataViz by Asjad Naqvi Stata Visual Library I recommend custom delimiters, which makes plotting commands more elegant: #delimit; ; gen di = year - branch_reform; eventdd entre_activation i.year lnagdp indust_stru finance ainternet market, timevar(di) //define the time dummy variable ci(rcap) //error bars noline //don't plot the confidence interval bar for period -1 method(fe) //to add autocorrelation clustering — method(fe,cluster(autocorrelation clustering)) baseline(0) //base year is 0 level(95) graph_op(ytitle(\"coefficients\") xtitle(\"Time\") xlabel(-10(2)14)); // cancel the custom line break #delimit cr\rCombining graphs graph combine \"a.gph\" \"b.gph\", col(1) xcommon ycommon\rBubble chart Seen in Stata draws advanced bubble charts, quite interesting sysuse auto,clear set scheme white_tableau //set the theme; you can set it according to your own preference twoway /// (scatter mpg weight [w= price] if foreign == 0 \u0026 price \u003c= 4220, msymbol(Oh) mcolor(\"220 235 136\") msize(small)) /// (scatter mpg weight [w= price] if foreign == 1 \u0026 price \u003c= 4220, msymbol(o) mcolor(\"220 235 136\") msize(small)) /// (scatter mpg weight [w= price] if foreign == 0 \u0026 (price \u003e 4220 \u0026 price \u003c= 6332), msymbol(Oh) mcolor(\"180 232 172\") msize(medium)) /// (scatter mpg weight [w= price] if foreign == 1 \u0026 (price \u003e 4220 \u0026 price \u003c= 6332), msymbol(o) mcolor(\"180 232 172\") msize(medium)) /// (scatter mpg weight [w= price] if foreign == 0 \u0026 price \u003e 6332, msymbol(Oh) mcolor(\"152 210 196\") msize(large)) /// (scatter mpg weight [w= price] if foreign == 1 \u0026 price \u003e 6332, msymbol(o) mcolor(\"152 210 196\") msize(large)), /// xlabel(2000(1000) 5000) ylabel(10(10)50) legend(label(1 \" \") label(2 \" \") label(3 \" \") label(4 \" \") label(5 \" \") label(6 \" \") order(2 4 6 1 3 5) row(2) ring(0) size(10) position(2) bmargin(medlarge)) text(45.3 3800 \"Foreign\", size(*0.7)) text(39.5 3800 \"Domestic\", size(*0.7)) text(49.5 4100 \"Low Price\", size(*0.7)) text(49.5 4450 \"Med Price\", size(*0.7)) text(49.5 4800 \"High Price\", size(*0.7)) //mycolor is RGB color codes; you can define them according to your preference; //xlabel and ylabel set the horizontal and vertical axis labels; legend sets the legend; text sets the specific position of text, format text(y-coordinate x-coordinate \"label text\")\rBubble scatter plot\rLine chart twoway /// (line var2 date if group==1) /// (line var2 date if group==2) /// (line var2 date if group==3) /// (line var2 date if group==4) /// (line var2 date if group==5) /// (line var2 date if group==6) /// (line var2 date if group==7) /// (line var2 date if group==8) /// (line var2 date if group==9) /// (line var2 date if group==10) /// (line var2 date if group==11) /// (line var2 date if group==12) /// , /// legend(order(1 \"group1\" 2 \"group2\" 3 \"group3\" 4 \"group4\" 5 \"group5\" 6 \"group6\" 7 \"group7\" 8 \"group8\" 9 \"group9\" 10 \"group10\" 11 \"group11\" 12 \"group12\")) /// title(\"Line plot\") /// note(\"The Stata Guide\", size(vsmall))\rPie chart graph pie var2 if group \u003c= 10, /// over(group) plabel(_all percent, format(%9.2f)) /// line(lcolor(black) lwidth(vvthin)) /// // outline colors have to be manually added title(\"Pie plot\") /// note(\"The Stata Guide\", size(vsmall))\rBox plot graph box /// var* /// , /// title(\"Box plot\") /// note(\"The Stata Guide\", size(vsmall))\rHistogram histogram var4, percent /// title(\"Histogram\") /// note(\"The Stata Guide\", size(vsmall))\rAdd a kernel density line histogram var4, /// ylabel(, angle(0)) /// xtitle(\"tax\") /// kdensity\rVertical bar chart graph bar /// var* /// , /// blabel(bar, format(%9.2f)) /// title(\"Bar graph\") /// note(\"The Stata Guide\", size(vsmall))\rHorizontal bar chart graph hbar (mean) /// var* /// if group \u003c= 6, /// over(group) /// percentages stack /// legend(order(1 \"Var 1\" 2 \"Var 2\" 3 \"Var 3\" 4 \"Var 4\" 5 \"Var 5\" 6 \"Var 6\")) /// title(\"Bar graph\") /// note(\"The Stata Guide\", size(vsmall))\rConfidence interval twoway /// (lpolyci var1 var9, fc","date":"2023-03-14","heading":"12. Some descriptive statistics plots","objectID":"/en/posts/data/:3:15","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#12-some-descriptive-statistics-plots"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"12. Some descriptive statistics plots\rSome visualization code sites\rSDAS Stata Graph Gallery StataViz by Asjad Naqvi Stata Visual Library I recommend custom delimiters, which makes plotting commands more elegant: #delimit; ; gen di = year - branch_reform; eventdd entre_activation i.year lnagdp indust_stru finance ainternet market, timevar(di) //define the time dummy variable ci(rcap) //error bars noline //don't plot the confidence interval bar for period -1 method(fe) //to add autocorrelation clustering — method(fe,cluster(autocorrelation clustering)) baseline(0) //base year is 0 level(95) graph_op(ytitle(\"coefficients\") xtitle(\"Time\") xlabel(-10(2)14)); // cancel the custom line break #delimit cr\rCombining graphs graph combine \"a.gph\" \"b.gph\", col(1) xcommon ycommon\rBubble chart Seen in Stata draws advanced bubble charts, quite interesting sysuse auto,clear set scheme white_tableau //set the theme; you can set it according to your own preference twoway /// (scatter mpg weight [w= price] if foreign == 0 \u0026 price \u003c= 4220, msymbol(Oh) mcolor(\"220 235 136\") msize(small)) /// (scatter mpg weight [w= price] if foreign == 1 \u0026 price \u003c= 4220, msymbol(o) mcolor(\"220 235 136\") msize(small)) /// (scatter mpg weight [w= price] if foreign == 0 \u0026 (price \u003e 4220 \u0026 price \u003c= 6332), msymbol(Oh) mcolor(\"180 232 172\") msize(medium)) /// (scatter mpg weight [w= price] if foreign == 1 \u0026 (price \u003e 4220 \u0026 price \u003c= 6332), msymbol(o) mcolor(\"180 232 172\") msize(medium)) /// (scatter mpg weight [w= price] if foreign == 0 \u0026 price \u003e 6332, msymbol(Oh) mcolor(\"152 210 196\") msize(large)) /// (scatter mpg weight [w= price] if foreign == 1 \u0026 price \u003e 6332, msymbol(o) mcolor(\"152 210 196\") msize(large)), /// xlabel(2000(1000) 5000) ylabel(10(10)50) legend(label(1 \" \") label(2 \" \") label(3 \" \") label(4 \" \") label(5 \" \") label(6 \" \") order(2 4 6 1 3 5) row(2) ring(0) size(10) position(2) bmargin(medlarge)) text(45.3 3800 \"Foreign\", size(*0.7)) text(39.5 3800 \"Domestic\", size(*0.7)) text(49.5 4100 \"Low Price\", size(*0.7)) text(49.5 4450 \"Med Price\", size(*0.7)) text(49.5 4800 \"High Price\", size(*0.7)) //mycolor is RGB color codes; you can define them according to your preference; //xlabel and ylabel set the horizontal and vertical axis labels; legend sets the legend; text sets the specific position of text, format text(y-coordinate x-coordinate \"label text\")\rBubble scatter plot\rLine chart twoway /// (line var2 date if group==1) /// (line var2 date if group==2) /// (line var2 date if group==3) /// (line var2 date if group==4) /// (line var2 date if group==5) /// (line var2 date if group==6) /// (line var2 date if group==7) /// (line var2 date if group==8) /// (line var2 date if group==9) /// (line var2 date if group==10) /// (line var2 date if group==11) /// (line var2 date if group==12) /// , /// legend(order(1 \"group1\" 2 \"group2\" 3 \"group3\" 4 \"group4\" 5 \"group5\" 6 \"group6\" 7 \"group7\" 8 \"group8\" 9 \"group9\" 10 \"group10\" 11 \"group11\" 12 \"group12\")) /// title(\"Line plot\") /// note(\"The Stata Guide\", size(vsmall))\rPie chart graph pie var2 if group \u003c= 10, /// over(group) plabel(_all percent, format(%9.2f)) /// line(lcolor(black) lwidth(vvthin)) /// // outline colors have to be manually added title(\"Pie plot\") /// note(\"The Stata Guide\", size(vsmall))\rBox plot graph box /// var* /// , /// title(\"Box plot\") /// note(\"The Stata Guide\", size(vsmall))\rHistogram histogram var4, percent /// title(\"Histogram\") /// note(\"The Stata Guide\", size(vsmall))\rAdd a kernel density line histogram var4, /// ylabel(, angle(0)) /// xtitle(\"tax\") /// kdensity\rVertical bar chart graph bar /// var* /// , /// blabel(bar, format(%9.2f)) /// title(\"Bar graph\") /// note(\"The Stata Guide\", size(vsmall))\rHorizontal bar chart graph hbar (mean) /// var* /// if group \u003c= 6, /// over(group) /// percentages stack /// legend(order(1 \"Var 1\" 2 \"Var 2\" 3 \"Var 3\" 4 \"Var 4\" 5 \"Var 5\" 6 \"Var 6\")) /// title(\"Bar graph\") /// note(\"The Stata Guide\", size(vsmall))\rConfidence interval twoway /// (lpolyci var1 var9, fc","date":"2023-03-14","heading":"Some visualization code sites","objectID":"/en/posts/data/:3:15","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#some-visualization-code-sites"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"13. Plotting styles\rSee the best plotting package I personally recommend the Rainbow and gg_tableau styles the most. The gg series imitates R\u0026rsquo;s default style. Rainbow is very bright, distinctive enough, and I also like the closed box with a pure white background. But note that the Rainbow style has a grid background by default, which makes customizing reference lines a bit inconvenient. ssc install schemepack, replace * set scheme white_tableau * set scheme black_tableau * set scheme gg_tableau * set scheme white_tableau * set scheme Rainbow The summary of styles is as follows — Series: Tableau - white_tableau black_tableau gg_tableau Cividis - white_cividis black_cividis gg_cividis Viridis - white_viridis black_viridis gg_viridis Hue - white_hue black_hue gg_hue BrBg - white_brbg black_brbg gg_brbg PiYg - white_piyg black_piyg gg_piyg pTol - white_ptol black_ptol gg_ptol Jet - white_jet black_jet gg_jet w3d - white_w3d black_w3d gg_w3d Standalones: Rainbow - rainbow Neon - neon Taylor Swift's Red - swift_red Ukraine - ukraine Colorblind-friendly schemes: Tab1 - tab1 Tab2 - tab2 Tab3 - tab3 cblind1 - cblind1 ","date":"2023-03-14","heading":"13. Plotting styles","objectID":"/en/posts/data/:3:16","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#13-plotting-styles"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"More:\rCommon Stata data-cleaning skills and knowledge, misallocation code ","date":"2023-03-14","heading":"More:","objectID":"/en/posts/data/:3:17","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#more"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"4. STATA to EXCEL\rHow to convert a dta file to excel? The code is: export excel using \"data.xlsx\", firstrow(variables)\rHere firstrow (variables) means the excel row keeps the variable names \u0026ldquo;data.xlsx\u0026rdquo; is the name of the file you save Correspondingly, to specify a save location, you can change it to \u0026ldquo;E:\\Desktop\\New folder (2)\\stata\\merge.dta\u0026rdquo; ","date":"2023-03-14","heading":"","objectID":"/en/posts/data/:4:0","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#4-stata-to-excel"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"5. EXCEL\r","date":"2023-03-14","heading":"5. EXCEL","objectID":"/en/posts/data/:5:0","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#5-excel"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"0. Common garbled text\rSome garbled excel/csv text like the ones below is due to wrong formatting. For example, in the figure below, adjusting the text box format to date fixes it. img\r","date":"2023-03-14","heading":"0. Common garbled text","objectID":"/en/posts/data/:5:1","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#0-common-garbled-text"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"1. The VLOOKUP function\rAfter using it a lot, I feel stata is much faster than Excel. For example, I did a task on descriptive statistics of rural revitalization levels, where I needed to show the number of villages above the mean for each indicator. In Excel this is fairly troublesome, involving judgment (if you haven\u0026rsquo;t mastered VBA); stata handles it much faster. global $xlist x1 x2 x3 x4 x5 foreach i in $xlist { egen b = mean(`i') gen a = 1*(b \u003c `i')+0*(b\u003e= `i') egen sum_`i' = sum(a) drop a drop b }\rThe easiest data to find and analyze in economics is definitely urban panel data, and city code matching is unavoidable Please refer to: link, which thoughtfully includes the city codes; many thanks! When using the vlookup function, you may also encounter a situation; excel\u0026rsquo;s format settings are truly bizarre! ","date":"2023-03-14","heading":"1. The VLOOKUP function","objectID":"/en/posts/data/:5:2","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#1-the-vlookup-function"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"2. Pivot tables\rUse it for simple counting and relatively complex grouped summation during cleaning. Insert - PivotTable. Excel\u0026rsquo;s current feature is quite smart, mainly very handy for cleaning panel data that needs accumulation. Note: the pivot table\u0026rsquo;s \u0026ldquo;sum function\u0026rdquo; requires the excel format to be \u0026ldquo;number\u0026rdquo;, while the \u0026ldquo;count function\u0026rdquo; has no format restriction. Sometimes data imported from excel img\rhas a format defaulting to \u0026ldquo;text\u0026rdquo;, and needs adjustment (at least first set it to \u0026ldquo;general\u0026rdquo; format). ","date":"2023-03-14","heading":"2. Pivot tables","objectID":"/en/posts/data/:5:3","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#2-pivot-tables"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"3. Splitting text\rAs far as econometrics goes, the current top-tier approach is DID. If your school has a student econometrics paper competition, it\u0026rsquo;s very likely pure \u0026ldquo;difference-in-differences\u0026rdquo; hand-to-hand combat (dog head) When doing DID, we need to manually record the policy variables. For example, smart cities and innovation cities piloted in three batches over several years. At this point we can\u0026rsquo;t foolishly copy-paste one by one; please use Excel\u0026rsquo;s text splitting. For example, splitting the set of pilot cities \u0026ldquo;Beijing, Chongqing, Tianjin, Shanghai\u0026rdquo;, you can select that cell, $Data\\Rightarrow Text to Columns$, In the \u0026ldquo;Text to Columns Wizard\u0026rdquo; dialog, choose \u0026ldquo;Delimited\u0026rdquo;, click \u0026ldquo;Next\u0026rdquo;, and check \u0026ldquo;,\u0026rdquo; in \u0026ldquo;Delimiters\u0026rdquo;. At this point the rows are split. Then combine with the VLOOKUP function to match. ","date":"2023-03-14","heading":"3. Splitting text","objectID":"/en/posts/data/:5:4","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#3-splitting-text"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"4. Deleting and modifying characters\rClever use of vlookup already handles most situations, but still not enough! The pits of data cleaning are hard to guard against Some Excel files have cityid as 1100, some as 110000 Some say Chengdu, some say Chengdu with the word \u0026ldquo;City\u0026rdquo; tacked on! Excel remove-character operation: A2=LEFT(A1,LEN(A1)-1) Excel add-character operation: A2=A1\u0026amp;\u0026ldquo;市\u0026rdquo; ","date":"2023-03-14","heading":"4. Deleting and modifying characters","objectID":"/en/posts/data/:5:5","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#4-deleting-and-modifying-characters"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"5. Database merging\rLook at the big screen! At first I thought Excel was quite beginner-ish to use this way, but after learning stata I realized merging data files is far more efficient than Excel. ","date":"2023-03-14","heading":"","objectID":"/en/posts/data/:5:6","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#5-database-merging"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"6. Closing\rThese days the Jinggu forum (经管之家) shut down, and I realized there\u0026rsquo;s nowhere to ask many basic stata questions,,,,, 90% of the problems were solved by methods found on Zhihu, the Jinggu forum, and Bilibili. Indeed the predecessors have covered it thoroughly; I\u0026rsquo;ve only lightly stepped in a few pits. ","date":"2023-03-14","heading":"6. Closing","objectID":"/en/posts/data/:6:0","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#6-closing"},{"categories":["Software Tools","Economic Studies"],"collections":["Stata Empirical Tools"],"content":"References\rThe chip\\cfps websites often crash, which is quite annoying\u0026#160;\u0026#x21a9;\u0026#xfe0e; Zhao Tao, Zhang Zhi, \u0026amp; Liang Shangkun. (2020). Digital Economy, Entrepreneurial Activity, and High-Quality Development — Empirical Evidence from Chinese Cities. Management World, 36(10), 65-76. https://doi.org/10.19744/j.cnki.11-1235/f.2020.0154[](https://www.sci-hub.ee/10.19744/j.cnki.11-1235/f.2020.0154)\u0026#160;\u0026#x21a9;\u0026#xfe0e; You can look into your own school\u0026rsquo;s library resources\u0026#160;\u0026#x21a9;\u0026#xfe0e; The province and city matched by the database sample id are in the 2013 data on its website, and are continued afterward but no longer updated in other years\u0026#160;\u0026#x21a9;\u0026#xfe0e; stata loop statements\u0026#160;\u0026#x21a9;\u0026#xfe0e; https://stata-club.github.io/stata_article/2017-10-29.html\u0026#160;\u0026#x21a9;\u0026#xfe0e; ","date":"2023-03-14","heading":"References","objectID":"/en/posts/data/:7:0","tags":["Microdata","Data Cleaning","Stata"],"title":"A Quick Guide to Cleaning Economic Microdata","uri":"/en/posts/data/#references"},{"categories":["Reading"],"collections":[],"content":"\u0026ldquo;The Calling of Spirits\u0026rdquo;: Prosperity\u0026rsquo;s zenith, sorcery\u0026rsquo;s sway,\rWhere power\u0026rsquo;s mirage, in twilight, may play. During the boring time of the Chinese New Year holidays, I finally finished reading \u0026ldquo;The Calling of Spirits.\u0026rdquo; In 1768, a panic of sorcery called \u0026ldquo;The Calling of Spirits\u0026rdquo; swept across the land of the Qing Empire. Surprisingly, the terms \u0026ldquo;prosperous era\u0026rdquo; and \u0026ldquo;sorcery\u0026rdquo; became parallel concepts. Kong Feili followed the thread of the \u0026ldquo;sorcery/hair-cutting case\u0026rdquo; and dissected the entire class structure of the Qing Dynasty—faced with the unheard-of sorcery of hair-cutting, each class had its own interpretation. In summary, the \u0026ldquo;Calling of Spirits\u0026rdquo; case involves three main threads: The panic and public dissemination of sorcery among common people. The political concerns and exploitation of the \u0026ldquo;Calling of Spirits\u0026rdquo; by the emperor. The bureaucratic dilemma of officials fearing pressure from above and below. ","date":"2023-01-21","heading":"\u0026ldquo;The Calling of Spirits\u0026rdquo;: Prosperity\u0026rsquo;s zenith, sorcery\u0026rsquo;s sway,","objectID":"/en/posts/soul/:1:0","tags":["Economic History"],"title":"The Calling of Spirits","uri":"/en/posts/soul/#the-calling-of-spirits-prosperitys-zenith-sorcerys-sway"},{"categories":["Reading"],"collections":[],"content":"First, public opinion: folk legends and population mobility.\rThe \u0026ldquo;Calling of Spirits\u0026rdquo; case involved an unheard-of form of sorcery where one\u0026rsquo;s money could be stolen simply by cutting off their braid. For the common people, who believed in the existence of the soul, \u0026ldquo;calling of spirits\u0026rdquo; was a widely circulated folk custom, providing a foundation for belief in sorcery. China\u0026rsquo;s deep-rooted local sentiment made it easier for people to demonize outsiders. At this time, Chinese construction workers and the monk class, due to the transient nature of their professions, were particularly susceptible to suspicion. The expansion of the \u0026ldquo;Calling of Spirits\u0026rdquo; incidents originated from these transient populations. ","date":"2023-01-21","heading":"First, public opinion: folk legends and population mobility.","objectID":"/en/posts/soul/:1:1","tags":["Economic History"],"title":"The Calling of Spirits","uri":"/en/posts/soul/#first-public-opinion-folk-legends-and-population-mobility"},{"categories":["Reading"],"collections":[],"content":"Second, cultural contradictions: Manchu rule over the Han.\rFaced with sorcery, the Qing Dynasty faced inherent cultural contradictions. Despite Emperor Qianlong\u0026rsquo;s early attempts to distance the \u0026ldquo;hair-cutting case\u0026rdquo; from political dissent, the braided queue remained a symbol of Manchu identity. As rulers of the Qing Dynasty, their attitude reflected not only fear of rebellion but also dissatisfaction with the Sinicization of the Manchus. The inherent weakness of feudal dynasties was evident in the legal ambiguity regarding \u0026ldquo;sorcery.\u0026rdquo; While the emperor and the state used the concept of \u0026ldquo;divine right\u0026rdquo; to bolster their legitimacy, sorcery was seen as both a miracle and a threat. This led to vague laws regarding sorcery in the Qing Dynasty, which had to be established nonetheless. ","date":"2023-01-21","heading":"Second, cultural contradictions: Manchu rule over the Han.","objectID":"/en/posts/soul/:1:2","tags":["Economic History"],"title":"The Calling of Spirits","uri":"/en/posts/soul/#second-cultural-contradictions-manchu-rule-over-the-han"},{"categories":["Reading"],"collections":[],"content":"Third, bureaucratic politics: examination and clubs.\rThe bureaucratic system of the Qing Dynasty was rife with inequality.The core of Kong Lifai\u0026rsquo;s research lies in the impact of this system on information dissemination and policy implementation. The emperor regarded bureaucrats as tools, establishing various channels. Although the ceremonial language was cumbersome, it served both as a means of communication and a way to delineate status. Without the ceremonial aspects, the emperor would struggle to bear the burden of pushing through tasks, yet reverting to formality also led to inefficiency. In the \u0026ldquo;hair-cutting case,\u0026rdquo; the most prominent aspect was the prevalence of officials\u0026rsquo; evaluations filled with flattery and mutual protection. Under the system of mutual recommendation for official selection, actions at all levels were aligned along an axis of interests. Bureaucratic evaluations manifested as a strip, with flattery revolving around imperial power. Qing officials\u0026rsquo; evaluations were brief and crude, with achievements attributed to \u0026ldquo;events.\u0026rdquo; What\u0026rsquo;s terrifying is that officials had the ability to control these events, and the moral risk of self-directed deception occurred easily under the desire for positive imperial evaluations and mutual concealment among peers. From this moment on, imperial evaluations had never had such power to influence the course of events, yet Qianlong\u0026rsquo;s decisions remained loyal to his position as a Manchu emperor. Was this management by an ethnic minority a political distortion? Regardless, as the \u0026ldquo;calling souls\u0026rdquo; case shattered, the actors on the stage retreated one by one. ","date":"2023-01-21","heading":"Third, bureaucratic politics: examination and clubs.","objectID":"/en/posts/soul/:1:3","tags":["Economic History"],"title":"The Calling of Spirits","uri":"/en/posts/soul/#third-bureaucratic-politics-examination-and-clubs"},{"categories":["Reading"],"collections":[],"content":"Fourth, Political Crimes: The Accessible Power and Fear\rHow was the \u0026ldquo;Haircut Case\u0026rdquo; classified? This is a \u0026ldquo;political crime\u0026rdquo; similar to a \u0026ldquo;literary inquisition,\u0026rdquo; where anyone can be charged with an unfounded accusation of political crime. For most people, this means - everyone has never had such an opportunity to get close to \u0026ldquo;power\u0026rdquo; and \u0026ldquo;fear.\u0026rdquo; For the masses, it is fear as well as a weapon. For bureaucrats, it is an event. For the emperor, it is a threat and a tool. For some people, it\u0026rsquo;s just fun. At this point, the \u0026ldquo;Haircut Case\u0026rdquo; / \u0026ldquo;Sorcery\u0026rdquo; / \u0026ldquo;Haircut,\u0026rdquo; mixed with various classes, has exploded into a chemical reaction. ","date":"2023-01-21","heading":"Fourth, Political Crimes: The Accessible Power and Fear","objectID":"/en/posts/soul/:1:4","tags":["Economic History"],"title":"The Calling of Spirits","uri":"/en/posts/soul/#fourth-political-crimes-the-accessible-power-and-fear"},{"categories":["Reading"],"collections":[],"content":"Conclusion: The \u0026ldquo;Soul Calling\u0026rdquo; of Cyberpunk\r\u0026ldquo;The Soul Calling\u0026rdquo; achieves a remarkable balance between academic rigor, detailed and vast content, and a compelling narrative. Faced with the same \u0026ldquo;soul calling\u0026rdquo; and hair-cutting incidents, the experiences of different social classes are completely different. Kong Feili has conducted a perfect \u0026ldquo;heterogeneity\u0026rdquo; analysis and class analysis of society. It is worth noting that this result is a structured classification rather than a combination of multiple quantities. Therefore, I believe that the discussion of \u0026ldquo;The Soul Calling\u0026rdquo; should be separated from \u0026ldquo;The Crowd: A Study of the Popular Mind\u0026rdquo;. The \u0026ldquo;Soul Calling\u0026rdquo; case has many similarities with the characteristics of the Qing Dynasty. This is an explanation of the decline and turning point under the prosperous age, and it is also the inevitable result of the historical operation of the feudal dynasty. Although the case seems to revolve around the emperor\u0026rsquo;s attitude, the emperor remains faithful to his class. However, China at this time had not yet achieved harmonious integration of its diverse cultural groups, leading to distortions in the operation of power. How could absurd sorcery emerge in a \u0026ldquo;prosperous age\u0026rdquo;? Perhaps coincidence is just a turning point in history. The big fish lurking beneath the surface of the water has never stopped swimming, just casting fleeting shadows in the rise and fall of governance. But we must be vigilant, for history occasionally drops insane fuses. Once the elements are in place—there is nothing to stand in the way of this madness. ","date":"2023-01-21","heading":"Conclusion: The \u0026ldquo;Soul Calling\u0026rdquo; of Cyberpunk","objectID":"/en/posts/soul/:1:5","tags":["Economic History"],"title":"The Calling of Spirits","uri":"/en/posts/soul/#conclusion-the-soul-calling-of-cyberpunk"},{"categories":["Reading"],"collections":[],"content":"Some Simple Reflections\rAs for why the \u0026ldquo;Call Soul Case\u0026rdquo; had such far-reaching consequences in the Qing Dynasty, I couldn\u0026rsquo;t help but think of cyberpunk. At a time of prosperity in the Qing Dynasty, why did superstition prevail? Certainly, the feudal cultural characteristics of the Qing Dynasty and its simplistic evaluation system played a role. But the tragic events of political crimes have recurred throughout history. The \u0026ldquo;Call Soul Case\u0026rdquo; created a collective \u0026ldquo;illusion of power\u0026rdquo; for people of all classes, with political crimes becoming the fear and weapon of everyone. In modern society, educated individuals are unlikely to be superstitious about \u0026ldquo;souls,\u0026rdquo; but in contemporary society (for example, online discourse), everyone seems to crave power more than ever: Educating others, a wield of power, Judging others, a wield of power, Assessing others, a wield of power. The discussion of three views is gradually becoming a weapon, Like blocking and reporting, once tools for maintaining discussion environment, Now wielded as weapons to attack dissenters. Misalignment of ideologies leads to explosions, Each fighting for their beliefs, But are we battling for truth itself, Or falling into the illusion of power? Israel\u0026rsquo;s deadly attacks on the West Bank of the Jordan River are still ongoing.\rIsrael deadly assault on the west bank of the Jordan River continues\r","date":"2023-01-21","heading":"","objectID":"/en/posts/soul/:1:6","tags":["Economic History"],"title":"The Calling of Spirits","uri":"/en/posts/soul/#some-simple-reflections"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"As everyone knows, the tikz package is the god-tier package for drawing in latex, but the code is genuinely hard to write. So I recommend using the tikzit software — draw with the mouse, then it automatically converts to latex code. ","date":"2022-10-19","heading":"","objectID":"/en/posts/latex2/:0:0","tags":["LaTeX","TikZ"],"title":"LaTeX and Drawing","uri":"/en/posts/latex2/#"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"Downloading the software\rDownload link: TikZit I suggest using Google Translate; the feature introductions are detailed and patient. I won\u0026rsquo;t repeat the drawing tutorial here — tikzit\u0026rsquo;s page is clean and easy to understand. The page looks like this: tikzit\r","date":"2022-10-19","heading":"Downloading the software","objectID":"/en/posts/latex2/:1:0","tags":["LaTeX","TikZ"],"title":"LaTeX and Drawing","uri":"/en/posts/latex2/#downloading-the-software"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"Environment setup (two ways to insert images)\rLet me stress environment setup first. The key is that you also need to download the package extension yourself — tikzit.sty There are also two ways to insert images. This text is in the \u0026ldquo;insert into LaTeX\u0026rdquo; section of the download page; note the blue hyperlink text, click it to download.\rThis text is in the \u0026ldquo;insert into LaTeX\u0026rdquo; section of the download page; note the blue hyperlink text, click it to download. ","date":"2022-10-19","heading":"Environment setup (two ways to insert images)","objectID":"/en/posts/latex2/:2:0","tags":["LaTeX","TikZ"],"title":"LaTeX and Drawing","uri":"/en/posts/latex2/#environment-setup-two-ways-to-insert-images"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"My recommendation: direct code insertion\rFirst, place the downloaded tikzit.sty in the same directory as your LaTeX paper document, Place the downloaded tikzit.sty in the same directory as your LaTeX paper document\rso that the package can be recognized. Using the LaTeX package: \\usepackage{tikzit} \\\\use the tikzit.sty package\rOnce you finish a diagram in tikzit, click the toolbar in order: tool, jump to selection, and the LaTeX code will pop up at the bottom. Auto-generated\rThe complete environment code looks like this: \\documentclass{article} \\usepackage{tikzit} \\begin{document} \\begin{tikzpicture} \\begin{pgfonlayer}{nodelayer} \\node [style=none] (0) at (-5.75, 1) {Y}; \\node [style=none] (2) at (-2, 0.75) {indifference curve}; \\node [style=none] (3) at (-4, 4) {}; \\node [style=none] (4) at (2.25, -1) {}; \\node [style=none] (5) at (-5, 3.75) {}; \\node [style=none] (6) at (-5, -1.5) {}; \\node [style=none] (7) at (2.75, -1.5) {}; \\node [style=none] (8) at (-1, -2.25) {X}; \\end{pgfonlayer} \\begin{pgfonlayer}{edgelayer} \\draw [bend right=45, looseness=1.50] (3.center) to (4.center); \\draw (6.center) to (7.center); \\draw (6.center) to (5.center); \\end{pgfonlayer} \\end{tikzpicture} \\end{document}\rPage\r","date":"2022-10-19","heading":"My recommendation: direct code insertion","objectID":"/en/posts/latex2/:2:1","tags":["LaTeX","TikZ"],"title":"LaTeX and Drawing","uri":"/en/posts/latex2/#my-recommendation-direct-code-insertion"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"Image reference insertion\rThe process is: first use tikzit to save multiple groups of vector diagrams you\u0026rsquo;ve drawn, number them, then insert them into the tex file. (Refer to the similar insertion approach for LaTeX bibliography and image insertion.) The specific process, Create a folder named tikzpaper. Put tikzit.sty inside it. Inside the tikzpaper folder, create a folder called figures, and save all the diagrams tikzit has saved into it. Create paper.tex in the tikzpaper folder. The paper.tex environment is as follows: Here \\tikzfig{ddd} and \\ctikzfig{ddd} are the two ways to reference images; the content inside the curly braces {} is the image filename saved in the figures folder. % paper.tex \\documentclass{article} \\usepackage{tikzit} %\\input{sample.tikzstyles} \\begin{document} A tikz picture as an equation: \\begin{equation} \\tikzfig{ddd} \\end{equation} A centered tikz picture: \\ctikzfig{ddd} \\end{document}\rThe result\r","date":"2022-10-19","heading":"Image reference insertion","objectID":"/en/posts/latex2/:2:2","tags":["LaTeX","TikZ"],"title":"LaTeX and Drawing","uri":"/en/posts/latex2/#image-reference-insertion"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"Other tools\rOpen-source software is small and elegant, and much of it works straight out of the box. mathcha (web, paid) tikzcd-editor (many answers mention this site, but the trouble is it doesn\u0026rsquo;t tell you which package you need; though now that we have GPT, it hardly matters) \\usepackage{tikz} \\usetikzlibrary{cd} \\\\tikz sub-package for calling the tikzcd command environment of relationship diagrams\rinkscape (you can treat it as an open-source PS) ipe (free and open-source, but there\u0026rsquo;s no Chinese localization yet, though the page is mostly graphics) When downloading ipe, don\u0026rsquo;t have Chinese characters in the install path, or it will error when opening. (For ipe, I suggest pairing it with a teaching video on Bilibili: Bilibili tutorial) latexdraw (free and open-source) LaTeXdraw\rTikzEdit (free, open-source, English, but easy to understand tikzedit\rTikzedit is like a just-in-time compiling tex; the page is also exactly the same as tex. I\u0026rsquo;ve tried both TikzEdit and latexdraw. latexdraw\u0026rsquo;s visual editing is better — text position and color can also be adjusted visually. TikzEdit is more about visual moving-editing of points and lines. But neither can visually edit arrow styles. For someone with some background, TikzEdit is more convenient. The dark-art method: use flashy tools (like PPT, processon (an online web page)) to draw, save as PDF, then crop and insert it into latex as a PDF file (this also reduces the typesetting and code-running pressure on latex). This is a diagram I casually drew using the processon web version, though the latex formulas inside lose fidelity when saved as PDF; other Chinese formats won\u0026rsquo;t.\rHere is the local environment for inserting a cropped PDF: \\begin{figure} \\centering \\includegraphics[width=0.8\\textwidth,height=0.5\\textwidth]{实践时间是.pdf} \\\\the square brackets control the PDF's size (width and height); the curly braces hold the PDF's name \\caption{Title} \\end{figure} By the way, here's the complete environment for inserting a whole-page PDF file: \\documentclass[a4paper]{article} \\usepackage{pdfpages} \\begin{document} \\includepdf[pages={1,2,4,7}]{PDF的名字.pdf} \\\\the content inside the square brackets is the page numbers of the original PDF \\end{document}\r","date":"2022-10-19","heading":"Other tools","objectID":"/en/posts/latex2/:3:0","tags":["LaTeX","TikZ"],"title":"LaTeX and Drawing","uri":"/en/posts/latex2/#other-tools"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"I got into LaTeX through a senior\u0026rsquo;s WeChat Moments post. I\u0026rsquo;m recording the learning process here, and also compiling the useful posts I\u0026rsquo;ve read recently. ","date":"2022-10-09","heading":"","objectID":"/en/posts/latex/:0:0","tags":["LaTeX"],"title":"How to Get Started with LaTeX in One Hour?","uri":"/en/posts/latex/#"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"What is LaTeX?\rLaTeX (/ˈlɑːtɛx/, often pronounced /ˈlɑːtɛk/ or /ˈleɪtɛk/) is a high-quality typesetting system based on TeX, developed in the early 1980s by the American computer scientist Leslie Lamport. It is very suitable for producing high-print-quality scientific, mathematical, and physics documents, and is especially good at typesetting complex tables and math formulas. LaTeX is the de facto standard for scientific literature exchange and publication. (Wikipedia) Word: what you see is what you get LaTeX: the typesetting format and the text content are separate (The typesetting is adjusted through code, and the best part is the various packages — you call them to do all sorts of things, like inserting a few emoji into your article~) Inserting emoji, something Word can\u0026rsquo;t do this naturally~\rFor me, LaTeX\u0026rsquo;s typesetting is genuinely beautiful, and getting a comfortable layout just right is very satisfying. If your article contains a lot of math formulas, figures, and tables, then LaTeX is definitely the better choice~ Word typesetting\rLaTeX typesetting\rOur team describing a queueing model in a math modeling competition, typeset in LaTeX\r","date":"2022-10-09","heading":"What is LaTeX?","objectID":"/en/posts/latex/:1:0","tags":["LaTeX"],"title":"How to Get Started with LaTeX in One Hour?","uri":"/en/posts/latex/#what-is-latex"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"Download and installation\rYou don\u0026rsquo;t have to download it; there are online LaTeX editing websites. You can skip this part and look at the LaTeX websites later. LaTeX has many versions: LaTeX, Ctex\u0026hellip; and the corresponding coding environment configurations also have many versions: winedit, studio\u0026hellip; Personally I recommend the following setup (for Windows): texlive + texstudio Reason: beginner-friendly, with Chinese UI support (winedit\u0026rsquo;s UI is English-only) LaTeX download tutorial: picked at random; you can find a newer one yourself. The tutorial I originally found was from 2018, but the 2021 installation turned out a bit different. The one linked here is the 2022 version. ","date":"2022-10-09","heading":"Download and installation","objectID":"/en/posts/latex/:2:0","tags":["LaTeX"],"title":"How to Get Started with LaTeX in One Hour?","uri":"/en/posts/latex/#download-and-installation"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"Quick start (within two hours)\rTips before opening the link: One part in it no longer works after a Windows update — \u0026ldquo;how to make LaTeX support Chinese text\u0026rdquo;. The corrected code is in the code block below the link: \\usepackage[fontset=windows]{ctex} %The percent sign means \"comment\" %usepackage is like adding a package, like downloading an app to your phone or a plugin to your browser; with a package you can do more things %After a Windows upgrade, use this to conveniently output or recognize Chinese\rIf the built-in PDF preview won\u0026rsquo;t display, the PDF reader might be to blame. ","date":"2022-10-09","heading":"Quick start (within two hours)","objectID":"/en/posts/latex/:3:0","tags":["LaTeX"],"title":"How to Get Started with LaTeX in One Hour?","uri":"/en/posts/latex/#quick-start-within-two-hours"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"Advanced tutorial (what you need for papers)\rSupplementing what the video above doesn\u0026rsquo;t cover. ","date":"2022-10-09","heading":"Advanced tutorial (what you need for papers)","objectID":"/en/posts/latex/:4:0","tags":["LaTeX"],"title":"How to Get Started with LaTeX in One Hour?","uri":"/en/posts/latex/#advanced-tutorial-what-you-need-for-papers"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"Two ways to cite\rLaTeX bibliography insertion methods (both complete) If the first method (BiB format) doesn\u0026rsquo;t compile: Check whether the bib format or the cited entry has any weird symbols The compilation order and number of compilations are wrong Restart and try again ","date":"2022-10-09","heading":"Two ways to cite","objectID":"/en/posts/latex/:4:1","tags":["LaTeX"],"title":"How to Get Started with LaTeX in One Hour?","uri":"/en/posts/latex/#two-ways-to-cite"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"Supplement: how to convert CNKI references to BIB format?\rMy approach is the Tampermonkey plugin (a college student\u0026rsquo;s online-course lifesaver!). Firefox, QQ Browser, Edge, and Chrome all support the Tampermonkey plugin. Tampermonkey plugin download Plugin script download CNKI references bibtex ","date":"2022-10-09","heading":"Supplement: how to convert CNKI references to BIB format?","objectID":"/en/posts/latex/:4:2","tags":["LaTeX"],"title":"How to Get Started with LaTeX in One Hour?","uri":"/en/posts/latex/#supplement-how-to-convert-cnki-references-to-bib-format"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"Emoji cuteness\rI recommend inserting emoji via the package approach. Check the corresponding manual for details. For example: \\emoji{grinning} \\emoji{sweat-smile} \\emoji{rofl} \\emoji{joy} \\emoji{smiling-face-with-hearts} \\emoji{face-savoring-food} Using Emoji in LaTeX ✌️ LaTeX has many compilers; the one that works with the emoji package is luaLaTeX. But if you go straight at it this way, it seems you can\u0026rsquo;t produce a PDF file. My advice is: skip the emoji package at first, compile with pdfLaTeX to produce the PDF, then add the emoji commands and compile with luaLaTeX. ","date":"2022-10-09","heading":"Emoji cuteness","objectID":"/en/posts/latex/:4:3","tags":["LaTeX"],"title":"How to Get Started with LaTeX in One Hour?","uri":"/en/posts/latex/#emoji-cuteness"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"Interesting packages\rChess packages — Go, Chinese chess, international chess, music scores. LaTeX editorial office ","date":"2022-10-09","heading":"Interesting packages","objectID":"/en/posts/latex/:4:4","tags":["LaTeX"],"title":"How to Get Started with LaTeX in One Hour?","uri":"/en/posts/latex/#interesting-packages"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"The advanced path (supplement from a senior)\rFor further LaTeX study, you can learn: Drawing with the Tikz package Making slides with the Beamer document class Developing your own package/class documents I feel like that\u0026rsquo;s about as far as a LaTeX user can go. ","date":"2022-10-09","heading":"The advanced path (supplement from a senior)","objectID":"/en/posts/latex/:4:5","tags":["LaTeX"],"title":"How to Get Started with LaTeX in One Hour?","uri":"/en/posts/latex/#the-advanced-path-supplement-from-a-senior"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"LaTeX websites\r","date":"2022-10-09","heading":"LaTeX websites","objectID":"/en/posts/latex/:5:0","tags":["LaTeX"],"title":"How to Get Started with LaTeX in One Hour?","uri":"/en/posts/latex/#latex-websites"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"Online LaTeX editing websites\rOverseas: overleaf Domestic: texpage , slager LaTeX templates: TeX Studio, shareLaTeX ","date":"2022-10-09","heading":"Online LaTeX editing websites","objectID":"/en/posts/latex/:5:1","tags":["LaTeX"],"title":"How to Get Started with LaTeX in One Hour?","uri":"/en/posts/latex/#online-latex-editing-websites"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"Math formula recognition websites\rSimpleLaTeX Baimiao LaTeX formula editor Mathpix ","date":"2022-10-09","heading":"Math formula recognition websites","objectID":"/en/posts/latex/:5:2","tags":["LaTeX"],"title":"How to Get Started with LaTeX in One Hour?","uri":"/en/posts/latex/#math-formula-recognition-websites"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"LaTeX table generation\rLaTeX tables Table conversion tool ","date":"2022-10-09","heading":"LaTeX table generation","objectID":"/en/posts/latex/:5:3","tags":["LaTeX"],"title":"How to Get Started with LaTeX in One Hour?","uri":"/en/posts/latex/#latex-table-generation"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"PDF processing websites\rWhy put this under LaTeX? Because LaTeX\u0026rsquo;s output is a PDF, and sometimes in competitions or paper settings, only the PDF cover is given. When collaborating with others on LaTeX, we also need to merge several PDFs. PDF processing website ","date":"2022-10-09","heading":"PDF processing websites","objectID":"/en/posts/latex/:5:4","tags":["LaTeX"],"title":"How to Get Started with LaTeX in One Hour?","uri":"/en/posts/latex/#pdf-processing-websites"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"My starter code\r\\documentclass{article} \\usepackage[fontset=windows]{ctex} %After a Windows upgrade, use this to conveniently output or recognize Chinese \\usepackage{graphicx}%for inserting images \\usepackage{emoji}%for emoji \\usepackage{amsmath} \\usepackage{xcolor} \\usepackage{cite}%for citations \\usepackage{amssymb}%math symbols \\usepackage{indentfirst} \\usepackage{tikz} \\usepackage{pdfpages} %for inserting PDFs %\\pagestyle{myheadings}%set the page format %arabic Arabic numerals %roman lowercase Roman numerals %Roman uppercase Roman numerals %alph lowercase letters %Alph uppercase letters \\pagenumbering{arabic}%set the page number format \\usepackage{fancyhdr}%import the fancyhdr package \\pagestyle{fancy} \\fancyhead[L]{left header} \\fancyhead[R]{right header} \\fancyhead[c]{center header} \\fancyfoot[L]{left footer} \\fancyfoot[C]{\\thepage} \\fancyfoot[R]{right footer} %------------------------------- %\\fancyfoot[LO]{odd-page left footer} %\\fancyfoot[LE]{even-page left footer} %\\fancyfoot[RO]{odd-page right footer} %\\fancyfoot[RE]{even-page right footer} %------------------------------ \\renewcommand{\\headrulewidth}{4pt}%header rule width 4pt \\renewcommand{\\footrulewidth}{4pt} %The above imports various packages, like browser plugins; with these packages you can conveniently use some handy code \\title{\\heiti My \\LaTeX getting-started notes} \\author{\\kaishu Hu Ang} \\date{\\today} \\renewcommand{\\abstractname}{\\textbf{\\zihao{4}Abstract}} %Abstract font: size 4, bold, with a space in the middle %The above part is the preamble %————————————————————————% %What follows is the body \\usepackage{tikzit} \\begin{document} \\maketitle%get the title %%the percent sign means comment \\newpage%start a new page \\tableofcontents%command to output the table of contents %\\listoffigures list of figures %\\listoftables list of tables \\newpage \\begin{abstract}%abstract This is the abstract part. Of the three document classes article, report, and book, the first two have an abstract environment, and the usage is just like this part. \\noindent{\\textbf{Keywords:} Abstract;\\LaTeX;paper format;operation record}\\centering%keywords centered \\end{abstract} \\emoji{grinning} \\emoji{sweat-smile} \\emoji{rofl} \\emoji{joy} \\emoji{smiling-face-with-hearts} \\emoji{face-savoring-food} \\part{Heading hierarchy} But chapter is generally used in report {chapter is larger than section} \\section{First chapter} Write something right under the chapter heading?\\emoji{+1} Describe font handling here\\emoji{joy} \\subsection{First subsection under the first chapter} \\subsubsection{I can already start nesting} I'll just start rambling and writing something Hahaha\\footnote{this is the command for adding a footnote} \\subsubsection{Use unlimited sub to describe sub-sections} \\section{Second chapter} \\section{Third chapter} What's explained here is lists the begin end corresponds to the list environment, where all content shares one text format \\begin{itemize} \\item unordered list one \\item unordered list two \\item unordered list three \\end{itemize} \\begin{enumerate} \\item ordered list one \\item ordered list two \\item ordered list three \\end{enumerate} \\part{Text effects} \\textbf{bold} \\textit{italic} \\underline{underline} \\part{Math typesetting} \\section{Formula environment} LaTeX supports direct input, but needs specific symbols: $E=C^2$ You can also write it on its own line, by adding symbols \\begin{equation} E=MC^2 \\end{equation} It can also be abbreviated: \\[ x^{4}+\\frac{x}{y}=x^3-23y{7} \\] \\[ d={k \\varphi(n)+1} \\over e \\] \\[ \\mathrm{func}(x, y)\\triangleq \\sum \\left({x^{100}}\\right) \\] \\section{Plus and minus signs} Math symbols: variables Greater than: \\textgreater Less than: \\textless The ones below need a space after them, or they'll be recognized incorrectly Greater than or equal to: \\geq Less than or equal to: \\leq \\section{Braces} Method 1: $$ f(x)=\\left\\{ \\begin{aligned} x \u0026 = \u0026 \\cos(t) \\\\ y \u0026 = \u0026 \\sin(t) \\\\ z \u0026 = \u0026 \\frac xy \\end{aligned} \\right. $$ Method 2: $$ F^{HLLC}=\\left\\{ ","date":"2022-10-09","heading":"My starter code","objectID":"/en/posts/latex/:6:0","tags":["LaTeX"],"title":"How to Get Started with LaTeX in One Hour?","uri":"/en/posts/latex/#my-starter-code"},{"categories":["Software Tools"],"collections":["Learning LaTeX"],"content":"Conclusion\rCongratulations, you\u0026rsquo;re now a member of the LaTeX army. Now go enjoy your refined typesetting life! Finally, a little LaTeX joke: What can Word do that LaTeX can\u0026rsquo;t? Writing a huge block of text behind an image to pad the word count! (lol~) ","date":"2022-10-09","heading":"Conclusion","objectID":"/en/posts/latex/:7:0","tags":["LaTeX"],"title":"How to Get Started with LaTeX in One Hour?","uri":"/en/posts/latex/#conclusion"},{"categories":["Travel"],"collections":["Fieldwork Notes"],"content":" During the holiday, I accompanied my teachers to conduct research at several county-level poverty alleviation and relocation sites in Zhaotong, Yunnan. Zhaotong is a city located at the junction of Sichuan and Yunnan provinces, famous for its Zhaotong apples. In the past, Zhaotong was renowned for its bold and vigorous people, but now, with a strong emphasis on education, the situation has improved significantly. The rural revitalization efforts here focus on supporting the special industry of Gastrodia elata. ","date":"2022-09-10","heading":"","objectID":"/en/posts/ynzt/:0:0","tags":["Fieldwork"],"title":" Research Note 1: Zhaotong, Yunnan","uri":"/en/posts/ynzt/#"},{"categories":["Travel"],"collections":["Fieldwork Notes"],"content":"County Town Scenic Spot\r","date":"2022-09-10","heading":"County Town Scenic Spot","objectID":"/en/posts/ynzt/:1:0","tags":["Fieldwork"],"title":" Research Note 1: Zhaotong, Yunnan","uri":"/en/posts/ynzt/#county-town-scenic-spot"},{"categories":["Travel"],"collections":["Fieldwork Notes"],"content":"Yanjin\rYanjin in Yunnan is known as a \u0026ldquo;front-line city,\u0026rdquo; with its main body built along the river. The roads are narrow, leaving only a single main road passing through the city. To accommodate this barely passable dual-carriageway, residents have had to extend their houses and plots along the riverbank slopes, resulting in houses predominantly made of reinforced concrete. The entire old town area is like LEGO blocks inserted between the two sides of the river. Often, just one family will occupy an entire building. Due to this terrain, the river here is swift-flowing, leading to relatively frequent flooding each year. A \u0026ldquo;first-tier\u0026rdquo; city built along rivers and canyons\rThe mountainous terrain in Yunnan is diverse, and there are many types of mushrooms, most of which are poisonous. Therefore, the community places particular emphasis on safety education to prevent both water disasters and food poisoning. As a precautionary measure, the community has even signed agreements with residents regarding food poisoning caused by mushrooms, stipulating that individuals bear responsibility for the consequences. local square at night\r","date":"2022-09-10","heading":"Yanjin","objectID":"/en/posts/ynzt/:1:1","tags":["Fieldwork"],"title":" Research Note 1: Zhaotong, Yunnan","uri":"/en/posts/ynzt/#yanjin"},{"categories":["Travel"],"collections":["Fieldwork Notes"],"content":"Tea Horse Ancient Road\rThe Tea Horse Ancient Road is home to the famous \u0026ldquo;Dousha Pass\u0026rdquo; and the cliff burials of the \u0026ldquo;Bo People Hanging Coffins\u0026rdquo;. During the Tang Dynasty, emissaries were sent to administer Yunnan, and the cliff carvings here serve as important evidence. Thanks to its strategic location as a transportation hub for the province, despite having the narrowest roads in some areas, it was the first to connect to the Southwest Silk Road, subway, train, and expressway. The scenic spot here is known as \u0026ldquo;One View and Five Roads\u0026rdquo;. Waterways, Roads, Plank Roads, Railways, Subways\rThe word \u0026ldquo;僰\u0026rdquo; in Chinese carries the ideographic meaning of people pulling a vine strip to swing.\r","date":"2022-09-10","heading":"Tea Horse Ancient Road","objectID":"/en/posts/ynzt/:1:2","tags":["Fieldwork"],"title":" Research Note 1: Zhaotong, Yunnan","uri":"/en/posts/ynzt/#tea-horse-ancient-road"},{"categories":["Travel"],"collections":["Fieldwork Notes"],"content":"Other County Towns\rOther county towns have relatively fewer attractions, so I won\u0026rsquo;t mention them in detail. Yunnan\u0026rsquo;s terrain is mainly mountainous and hilly, which makes road construction more costly and tolls on expressways higher. Due to the limited availability of land caused by the terrain, urban planning in Yunnan faces many constraints, and construction costs are also higher. Take Ludian County as an example, where most residents live in the mountains. In the evening, walking up the road along the mountain, you can see scattered lights in the distance on the mountain, like stars in the night sky. Therefore, the local area also calls the relocation operation as a \u0026ldquo;picking star action.\u0026rdquo; ","date":"2022-09-10","heading":"Other County Towns","objectID":"/en/posts/ynzt/:1:3","tags":["Fieldwork"],"title":" Research Note 1: Zhaotong, Yunnan","uri":"/en/posts/ynzt/#other-county-towns"},{"categories":["Travel"],"collections":["Fieldwork Notes"],"content":"Research Summary\r","date":"2022-09-10","heading":"Research Summary","objectID":"/en/posts/ynzt/:2:0","tags":["Fieldwork"],"title":" Research Note 1: Zhaotong, Yunnan","uri":"/en/posts/ynzt/#research-summary"},{"categories":["Travel"],"collections":["Fieldwork Notes"],"content":"Research Summary\rThe relocation targets residents in remote mountainous areas, affected by environmental and economic factors, and generally suffering from chronic diseases. What needs to change is not just their physical living environment, but also their consciousness. The key to relocation is how to help relocated households adapt to the transformation of identity and consciousness from rural to urban towns. In rural areas, they were self-sufficient, without water and electricity bills, growing their own vegetables. Now, they face property management fees, water and electricity bills, which they may not fully understand. Therefore, the community has adopted a transitional plan: water and electricity are free for the first three years, with gradually increasing payment proportions thereafter. To adapt to rural culture, the community also provides services for both happy and sad occasions. All can be handled within the community. Implementing grid management (a classic special term 🙃), establishing files, and finely managing in batches. Classify those with disabilities, those without disabilities, those with major illnesses, and elderly families\u0026hellip; Regular training is needed to help residents adapt to the internet, at least to learn to read WeChat notifications. Multi-dimensional poverty alleviation employment, preventing relapse into poverty. Employment subsidies for working outside, poverty alleviation employment workshops within the community, local industry poverty alleviation employment, and entrepreneurial subsidies (opening a stall, buying snacks is also considered entrepreneurship). Leveraging comparative advantages. Yunnan\u0026rsquo;s advantage in developing industries is green food—such as Gastrodia elata, bamboo shoots, oranges, and others. Its weaknesses lie in transportation, and processing and manufacturing capabilities. The local area lacks money, really lacks money! There are many arrears in project payments. ","date":"2022-09-10","heading":"Research Summary","objectID":"/en/posts/ynzt/:2:1","tags":["Fieldwork"],"title":" Research Note 1: Zhaotong, Yunnan","uri":"/en/posts/ynzt/#research-summary-1"},{"categories":["Travel"],"collections":["Fieldwork Notes"],"content":"Research Banquets\rDuring county-level research, it\u0026rsquo;s inevitable to interface with local leaders, and these interactions often involve banquets where baijiu (a strong Chinese liquor) is typically served. Excessive drinking is always harmful to health. Here are some personal insights based on my experiences. The banquets I encountered in several counties generally followed four stages: Stage One: Personal introductions, after which individuals start drinking voluntarily. Stage Two: Mutual exchanges and inviting others to drink, one-on-one. Stage Three: Speech by leaders, giving collective advice, followed by a group toast where everyone stands and toasts around the table. Stage Four: As the banquet wraps up, exchanging WeChat contacts. Strategies for drinking should be flexible and adapted according to each stage. Spell casting preparation: Emphasize repeatedly that you don\u0026rsquo;t drink, haven\u0026rsquo;t drunk before, to reduce the difficulty level as much as possible. Stage One: Usually, when standing up to introduce yourself, you can start pouring a bit of the drink from the small or medium-sized glass. Alternatively, you can discreetly pour it out under the table beforehand. When raising the glass, use your hand to cover the side of the glass (fully covering the glass would look too fake!), so that others can\u0026rsquo;t see the level of the drink, thinking it\u0026rsquo;s in the pouring state. Stage Two: Because it\u0026rsquo;s a university student survey, you can eat and drink casually without knowing the rules. Pay attention to see if there\u0026rsquo;s milk or tea cups on the table. Drink water to one-third full, hold the wine in your mouth after the toast (be careful not to puff your mouth up! Tongue might be quite rough), pretend to drink the beverage, and spill the wine into the beverage. If no beverage is available, the filled bowl of rice or soup is the best hiding tool When others interject to add to the conversation, it\u0026rsquo;s also a good opportunity for a small move. Typically, at a drinking session, everyone usually watches the person speaking. Stage three: Here, the meal is almost over and most people are at least tipsy, so they can rest assured. When toasting, cover the sides of the glass with your hands. Join the toasting group and pretend to be drinking, but no wine enters your mouth. Move around a lot. At this time, everyone is usually trying to please others and will usually not notice small movements. It is recommended to use the teachings in Liu Qian\u0026rsquo;s magic class - big movements cover up small movements to mislead the other party\u0026rsquo;s attention. For example, one hand makes movements to attract attention, and the other hand gently pours wine on the ground. ","date":"2022-09-10","heading":"Research Banquets","objectID":"/en/posts/ynzt/:2:2","tags":["Fieldwork"],"title":" Research Note 1: Zhaotong, Yunnan","uri":"/en/posts/ynzt/#research-banquets"},{"categories":["Travel"],"collections":[],"content":"The Mogao Grottoes aspire to be more than mere tourist attractions\rIn practice, it has yet to be rated because it is considered an endeavor in scientific education, falling under the purview of the Cultural Relics Bureau rather than the Tourism Bureau. The Tourism Bureau has granted the Forbidden City the highest rating and naturally desires to do the same for Dunhuang. However, the Mogao Grottoes have not acquiesced. In former days, the Taoist king had already cast out all the gold, and the resplendent treasures rode makeshift cattle carts, wandering into foreign lands. The sedimented history pays no heed to transient hustle and bustle, while the British Museum, destined for daily foot traffic, bustles incessantly. History chuckles. Faced with vast, magnificent toys, infants find themselves bewildered. Yet, the entirety of culpability does not solely rest upon the Taoist king—Dunhuang was not unearthed in an auspicious era, and even today, I cannot easily sketch the contours of ancients. Thus, here, cultural heritage preservation and dissemination intertwine. To behold Dunhuang is to encounter Dunhuang yet not entirely Dunhuang. This journey has also lifted the veil of mystery in my mind. The image of Dunhuang, akin to the temples of the Maya, has dissolved. The Mogao Grottoes are neither a testament to the grandeur of a mysterious dynasty nor a site of blessings for unknown merchants. The \u0026ldquo;donors\u0026rdquo; are part of the Mogao Grottoes culture. In other words—who carved which caves. Everything is recorded plainly! After all, without leaving names, how would the deities receive their \u0026ldquo;payments\u0026rdquo;? Dunhuang lacks the unsolved mysteries of the Maya, but conversely, beneath the Maya civilization, there is no deeply sedimented loess land. The establishment of the grottoes spans from the Southern and Northern Dynasties to the Yuan Dynasty, and the marginal expansion of its scale reflects the prosperity and decline of the Silk Road. From the Li family of the Tang Dynasty to nameless merchants, if you dare to dig, you can dig. There are thousands of caves, each unique. Setting aside wealth, these grottoes embrace the \u0026ldquo;donors\u0026rdquo; who come and go, regardless of status, place of origin, or time. Relying solely on \u0026ldquo;flying apsaras\u0026rdquo; cannot uphold the phrase \u0026ldquo;Chinese treasure.\u0026rdquo; The most precious aspect of Dunhuang lies in the flowing years and its unique cultural temperament. History flows over these precipitous cliffs, time flips upside down, and finally condenses at the depths of the caves. From the tiles of the Southern and Northern Dynasties to the Yuan Dynasty, patterns evolve from simple geometric shapes to rounded lotuses. Whether angry or smiling, sharp or gentle, the myriad heavenly deities and Buddhas respond to the times. The multitude of cave entrances symbolizes the interaction of communities. In the long river of history filled with wars, there indeed exists such a solid port of ethnic integration. Inside the caves, there is no strong light; instead, the mineral pigments from the Tang Dynasty cover every surface, creating a faint fluorescent effect. Most of the sculptures I observed were of figures like Shakyamuni Buddha and Guanyin. Simply speaking of the sculptures, I did not perceive any advanced craftsmanship or exquisite expressions. According to the introduction, the internal craftsmanship mainly involves unique filling methods, often utilizing local materials, with a deeper cultural significance such as the reclining Buddha in Nirvana. Observing the seated Buddha indoors is quite marvelous. Unlike viewing the Leshan Giant Buddha under the bright sunlight, leaving nothing unseen, looking up at the seated Buddha inside the cave is different. The shadows above exude a profound sense of emptiness, making the Buddha statue appear enigmatic and compelling one to kneel in reverence. The murals of Dunhuang, illuminated by the dim light within the caves, leave one spellbound. The a","date":"2022-07-29","heading":"The Mogao Grottoes aspire to be more than mere tourist attractions","objectID":"/en/posts/mgk/:0:0","tags":["Travel"],"title":"The Mogao Grottoes aspire to be more than mere tourist attractions","uri":"/en/posts/mgk/#the-mogao-grottoes-aspire-to-be-more-than-mere-tourist-attractions"},{"categories":["Travel"],"collections":[],"content":" The Hexi Corridor, truly formidable, unfolds its rugged terrain. The Qilian Mountains, with their majestic peaks and ridges, reveal the lean loess skin weathered over ages, adorned with streaks of black and red hues. The mountain summits swell like vertebrae, encircling the narrow passage with a slow, imposing embrace. Today, it serves as a natural pastureland, but yesterday, it was a treacherous gorge. Traveling along the main road, the distant mountains loom, pressed into ink wash, with shades of ochre and cyan dominating the scene. Once vegetation is lost and the mountains no longer provide cover, the vast sky and embracing Gobi become desolate. In this land of beacon fires and billowing smoke, tufts of grass resemble slender arrows, rudely piercing the desert\u0026rsquo;s skin at inopportune moments. In the valleys adorned with shrubs, occasional glimpses of the gentle ruins of the Great Wall emerge, nearly worn away by wind and sand, resembling mere road markers. Occasionally, a herd of horses, a group of cattle, or a few windmills appear, only to vanish behind the car window in the blink of an eye. If Don Quixote were to behold the slender white windmill blades at the foot of the mountain, he might indeed be astonished to encounter such elegantly slender giants, wouldn\u0026rsquo;t he? Yet, who created these giants? Who nurtured the creatures in the desert? The sands of history have never ceased to erode and bury, yet some have ventured far from the encroaching desert. There are always camel bells ringing in the dryness, and the aging loess also boasts the merit of blocking the billowing smoke. Initially, no one paid attention to the flowers aging beneath the cliffs, until the monuments of history stood tall above the sands of time. The distant sands carry no echoes, but who traversed the Hexi Corridor? The Hexi Corridor\r","date":"2022-07-09","heading":"","objectID":"/en/posts/hexi/:0:0","tags":["Travel"],"title":"The Hexi Corridor","uri":"/en/posts/hexi/#"},{"categories":["Reading"],"collections":["Academic Rhetoric"],"content":" Archiving past reflections. During a high school reading class, I casually picked up Yan Lianke\u0026rsquo;s literary essays. His advocacy for Divine Realism lingers with me to this day. While working through advanced mathematics, I suddenly grasped the shared essence of \u0026ldquo;Divine Realism\u0026rdquo; and \u0026ldquo;Magical Realism.\u0026rdquo; They both take \u0026ldquo;conveyance\u0026rdquo; as their mission, much like the rhetoric of ancient Greece, creating a reality of their own. Yet, the crux lies in the scene the novelist chooses to craft—that is where true artistry resides. Confucius said: \u0026ldquo;Let words convey meaning, and no more.\u0026rdquo; A critique of the futility in ornate expression, this statement forms the foundation of Divine Realism. These writers forgo flowery language or dazzling rhetoric. Instead, they emphasize the construction of a scene, delivering a visceral experience often laden with lingering aftertaste. The aroma of horses’ hooves, a monk balancing water—is this not such art? Such techniques cannot be summarized as \u0026ldquo;indirect or metaphorical\u0026rdquo;; they transcend simplistic categorizations. They emerge from meticulous contemplation of life’s interwoven relations, threading subtle details into profound undertones, capturing the nexus of things with precision. Yan Lianke’s example, recalled now, feels remarkably fitting: imagine the Titanic sinking beneath the waves. How might this be conveyed in a novel? Perhaps a seagull soars by, its body adorned with a small compass, quivering as it passes above the sea, sensing the ship\u0026rsquo;s magnetic pull. This construct rests firmly upon reality while radiating an uncanny tension. Truly, it embodies the ideal of \u0026ldquo;The Literary Mind and the Carving of Dragons\u0026rdquo;: an antelope hanging its horns on a tree, leaving no trace to follow. Consider the horns of a sheep. Perhaps we know a sheep by its horns because they are familiar to us, but the essence of a sheep is not bound to its horns. Many sheep lack them entirely. If we seize upon the horns as the cornerstone of a sheep’s image, our perspective gains a unique angle. Should this image then shift towards demonic figures or other forms, it ascends to the realm of extraordinary creation. Here lies the ethereal beauty of writing—a spiritual elegance, indeed. The balance between illusion and reality is delicate, like the elusive harmony of \u0026ldquo;unexpected yet reasonable.\u0026rdquo; Science rarely speaks in human terms, but pondering such constructs, one realizes that no matter how illusory they appear, their foundation is life’s meticulous observation: feel first, discern connections, then create. Material dictates consciousness—a truth that resonates deeply within me. img\r","date":"2021-05-22","heading":"","objectID":"/en/posts/sszy/:0:0","tags":["Literature"],"title":"Divine Realism","uri":"/en/posts/sszy/#"},{"categories":["Reading"],"collections":[],"content":" Striving to emulate the writing style of Walden. The beauty of its prose varies greatly between versions. Though I have yet to finish it, each reopening yields fresh insights. I have never been fond of winter’s blazing sun—the crimson orb that casts its light upon an indifferent air. The scant warmth teases the faces of passersby, much like a damp and probing tongue. By mere touch, I feel the burn upon my skin—a harsh caress of light peeling back layers like a blade, as if Siegfried himself wielded his gleaming sword, leaving one’s cheeks tingling, itching, raw. Perhaps it is the rush of blood within, but walking in such weather brings alternating waves of warmth and chill. The body becomes a vessel of fleeting seasons, encased momentarily in ice, then swiftly embraced by sunlight\u0026rsquo;s fervent touch, only to await the next frost. This interplay of sensation often unfolds on the school’s winter grounds. Uncomfortable though it may be, the symphony of voices brings solace, like the lilting melody of \u0026ldquo;Ballade pour Adeline,\u0026rdquo; leaving one entranced. The rhythmic tapping of footsteps and the lively echoes of play compose a sonorous celebration of life. What could rival this healthful and jubilant cadence of existence? The bounce of a basketball on the court sings a hymn of exuberance, its fervor untamed. The friction of a soccer ball against the turf whispers secrets, the soft rustle akin to a golden monkey slipping through the forest\u0026rsquo;s embrace. Beneath the throbbing drumbeat and the delicate chime of silver bells, the feathery stroke of a badminton bird weaves its airy tapestry—like the frantic flutter of startled pheasants alighting from treetops. Wood, rubber, and plastic collaborate in a playful harmony: the sturdy \u0026ldquo;thunk\u0026rdquo; of a paddle meeting ball, the hushed \u0026ldquo;swoosh\u0026rdquo; of air past a balloon, the frenetic \u0026ldquo;hiss\u0026rdquo; of a rapid volley. Thus, the wise cynic of the West reclines in a shattered barrel, bidding Alexander not to obscure his sun; Zhuangzi likens himself to a mud-bathing turtle, blissfully wagging its tail. Even now, humans find delight in a few planks and a ball—as do I, sharing in their joy. Such simple pleasures cost so little. Adults swing tirelessly at golf, elevating the game to a mark of elegance, their engagements a ceaseless negotiation of self-image. Children, meanwhile, find endless mirth in the toss of a stick. Yet adults, constrained by societal constructs, cannot stop at sticks, striving instead for gilded wheels of industry. Gold outshines the stars, black oil surpasses sweet springs. Two grown men building sandcastles might seem foolish and pitiable; yet, to me, they embody the true essence of life. For life, in its unadorned purity, is nature itself. The earth offers us a tranquil haven, yet humanity, in its pride, constructs fortresses of wealth and power, losing itself in self-made illusions. Only those willing to descend from their towers can truly reclaim themselves, returning to the soil from which they arose. Some may question my seeming indolence. To them, I ask only that they peer deep into Walden’s crystalline depths. A simple life soothes the weary soul; indeed, simplicity is the sole truth of existence. ","date":"2021-03-29","heading":"","objectID":"/en/posts/wedh/:0:0","tags":["Literature"],"title":"Reflections on Walden","uri":"/en/posts/wedh/#"},{"categories":["Film and TV"],"collections":[],"content":" My earliest serious film review, archived here. ","date":"2021-02-19","heading":"","objectID":"/en/posts/ydzh/:0:0","tags":["Movies"],"title":"The Dawn of Farewell - Binding the Flower of Promises on the Morning of Parting","uri":"/en/posts/ydzh/#"},{"categories":["Film and TV"],"collections":[],"content":"Preface\rThis work contains almost none of the traditional elements such as harems, large breasts, long legs, tsunderes, high school romance, or passionate. I can only say that the world needs more anime works like this. This work expresses a core spirit of life through its unique setting. We need such works to prove that anime is not just a plaything for otakus but a poetic form of expression. ——Preface Have you ever seen the boundless sea? The refreshing sea breeze brushes against your face, and the calm sea is accompanied by the occasional chirping of birds. Yet, I know deep down that beneath the surface lies a profound vortex, but what I see is a faint veil. This is the feeling this movie gives me. Image\rThe entire movie revolves around the growth of \u0026ldquo;Maquia\u0026rdquo; as a mother, with a significant portion dedicated to the narrative of maternal love. However, there are also other character arcs, such as the Iorph, the Ancient Dragons, and the changing world from the Middle Ages to the Industrial Revolution. These various symbols indicate that \u0026ldquo;maternal love\u0026rdquo; is not the sole theme of the movie. I even believe that maternal love is not the primary theme. The fate of the Iorph is the revelation. This movie discusses a \u0026ldquo;life value\u0026rdquo;—— Should we, who fear parting, refuse to encounter? Mother and child gaze, mutual redemption\r","date":"2021-02-19","heading":"Preface","objectID":"/en/posts/ydzh/:1:0","tags":["Movies"],"title":"The Dawn of Farewell - Binding the Flower of Promises on the Morning of Parting","uri":"/en/posts/ydzh/#preface"},{"categories":["Film and TV"],"collections":[],"content":"Plotlines:\rBackground: Under the strife of kingdoms, the powerful human kingdom of Mezarte captures the Iorph, a race with longevity genes, to further strengthen their power. Main Plot: Maquia, a young Iorph girl who narrowly escapes, adopts an orphan from an ordinary family and strives to be a good mother. Subplots: The Iorph, the resistance of other nations, the changing world, and the captured Iorph. ","date":"2021-02-19","heading":"Plotlines:","objectID":"/en/posts/ydzh/:2:0","tags":["Movies"],"title":"The Dawn of Farewell - Binding the Flower of Promises on the Morning of Parting","uri":"/en/posts/ydzh/#plotlines"},{"categories":["Film and TV"],"collections":[],"content":"Symbolism Interpretation\rIorph (also known as the Clan of Parting): Possesses nearly infinite lifespans and the unique ability to weave language into cloth. The cloth they weave is called \u0026ldquo;Hibiol.\u0026rdquo; ","date":"2021-02-19","heading":"Symbolism Interpretation","objectID":"/en/posts/ydzh/:3:0","tags":["Movies"],"title":"The Dawn of Farewell - Binding the Flower of Promises on the Morning of Parting","uri":"/en/posts/ydzh/#symbolism-interpretation"},{"categories":["Film and TV"],"collections":[],"content":"Parting\rDue to their longevity, their interactions with ordinary people only lead to constant parting, increasing their pain. Rather than endure such sorrow, it is better to live in seclusion. This should be the attitude hinted at by the \u0026ldquo;Elder\u0026rdquo; at the beginning. When Maquia says she feels lonely, the Elder responds, \u0026ldquo;Do you still feel lonely with me here?\u0026rdquo; and advises against loving in the mortal world, as it only brings pain. When attacked by human knights, the Elder says, \u0026ldquo;We have no connection with the mortal world.\u0026rdquo; From this, we can see the Elder\u0026rsquo;s attitude: Avoid contact with ordinary people to prevent future sorrow from parting. However, due to human desires, they are forced into contact with humans. ","date":"2021-02-19","heading":"Parting","objectID":"/en/posts/ydzh/:3:1","tags":["Movies"],"title":"The Dawn of Farewell - Binding the Flower of Promises on the Morning of Parting","uri":"/en/posts/ydzh/#parting"},{"categories":["Film and TV"],"collections":[],"content":"Hibiol\rThe warp is the flowing years, guiding the change of seasons and the shifting sky. The weft is the livelihood of people, intricately woven on the land, plucking the heartstrings of all. This is the opening line of the movie. From the entire film, I believe this is an interpretation of life. The warp, representing time, is like the lifespan of a person. The weft, representing space, is the encounters of people. Even if the warp is infinitely long, it is still necessary to weave the weft. Weaving memories into cloth, this metaphor of turning the abstract into the concrete, is an expression of giving life meaning. This setting reminds me of Your Name, which is essentially a form of pantheism: We do not worship a specific god, but the deity represented by connections—the red thread of human connections is the deity we worship (paraphrased). Image\rHibiol, as the cloth woven by the Clan of Parting, holds significant meaning. It can be said to be the faith of their existence. ","date":"2021-02-19","heading":"Hibiol","objectID":"/en/posts/ydzh/:3:2","tags":["Movies"],"title":"The Dawn of Farewell - Binding the Flower of Promises on the Morning of Parting","uri":"/en/posts/ydzh/#hibiol"},{"categories":["Film and TV"],"collections":[],"content":"Ancient Dragons\rAs one of the two oldest races in the setting, both the Ancient Dragons and the Iorph have been conquered by human kingdoms, forming a parallel with the Iorph, given their similarly tragic fates. Ancient Dragons and Red-Eye Disease\r","date":"2021-02-19","heading":"Ancient Dragons","objectID":"/en/posts/ydzh/:3:3","tags":["Movies"],"title":"The Dawn of Farewell - Binding the Flower of Promises on the Morning of Parting","uri":"/en/posts/ydzh/#ancient-dragons"},{"categories":["Film and TV"],"collections":[],"content":"Red-Eye Disease\rCaused by the accumulation of madness from being enslaved and not daring to fight for freedom. This can be seen from the dialogue between the enslaved Leilia and the dragon. She scolds the dragon for being able to fly but not fighting for freedom. In practice, the enslaved Leilia is similar to the dragon. She claims to \u0026ldquo;be able to fly\u0026rdquo; but does not fight for freedom. Is there a connection between this and the symbolism of the Clan of Parting? I haven\u0026rsquo;t figured this out yet. But one reason is that she is pregnant with the child of her enemy (the prince of the human kingdom). To protect the girl, she even gives up the chance to be rescued by her true love, leading to his \u0026ldquo;darkening.\u0026rdquo; Here, the darkened character is also confused: He wants to remain unchanged, but both Maquia and Leilia, who have children, have changed. Why? This also leads to the ultimate question of the movie: Is encountering worth it? Image\rImage\r","date":"2021-02-19","heading":"Red-Eye Disease","objectID":"/en/posts/ydzh/:3:4","tags":["Movies"],"title":"The Dawn of Farewell - Binding the Flower of Promises on the Morning of Parting","uri":"/en/posts/ydzh/#red-eye-disease"},{"categories":["Film and TV"],"collections":[],"content":"Children and Encounters\rIn The Dawn of Farewell, children represent \u0026ldquo;encounters\u0026rdquo;! Therefore, I believe maternal love is merely a representation, not the theme. The process of a mother interacting with her child is the best example of encounters and change. A mother\u0026rsquo;s encounter with her child is often not entirely voluntary, and the encounter with a child is the most magical. The parting between a mother and her child is inevitable. The Clan of Parting does not want to face parting, but when they are forced to face the world and become ordinary mothers, encountering children who will eventually leave them, experiencing joy or tears, They come to understand: \u0026ldquo;Iorph\u0026rdquo; is a curse of continuity. Whether this curse is a blessing or a misfortune is something they can only answer after experiencing it. ","date":"2021-02-19","heading":"Children and Encounters","objectID":"/en/posts/ydzh/:4:0","tags":["Movies"],"title":"The Dawn of Farewell - Binding the Flower of Promises on the Morning of Parting","uri":"/en/posts/ydzh/#children-and-encounters"},{"categories":["Film and TV"],"collections":[],"content":"Encounters and Weaving are the Curses of Happiness and Freedom\rLet\u0026rsquo;s start with the two mothers, one active, one passive, contrasting yet ending the same. Protagonist Maquia: Escapes from disaster, adopts a child from an ordinary family, experiences everything a mother does, and witnesses the child\u0026rsquo;s departure (in the end, Maquia still looks 15 years old). Being a single mother is not easy (finding work, raising a family, dealing with a rebellious child, and the child\u0026rsquo;s various \u0026ldquo;childish promises and comforts\u0026rdquo;); She actively raises this child because she fears loneliness and wants to share her life, unknowingly developing genuine maternal love. In this segment, pay attention to the changes in Maquia\u0026rsquo;s hair color and length, as well as her overall appearance. Maquia\u0026rsquo;s friend Leilia: Forced to bear the child of her enemy and never able to see her again, she meets her daughter after the fall of Mezarte and escapes the kingdom. Leilia is eventually rescued by the last remaining Ancient Dragon and says two lines that caught my attention. A. I can fly. The dragon should be a reflection of her. The dragon finally takes flight to fight for freedom, and she meets her long-lost daughter, then decides to leave. B. \u0026ldquo;I will forget everything here; you are just a tangled thread in the Hibiol.\u0026rdquo; Image|344\rEven if it\u0026rsquo;s a tangled thread, it holds unique emotional significance, but Leilia has indeed had a tough life. Image\rBut can she really forget? For a mother, her child is her parting. The Clan of Parting, untouched by the mortal world, is forced to experience the pain of parting, but this parting seems like a shackle. Mothers lose much for their children—freedom, ideals, and endure unnecessary fears and their children\u0026rsquo;s anger. Once genuine love is formed, the long-lived mothers can only watch their children grow old. What is the meaning of encountering? Would abandoning encounters also eliminate the pain of parting? Later, Maquia responds to her, \u0026ldquo;You will never forget.\u0026rdquo; Indeed, through tears, Leilia says the crucial line: \u0026ldquo;It\u0026rsquo;s sad and painful, but how could I forget such a beautiful world?\u0026rdquo; Because once an encounter happens, the spark cannot be suppressed. Hibiol will record everything. Mothers develop love in the process of raising their children. Like fireworks that eventually fade, the beautiful scene remains in our tender hearts. Now, what does Hibiol truly mean? As the duty and characteristic of the Clan of Parting, I interpret it as \u0026ldquo;human duty, human characteristics.\u0026rdquo; The Clan of Parting is just a hypothetical race. Aren\u0026rsquo;t we just like them, afraid of loss, afraid of parting? Image\rParting seems painful, but it also corresponds to an encounter, a shining moment. Buddhism teaches us to let go of everything, to see it as \u0026ldquo;empty,\u0026rdquo; to treat everything as fleeting as dew. But would we still be human if we did that? Should we discard the meaning and happiness of the process just because of a little pain? We fear encounters, lamenting life as fleeting as morning dew; we dread parting, exclaiming life as an illusion, as if life is short and illusory. Thus, the movie creates the nearly immortal Clan of Parting to tell us: Facing encounters and life, bravely loving is unrelated to the length of time or superficial results. Binding the flower of promises at the moment of parting. At the moment of parting, we also pick up those precious memories. That is enough. ","date":"2021-02-19","heading":"Encounters and Weaving are the Curses of Happiness and Freedom","objectID":"/en/posts/ydzh/:5:0","tags":["Movies"],"title":"The Dawn of Farewell - Binding the Flower of Promises on the Morning of Parting","uri":"/en/posts/ydzh/#encounters-and-weaving-are-the-curses-of-happiness-and-freedom"},{"categories":["Film and TV"],"collections":[],"content":"Solving the Title: Binding the Flower of Promises on the Morning of Parting\rOn the surface, it is about a long-lived mother sending off her aging son, recalling past vows and times at the moment of parting. In essence: The moment of parting: Once an encounter happens, parting is inevitable. The flower of promises: When Maquia, still looking 15, faces the reality of her son growing old: \u0026ldquo;Mothers don\u0026rsquo;t cry, but I\u0026rsquo;m sorry, I can\u0026rsquo;t keep the promise. Loving you was truly happy.\u0026rdquo; Breaking the promise in this way is the flower of promises. As long as Maquia lives, her child\u0026rsquo;s Hibiol will continue. This is the true flower of promises. No one is immortal, but people will continue to encounter each other. Before and after parting, emotions and meanings are bestowed. Parting is not just pain, so please gather the courage to meet new partings! Anime that calmly explores seemingly ethereal themes is truly remarkable. I sincerely hope this movie helps people understand: The feeling of love is wonderful. Image\r","date":"2021-02-19","heading":"Solving the Title:","objectID":"/en/posts/ydzh/:6:0","tags":["Movies"],"title":"The Dawn of Farewell - Binding the Flower of Promises on the Morning of Parting","uri":"/en/posts/ydzh/#solving-the-title-binding-the-flower-of-promises-on-the-morning-of-parting"},{"categories":["Film and TV"],"collections":[],"content":"Beyond Anime\rHi, Mom is a hymn to mothers. The Dawn of Farewell - Binding the Flower of Promises on the Morning of Parting is more like an epic of mothers, a history of maternal growth. The theme of the movie is not maternal love; maternal love is just one element of the core proposition. Mothers are always mothers, transcending race and time. These settings cannot be expressed without the anime format, a fairy-tale-like medium. This is why I highly recommend it: This is a work that can only be expressed through anime settings. And this expression transcends anime itself, using a form to write the meaning of encounters. Anime is not just a style; it is a form of expression. Considering the term \u0026ldquo;anime\u0026rdquo; itself, isn\u0026rsquo;t it a form of two-dimensional artistic expression? Hi, Mom, as Jia Ling\u0026rsquo;s directorial debut, has been critiqued for its technical shortcomings, but that doesn\u0026rsquo;t hinder its 8.3 rating on Douban (which is quite high for Douban). Through these two works, I truly understand: Childishness and naivety must not be confused, and the emotional core is the essence, regardless of the external form. In the end, the highest emotional intelligence is often sincerity. Other Thoughts\rFreedom and happiness are born from restraints. Is the life of a leaf meant to fall, or to nourish? The fate of the Clan of Parting is linked to their hair; they cannot form bonds with freedom mothers. Maternal love. Single mothers don\u0026rsquo;t cry; the significance of children to mothers is life. The middle section\u0026rsquo;s grand battle and childbirth scenes are breathtaking. Destruction and rebirth are captured in the lenses. A world of sadness and pain; love is a curse, encounters are a curse that makes one lonely. Buddhism teaches us to let go of everything, but only by experiencing can we truly let go. In the middle, a knight says, \u0026ldquo;Ancient creatures are destined to perish.\u0026rdquo; I believe this represents the outdated ideas (notions) of the Clan of Parting will disappear. They have truly experienced the parting of the mortal world, understood the pain, and also felt happiness. ","date":"2021-02-19","heading":"Beyond Anime","objectID":"/en/posts/ydzh/:7:0","tags":["Movies"],"title":"The Dawn of Farewell - Binding the Flower of Promises on the Morning of Parting","uri":"/en/posts/ydzh/#beyond-anime"},{"categories":["Film and TV"],"collections":[],"content":"The Fantasy of Tomihiko Morimi\rTomihiko Morimi is a Japanese fantasy novelist whom I personally admire. \u0026ldquo;Penguin Highway\u0026rdquo; is referred to as a \u0026ldquo;non-Morimi-style\u0026rdquo; work, differing entirely in tone and theme from his other writings. His works, such as \u0026ldquo;The Tatami Galaxy\u0026rdquo; and \u0026ldquo;The Eccentric Family,\u0026rdquo; find humor in the mundane lives of adults and are often imbued with a sense of weariness. In contrast, \u0026ldquo;Penguin Highway\u0026rdquo; offers a child\u0026rsquo;s perspective. Morimi once edited an anthology of short stories by Osamu Dazai titled \u0026ldquo;Kisho to Egao.\u0026rdquo; He admitted that rather than being influenced by Dazai’s famous works like \u0026ldquo;No Longer Human\u0026rdquo; or \u0026ldquo;The Setting Sun,\u0026rdquo; it was Dazai’s humorous writing and engaging dialogue that left a more significant mark on him. Regarding his writing process, he confessed that despite contemplating settings outside Kyoto, he ultimately found it impossible. It seems he can only depict and imagine within his familiar circle of daily life. ","date":"2020-12-24","heading":"The Fantasy of Tomihiko Morimi","objectID":"/en/posts/penguin/:1:0","tags":["Movies"],"title":"Penguin Highway: The Journey of a Boy Growing Up","uri":"/en/posts/penguin/#the-fantasy-of-tomihiko-morimi"},{"categories":["Film and TV"],"collections":[],"content":"Penguin Highway\rSynopsis: During a dull and uneventful summer, a group of penguins mysteriously appears in a small town far from the sea. After witnessing a cola can thrown by a dental assistant (voiced by Yuu Aoi) transform into a penguin, an inquisitive young boy named Aoyama (voiced by Kana Kita) becomes determined to uncover the truth, embarking on an unforgettable summer adventure filled with wonder. ","date":"2020-12-24","heading":"Penguin Highway","objectID":"/en/posts/penguin/:2:0","tags":["Movies"],"title":"Penguin Highway: The Journey of a Boy Growing Up","uri":"/en/posts/penguin/#penguin-highway"},{"categories":["Film and TV"],"collections":[],"content":"Overview\rThe vast world is full of unending mysteries. Amid the innocence of youth, the boy faces storms and ultimately captures his sweet dream through growth. However, growing up often comes at the cost of letting go\u0026hellip; The Female Lead (The Assistant): A mysterious figure who can conjure penguins, she is the source of the enigmatic occurrences. She plays chess with Aoyama, indulges some of his whims, is beautiful and intellectual, and admires his scientific mind, calling him the \u0026ldquo;Child of Science.\u0026rdquo; As pictured\rThe Male Lead, Aoyama: A precocious fourth-grader who views everything, including the assistant\u0026rsquo;s breasts, as a subject of study. He considers her the epitome of perfection. As pictured\rAoyama\u0026rsquo;s research on breasts|481\r","date":"2020-12-24","heading":"Overview","objectID":"/en/posts/penguin/:2:1","tags":["Movies"],"title":"Penguin Highway: The Journey of a Boy Growing Up","uri":"/en/posts/penguin/#overview"},{"categories":["Film and TV"],"collections":[],"content":"Elementary Students and Curiosity\r\u0026ldquo;A gentleman’s passions are tempered by reason.\u0026rdquo; From a child\u0026rsquo;s perspective, such a storyline adds a touch of humor, much like \u0026ldquo;Your Name,\u0026rdquo; where adolescent traits are subtly revealed without overshadowing the narrative. The protagonist\u0026rsquo;s age brings comedic moments to the film. ","date":"2020-12-24","heading":"Elementary Students and Curiosity","objectID":"/en/posts/penguin/:2:2","tags":["Movies"],"title":"Penguin Highway: The Journey of a Boy Growing Up","uri":"/en/posts/penguin/#elementary-students-and-curiosity"},{"categories":["Film and TV"],"collections":[],"content":"Solving Mysteries\rThe movie revolves around the mysteries of the \u0026ldquo;sea,\u0026rdquo; the assistant, and the various animals she generates. Aoyama\u0026rsquo;s father provides intriguing advice on his research: Break down big questions into smaller ones. Ask many questions and draw connections. Look at problems from a broader perspective. A Thought Experiment\rImagine if the light in your house goes out. What could be the reason? A tripped circuit breaker? A short circuit? These seem plausible. But then you realize the entire town is dark. Suddenly, you have a new hypothesis. By linking his studies on \u0026ldquo;The World’s End,\u0026rdquo; \u0026ldquo;Channel Research,\u0026rdquo; and \u0026ldquo;The Assistant\u0026rsquo;s Breasts,\u0026rdquo; Aoyama discovers the hidden connections between the mysterious events, experiencing a sense of clarity as the pieces fall into place. Although the movie is a fantasy, the investigative process employs a scientific lens, giving the narrative a rational tone from the start. The protagonist\u0026rsquo;s youthful perspective makes the themes more lively, with subtle explorations of family, friendship, and more. Yet, the most remarkable aspect is how these themes are woven into Aoyama\u0026rsquo;s innocent feelings for the assistant, enriching but never overshadowing the main plot. ","date":"2020-12-24","heading":"Solving Mysteries","objectID":"/en/posts/penguin/:2:3","tags":["Movies"],"title":"Penguin Highway: The Journey of a Boy Growing Up","uri":"/en/posts/penguin/#solving-mysteries"},{"categories":["Film and TV"],"collections":[],"content":"The Revelation\rBy connecting all the elements, Aoyama arrives at the following relationship (approximately): The movie gradually unravels these connections with a well-paced rhythm that keeps the audience intrigued. Relationship diagram (spoilers about the sea\u0026rsquo;s properties are omitted)\rThe assistant is both a beneficiary and a predator of the \u0026ldquo;sea,\u0026rdquo; forming a miniature ecosystem. Professor Wang Peng interprets this as a reflection of \u0026ldquo;the coexistence of truth and fallacy,\u0026rdquo; suggesting that \u0026ldquo;the assistant embodies truth.\u0026rdquo; Hence, the protagonist’s admiration for her symbolizes an admiration for truth—enigmatic and distant. Despite his precociousness, Aoyama remains a child. Ultimately, due to the sea\u0026rsquo;s instability, the assistant chooses to destroy it, sacrificing herself to prevent the sea from overwhelming the town. \u0026ldquo;The sea\u0026rdquo; becomes a truth known only to Aoyama. It serves as his rite of passage, guiding him toward exploring the world. I agree with Professor Wang Peng: The assistant embodies beauty and mystery, making Aoyama, the \u0026ldquo;explorer,\u0026rdquo; instinctively develop feelings for her. However, I believe it is equally vital to recognize that \u0026ldquo;Penguin Highway\u0026rdquo; is a coming-of-age story: Initially, Aoyama feared losing his baby teeth. One night, his younger sister expressed her fear that \u0026ldquo;someday, Mom might die.\u0026rdquo; From that moment, Aoyama’s transformation became more pronounced. With the assistant’s help, he courageously overcame his fear of losing a tooth. Ultimately, he accepts the assistant\u0026rsquo;s sacrifice, signifying his growth. Through this journey, Aoyama becomes braver and transitions from pure scientific reasoning to a more emotional perspective, grounded in a belief in science and the courage to confront growth. The assistant provides him with a new way of seeing the world. The assistant\u0026rsquo;s final disappearance\u0026hellip;\rThe assistant serves as a \u0026ldquo;guide.\u0026rdquo; Every child may have such a figure in their heart—someone who grows old and eventually leaves. While it brings sorrow, it also teaches acceptance and growth, shaping the child into a better adult. The film is incredibly gentle, frequently hinting that \u0026ldquo;the sea\u0026rdquo; represents the world\u0026rsquo;s end. This concept reshapes Aoyama\u0026rsquo;s worldview, becoming a part of his growth. Since the assistant is not human, her disappearance at the end leaves room for interpretation about the \u0026ldquo;sea\u0026rdquo; and its connection to the world’s end. A fantasy film grounded in science, mended with warmth and growth, \u0026ldquo;Penguin Highway\u0026rdquo; charts a unique path. So, what lies at the end of the Penguin Highway? It is the silhouette of a boy running, exploring amidst loss, and ultimately growing into an exceptional adult. Keep running, along the Penguin Highway, until you reach the world’s end! ","date":"2020-12-24","heading":"The Revelation","objectID":"/en/posts/penguin/:3:0","tags":["Movies"],"title":"Penguin Highway: The Journey of a Boy Growing Up","uri":"/en/posts/penguin/#the-revelation"},{"categories":["Travel"],"collections":[],"content":" A casual essay assignment for the Modern History course. The autumnal atmosphere of Beijing is often particularly intense, for this land brims with profound history. Ancient capitals of the Jin, Yuan, Ming, and Qing dynasties rose upon this soil; the smoke of war from Beiping lingers long without dissipating; countless heroes and sages have halted here, leaving behind silhouettes that the world reveres—and the great standard-bearer of the New Culture Movement, Lu Xun, also left a brilliant mark in Beijing. No. 19, Fuchengmen Ertiao—this was my first stop upon coming to Beijing during my university years: Lu Xun\u0026rsquo;s Former Residence. I wondered with what state of mind this great literary master came to the flourishing city of Beijing? What manner of scenery would the former residence of such a lifelong vanguard of the pen hold? The exhibition hall sits within a hutong (narrow alleyway), secluded and tranquil. I entered from a bustling commercial street, possessing a certain sense of \u0026ldquo;a winding path leading to a secluded retreat,\u0026rdquo; much like the profound connotations under Lu Xun\u0026rsquo;s literary brushwork. Perhaps to avoid excessively disturbing the legacy left by the master, the hutong has remained largely unchanged. Beside it stand plump birds scattered here and there; the crisscrossing network of hutong lanes maintains its antique appearance, with clothes drying openly on all sides and motorcycles parked around. I imagine that were Mr. Lu Xun alive today, he would be pleased to witness such harmonious development. Heroes dedicated themselves to peace, and this is precisely the tranquility they prayed for. The tiled houses flanking the ancient main gate are covered in moss, while towering trees provide shelter amidst the autumn wind, as if Mr. Lu Xun were still extending welcoming arms to visitors. Such scenery and atmosphere readily bring to mind secluded dwellings like \u0026ldquo;Zhuge\u0026rsquo;s Thatched Cottage\u0026rdquo; and \u0026ldquo;The Humble Room Inscription.\u0026rdquo; The above description can hardly be called baseless association; in fact, many visitors, before even stepping through the gate, begin plotting photographs beside the tall trees and tiled houses. 如图\rAfter making an online reservation for the exhibition, one can enter by displaying a health code and ID card. There is not a single fee charged—a true display of Beijing\u0026rsquo;s generosity. Lu Xun and Guo Moruo\rThe plaque \u0026ldquo;Lu Xun Former Residence\u0026rdquo; was written by Guo Moruo. It seems Mr. Guo Moruo truly traveled far and wide—the calligraphy of our three famous local universities also originated from his brush. Interestingly, \u0026ldquo;From afar it looks like a dog, up close it looks like a Japanese dog, upon closer inspection, it turns out to be Mr. Guo Moruo.\u0026rdquo; This remark is rumored to be Lu Xun\u0026rsquo;s evaluation of this \u0026ldquo;talent and rogue.\u0026rdquo; Whether it is authentic can no longer be verified, but after verification, the former residence in Shanghai was actually also inscribed by Mr. Guo Moruo, so personally I feel the probability that Mr. Lu Xun actually said that evaluation should be quite small. Entering the courtyard, I was surprised to find it so intimate? The first things to catch one\u0026rsquo;s eye are two plump orange cats, quietly enjoying the crowd\u0026rsquo;s adoration, occasionally stretching lazily and sauntering a few steps. The solemn former residence instantly became intimate and approachable. Thinking about it, although Mr. Lu Xun originally gave people a serious impression, his lovable qualities were by no means few—could works like \u0026ldquo;Old Tales Retold\u0026rdquo; be written by someone with a dry and insipid soul? 如图\rThe main exhibition hall has two floors, above ground and below, using Lu Xun\u0026rsquo;s life timeline as its thread, roughly divided into several stages. Each exhibition room unfolds continuously according to Mr. Lu Xun\u0026rsquo;s original writings. At the very front stands a large white wall with simple patterns, upo","date":"2020-12-19","heading":"","objectID":"/en/posts/lxgj/:0:0","tags":["Travel"],"title":"Lu Xun's Former Residence: The Sole Light","uri":"/en/posts/lxgj/#"},{"categories":["Travel"],"collections":[],"content":" A little essay from my first year of high school that I unexpectedly dug up, filed here for the record. In my youth I was fond of clever parallelism, half-vernacular and half-classical, ornate but hollow. Though the words merely get the meaning across, the brilliance of those youthful days feels like yesterday, and it makes me nostalgic — so here it is, filed for the record. The soldier steadies the heart and calms the breath, and with a stern martial air stands tall and gallant. The common heart, compared with the soldier\u0026rsquo;s heart, is far inferior. Our school uses military training to cultivate people and foster virtue, to practice breadth and completion, and to drill the three merits of military discipline. Given time, we shall surely become great vessels! ","date":"2017-10-06","heading":"","objectID":"/en/posts/zw/:0:0","tags":["Military Training"],"title":"Three Merits of Military Training","uri":"/en/posts/zw/#"},{"categories":["Travel"],"collections":[],"content":"The First Merit: Still as Water\rThe sun\u0026rsquo;s blaze had not dimmed, and the great wind held its troops in check. Ten thousand miles of sky were all clear, and rivers of sour sweat ran into the fields. The uniform on my body had long been soaked and softened. My hands, my back, my chin\u0026hellip; all tingled numbly from the wandering sweat, yet I could not reach to wipe it away. Bitterly I waited, joints numb, drenched in sweat. Then a wisp of breeze brushed my face, and the world grew easy. It was only a wisp of wind, yet it nourished my parched soul at that moment. I felt the breeze against my cheek, lifting my hair, and finally gathering in the dark bamboo grove behind the rostrum. My gaze was like clear water; the breeze lifted my sleeve, and I stood unmoved, while my heart had long since grown still as still water, flowing toward the distance\u0026hellip; ","date":"2017-10-06","heading":"The First Merit: Still as Water","objectID":"/en/posts/zw/:0:1","tags":["Military Training"],"title":"Three Merits of Military Training","uri":"/en/posts/zw/#the-first-merit-still-as-water"},{"categories":["Travel"],"collections":[],"content":"The Second Merit: The Merit of Alignment\rMarching depends on spirit, and rests on the neatness of the ranks. When steps are in unison and voices resonate, that mountain-toppling momentum gushes forth. The trouble was that our row was half boys and half girls, yet we had to be split apart and woven into two great columns. \u0026ldquo;Look left! Keep the line! How many times do I have to say it — mind the line!\u0026rdquo; The instructor and teachers shouted themselves hoarse, to little effect. Only by doing it again! We kept marching, learning from each mistake, lining up the ranks with the corner of our eyes. Now lifting our feet high, now lowering our steps, finding the rhythm\u0026hellip; At last the playground resounded with the uniform beat of marching steps, one step after another, long and lingering\u0026hellip; ","date":"2017-10-06","heading":"The Second Merit: The Merit of Alignment","objectID":"/en/posts/zw/:0:2","tags":["Military Training"],"title":"Three Merits of Military Training","uri":"/en/posts/zw/#the-second-merit-the-merit-of-alignment"},{"categories":["Travel"],"collections":[],"content":"The Third Merit: The Long March\rTwo hours had passed since we set out; the laughter and chatter of the start seemed to have vanished into the mountain mist, hazy and distant. Numb after many turns, seeing the column stretching farther and farther ahead, I could only grit my teeth and press on. Just like that — repeated endurance, changing scenery, no surging resolve and no stirring ups and downs. Only one step and the next, walking out of × Middle School and back to × Middle School, everything natural yet somehow unfinished. The road is always measured by our own feet. Seven days of military training, all for three merits, tempered day and night — surely never to be forgotten or let go for a lifetime. Learn three merits, savor three virtues: still as water — finding stillness in hardship; the merit of alignment — seeing the worthy and striving to match them; the long march past — measuring oneself. Ah! The subtle delight I take from military training lies in these three! ","date":"2017-10-06","heading":"The Third Merit: The Long March","objectID":"/en/posts/zw/:0:3","tags":["Military Training"],"title":"Three Merits of Military Training","uri":"/en/posts/zw/#the-third-merit-the-long-march"},{"categories":null,"collections":null,"content":"About HXS\rReasons to use blogs: I want to try to build my own website I want to leave a little mark on the world Zhihu writes notes, but actually restricts off-site reference links Bottom line: A Libra who is learning the quadratic of economics, trying to gauge the intriguing and deep. Contact: home on social media Zotero Paper Group: I most aspire to research related to economic growth, and most often read research related to development economics, and I am always refreshed by causal inference to refresh the world\u0026rsquo;s cognition. Steam: Open world, role-playing, card strategy players. Bilibili: Preference for world-system, reasoning, and fantasy elements. Zhihu: Pay attention to the world Github: Know a little about chinese ancient poetry writing and LaTeX, easy to use AI, plaese see 《Song of the Heartless 》and 《Spiritual Pollution》。 ","date":"0001-01-01","heading":"About HXS","objectID":"/en/about/:0:0","tags":null,"title":"","uri":"/en/about/#about-hxs"},{"categories":null,"collections":null,"content":" This tune is for one who truly hears. When the song ends, only moonlight keeps the past. Over warm wine, we meet the few who understand. ","date":"0001-01-01","heading":"","objectID":"/en/friends/:0:0","tags":null,"title":"Friends Afar","uri":"/en/friends/#"},{"categories":null,"collections":null,"content":"Classmates\rFrom middle school to college, the rankings were always random\u0026hellip; YllhwaFernvenuekLiHzBdim无边的奇想角落Wenjun Zheng抹月批风FinneasLes1ie花开庄 ","date":"0001-01-01","heading":"Classmates","objectID":"/en/friends/:1:0","tags":null,"title":"Friends Afar","uri":"/en/friends/#classmates"},{"categories":null,"collections":null,"content":"Bloggers\rSome are one-way links to blogs I simply find interesting. Web of Nothing_松易涅槐序理论派时歌TengFei破博客Yuteng Yan狐狸反走矣LS-Shandong赫赫文王寒夏摸鱼站刑辩人在路上第三夏尔蓝小柠Lruihao萌豚 MoechuImCaOxkcdRhizome6young吕志冲左祥太 ","date":"0001-01-01","heading":"Bloggers","objectID":"/en/friends/:2:0","tags":null,"title":"Friends Afar","uri":"/en/friends/#bloggers"},{"categories":null,"collections":null,"content":"Economists\rThe best social scientists dig with worldviews. 陆铭叶晓阳Zhiren Hu陶哲轩Greg MankiwETH ZurichChris BlattmanDaron AcemogluDavid YJeff ElyNicolasschutzPatrick Hamilton宋铮洪永淼曹一鸣方汉明陈硕史震涛王绍达聂辉华David MckenzieEconbrowserSTATA 官方R 开发者博客Arcgis 开发博客statlect ","date":"0001-01-01","heading":"Economists","objectID":"/en/friends/:3:0","tags":null,"title":"Friends Afar","uri":"/en/friends/#economists"},{"categories":null,"collections":null,"content":"Hugo\rTinkering is not useless. It simply does not end. LoveIt 主题Stilig雨临Lewis十年之约开往：友链计划萌备BlogFinder博友圈博友俱乐部 ","date":"0001-01-01","heading":"Hugo","objectID":"/en/friends/:4:0","tags":null,"title":"Friends Afar","uri":"/en/friends/#hugo"},{"categories":null,"collections":null,"content":"Link Format\r- nickname: HXS\ravatar: https://blog.huaxiangshan.com/images/avatar.png\rurl: https://blog.huaxiangshan.com/\rdescription: An unaffiliated wanderer, basically a solo trainee\rweight: 100\r","date":"0001-01-01","heading":"Link Format","objectID":"/en/friends/:5:0","tags":null,"title":"Friends Afar","uri":"/en/friends/#link-format"}]