Thursday, January 18, 2024

LIS 4317 Visual Analytics - Module 2 Post

For this assignment, I will be using Public Tableau to visualize all Starbucks locations in the USA. Although I did have the opportunity to visualize all Starbucks in the entire world, to keep things simple, I will focus on the USA as the map gets a little hard to read!

Here's a link to the main visualization:

Starbucks Locations by State


The larger the points, the greater number of stores present:

So, the state with least number of stores is Vermont with 11 stores while the state with the greatest number of stores is California with 2,983 stores. This was surprising as I would have thought it would have been Washington state as that was where the coffee shop originated from.

Vermont:


California:


Washington:

While there are only 742 stores in the state, we can still see quite a few Starbucks in the Seattle area.


 

Look! It's the Starbucks at the USF Library!


Thinking about how to make this map more communicative, the first thing that comes to mind is changing the green points to the Starbucks mermaid logo to make it more distinctive. Second, it would be more interesting to see an actual map underneath the points instead of an arbitrary general landscape. It would be neat to see buildings, roads, and other notable landmarks alongside these Starbucks. Third, it might be a good idea to create another viz to color code the states based on which ones are the most populated with Starbucks.

~ Katie

Wednesday, January 17, 2024

LIS 4317 Visual Analytics - Module 2 (Bonus Practice!!!)

For this practice, I will use Public Tableau to visualize a dataset. I decided to work with a dataset that captured global shark attacks. To keep things simple, I will be looking at United States shark attacks and will strictly look at states that border the Atlantic Ocean, Pacific Ocean, and the Gulf of Mexico. 

For some odd reason, there was a strange number of shark attacks taking place in landlocked states such as Missouri and New Mexico but these attacks were disturbingly unnatural and were often provoked by an individual jumping into a shark tank at a aquarium.

Anyway, the goal of this visualization is to determine the average age of shark attack victims by state.

Below, is a link to the visualization's main page:

Average Age of Shark Attack Victims  


By looking at the color scale of the map, one can see that the darker the color, the older the shark attack victim tends to be. Thus, in states like Massachusetts, Connecticut, and Alabama, the victims tend to be older but technically middle age.

Massachusetts - Average Victim Age: 41

Connecticut - Average Victim Age: 38

Alabama - Average Victim Age: 34

As for states with the youngest victim age, Texas had the youngest age with it being 18 and other states in that similar shade were clustered around that age as well.

Texas:

Georgia:

Virginia:

As for graphic elements that would make the map more communicative, I would think that adding location points of where the victims were attacked to the visualization would make it much more interesting to look at. Additionally, I would like to make the legend I generated in Tableau play a bigger role in the visualization as a whole. Currently, it is pushed off to the side and small. I would prefer that the legend on the map so that viewers do not have to look around for it.

~ Katie

Monday, January 15, 2024

LIS4370 R Programming - Module 2 Assignment

For this post, I will evaluate the following function called myMean as well as the data for this function assignment2.

Here's the code:

Here's the output:

After executing the function, it did indeed work but executing the function on its own will not result it anything meaningful unless you directly call the function and insert the variable you want to see the mean of. In this case, by plugging in assignment2, the myMean function takes the sum of it and divides it by the length of the vector and results in a value of 19.25.

Here is a link to the code via GitHub: 

 Module 2 Code

~ Katie

Thursday, January 11, 2024

LIS4317 - Visual Analytics - Module 1 Post

After checking out the internet for the most interesting data visualizations, I have decided to focus on The 50 Most Visited Websites in the World by Dorothy Neufeld and Joyce Ma of Visual Capitalist.

Here is the link to the visualization and their findings:

https://www.visualcapitalist.com/the-50-most-visited-websites-in-the-world/

To answer the question on why I chose this particular visualization, I chose it because it was easy to make sense of their findings and the idea of bubbles representing the number of monthly website visits made it very simple to interpret.

Relating the Keim et al. (2008) definition of visual analytics, it is said that data at first has no direct value until an individual makes a point to get information from it (p. 154). Therefore, the data in the visualization is monthly website visits and applying Keim et al.’s definition, one is aware the monthly website visits do not mean much unless there is some meaning giving to it. In this case, the greater the number of website visits, the more popular the website is. We can see this idea represented by the size of the bubbles like how the YouTube bubble is smaller than the Google bubble.

Moving on to the definition of visualization, Keim et al. (2008) suggests that the act of visualization takes both data and information and their associated processes and makes it communicable so that individuals can obtain a greater understanding and clarity about a particular dataset (pp.155-157). When an individual quickly glances at the visualization, they can immediately determine that Google is the website with the greatest number of monthly visits just by looking at the largest bubble. By using bubbles, the visualization captures various websites and how they are related by company and makes the data more expressive as a result.

As for knowledge, Keim et al. (2008) continuously stresses the importance of transforming “data into reliable and provable knowledge” through the use of methods and models (p. 155). Knowledge can be quite difficult to express and without careful consideration of the design of the visualization, the intended audience of the visualization will end up confused and no extraction of knowledge will occur. Thus, one can infer that visualization is very important for allowing individuals to make sense and derive information and knowledge from the data. So, visualization such as the choice of how one will represent their data goes hand in hand with knowledge extraction. That is, how will certain design choices impact the readability and/or clarity of the data presented? Just looking at the visualization, the creators clearly prioritized the design of it to make it as easy to read as possible.

According to Keim et al. (2008), models play a significant role in data analysis (p. 161). From preparing a training dataset to teach models to locate data samples based on classification and/or prediction to using association rules to identify the co-occurrence of data items, there is a variety of different models out there performing many things. Sadly, not much is known regarding the techniques used to gather data for this particular visualization. While the data was retrieved by SimilarWeb, they do not document how they went about getting and recording the data. Nor if any models were applied.


~ Katie

Wednesday, November 15, 2023

LIS4273 - UFO Sightings Final Project

Important Background Information:

For this project, I decided to analyze a dataset containing UFO sightings in the United States, Mexico, Canada, and certain places in Europe. However, to keep it simple I focused solely on the data records from the United States.

Here is the link to the original dataset: https://www.kaggle.com/datasets/NUFORC/ufo-sightings/data

Note: when you go on to download the dataset, you will actually download two datasets: scrubbed.csv and complete.csv

For this analysis, I worked from scrubbed.csv which had less entries. After some data munging, I was able to get it down to approximately 63,561 rows and 11 variables which will work as the base of my analysis.

Establishing the Hypothesis (Problem Description):

From this dataset, I intended to determine the following:

Is there any difference in the duration (seconds) of the sightings between the north and south regions of the United States?

From the flowchart provided in the project instructions, I will be working with two samples (North and South) and developed the null and alternative hypotheses.

Null Hypothesis (H0): The average duration of UFO sightings is the same in the North and South regions, and there is no significant difference in the variability of durations between the two regions.

Alternative Hypothesis (H1): The average duration of UFO sightings differs between the North and South regions, and there is a significant difference in the variability of durations between the two regions.

Through conducting the Levene Test, I was able to determine that there are equal variances, and a Two Sample t-Test would be suitable for this analysis.

Also, important to note, to determine what states could be classified as “North” or “South”, I created a new variable known as region which through an if-else statement classifies a state as “North” or “South” by checking if it is above or below my selected latitude bench line. Given that I am from Maryland, this latitude value is 39.718457 and is based off the Mason-Dixon Line which I have crossed on multiple occasions. Fun times!

Related Work:

As for how my problem and chosen method for analysis relates to what was learned during the semester, it can be traced back to Module #6 Random Variable(s) and Probability Distribution(s) and One-Sample and Two-Sample Tests. Through the provided table in the Module #6 One-sample and Two-sample tests page, I used it as a guide when it came to forming my hypotheses.

Solution:

To solve the problem, I used various R functions to conduct my analysis. To determine if there are equal variances, I made use of the Levene test function, and my primary methodology was using a two sample t-test.

Why a two sample t-test, you might ask? Well, this test was determined to be the best choice by following the guidelines in the Final Project flowchart.

Given that I had two samples (North and South), the first question I had to ask myself was whether the data was in pairs or not. In this case, it was not as for North there was only 28,423 records and for South there was 35,020 records. For data to be paired, the observations must be of equal length.

Therefore, I followed the “No” arrow and proceeded to the “Equal Variances?” prompt. This part was a little tricky as the p-value was 0.05573 as determined by the Levene test. It was just barely above the 0.05 significance level so it was natural to check “Assume Equal Variances”, but it could also be considered as no equal variances as well. I was concerned about a potential violation so I performed two t-tests with var.equal set to TRUE or FALSE to see if there was any difference. From the results, I was able to confirm that there was no significant difference. Thankfully, whether I selected “Yes” or “No” to the Equal Variances prompt, it led to the same Two-Sample t-test.

To understand why a two sample t-test was preferred over other analysis methods, I realized that I needed a test that could handle two samples so naturally, I crossed out the idea of using a one-sample t-test as I had two samples (North and South). Furthermore, I did not consider the one-way ANOVA test as you need to have a minimum of three independent samples to make it work. Also, because my data was not paired nor related to each other, I did not execute a paired t-test. Through these insights, I was able to conclude that the Two-Sample t-test was the best fit for the data given the choices in the flowchart. 

Findings and Conclusions:

Upon executing my first t-test will var.equal set to TRUE, I soon became aware that I was in marginal violation of the equal variance assumption as the p-value (0.05573) from the Levene test was only slightly above the significance level of 0.05. With this minor issue in mind, I wanted to see via two t-tests with var.equal set to TRUE or FALSE respectively if there was any major difference in output. Quickly, I saw that their differences were minor and essentially alluded to the same findings.

Thus, we can infer the following.

Seeing that the p-value is just above the significance level of 0.05, we can determine that there is not enough evidence to reject the null hypothesis. In other words, there is no significant difference in the average duration of UFO sightings in the north and south regions of the United States. While the means for duration do appear to differ between North and South, one must understand that there truly is no significant difference in the length of the sightings.

~ Katie

Thursday, November 9, 2023

LIS4273 - Module 12 Assignment

 For this assignment, I will be answering the following questions:

The table below represents charges for a student credit card.

a. Construct a time series plot using R

b. Employ Exponential Smoothing Model as outlined in Avril Voghlan's notes and report the statistical outcome.

For these two parts, please see the following R code and its associated output:

c. Provide a discussion on time series and Exponential Smoothing Model result you led to.

Through the output, we can first see with the Time Series plot, it clearly shows the fluctuations in charges throughout the months and years. Furthermore, it does seem to peak in charges around mid-year, which may refer to high spending during the winter holiday months.

When we review the Exponential Smoothing model and its impact on the dataset, the first thing to take away is both parameters (beta and gamma) are set to FALSE which means that without trend and seasonality, it will emphasize the short-term variations of the data.

Looking at the high alpha value (0.8232442), this indicates that the forecasts are primarily influenced by recent observations. As for the coefficient ‘a’ value (62.44453), we can see that the model expects future values to revolve around this particular value. Now, when this new model is plotted, it more closely aligns with one another as opposed to the first plot which did not appear to be as closely aligned. Moving on the calculation of the sum-of-squared-errors (SSE), the value outputted was 835.38 which may infer that a model containing both trend and seasonality may better capture the underlying patterns in the data. Thus, it is key that you a strike a good balance between model refinement and goals of the analysis to increase model accuracy and reliability.

~ Katie


Tuesday, October 31, 2023

LIS4273 - Module 11 Assignment

 For this assignment, I will be answering the following questions:

10.1

From out textbook: pp. 188 Question 10.1

Set up an additive model for the ashina data, as part of the ISwR package

This data contains additive effects on subjects, period, and treatment. Compare the results with those obtained from t tests.

R code:

Result Interpretation:

Analyzing the results of the additive model, we first see that with the variable treat, its coefficient is -42.87 suggesting that the treatment group experienced a 42.87 unit decrease in vas as compared to the control group. As for period, its coefficient value is 80.50 which means that period 2 experienced an 80.50 unit increase in vas compared to period 1. Moving on to subjects, the first thing that sticks out are the significance levels and it is learned that for the intercept, treat, subject3, subject5, subject7, subject8, and subject10 are all significant (**) at 0.1 significance level where we can infer that their effects are not likely due to random chance. As for residuals, the range appears to go from -48.94 to positive 48.94. Ideally, these values should be randomly distributed around zero but a pattern such as this indicates the model is not capturing some aspect of data. As for the r-squared value, it is 0.7566 or 75.66% and while a good fit is a value close to 1, it means the 75.66% of the variability in vas scores is accounted for by the model. Lastly, with the F-statistic 2.914 and its associated p-value 0.02229, we can see that the model is indeed statistically significant.

Moving on to t test for treatment, we can see that there is a significant difference between the treatment and the control group via the p-value (0.02099). As for the t test for period, it is only marginally significant with the p-value (0.0672).

10.3 Consider the following definitions


Note:

The rnorm() is a built-in R function that generates a vector of normally distributed random numbers. The rnorm() method takes a sample size as input and generates that many numbers.

Your assignment:

Generate the model matrices for models z ~ a*b, z ~ a:b, etc. In your blog posting discuss the implications. Carry out the model fits and notice which models contain singularities.

Hint

We are looking for...

model.matrix(~ a:b); lm(z ~a:b)

R code:

Result Interpretation:

Through executing the code, the only model that contained singularities is model2 which held the expression a:b. The rest of the models yielded false when asked if they held singularities. What are the implications of this? Well, first off, it means the model2 has perfect collinearity. In other words, one predictor can be exactly predicted from the other which may lead to numerical instability in estimating the coefficients. Additionally, singularity means that there is an infinite number of solutions to model and R cannot uniquely determine the coefficients of a and b. Further, because a and b cannot be separated due to collinearity, the coefficient estimates will be unreliable.

As for the other models which yielded false when prompted for collinearity, we know that the coefficient estimates are reliable. Seeing that only one model had perfect collinearity and the rest did not, it might be best to focus on the non-collinear models for future analysis.

~ Katie

LIS 4370 R Programming - sentimentTextAnalyzer2 Final Project

For this class's major final project, I set out to make the process of analyzing textual files and URL links for sentiment insights much...