Quake_pitch

Brendan
Jan. 4th 2018

code_folding: hide

Shiny App for exploration of Joyner-Boore Attenuation Data

Objectives

  • Create an xy-scatterplot from any two numeric variables
  • Provide a tool to transform variables to base 10 log scale
    • Base 10 log are a common scale in earthquake data
  • Fit a linear regression model to the selected variables.

This data is in the dataset package (called 'attenu'). For more details on the dataset, use the link below. https://stat.ethz.ch/R-manual/R-devel/library/datasets/html/attenu.html

App Inputs

  • The inputs are the x and y variables selected from the list below.
library(datasets); names(attenu[,sapply(attenu,is.numeric)])
[1] "event" "mag"   "dist"  "accel"
  • A checkbox to indicate whether or not to transform the data to log scale.
  • A textbox to add a user selected title.
  • A button to generate the plot.

App Output is a plot with a fitted equation.

Some code is hidden

x <- log10(attenu$dist);      y <- log10(attenu$accel)
fit <- lm(y~I(x^2) +x); xNew <- data.frame(x = seq(min(x),max(x), length.out = 50))
pred <- predict(fit, newdata= xNew)
plot(x, y,  xlab = "log dist", ylab = "log accel")

plot of chunk unnamed-chunk-3

Summary

  • xy-scatterplot can be created from any two numeric variables
  • logrithmic scaling is avialable
  • regression between any two variables can be preformed
    • the predicted curve is plotted
    • the equation is display with the \( R^2 \) value
  • Provides a basic tool to explore the data and trends

    Earthquake_Att available here: https://brendanpowers.shinyapps.io/Earthquake_Att/