This page provides an organized collection of code and links to software.


Code Examples 

These code examples illustrate the basics of modeling. The examples cover general modeling, statistical analysis, model evaluation, data handling, graphs and graphics, and Shiny in RStudio. Most examples are written for R or SAS. All code examples can be found in the NANP GitHub Repository. The various content areas and links to GitHub are listed below. No GitHub account is required for downloads.

The use of this material should be acknowledged. Suggested Citation: National Animal Nutrition Program (year). Accessed (Date)

To download, click the "Clone or Download" button. To run, open files with R, SAS, or the appropriate software.

Content Areas and Links to NANP GitHub Repository 

Data Handling 


Graphs and Graphics 

Model Evaluation 

Statistical Analysis 




Software are specialized computer programs for data analysis and modeling. The table below contains a brief list of some common software programs available.



 R Language

R is a language and environment for statistical computing and graphics. It is a GNU project which is similar to the S  language and environment which was developed at Bell Laboratories (formerly AT&T, now Lucent Technologies) by  John  Chambers and colleagues. R can be considered as a different implementation of S. R provides a variety of  statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering, etc)  and graphical techniques, and is highly extensible. 

R website


SAS features an intuitive interface that lets you interact with the software from your computer. It is a powerful  programming language that is easy to learn and easy to use. SAS provides a comprehensive, reliable suite of tools that  include state-of-the-art statistical methods. It is a robust, yet flexible, matrix programming language. 


SAS website


Stella offers a practical way to dynamically visualize and communicate how complex systems and ideas really work.  Whether they are first-time or experienced modelers, teachers, students, and researchers use stella to explore and  answer endless questions.

Stella website 


Stata statistical software is a complete, integrated statistical software package that provides everything you need for    data analysis, data management, and graphics. Stata is not sold in modules, which means you get everything you need  in one package. And, you can choose a perpetual license, with nothing more to buy ever. Annual licenses are also  available. 

Stata website 

 The General Algebraic Modeling System (GAMS)  

GAMS is a high-level modeling system for mathematical programming and optimization. It consists of a language  compiler and a stable of integrated high-performance solvers. GAMS is tailored for complex, large scale modeling  applications, and allows you to build large maintainable models that can be adapted quickly to new situations. 

GAMS website 


MATLAB® is a high-level language and interactive environment for numerical computation, visualization, and  programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The  language, tools, and built-in math functions enable you to explore multiple approaches and reach a solution faster than  with spreadsheets or traditional programming languages, such as C/C++ or Java™. 

MATLAB website 


Python is an interpreted, interactive, object-oriented programming language. It incorporates modules, exceptions,  dynamic typing, very high-level dynamic data types, and classes. Python combines remarkable power with very clear  syntax. It has interfaces to many system calls and libraries, as well as to various window systems, and is extensible in C  or C++. It is also usable as an extension language for applications that need a programmable interface. Finally, Python  is portable: it runs on many Unix variants, on the Mac, and on PCs under MS-DOS, Windows, Windows NT, and OS/2. 

Python website 


Vensim is a simulation software for improving the performance of real systems. Vensim is used for developing,  analyzing, and packaging dynamic feedback models. The software emphasized high quality, weigh tdimensional  consistency and reality checks; connections to data and sophisticated calibration methods; instant output with  continuous simulation in SyntheSim; flexible model publication; model analysis, including optimization and monte carlo  simulation. 

Vensim website 


The award-winning acslX environment provides integrated, end-to-end capabilities for model development, simulation    execution, and results analysis. Models are specified using either familiar block diagram notation, or code-based  descriptions using the CSL modeling language. By default, all model representations are translated into C or FORTRAN  language source code for compilation and execution, ensuring the fastest possible performance and support for  extremely large or complex models. Open application programming interfaces (APIs) are provided throughout the  system to extend acslX functionality, allow the integration of custom or legacy code within acslX models, or to embed  the generated simulation into end-user applications. Model code reuse is supported through easily creatable user-  defined libraries of simulation blocks. acslXtreme provides a powerful simulation control scripting language and  mathematical analysis environment based on the popular M language for mathematical computing. 

acslX website 

 Microsoft Excel

Microsoft Excel is primarily a spreadsheet program that runs on multiple platforms (phones, tablets). Excel can be used  to visualize data and share with others. Basic statistical functions are available and a simple linear optimizer is included.

Excel website