Predicting Apple Net Income

Noel Temena
September 15 2017

Coursera: Data Products Project

This application will predict Apple's net income based from the number of sold iPhone and Macs units.

Application instructions:

1)Move slider to the left to pick a number of iPhone units.   

2)Move the slider to the left to pick a number of Macs units.   

3)Click the Submit button and watch the Predicted Net income number change.   

Refer to the last slide to see sliders screenshot.

Financial data

Prediction formula and data were derived from Apple's SEC 10K filings from 2005 to 2016.

Data

I have intentionally excluded other Apple revenue stream ( i.e. itunes, ipads, icloud ) to simplify prediction inputs.

This is a demo application,not a financial tool.

source: http://investor.apple.com/sec.cfm

R Codes

Code below is used to train the model. All three products were used.

set.seed(333)
fit <- train(netIncome ~iPhone + Ipod + Macs,  data= allData)# default method is RF

Code below is the reactive part to reflect user input and refresh the application.

Note: Since RF model formula created a negative coefficient, I made ipod constant and excluded it from the user input.

pred_ <- reactive({
        iphoneInput <- input$slideriPhone
        MacsInput <- input$sliderMacs
        IpodInput <- 1000 # constant 
        test_data <- data.frame(iPhone = iphoneInput, Macs = MacsInput, Ipod = IpodInput)
        answer <- predict(fit, test_data)
        answer <- round((answer * 1000000), digits = 0)
        answer <- prettyNum(answer,big.mark=",")
        paste0("$ ", answer)
    })

Screenshot of the application