Package: MyFirstFourStepModel 1.0.0

MyFirstFourStepModel: Highly Simplified Four-Step Travel Demand Models for Teaching

This package provides a highly simplified four-step model. Running the model requires only R, and is designed to be computationally efficient and run even on consumer-grade equipment.

Authors:Matt Bhagat-Conway [aut, cre]

MyFirstFourStepModel_1.0.0.tar.gz
MyFirstFourStepModel_1.0.0.zip(r-4.7-x86_64)MyFirstFourStepModel_1.0.0.zip(r-4.6-x86_64)MyFirstFourStepModel_1.0.0.zip(r-4.5-x86_64)
MyFirstFourStepModel_1.0.0.tgz(r-4.6-x86_64)MyFirstFourStepModel_1.0.0.tgz(r-4.6-arm64)MyFirstFourStepModel_1.0.0.tgz(r-4.5-arm64)MyFirstFourStepModel_1.0.0.tgz(r-4.5-x86_64)
MyFirstFourStepModel_1.0.0.tar.gz(r-4.7-arm64)MyFirstFourStepModel_1.0.0.tar.gz(r-4.7-x86_64)MyFirstFourStepModel_1.0.0.tar.gz(r-4.6-arm64)MyFirstFourStepModel_1.0.0.tar.gz(r-4.6-x86_64)
manual.pdf |manual.html
DESCRIPTION
card.svg |card.png
MyFirstFourStepModel/json (API)

# Install 'MyFirstFourStepModel' in R:
install.packages('MyFirstFourStepModel', repos = c('https://mattwigway.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/mattwigway/myfirstfourstepmodel/issues

Pkgdown/docs site:https://projects.indicatrix.org

On CRAN:

Conda:

rustcargo

5.21 score 6 stars 9 scripts 19 exports 116 dependencies

Last updated from:37179f31b5. Checks:11 WARNING, 1 OK, 1 FAIL. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64WARNING302
linux-devel-x86_64WARNING396
source / vignettesOK711
linux-release-arm64WARNING304
linux-release-x86_64WARNING350
macos-release-arm64WARNING366
macos-release-x86_64WARNING745
macos-oldrel-arm64WARNING231
macos-oldrel-x86_64WARNING486
windows-devel-x86_64WARNING367
windows-release-x86_64WARNING410
windows-oldrel-x86_64WARNING377
wasm-releaseFAIL218

Exports:add_householdsestimateestimate_vmtget_mode_sharesload_landuse_scenarioload_modelload_nhtsmap_congestionmap_trip_distributionmap_trip_generationmode_choicemodify_waysnetwork_assignmentnetwork_to_gissave_landuse_scenariosave_modeltribbletrip_distributiontrip_generation

Dependencies:askpassbackportsbase64encbitbit64bslibcachemcellrangercheckmateclassclassIntclicliprclustercolorspacecpp11crayoncredentialscurldata.tableDBIdescdigestdplyre1071evaluatefarverfastmapfontawesomeforeignFormulafsgenericsgertggplot2gitcredsgluegridExtragtablehighrHmischmshtmlTablehtmltoolshtmlwidgetshttrhttr2igraphiniisobandjquerylibjsonliteJuliaCallKernSmoothknitrlabelinglatticelifecyclemagrittrMASSMatrixmemoisemimennetopensslpillarpkgconfigprettyunitsprogressproxypurrrR6rappdirsRColorBrewerRcppreadrreadxlrematchrjsonrlangrmarkdownrpartrprojrootrstudioapirvests2S7sassscalesselectrsfstringistringrsystibbletidycensustidyrtidyselecttigristinytextzdbunitsusethisutf8uuidvctrsviridisLitevroomwhiskerwithrwkwritexlxfunxml2yamlzip

Estimation
References

Last update: 2026-03-13
Started: 2026-03-13

Example homework assignment
Homework assignment | Extra credit

Last update: 2026-03-13
Started: 2026-03-13

Learning module
Introduction | Installation | Loading the package and the model | Trip generation | Trip distribution | Mode choice | Network assignment | Land use scenarios | Network scenarios | References

Last update: 2026-03-13
Started: 2026-03-13

Methods and input data
Trip generation | Trip distribution | Mode choice | Network assignment | References

Last update: 2026-03-13
Started: 2026-03-13

Prior work
References

Last update: 2026-03-13
Started: 2026-03-13

Scenario creation
Land use scenarios | Network scenarios

Last update: 2026-03-13
Started: 2026-03-13

Readme and manuals

Help Manual

Help pageTopics
Add households to particular Census tracts in the regionadd_households
This calibrates the trip distance beta, using the method described in Merlin (2020) A new method using medians to calibrate single-parameter spatial interaction models, JTLU. The basic idea is that we adjust the beta for the decay function until half the distance-weighted accessibility occurs in the median travel distance. For NHB, productions and attractions will be the samecalibrate_trip_distance_beta
Calibrate betas for all trip types median_distances should be a list with element HBW, HBO, and NHB with median crow-flies trip distances in each.calibrate_trip_distance_betas
Estimate a four step model for later use, based on 2017 NHTS data and PSRC household survey data (for distribution functions).estimate
Calculates VMT based on flows.estimate_vmt
This function uses the output of 'mode_choice()' to calculate mode shares.get_mode_shares
Load a land use scenario in Excel formatload_landuse_scenario
Load a modelload_model
Load a model in model format 0 (used with pre-2026 releases)load_model_v0
Load 2017 NHTS data, handling types appropriatelyload_nhts
Produce a congestion mapmap_congestion
Map trip distribution from a single trip.map_trip_distribution
Map trip generation.map_trip_generation
This runs the mode choice step of the model, and returns flows differentiated by mode for each trip type and time of day.mode_choice
Modify network attributes of existing OSM ways. Note that this currently only updates them for modeling; visualizations and GIS exports are not changed.modify_ways
This runs the network assignment step of the model.network_assignment
Convenience function to export a network scenario to a GIS filenetwork_to_gis
Save a land use scenario in Excel formatsave_landuse_scenario
Save a modelsave_model
This runs the trip distribution step of the modeltrip_distribution
This runs the trip generation step of the model.trip_generation
Write the minimal information to be able to reconstruct enough of an lm to be able to do prediction.write_lm
Write just enough of a multinomial logit model that we can deserialize and apply itwrite_mnl