Learn R Programming

YRmisc (version 0.1.6)

Y&R Miscellaneous R Functions

Description

Miscellaneous functions for data analysis, portfolio management, graphics, data manipulation, statistical investigation, including descriptive statistics, creating leading and lagging variables, portfolio return analysis, time series difference and percentage change calculation, stacking data for higher efficient analysis.

Copy Link

Version

Install

install.packages('YRmisc')

Monthly Downloads

192

Version

0.1.6

License

GPL (>= 2)

Maintainer

Xuanhua Yin

Last Published

March 25th, 2020

Functions in YRmisc (0.1.6)

cv.annu.pv

Calculate present value of annuity
cv.diff

Calculating the difference of a time series
cor.spearman

Spearman rank correlation
ds.mode

Calculating mode for numeric data
ds.kurt

Calculating kurtosis for numeric data.
cv.axp

Create logarithm with a random base
cor.lag

Lag/Lead Correlation
cv.powers

Create nth power variable
df.sortcol

Sort a data frame by a column
cv.pctcng

Calculating rate of return of a vector
cv.logs

Create logarithm with a random base
cv.bondprice

Calculate the plain vanilla bond price
cv.lag

Create a lag variable
ds.skew

Calculating skewness for numeric data
cv.lead

Create a lead variable
cv.drawdown

Largest draw down of returns
pl.3smoothtxt

Scatter smooth plot with text overlay
pl.histgg

Plot histograms for a data frame with ggplot2
pl.sm

Plot scatter smooth plots for a data frame
pl.hist

Plot histograms for a data frame
pt.hismv

Mean-variance model with historical average returns and standard deviations
pl.sgg

Plot scatter plots for a data frame using ggplot2
pl.coplot

Scatter plot of x and y divided by z
pt.info

Information ratio
pt.beta

Stock return beta
pt.bias

Bias ratio
pt.sharp

Sharp ratio
ds.summ

Descriptive statistics of a data frame
df.stack

Stack data frame by one classifier
ds.corm

Correlation matrix
pl.hs

Plot histograms and scatter plots for a data frame
pt.annsd

Annualized standard deviation
pt.annrtn

Annualized return
pl.smgg

Plot scatter plots with smooth line for a data frame using ggplot2
pt.jalpha

Jensen's alpha
reg.bic

BIC for lm.fit
pt.m2

Modigliani risk-adjusted performance
pl.ts

Plot time series plots for a data frame
reg.dof

Degree of freedom for lim.fit
pl.hsd

Plot histogram with density line for a data frame
pl.3smoothtxtgg

Scatter smooth plot with text overlay using ggplot2
pl.hsdgg

Plot histograms for a data frame with ggplot2
pt.sortino

Sortino ratio
pl.3txt

Scatter plot with text overlay
pt.dalpha

Dual-alpha
pt.roy

Roy's safety-first criterion
reg.r.squared

R-squared for lm.fit
reg.model

Linear model generator
pt.te

Tracking error
pt.probloss

Probability of loss
pt.treynor

Treynor ratio
pt.cmrtn

Cumulative return
reg.dw

Durbin-Watson Test
pl.3txtgg

Scatter plot with text overlay with ggplot2
pt.btavg

Batting average
pt.dbeta

Dual-beta
pt.exploss

Expected loss
pt.cmexrtn

Cumulative excess return
pl.mv

Plot mean-variance simulation result
pl.s

Plot scatter plots for a data frame
reg.adj.r.squared

Adjusted R-squared for lm.fit
reg.aic

AIC for lm.fit
pl.2ts

Time series plot for two variables
pl.2tsgg

Time series plot for two variables with ggplot2
tr.unli

Unit normal loss integral
xd.fred.tickers

Federal Reserve Bank of St. Louis Economic Data Tickers
xd.fred

Download data from Federal Reserve Bank of St. Louis
pl.tsgg

Plot times series plot for a data frame with ggplot2
pl.tss

Time series plot with multiple variables
reg.linreg

Linear regression processor
tr.nd

Normal density function
tr.logtb

Logistic function
pt.alpha

Stock return alpha
pt.annexrtn

Annualized excess return
pt.sdexrtn

Standard deviation of excess return
pt.semivar

Semivariance of loss
pt.udrtn

Average up and down returns
reg.std.err

Standard error for lim.fit
tr.log

Sigmoid function
pt.updwcap

Up and down capture
cv.annu.fv

Calculate future value of annuity