Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ BMisc Public

❗ This is a read-only mirror of the CRAN R package repository. BMisc — Miscellaneous Functions for Panel Data, Quantiles, and Printing Results. Homepage: https://bcallaway11.github.io/BMisc/ Report bugs for this package: https://github.com/bcallaway11/BMisc/issues

Notifications You must be signed in to change notification settings

cran/BMisc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BMisc

CRAN checks

BMisc includes miscellaneous functions for working with panel data, quantiles, dealing with formulas, among other things.

Installation

You can install BMisc from github with:

# install.packages("devtools")
devtools::install_github("bcallaway11/BMisc")

or from CRAN with:

install.packages("BMisc")

Example 1: Working with distribution functions

The make_dist creates a distribution function from a vector of value of the random variable and the corresponding value of its cdf.

library(BMisc)
y <- rnorm(100)
y <- y[order(y)]
u <- runif(100)
u <- u[order(u)]
F <- make_dist(y, u)
class(F)
#> [1] "ecdf"     "stepfun"  "function"
# plot(F)

Example 2: Working with panel data

Another useful function is the make_balanced_panel function which drops observations from a panel dataset which are not available in all time periods.

id <- rep(seq(1, 100, 1), 2) ## individual ids for setting up a two period panel
t <- rep(seq(1, 2), 100) ## time periods
y <- rnorm(200) ## outcomes
dta <- data.frame(id = id, t = t, y = y) ## make into data frame
dta <- dta[-7, ] ## drop the 7th row from the dataset (which creates an unbalanced panel)
nrow(dta)
#> [1] 199
dta <- make_balanced_panel(dta, idname = "id", tname = "t")
nrow(dta) ## now all the observations with missing data in any period are dropped
#> [1] 198

About

❗ This is a read-only mirror of the CRAN R package repository. BMisc — Miscellaneous Functions for Panel Data, Quantiles, and Printing Results. Homepage: https://bcallaway11.github.io/BMisc/ Report bugs for this package: https://github.com/bcallaway11/BMisc/issues

Resources

Stars

Watchers

Forks

Packages

No packages published