Beginner's Guide to Computation in Statistical Research: Difference between revisions

From Stat DS Computing Wiki
use a grid of boxes instead of a sequence
 
(16 intermediate revisions by one other user not shown)
Line 1: Line 1:
While the foundations of statistical methods are grounded in mathematical theory, we often need to demonstrate that these methods '''are useful in practice'''. This can done via toy examples, simulation studies, and applications to real-world datasets. We do not recommend spending hundreds of hours running calculations on datasets by hand. Thus, we will introduce the reader to core concepts of statistical computing and relevant resources in the CMU Department of Statistics and Data Science.
At some point, you will need to demonstrate that your statistical methods actually work in practice. Whether you are running a toy simulation, analyzing real-world data, or optimizing a complex neural network, you will need to write code. If you are new to computing, the wiki can be overwhelming. '''Read every section top to bottom up through the Reproducibility and Collaboration section. (You do not need to read every page in every section, but note their existence)''' It is designed to take you from installing your first language to running massive workflows on department servers.


== Implementation ==
== Implementation ==
The main aim for statistical computing is to implement proposed algorithms in code such that they can be applied to a variety of inputs very quickly. These implementations can be as simple as computing the OLS coefficients to optimizing a billion-parameter neural network.  
Your first goal is to translate mathematical algorithms into functional code. '''It is important to familiarize yourself with these concepts early on.'''


These implementations are usually achieved through computer programming. As a student in the Statistics department, you will be exposed to a variety of programming languages and tools. Below is a reading list of first steps to get you started on your computation journey
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(500px, 1fr))">
{| class="wikitable"
<div style="background-color: #f8f9fa; border-left: 4px solid #C41230; padding: 10px 15px; margin-bottom: 10px;">
|+
'''[[Choosing and Installing a Programming Language]]''' <br>
!Title
Help deciding between R, Python, Julia, or other languages and how to get them running on your personal machine.
!Description
</div>
!Reading Time?
 
|-
<div style="background-color: #f8f9fa; border-left: 4px solid #C41230; padding: 10px 15px; margin-bottom: 10px;">
|[[Choosing and Installing a Programming Language]]
'''[[Installing and Configuring an Integrated Development Environment]]''' <br>
|Helping you decide between R, Python, etc
Your IDE (Integrated Development Environment) is your workshop. Learn how to set up VS Code or RStudio.
|5 minutes
</div>
|-
 
|[[Installing and Configuring an Integrated Development Environment]]
<div style="background-color: #f8f9fa; border-left: 4px solid #C41230; padding: 10px 15px; margin-bottom: 10px;">
|Your coding program is just as important as your programming language
'''[[Beyond Print Statements: Breakpoint Debugging]]''' <br>
|
Your IDE (Integrated Development Environment) is your workshop. Learn how to set up VS Code or RStudio.
|-
</div>
|[[Other Helpful Resources for Implementation]]
 
|Things like AI, CMU Courses, and informational seminars
<div style="background-color: #f8f9fa; border-left: 4px solid #C41230; padding: 10px 15px; margin-bottom: 10px;">
|}
'''[[Command Line Basics]]''' <br>
#  
Essential survival skills for navigating your computer without graphical windows
#  
</div>
</div>
#


== Scale and Efficiency ==
== Scale and Efficiency ==
Once you have gotten the hang of implementing statistical algorithms in code, the next major hurdle will be making your workflows '''scalable and efficient'''. For code running on your own machine, you want to make sure you are using every CPU core and every bit of RAM as efficiently as possible. Even then, your personal computer alone can only get you so far. Thankfully, the department also provides several options for remote high-performance computing for even the largest of research workflows.
Once you have gotten the hang of implementing statistical algorithms in code, the next major hurdle will be making your workflows '''scalable and efficient'''. For code running on your own machine, you want to make sure you are using every CPU core and every bit of RAM as efficiently as possible. Even then, your personal computer alone can only get you so far. Thankfully, the department also provides several options for remote high-performance computing for even the largest of research workflows.
{| class="wikitable"
 
!Title
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(500px, 1fr))">
!Description
<div style="background-color: #f8f9fa; border-left: 4px solid #C41230; padding: 10px 15px; margin-bottom: 10px;">
!Reading Time?
'''[[Building Workflows on Remote Servers]]''' <br>
|-
Using the department servers and other computing clusters
|[[Parallelization: Making the most of your Machine]]
</div>
|How to run many experiments at once
 
|
<div style="background-color: #f8f9fa; border-left: 4px solid #C41230; padding: 10px 15px; margin-bottom: 10px;">
|-
'''[[Parallelization: Making the most of your Machine]]''' <br>
|[[Building Workflows on Remote Servers]]
How to run multiple experiments simultaneously without babysitting your machine
|Using the department servers and other computing clusters
</div>
|
 
|-
<div style="background-color: #f8f9fa; border-left: 4px solid #C41230; padding: 10px 15px; margin-bottom: 10px;">
|[[Big Data Management]]
'''[[Big Data Management]]''' <br>
|How to handle datasets that are measured in terabytes
How to handle datasets that are measured in terabytes
|}
</div>
#
 
</div>


== Reproducibility and Collaboration ==
== Reproducibility and Collaboration ==
While it is important that you are able to obtain results efficiently, it is also equally important for other member of the academic community to arrive at your same results independently. Specifically, others should be able to run your workflow and obtain the exact same output as you did with minimal tinkering and friction.  
While it is important that you are able to obtain results efficiently, it is also equally important for other members of the academic community to arrive at your same results independently. Specifically, others should be able to run your workflow and obtain the exact same output as you did with minimal tinkering and friction.
 
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(500px, 1fr))">
<div style="background-color: #f8f9fa; border-left: 4px solid #C41230; padding: 10px 15px; margin-bottom: 10px;">
'''[[Version Control]]''' <br>
Keeping track of code/experiment history
</div>
 
<div style="background-color: #f8f9fa; border-left: 4px solid #C41230; padding: 10px 15px; margin-bottom: 10px;">
'''[[Dependency Management]]''' <br>
Making sure anyone else in the world can run your workflow
</div>
 
</div>
 
== Software Development (Optional) ==
If you envision yourself making your methods and associated algorithms available for mass adoption, there are other considerations for publishing your code that go beyond simple reproduciblity. Other should not only be able to reproduce your results, but also modify your code for new experiments with minimal hassle.


# [[Version Control]]
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(500px, 1fr))">
# [[Dependency Management]]
<div style="background-color: #f8f9fa; border-left: 4px solid #C41230; padding: 10px 15px; margin-bottom: 10px;">
'''[[Creating Libraries and Packages]]''' <br>
How to structure your code to for easy consumption by other researchers
</div>


== Software Development ==
<div style="background-color: #f8f9fa; border-left: 4px solid #C41230; padding: 10px 15px; margin-bottom: 10px;">
Topics like
'''[[Working with package repositories]] (TBW)''' <br>
How to upload your packages to public repositories for easy widespread distribution.
</div>


* [[Developing python packages]] and [[Developing R packages]]
</div>

Latest revision as of 14:18, 7 July 2026

At some point, you will need to demonstrate that your statistical methods actually work in practice. Whether you are running a toy simulation, analyzing real-world data, or optimizing a complex neural network, you will need to write code. If you are new to computing, the wiki can be overwhelming. Read every section top to bottom up through the Reproducibility and Collaboration section. (You do not need to read every page in every section, but note their existence) It is designed to take you from installing your first language to running massive workflows on department servers.

Implementation

Your first goal is to translate mathematical algorithms into functional code. It is important to familiarize yourself with these concepts early on.

Choosing and Installing a Programming Language
Help deciding between R, Python, Julia, or other languages and how to get them running on your personal machine.

Installing and Configuring an Integrated Development Environment
Your IDE (Integrated Development Environment) is your workshop. Learn how to set up VS Code or RStudio.

Beyond Print Statements: Breakpoint Debugging
Your IDE (Integrated Development Environment) is your workshop. Learn how to set up VS Code or RStudio.

Command Line Basics
Essential survival skills for navigating your computer without graphical windows

Scale and Efficiency

Once you have gotten the hang of implementing statistical algorithms in code, the next major hurdle will be making your workflows scalable and efficient. For code running on your own machine, you want to make sure you are using every CPU core and every bit of RAM as efficiently as possible. Even then, your personal computer alone can only get you so far. Thankfully, the department also provides several options for remote high-performance computing for even the largest of research workflows.

Building Workflows on Remote Servers
Using the department servers and other computing clusters

Parallelization: Making the most of your Machine
How to run multiple experiments simultaneously without babysitting your machine

Big Data Management
How to handle datasets that are measured in terabytes

Reproducibility and Collaboration

While it is important that you are able to obtain results efficiently, it is also equally important for other members of the academic community to arrive at your same results independently. Specifically, others should be able to run your workflow and obtain the exact same output as you did with minimal tinkering and friction.

Version Control
Keeping track of code/experiment history

Dependency Management
Making sure anyone else in the world can run your workflow

Software Development (Optional)

If you envision yourself making your methods and associated algorithms available for mass adoption, there are other considerations for publishing your code that go beyond simple reproduciblity. Other should not only be able to reproduce your results, but also modify your code for new experiments with minimal hassle.

Creating Libraries and Packages
How to structure your code to for easy consumption by other researchers

Working with package repositories (TBW)
How to upload your packages to public repositories for easy widespread distribution.