# Social Media Analytics

Social Media Analytics

## Resources

Resources

## Introduction

Introduction

Examining the information available through social media can tell you a lot about your online presence. This is a quick exploration of some social media analytics, with examples using a personal Twitter account.

## Getting Data

Getting Data

In order to do any meaningful analysis, we’ll need to pull data from a few different sources. The first step is to connect to a social network—in this case, Twitter. We’ll also pull in some geographic data from the Wolfram Knowledgebase, as well as some data collected through an email survey.

Import a follower network from Twitter:

network=ServiceExecute["Twitter","FollowerNetwork"]

In[1]:=

Out[1]=

Grab entities for the 30 nearest cities:

cities=GeoEntities,"City"

In[2]:=

Out[2]=

Import local data from the survey:

data=SemanticImport["surveydata.csv"]

In[3]:=

Out[3]=

Data types are automatically interpreted during import, so the locations in this dataset match the previous knowledgebase entities. We can easily cross-reference this data for quick analysis.

A map showing how many followers live in nearby cities:

GeoBubbleChart[data@Select[MemberQ[cities,#Location]&]//CountsBy[#Location&]]

In[4]:=

## Age: How Old Are Followers in the Network?

Age: How Old Are Followers in the Network?

Looking at the age spread of a network can be a good starting point for understanding its makeup. The goal here is to compute an approximate numerical distribution of ages. Since the normal distribution has convenient analytic properties, we’ll try that first.

Find the closest normal distribution fit:

Plot the actual distribution (red) compared with the estimate (yellow):

The normal distribution doesn’t quite match; the original data looks heavier on the left side than on the right. For this asymmetric shape, the skew normal distribution might be a better approximation. It has an additional parameter α that measures the skewness (slant) of the distribution.

Compare the formulas for the two distributions:

Find starting parameters for the skew normal distribution:

Adjust the sliders to verify the fit visually: