In this short post I want to quickly demonstrate how the most basic neural network (no hidden layer) gives us the same results as the linear model.
First we need data
We can now specify a model.
Let’s start by estimating a linear model.
Now lets use the built in
nnet package to estimate a neural network without a hidden layer.
Let look at the results next to each other.
We can also estimate this model using the
neuralnet package (this package needs to be installed first using
install.packages("neuralnet")). This package allows us to nicely visualise the results.
Of course it only becomes interesting if we include a hidden layer.