knitr::opts_chunk$set(collapse = TRUE,comment = "#>")
  options(tibble.print_min = 4L, tibble.print_max = 4L)
library(dplyr)
library(ggplot2)
library(magrittr)
library(TinglanTools)

Some remainders when working with data:

TinglanTools package makes operations fast and easy:

This document introduces you to TinglanTools's set of tools, and shows you how to apply them to data frames. TinglanTools also supports databases via the package, once you've installed, read vignette("TinglanTools") to learn more.

Catalogue

TinglanTools aims to provide a function for each basic verb of data manipulation: func7() to Computes the liklihood of any given distribution. plotMyData() to make a neat graph. dplyrWrapper() wrap by using dplyr and count the frequency of data. func1() computes basic mean, var, sd. func2() computes the mean, variance and sd of a vector, but with user checks. func5() computes weighted mean, var, sd.

MLE with func7

func7 returns to you the log of the probability density function (PDF) or probability mass function (PMF), depending on whether the distribution of x is contiuous or discrete, respectively. You provide a function for whatever the distribution you want. For example, if you want a MLE with a gamma distribution:

  x1=rgamma(100,3)
func1 = function(theta, x) dgamma(x, shape = theta, log = TRUE)
func7(x1,func1,c(0,3))

These ideas also applies to "cauchy" or "binomial" distributions

Plot with plotMyData

plotMyData allows you to compute a plot for your data with good-looking geometric dots. Just add your data and put the data name into the only one parameter. For example:

plotMyData(d)

Wrap with dplyrWrapper

dplyrWrapper uses one of the dplyr package functions to help you count the frequency of each of the oberservation in a table in an efficient manner:

df1 <- data.frame(x = 1:10, y = 1:10, z = 1:10)
  dplyrWrapper(df1)

Summary with func1

func1 takes in a data set you defied as a parameter and automatically generate its mean, variance, and sd. It will return a list back to you:

x <- 1:10
#func1(x)

Summary with func2

Works exactly the same with func1, but with user checks. Note that tha data's components are nonnegative and sum to one.

x <- 1:10
func2(x)

Summary with func5

A modified function of func1. Now we will allow unequal probabilities for the data values. So now we have two vectors of the same length, call them x and p and the latter is a probability vector. Note that the components are nonnegative and sum to one. You will get a list returned with your data's mean, variance, sd. Here's an example:

d <- read.table(url("http://www.stat.umn.edu/geyer/3701/data/q1p4.txt"),header = TRUE)
  func5(d)


katherineli007/TinglanLiiiTools documentation built on May 25, 2019, 7:24 p.m.