关于大数据的定义很多。有将大数据定义为任何无法放入电脑的数据,也有将其定义为具有高容量、高速度和高多样性的数据。美国公共舆论研究协会(American Association of Public Opinion Research)的描述:“’大数据’是一个不精确的术语,描述了一组丰富而复杂的特性、实践、技术、伦理问题和与数据相关的结果”(Japec等人,2015)。
例如,研究者评估某项公共健康干预措施(如全国性疫苗推广计划)对降低特定疾病发病率的影响。假设干预预期效果很小——例如,只降低发病率0.5%(effect size小),因为大多数人已通过其他方式获得免疫。如果从全国数亿条健康记录中随机抽取小样本(如10万条),统计功效不足,无法可靠检测出这0.5%的差异(p值可能不显著,看起来像零效果)。在少数高风险人群中,效果才显现(如老人或偏远地区居民)。因此,需要分析整个大 N 数据集(数亿行记录)来积累足够的统计功率,区分真实政策效果与噪声,从而为政府决策提供依据(如是否继续推广疫苗)。这种小效果常见于政策评估,如果抽样,可能会错失微弱但重要的信号,导致无效结论。但是,已有成熟的机器学习方法(例如分布式随机森林)可以更好地解决这些问题。机器学习方法及应用是本课程介绍的重点内容,帮助解决传统统计方法在分析大数据中面临的困境。
编写高效代码
在处理中小规模数据集时,数据分析脚本是否高效编写可能无关紧要。然而,面对大型数据集,运行脚本可能会变得不顺畅,或者完全无法顺利运行。因此,需要了解如何在 R 中编写高效快速代码。本课程会在R语言基础部分,介绍进行R语言的高效编程的原则。
source browser city purchase
1 google Chrome San Jose 1
2 (direct) Edge Charlotte 1
3 (direct) Safari San Francisco 1
4 (direct) Safari Los Angeles 1
5 (direct) Chrome Chicago 1
6 (direct) Chrome Sunnyvale 1
lasso 估计提供了方便且高效的方法来获得一系列候选模型。lasso 的核心思想是在估计过程中惩罚模型复杂性,复杂性是造成模型不稳定的主要原因。然后,可以根据 k 折交叉验证的样本外预测方法,从候选模型序列中选择最终模型。下面基于 gamlr 包采用lasso 用于生成候选模型序列,基于 k 折交叉验证选择最佳模型。
library(gamlr)# 创建模型矩阵mm <-model.matrix(purchase~source, data = ga)# 更节省内存的方式,创建稀疏矩阵(因为模型矩阵中存在大量的0)mm_sparse <-sparse.model.matrix(purchase~source, data = ga)# 比较两种方式占用内存大小as.numeric(object.size(mm)/object.size(mm_sparse))
R 是本课程中主要使用的程序语言,完成收集、导入、清洗、可视化和分析数据等主要任务。同时,安装和使用专门为大数据设计的 R 包,将R作为使用其他程序语言的高级接口(如 C语言等)。此外,还将使用 R 命令与专门设计用于处理大数据的低级软件系统通信(例如数据仓库或在集群计算机上运行分析脚本的软件)。这样做的方便之处在于不用详细了解其他高级语言或低级软件系统,只需知道触发最终计算的 R 命令即可完成特定任务。
结构化查询语言(SQL)是课程中介绍的另一个重要软件工具。因为,需要通过 R 与低级大数据软件工具交互,以 SQL 命令形式(封装在 R 函数中)发送某些指令通常更方便,或者甚至是必须的。当前,SQL不仅应用于传统关系数据库系统,已经发展了许多与大数据系统交互的 SQL 变体,从 Apache Spark(用于大规模数据处理的统一分析平台)到 Apache Druid(基于列的分布式数据存储)和 AWS Athena(基于云的、无服务器查询服务,用于简单存储/数据湖)。
参考书籍
Pang-Ning Tan 数据挖掘导论(第2版),机械工业出版社,2019.
Ian Foster等 Big Data and Social Science: Data Science Methods and Tools for Research and Practice, CRC Press, 2021.
Kabacoff (王小宁等译) R语言实战(第3版),人民邮电出版社,2023.
Ulrich Matter Big Data Analytics: A Guide to Data Science Practitioners Making the Transition to Big Data, CRC Press, 2024.
Eric Matthes (袁国忠译) Python编程:从入门到实践(第3版),人民邮电出版社,2023.
参考文献
Elise Zufall, Tyler A Scott, Mark Lubell, Linda Estelí Méndez-Barrientos, Do governance platforms achieve the aims of the platform sponsor? Principal-agent tension in environmental governance reforms, Journal of Public Administration Research and Theory, Volume 35, Issue 3, July 2025, Pages 292–308, https://doi.org/10.1093/jopart/muaf015
Jan Boon, Jan Wynen, Koen Verhoest, Walter Daelemans, Jens Lemmens, A reputational perspective on structural reforms: how media reputations are related to the structural reform likelihood of public agencies, Journal of Public Administration Research and Theory, Volume 35, Issue 1, January 2025, Pages 58–72, https://doi.org/10.1093/jopart/muae023
Graham Ambrose, Saba Siddiki, Assessing drivers of sustained engagement in collaborative governance arrangements, Journal of Public Administration Research and Theory, Volume 34, Issue 4, October 2024, Pages 498–514, https://doi.org/10.1093/jopart/muae005
Robert A Greer, Tima T Moldogaziev, Ryan P Scott, Tyler A Scott, Signaling Resilience: A Computational Assessment of Narratives in Local Government Budgets, Journal of Public Administration Research and Theory, Volume 33, Issue 4, October 2023, Pages 688–700, https://doi.org/10.1093/jopart/muad001
Sicheng Chen, Tom Christensen, Liang Ma, Reputation Management and Administrative Reorganization: How Different Media Reputation Dimensions Matter for Agency Termination, Journal of Public Administration Research and Theory, Volume 33, Issue 2, April 2023, Pages 217–231, https://doi.org/10.1093/jopart/muac028
Hongyu Chen, Yuxiang Dong, Hao Li, Shuangzhi Tian, Longfeng Wu, Jinlong Li, Chensong Lin, Optimized green infrastructure planning at the city scale based on an interpretable machine learning model and multi-objective optimization algorithm: A case study of central Beijing, China,Landscape and Urban Planning,Volume 252,2024,105191,ISSN 0169-2046, https://doi.org/10.1016/j.landurbplan.2024.105191.
Abdesslam Chai-allah, Johannes Hermes, Anne De La Foye, Zander S. Venter, Frédéric Joly, Gilles Brunschwig, Sandro Bimonte, Nathan Fox,Assessing recreationists’ preferences of the landscape and species using crowdsourced images and machine learning,Landscape and Urban Planning,Volume 257,2025,105315,ISSN 0169-2046, https://doi.org/10.1016/j.landurbplan.2025.105315.
Zhichao Ba, Leilei Liu, Yikun Xia, Multidimensional policy citation features: Insights into policymakers’ policy adoption decision-making, Government Information Quarterly, Volume 42, Issue 1,2025,102004,ISSN 0740-624X, https://doi.org/10.1016/j.giq.2024.102004.