A ridge regression can be done as follows:
"""
RidgeRegression(Y,X,λ,β₀=0)
Calculate ridge regression estimate with target vector β₀.
"""
function RidgeRegression(Y,X,λ,β₀=0)
K = size(X,2)
isa(β₀,Number) && (β₀=fill(β₀,K))
b = (X'X+λ*I)\(X'Y+λ*β₀) #same as inv(X'X+λ*I)*(X'Y+λ*β₀)
return b
end
This is from my lecture notes.