# Is it correct to evaluate response histogram to decide between a normal regression and other GLMS?

everybody I'm learning about linear regression and GLM's. One of the things I see is the affirmation that: I can make and histogram of the response $$y$$ and if it don't follows a normal (for example follows a gamma distribution) then I can use a GLM with gamma distribution. My problem is that this affirmation seems wrong to me, I can simulate a linear function with normal error, but sample it so that the response doesn't look's like normal, if I try enough I can make it looks like a gamma, for example:

import pandas as pd
import numpy as np
def funcao_linear(x):
#Função linear com erro normal
return 0.5*x+2+np.random.normal(size=1)[0]
#Pegando mais valores em x=5 to make a bias
x=[5]*1000+[6]*100
for i in range(7,100):
x=x+[i]*int(100-i)
temp=pd.DataFrame({'x':x})
temp
temp['y']=temp.x.apply(funcao_linear)
temp.y.hist(bins=20)

• For linear regression, the residuals $(y-y_{predicted})$ should be normally distributed. The distribution of the original dependent variable is irrelevant, other than providing a suggest for the better model. Commented Apr 9 at 23:39