Friday, November 11, 2016

What next for detroit tigers?

Tigers GM Al Avila has said that he wants to stay competitive and go younger and leaner. The Cameron Maybin trade tells us that this time; the talk is not a bluff for the other teams. The Tigers are embarking on a change that has been discussed for years, but has never been done.They will not be active in free Agency.That means they will have to get whatever help they can from the trades that Avila is planning. They cannot go for super prospects who are years away from contention. They will have to get players who will be ready for next season and give them a proper chance to see what they can do. The current lineup is too rightly heavy. Given the depth chart below, the only gaps as of now are:
  1. A bench player who is a big threat on the bases.
  2. A left hitting catcher




The high earning players are classified as per their necessity to contention next year.

Vital

Justin Verlander, Jordan Zimmerman and Ian Kinsler, are irreplaceable because:
  1.  There is no prospect available who can replace them now
  2.  There is no one in other teams who can be had in a trade

Trade only for Salary

Miguel Cabrera and Anibal Sanchez: No one will touch Anibal Sanchez with his contract. However, there are some hard hitters in the team to package with Anibal Snachez. One possible trade is Anibal Sanchez and Miguel Cabrera to marlins for Martin Prado. Sanchez will have more value being plugged in rotation, long relief or as a closer.
Prado can man 3rd base moving Castellanos to first base.
J D Martinez to Astros and in return, get Michael Feliz, or Lance McCullers, if they are lucky.

Expendable

This is the Money Detroit Tigers should save. This is the group that is replaceable.
Pos'n
ML Srv
Agent
Length / Total Value
2017
2018
2019
2020
2021
2022
Upton, Justin
lf
9.06
Reynolds Sports
6 yr/132.75M (16-21)
$ 22,125,000
$ 22,125,000
$ 22,125,000
$ 22,125,000
$ 22,125,000
 FA
Martinez, Victor
dh
13.114
Octagon
4 yr/68M (15-18)
$ 18,000,000
$ 18,000,000
 FA
Pelfrey, Mike
rhp-s
9.122
Boras Corp.
2 yr/16M (16-17)
$ 8,000,000
 FA
Rodriguez, Francisco
rhp-c
13.115
Boras Corp.
2 yr/13M (15-16)+17 opt
$ 6,000,000
Lowe, Mark
rhp
8.159
Frye McCann
2 yr/11M (16-17)
$ 5,500,000
 FA
Total
59,625,000
40,125,000
$ 22,125,000
$ 22,125,000
$ 22,125,000

Victor Martinez: Boston needs a new designated hitter. V-Mart is a switch hitter, and has adjusted to DH duties. Boston’s line-up leans heavily to RHs (Betts, Bogaerts, Hanley, Pedroia). V-Mart has in-clubhouse presence, and only one year left on his contract. Brian Johnson is an option for back of the Rotation or a spot starter in the worst case.
As for the rest, given that Cameron Maybin fetched just a fringe pitching prospect with control issues, Detroit should focus on packaging them for one or two position prospects projects. I will describe further
Justin Upton: His $132.75 million contract would be off the books. In hindsight, signing this guy to a six-year contract was a bad idea. His great second half might convince another team to take a chance on him.

Lineup without the disposables (Against Lefties)

Ian Kinsler
Jose Iglesias
Miguel Cabrera
J.D. Martinez
Steven Moya
Nick Castellanos
Andrew Romine
James McCann
Anthony Gose

Lineup without the disposables (Against Righties)

Ian Kinsler
Anthony Gose
Miguel Cabrera
J.D. Martinez
Tyler Collins
Jose Iglesias
Nick Castellanos
Steven Moya
New Catcher

Rotation
Justin Verlander
Matt Boyd*
Jordan Zimmermann
Daniel Norris*
Michael Fulmer
Anibal Sanchez
Brian Johnson*

Bullpen
Closer position must be rotating till someone runs with it
Bruce Rondon
Kyle Ryan*
Alex Wilson
Shane Greene
Justin Wilson*
Blaine Hardy*
Buck Farmer
Drew VerHagen
Relif pitchers traded in

Even with minimal batting expectations from the new lefty catcher, this is a great lineup provided the new lefty catcher is a defensive gem. 

Now assuming we trade the second group out. It leaves a lot of holes that have to be filled by players brought in.

Lineup with only Vital players (Against Lefties)

Ian Kinsler
Jose Iglesias
Martin Prado
Steven Moya
Nick Castellanos
Andrew Romine
James McCann
Anthony Gose
Tyler Collins

Lineup with only Vital players (Against Righties)

Alex Presley

Rotation
Justin Verlander
Matt Boyd*
Jordan Zimmermann
Daniel Norris*
Michael Fulmer
Brian Johnson


Bullpen
Closer position must be rotating till someone runs with it
Bruce Rondon
Kyle Ryan*
Alex Wilson
Michael Feliz,
Shane Greene
Justin Wilson*
Blaine Hardy*
Buck Farmer
Drew VerHagen
Relief pitchers traded in

In this situation, the team is giving up hitting for pitching and salary relief. The situation is shown by the fact that Tigers need to bring in a 3-hole batter. Kinsler can be moved to third with Martin Prado batting behind him. Gose or Iglesias can then bat leadoff. More than skill, the new players need some support and time to gain confidence and experience to be dependable in the high pressure spots.

Wednesday, November 02, 2016

The True bell-weather of US Presidential elections

I sometimes felt as if I were watching the psychodrama of the baby boom generation — a tale rooted in old grudges and revenge plots hatched on a handful of college campuses long ago — played out on the national stage.


-The Audacity of Hope

Next week, after being out of power for eight years, the baby Boomer generation will come roaring back and put a president from their cohort in Power. While millennial Republicans had Marco Rubio and Ted Cruz to associate with, the millennial Democrats has only Grandpa Bernie Sanders and nostalgia. The two year drama will finally draw to a close next week and end my obsession with these elections. Obsessive preoccupation with polls is a ritual that propels laughable coverage of any elections.  Too many states in USA like to be called the Barometer of the presidential elections. States like Ohio make a fuss about their ability to correctly vote for the US president. There are even fraud analyses and articles which torture the data enough to show why their state is the true barometer.

But the true bell-weather state seems to be New Mexico with a 92% success rate. Startlingly, the seat of power Washington DC has no idea what the rest of nation wants. The Rates for Mississippi and Alabama Partly explain their backwardness.New York has the best record among the 13 founding states.


Full table for those interested below.data from Wikipedia. I have looked at all elections.
State Correct Elections Accuracy
New Mexico 24 26 92%
Illinois 41 49 84%
Ohio 44 53 83%
California 34 41 83%
New York 47 57 82%
Nevada 31 38 82%
Pennsylvania 46 57 81%
Arizona 20 26 77%
Wisconsin 32 42 76%
New Hampshire 43 57 75%
Minnesota 29 39 74%
Oregon 29 39 74%
Montana 23 31 74%
Indiana 37 50 74%
Iowa 31 42 74%
West Virginia 28 38 74%
Missouri 36 49 73%
Michigan 33 45 73%
Utah 22 30 73%
Florida 30 41 73%
New Jersey 41 57 72%
Colorado 25 35 71%
Rhode Island 40 56 71%
Idaho 22 31 71%
Washington 22 31 71%
Wyoming 22 31 71%
Oklahoma 19 27 70%
Connecticut 39 57 68%
Kansas 26 38 68%
North Dakota 21 31 68%
Maine 33 49 67%
North Carolina 37 55 67%
Virginia 37 55 67%
Maryland 38 57 67%
Massachusetts 38 57 67%
Tennessee 36 54 67%
Nebraska 24 37 65%
Hawaii 9 14 64%
Vermont 36 56 64%
Louisiana 32 50 64%
Delaware 36 57 63%
Kentucky 35 56 63%
Arkansas 26 44 59%
South Dakota 18 31 58%
Texas 23 40 58%
Alaska 8 14 57%
Georgia 32 56 57%
South Carolina 32 56 57%
Mississippi 24 47 51%
Alabama 24 48 50%
D.C. 6 13 46%

Friday, September 30, 2016

Google Analytics Package in R

Any analyst in the world knows what R and Python are. There is a new Package released in R.

Released by Mark Edmondson, It is called googleAnalyticsR. It uses the latest Version of the GA analytics API. Thus, any digital analyst, even those new to R can start using the power of R to get to the "what" of the business question. The code given below will pull Basic data for the past quarter and enable an analysts can the trend.
 # One time install of the packages required for this task  
 install.packages("ggplot2 ")  
 install.packages("plotly ")  
 install.packages("htmlwidgets ")  
 install.packages("googleAnalyticsR ")  
 #Add the basic Packages required for this task  
 library(ggplot2)  
 library(plotly)  
 library(htmlwidgets)  
 library(googleAnalyticsR)  
 # Set the view ID that we'll be using. You can get the view ID for a specific view from analytics edge or by logging into the Google Analytics Query Explorer at https://ga-dev-tools.appspot.com/query-explorer/. It's the "ids" value.  
 view_id <- XXXXXXXX  
 # Authorize Google Analytics. Use (new_user = TRUE) if you check multiple views  
 #ga_auth(new_user = TRUE)  
 ga_auth()  
 # Get the data from Google Analytics without Sampling  
 gadata <- google_analytics_4(view_id,   
                date_range = c("2016-08-01", "2017-03-31"),  
 metrics = "sessions", dimensions = c("date", "channelGrouping", "deviceCategory"),anti_sample = TRUE)  
 # Create your graphs  
 my_graph<- ggplot(gadata,aes(x=date,y=sessions))+stat_summary(fun.y=sum,geom = "bar")+facet_wrap(~channelGrouping + deviceCategory, scales = "free")  
 # Make Graphs interactive for exploration  
 ggplotly(my_graph)   
The output is a series of interactive graphs that looks like below. Like a dashboard , these will help an Analyst identify the most interesting stories to analyze.



Each line above has multiple functions so that any user can just insert the option they want. You can use the above to pull data across various accounts, dimension, metrics and customize the graph. Like I said earlier, R does not need introduction. Compared to excel, R does calculations much faster. Being open source, there are more open  source packages that we need. They enable powerful operations that save time on data arrangement and you do need a budget approval from managers to use it.

Thursday, June 16, 2016

UEFA European Champions Cup & Champions League 1955-56 to 2015-16 (61 Seasons) Last Eight Clubs

European Champion Clubs' Cup started in 1955. Real Madrid has dominated the competition then and Now. Spanish clubs have now won Europe's top club prize 17 times.
This works again builds on the good work of the folks at Football facts.
Athletico Madrid is now officially the unluckiest team as it lost the Final again. No one has lost so many finals without winning. Maybe next year?

Team Winners Losing Finalists Losing Semi-Finalists Losing Quarter Finalists Total
REAL MADRID 11 3 13 6 33
BAYERN MUNICH 5 5 8 9 27
BARCELONA 5 3 8 4 20
MANCHESTER UNITED 3 2 7 6 18
BENFICA 2 5 1 9 17
AC MILAN 7 4 2 4 17
JUVENTUS 2 6 3 5 16
AJAX 4 2 2 5 13
LIVERPOOL 5 2 2 4 13
INTER MILAN 3 2 3 4 12
CHELSEA 1 1 5 2 9
RED STAR BELGRADE 1 0 2 5 8
ATLETICO MADRID 0 3 2 3 8
DINAMO KIEV 0 0 3 5 8
CELTIC 1 1 2 3 7
FC PORTO 2 0 0 5 7
PSV EINDHOVEN 1 0 2 4 7
BORUSSIA DORTMUND 1 1 2 3 7
ARSENAL 0 1 1 5 7
RSC ANDERLECHT 0 0 2 5 7
GLASGOW RANGERS 0 0 1 4 5
GALATASARAY 0 0 1 4 5
PARIS SAINT-GERMAIN 0 0 1 4 5
OLYMPIQUE MARSEILLE 1 1 1 1 4
PANATHINAIKOS 0 1 2 1 4
AS MONACO 0 1 1 2 4
RAPID VIENNA 0 0 1 3 4
DUKLA PRAGUE 0 0 1 3 4
STANDARD LIEGE 0 0 1 3 4
IFK GOTHENBERG 0 0 1 3 4
OLYMPIQUE LYONNAIS 0 0 1 3 4
FEYENOORD 1 0 1 1 3
SV HAMBURG 1 1 1 0 3
STEAUA BUCHAREST 1 1 1 0 3
STADE REIMS 0 2 0 1 3
PARTIZAN BELGRADE 0 1 0 2 3
LEEDS UNITED 0 1 2 0 3
SAINT ETIENNE 0 1 1 1 3
AS ROMA 0 1 0 2 3
VALENCIA 0 2 0 1 3
LEGIA WARSAW 0 0 1 2 3
UJPESTI DOZSA 0 0 1 2 3
GIRONDINS DE BORDEAUX 0 0 1 2 3
DEPORTIVO LA CORUNA 0 0 1 2 3
SPARTAK TRNAVA 0 0 1 2 3
SPARTAK MOSCOW 0 0 1 2 3
SCHALKE 04 0 0 1 2 3
SPARTA PRAGUE 0 0 0 3 3
DYNAMO DRESDEN 0 0 0 3 3
HADJUK SPLIT 0 0 0 3 3
NOTTINGHAM FOREST 2 0 0 0 2
ASTON VILLA 1 0 0 1 2
FIORENTINA 0 1 0 1 2
CLUB BRUGGE 0 1 0 1 2
BAYER LEVERKUSEN 0 1 0 1 2
VASAS SC 0 0 1 1 2
TOTTENHAM HOTSPUR 0 0 1 1 2
FC ZURICH 0 0 2 0 2
BORUSSIA MOECHEN 0 0 1 1 2
1FC KOLN 0 0 1 1 2
CSKA-CZ SOFIA 0 0 2 0 2
AUSTRIA VIENNA 0 0 1 1 2
VILLARREAL 0 0 1 1 2
OGC NICE 0 0 0 2 2
VIENNA SPORTCLUB 0 0 0 2 2
GRASSHOPPER ZURICH 0 0 0 2 2
DYNAMO BERLIN 0 0 0 2 2
DNIPRO DNIPROPETROVSK 0 0 0 2 2
EINTRACHT FRANKFURT 0 1 0 0 1
BORUSSIA MOENCHEN 0 1 0 0 1
MALMO FF 0 1 0 0 1
SAMPDORIA 0 1 0 0 1
DUNDEE 0 0 1 0 1
REAL SOCIEDAD 0 0 1 0 1
DINAMO BUCHAREST 0 0 1 0 1
SPARTA PRAGUE (2) 0 0 1 0 1
GLASGOW RANGERS (2) 0 0 1 0 1
AS MONACO (2) 0 0 1 0 1
FC NANTES 0 0 1 0 1
HIBERNIAN 0 0 1 0 1
BSC YOUNG BOYS 0 0 1 0 1
VASAS ETO GYOR 0 0 1 0 1
DERBY COUNTY 0 0 1 0 1
WIDZEW LODZ 0 0 1 0 1
DUNDEE UNITED 0 0 1 0 1
RED STAR BELGRADE (2) 0 0 1 0 1
IFK GOTHENBERG (2) 0 0 1 0 1
FC PORTO (2) 0 0 1 0 1
SEVILLA 0 0 0 1 1
AARHUS GF 0 0 0 1 1
NUREMBERG 0 0 0 1 1
VOJVODINA 0 0 0 1 1
GORNIK ZABRZE 0 0 0 1 1
VORWARTS BERLIN 0 0 0 1 1
CSKA SEPTEMBER FLAG 0 0 0 1 1
ARARAT YEREVAN 0 0 0 1 1
CSKA 0 0 0 1 1
KUUSYSI 0 0 0 1 1
BRONDBY 0 0 0 1 1
WERDER BREMEN 0 0 0 1 1
KV MECHELEN 0 0 0 1 1
BENFICA (3) 0 0 0 1 1
CLUB BRUGGE (3) 0 0 0 1 1
WERDER BREMEN (3) 0 0 0 1 1
AUXERRE 0 0 0 1 1
SHAKHTAR DONETSK 0 0 0 1 1
VOROS LOBOGO (MTK) 0 0 0 1 1
SPARTAK HRADEK KRALOVE 0 0 0 1 1
EVERTON 0 0 0 1 1
WISLA KRAKOW 0 0 0 1 1
UNIVERSITATEA CRAIOVA 0 0 0 1 1
RSC ANDERLECHT (3) 0 0 0 1 1
FC PORTO (3) 0 0 0 1 1
SPARTAK MOSCOW (3) 0 0 0 1 1
ROSENBORG 0 0 0 1 1
KAISERSLAUTERN 0 0 0 1 1
SS LAZIO 0 0 0 1 1
FENERBAHCE 0 0 0 1 1
MALAGA 0 0 0 1 1
ATHLETIC BILBAO 0 0 0 1 1
WOLVERHAMPTON WAND 0 0 0 1 1
IFK MALMO 0 0 0 1 1
FERENCVAROS 0 0 0 1 1
RUCH CHORZOW 0 0 0 1 1
WACKER 0 0 0 1 1
RC STRASBOURG 0 0 0 1 1
BANIK OSTRAVA 0 0 0 1 1
SPORTING LISBON 0 0 0 1 1
DINAMO MINSK 0 0 0 1 1
BESIKTAS 0 0 0 1 1
DINAMO KIEV (4) 0 0 0 1 1
PSV EINDHOVEN (4) 0 0 0 1 1
RSC ANDERLECHT (4) 0 0 0 1 1
OLYMPIAKOS 0 0 0 1 1
CSKA MOSCOW 0 0 0 1 1
DJURGARDEN 0 0 0 1 1
CDNA SOFIA 0 0 0 1 1
KARL MARX STADT 0 0 0 1 1
SPARTA ROTTERDAM 0 0 0 1 1
BURNLEY 0 0 0 1 1
DOOR WILSKRACHT STERK 0 0 0 1 1
LINFIELD 0 0 0 1 1
EINTRACHT BRAUNSCHWEIG 0 0 0 1 1
AEK ATHENS 0 0 0 1 1
CARL ZEISS JENA 0 0 0 1 1
FC BASEL 0 0 0 1 1
ATVIDABERGS FF 0 0 0 1 1
ABERDEEN 0 0 0 1 1
CSKA SOFIA 0 0 0 1 1
PANATHINAIKOS (4) 0 0 0 1 1
CSKA MOSCOW (4) 0 0 0 1 1
GALATASARAY (4) 0 0 0 1 1
APOEL 0 0 0 1 1
Manchester City 0 0 1 0 1
Wolfsburg 0 0 0 1 1