Publications by Fabio Veronesi

Assessing the Accuracy of our models (R Squared, Adjusted R Squared, RMSE, MAE, AIC)

10.07.2017

Assessing the accuracy of our modelThere are several ways to check the accuracy of our models, some are printed directly in R within the summary output, others are just as easy to calculate with specific functions.R-SquaredThis is probably the most commonly used statistics and allows us to understand the percentage of variance in the target varia...

3627 sym 8 img

Generalized Additive Models and Mixed-Effects in Agriculture

15.07.2017

IntroductionIn the previous post I explored the use of linear model in the forms most commonly used in agricultural research.Clearly, when we are talking about linear models we are implicitly assuming that all relations between the dependent variable y and the predictors x are linear. In fact, in a linear model we could specify different shapes f...

16699 sym R (6794 sym/33 pcs) 28 img

Power analysis and sample size calculation for Agriculture

21.07.2017

Power analysis is extremely important in statistics since it allows us to calculate how many chances we have of obtaining realistic results. Sometimes researchers tend to underestimate this aspect and they are just interested in obtaining significant p-values. The problem with this is that a significance level of 0.05 does not necessarily mean th...

21725 sym R (6617 sym/32 pcs) 30 img 2 tbl

Experiment designs for Agriculture

25.07.2017

This post is more for personal use than anything else. It is just a collection of code and functions to produce some of the most used experimental designs in agriculture and animal science. I will not go into details about these designs. If you want to know more about what to use in which situation you can find material at the following links:De...

3894 sym R (4503 sym/13 pcs)

Street Crime UK – Shiny App

11.03.2018

IntroductionThis is a shiny app to visualize heat maps of Street Crimes across Britain from 2010-12 to 2018-01 and test their spatial pattern.The code for both ui.R and server.R is available from my GitHub at: https://github.com/fveronesi/StreetCrimeUK_ShinyUsagePlease be aware that this apps downloads data from my personal Dropbox once it start...

3945 sym R (424 sym/1 pcs) 2 img

Data Visualization Website with Shiny

25.03.2018

My second Shiny app is dedicated to data visualization.Here users can simply upload any csv or txt file and create several plots:Histograms (with option for faceting)Barchart (with error bars, and option for color with dodging and faceting)BoxPlots (with option for faceting)Scatterplots (with options for color, size and faceting)TimeS...

1517 sym 4 img

Spreadsheet Data Manipulation in R

15.06.2018

Today I decided to create a new repository on GitHub where I am sharing code to do spreadsheet data manipulation in R.The first version of the repository and R script is available here: SpreadsheetManipulation_inRAs an example I am using a csv freely available from the IRS, the US Internal Revenue Service.https://www.irs.gov/statisti...

1000 sym

Geocoding function

16.02.2019

This is a very simple function to perform geocoding using the Google Maps API: getGeoCode <- function(gcStr, key) { library("RJSONIO") #Load Library gcStr <- gsub(' ','%20',gcStr) #Encode URL Parameters #Open Connection connectStr <- paste0('https://maps.googleapis.com/maps/api/geocode/json?address=',gcStr, "&key=",key) co...

1065 sym R (708 sym/2 pcs)

Weather Forecast from MET Office

16.02.2019

This is another function I wrote to access the MET office API and obtain a 5-day ahead weather forecast:METDataDownload <- function(stationID, product, key){ library("RJSONIO") #Load Library library("plyr") library("dplyr") library("lubridate") connectStr <- paste0("http://datapoint.metoffice.gov.uk/public/data/val/wxfcs/all...

1285 sym R (3377 sym/3 pcs)

Shiny App to access NOAA data

21.02.2019

Now that the US Government shutdown is over, it is time to download NOAA weather daily summaries in bulk and store them somewhere safe so that at the next shutdown we do not need to worry.Below is the code to download data for a series of years:NOAA_BulkDownload <- function(Year, Dir){ URL <- paste0("ftp://ftp.ncdc.noaa.gov/pub/data...

1572 sym R (510 sym/2 pcs) 4 img