Publications by Cliff Lee
Week 7 - Working with XML and JSON in R
HTML, JSON and XML This assignment involves reading three files in different formats into an R markdown file. The files were created manually for this exercise, although on the web, they probably exist in a raw form. The chosen books are below: chosen_books <- tibble( Title = c("Take the Cannoli: Stories from the New World", "Gig: Americans Tal...
815 sym R (1392 sym/5 pcs) 5 tbl
DATA 607 Assignment Nine - NYTimes API
Brief In this assignment, we are pulling book review data in the JSON format. As there is a lot of meta data in the returned data, we’ll only display the relevant book data in one of the sub data structures. Note: This script assumes an environment variable, api_key_nytimes, is set beforehand. # Set constants api_key <- Sys.getenv('api_key_nyti...
304 sym R (955 sym/1 pcs) 1 tbl
DATA 607 Assignment Ten - Sentiment Analysis
Brief This assignment focuses on sentiment analysis from a couple of different corpora. First, an example analysis is reproduced from “Text Mining with R” (Robinson, J. S. and D.) using the novels of Jane Austen. Later, I apply similar sentiment analysis on Jack London’s White Fang using a different sentiment lexicon. Sentiment Analysis wi...
1386 sym R (10850 sym/71 pcs) 8 img
Data 605 - Assignment 2
Problem Set 1 (1) Show that \(A^{T}A \neq AA^{T}\) in general. (Proof and demonstration.) Answer: From textbook example MMNC (\(\xi MM\), page 151), we see that matrix multiplication is not communtative. In other words, for two matrices \(A\) and \(B\): \(AB \neq BA\) So, if \(B = A^{T}\) we get the similar result: \(AA^{T} \neq A^{T}A\) To show...
1848 sym R (1030 sym/6 pcs)
Assignment 3
Problem Set 1 What is the rank of the matrix A? \(A = \begin{bmatrix}1 & 2 & 3 & 4\\−1 & 0 & 1 & 3\\0 & 1 & −2 & 1\\5 & 4 & −2 & −3\end{bmatrix}\) Answer: $ \(\overset{Start...}{\rightarrow} \begin{bmatrix}1 & 2 & 3 & 4\\−1 & 0 & 1 & 3\\0 & 1 & −2 & 1\\5 & 4 & −2 & −3\end{bmatrix} \overset{R_{1} + R_{2}}{\rightarrow} \begin{bma...
6306 sym
Data 605 - Assignment 10
Smith is in jail and has 1 dollar; he can get out on bail if he has 8 dollars. A guard agrees to make a series of bets with him. If Smith bets A dollars, he wins A dollars with probability .4 and loses A dollars with probability .6. Find the probability that he wins 8 dollars before losing all of his money if (a) he bets 1 dollar each time (timid...
1017 sym R (3188 sym/16 pcs)
Linear Regression - Housing Price and Square Footage
King’s County Housing Sales We will perform a simple linear regression with the explanatory variable being the amount of livable square footage above ground and the response variable being the sale price. Reference - https://www.kaggle.com/code/sid321axn/house-price-prediction-gboosting-adaboost-etc/data Build a simple linear model model <- lm...
857 sym R (868 sym/5 pcs) 3 img
Data 602 - Final Exam
1. Playing with PageRank Let’s use the 6 page universe that we had in the previous discussion For this directed graph, perform the following calculations in R. A. Form the A matrix. Then, introduce decay and form the B matrix as we did in the course notes. (5 Points) B. Start with a uniform rank vector r and perform power iterations on B till c...
10991 sym R (19445 sym/108 pcs) 43 img
Taylor Series
For each function, only consider its valid ranges as indicated in the notes when you are computing the Taylor Series expansion. \(f(x) = \frac{1}{1-x}\) \(f(x) = e^x\) \(f(x) = ln(1+x)\) \(f(x) = x^{1/2}\) Answers: a) \(f(x) = \frac{1}{1-x}\) We can use pracma library for the Taylor series expansion but in this case we’ll make a function for ...
923 sym R (933 sym/9 pcs)
8.8 - Question 6
Key Idea 8.8.1 gives the nth term of the Taylor series of common functions. In Exercises 3 - 6, verify the formula given in the Key Idea by finding the first few terms of the Taylor series of the given function and identifying 6. \(f(x) = tan^{-1}x\) ; c = 0 Answer: We can use the R derive function (‘D’) to help with the derivations since aft...
677 sym R (2081 sym/24 pcs)