Closed christophsax closed 1 month ago
Perhaps also something for @andreranza?
There is a ‘popularity’ attribute in fredr, and we can use tags. Here I am getting two ‘pages’, i.e., each 2000 quarterly and monthly series.
library(fredr)
library(tidyverse)
monthly <-
fredr_tags_series("nsa;monthly", order_by = "popularity", sort_order = "desc")
monthly_p2 <-
fredr_tags_series("nsa;monthly", order_by = "popularity", sort_order = "desc", offset = 1000)
quarterly <-
fredr_tags_series("nsa;quarterly", order_by = "popularity", sort_order = "desc")
quarterly_p2 <-
fredr_tags_series("nsa;quarterly", order_by = "popularity", sort_order = "desc", offset = 1000)
The most popular series
monthly |>
select(id, title, popularity)
#> # A tibble: 1,000 × 3
#> id title popularity
#> <chr> <chr> <int>
#> 1 FEDFUNDS Federal Funds Effective Rate 98
#> 2 CSUSHPINSA S&P CoreLogic Case-Shiller U.S. National Home … 88
#> 3 REAINTRATREARAT10Y 10-Year Real Interest Rate 80
#> 4 AAA Moody's Seasoned Aaa Corporate Bond Yield 80
#> 5 UMCSENT University of Michigan: Consumer Sentiment 80
#> 6 TB3MS 3-Month Treasury Bill Secondary Market Rate, D… 79
#> 7 ACTLISCOUUS Housing Inventory: Active Listing Count in the… 78
#> 8 PPIACO Producer Price Index by Commodity: All Commodi… 78
#> 9 BOGMBASE Monetary Base; Total 78
#> 10 APU0000708111 Average Price: Eggs, Grade A, Large (Cost per … 76
#> # ℹ 990 more rows
quarterly |>
select(id, title, popularity)
#> # A tibble: 1,000 × 3
#> id title popularity
#> <chr> <chr> <int>
#> 1 MSPUS Median Sales Price of Houses Sold for the United St… 90
#> 2 ASPUS Average Sales Price of Houses Sold for the United S… 84
#> 3 GFDEBTN Federal Debt: Total Public Debt 83
#> 4 MMMFFAQ027S Money Market Funds; Total Financial Assets, Level 76
#> 5 USSTHPI All-Transactions House Price Index for the United S… 75
#> 6 GDPPOT Real Potential Gross Domestic Product 75
#> 7 DRTSCILM Net Percentage of Domestic Banks Tightening Standar… 73
#> 8 COMREPUSQ159N Commercial Real Estate Prices for United States 71
#> 9 CASTHPI All-Transactions House Price Index for California 71
#> 10 RHORUSQ156N Homeownership Rate in the United States 71
#> # ℹ 990 more rows
As for the less lower part of the table, we have:
monthly_p2 |>
select(id, title, popularity) |>
tail(10)
#> # A tibble: 10 × 3
#> id title popularity
#> <chr> <chr> <int>
#> 1 TWEXMTHY Trade-Weighted Exchange Value of U.S. Dollar v… 12
#> 2 JTU480099JOR Job Openings: Transportation, Warehousing, and… 12
#> 3 PCU3315233315231 Producer Price Index by Industry: Nonferrous M… 12
#> 4 APU0000711311 Average Price: Oranges, Navel (Cost per Pound/… 12
#> 5 PCU532111532111221 Producer Price Index by Industry: Passenger Ca… 12
#> 6 GBRCPICORMINMEI Consumer Price Indices (CPIs, HICPs), COICOP 1… 12
#> 7 IR3TCP01CAM156N Interest Rates: 3-Month or 90-Day Rates and Yi… 12
#> 8 ACTLISCOU6065 Housing Inventory: Active Listing Count in Riv… 12
#> 9 NYURN Unemployment Rate in New York 12
#> 10 PCU327327 Producer Price Index by Industry: Nonmetallic … 12
quarterly_p2 |>
select(id, title, popularity) |>
tail(10)
#> # A tibble: 10 × 3
#> id title popularity
#> <chr> <chr> <int>
#> 1 MNTACAFSS Total Amortized Cost of Available-For-Sale Securit… 3
#> 2 IATEQC Total Equity Capital for Commercial Banks in Iowa … 3
#> 3 EQTA26 Total Equity to Total Assets, Banks with Total Ass… 3
#> 4 ENUC180230010 Total Quarterly Wages in Columbus, IN (MSA) 3
#> 5 ENUC201030010 Total Quarterly Wages in Dover, DE (MSA) 3
#> 6 EVLNNQ Total Value of Loans for More than 365 Days, Minim… 3
#> 7 EDSXFBNQ Weighted-Average Maturity for 2 to 30 Days, U.S. B… 3
#> 8 ERTP365PDXSLNQ Weighted-Average Risk Rating by Time that Pricing … 3
#> 9 ERTSFXFBNQ Weighted-Average Risk Rating by Time that Pricing … 3
#> 10 ERTSIXSLNQ Weighted-Average Risk Rating by Time that Pricing … 3
Perhaps also something for @andreranza?
@christophsax, sorry this week was full and couldn't have a look. Conf is getting closer...
Is there maybe "mini" task I can take over?
Thanks, no it's fine, I have something here. Just focus on conf!
The 4000 series are now included in seasonalbook::fred
. ?fred
gives an example:
library(seasonalbook)
stopifnot(packageVersion("seasonalbook") >= "0.1.1")
library(dplyr)
library(seasonalbook)
library(seasonal)
library(furrr)
try_na_real <- function(expr) {
cat(".")
ans <- try(expr)
if (inherits(ans, "try-error")) return(NA_real_)
ans
}
my_stats <- function(x) try_na_real(AIC(seas(x)))
my_stats(AirPassengers)
ans <-
fred |>
mutate(aic = purrr::map_dbl(ts, my_stats))
# To speed up, use parallel processing
plan(multisession, workers = parallelly::availableCores())
ans_2 <-
fred |>
mutate(aic = furrr::future_map_dbl(ts, my_stats))
ans_2 |>
arrange(aic)
@jlivsey this can be used to find examples.
where we can take out our examples. We should have a list or a nested tibble with a few 1000 series, so we can pick interesting ones.
I guess FRED would be more interesting, because we can include international series: https://fred.stlouisfed.org/categories
Did we had something on that? How could we come up with a list of 1000 or so broadly mixed IDs?