GGplot Examples

The same data flightData plotted 3 different ways.

library(PowerKyleTools)
library(ggplot2)
flightData <- read.csv("http://users.stat.umn.edu/~almquist/3811_examples/all_alaska_flights.csv")
ggplot2::ggplot(data = flightData, mapping = aes(x = dep_delay, y = arr_delay)) + 
  geom_boxplot()
ggplot2::ggplot(data = flightData, mapping = aes(x = dep_delay, y = arr_delay)) + 
  geom_point()
ggplot2::ggplot(data = flightData, mapping = aes(x = dep_delay, y = arr_delay)) + 
  geom_smooth()

Examples

Calling func1 on a data set will return a list containing the mean, variance, and standard deviation without running any data checks. Calling func2 on a data set will also return a list containing the mean, variance, and standard deviation, but first will check the data to make sure it is compatible.

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

Calling func3 on a vector will compute the Maximum Liklihood Estimation for a gamma distribution and return the scalar result.

library(PowerKyleTools)
v <- (1:10)
func3(v)

Calling func4 on a data.frame will compute the weighted mean, variance, and standard deviation and return it as a list.

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

Calling func5 on a data.frame will compute the weighted mean, variance, and standard deviation and return it as a list, but will first check to make sure data frame contains compatible data.

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

Calling func6 on a data set will run a check to make sure that data is compatible, and will throw an error if data is not numeric, finit, zero lenth, NA, NAN.

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

Use func7 to compute the liklihood of a given distribution for data x, and return the scalar result.

library(PowerKyleTools)
x1 = rgamma(100,3)
func1 = function(theta, x) dgamma(x, shape = theta, log = TRUE)
result7_gamma <- func7(x1,func1,c(0,3))

Use matMult to compute the scalar result of $$x^T A^{-1} x$$

library(PowerKyleTools)
load(url("http://www.stat.umn.edu/geyer/3701/data/q2p1.rda"))
matMult(a, x)

Use stdize to compute the standardized result of a 2-D matrix by column.

library(PowerKyleTools)
load(url("http://www.stat.umn.edu/geyer/3701/data/q2p1.rda"))
stdize(a)


power502/PowerKyleTools documentation built on May 26, 2019, 12:33 a.m.