Program service revenue as a share of total revenue.
Formula:
revenue_programs = program_service_revenue / total_revenueDefinitional Range
Bounded [0, 1]. Zero means none of this revenue type was received; one means this channel accounted for all total revenue.
Calculated For: 990 filers only.
Usage
get_revenue_programs_ratio( df,
program_service_revenue = "F9_08_REV_PROG_TOT_TOT",
total_revenue = "F9_08_REV_TOT_TOT",
winsorize = 0.98 ,
range = "zo",
sanitize = TRUE,
summarize = FALSE )Arguments
- df
A
data.framecontaining the fields required for computing the metric.- program_service_revenue
Total program service revenue.
- total_revenue
Total revenue.
- winsorize
Winsorization proportion between 0 and 1 (default
0.98).- range
Character string specifying the theoretical range of the ratio, used to set winsorization bounds. Default
"zo". Options:"np"(negative to positive),"zp"(zero to positive),"zo"(zero to one),"nz"(negative to zero), or a custom"lo;hi"pair (e.g."0;10").- sanitize
Logical (default
TRUE). IfTRUE, imputes zero for NA financial fields before computing, respecting form scope.- summarize
Logical (default
FALSE). IfTRUE, prints summary statistics and density plots for all four output columns.
Value
The original data.frame with four new columns:
revenue_programs(raw ratio)revenue_programs_w(winsorized)revenue_programs_z(z-score)revenue_programs_p(percentile rank, 1-100)
Details
Revenue Programs Ratio - Revenue composition measure
Formula: program service revenue / total revenue. Bounded [0, 1].
Pure program service share, distinct from get_earned_income_ratio which also includes dues, royalties, and misc.
Examples
library( fiscal )
data( dat10k )
d <- get_revenue_programs_ratio( df = dat10k )
#> :: Total revenue equal to zero :: 74 case(s) replaced with NaN
head( d[ , c( "revenue_programs", "revenue_programs_w", "revenue_programs_z", "revenue_programs_p" ) ] )
#> revenue_programs revenue_programs_w revenue_programs_z revenue_programs_p
#> <num> <num> <num> <int>
#> 1: NA NA NA NA
#> 2: 0.0000000 0.0000000 -3.181683 1
#> 3: 0.0214227 0.0214227 -1.417831 43
#> 4: NA NA NA NA
#> 5: 0.0000000 0.0000000 -3.181683 1
#> 6: NA NA NA NA