# MARGINAL EFFECTS FOR POISSON COUNT DATA MODEL:

relative_avg <- mean(relative)

work_avg <- mean(work)

gender_avg <- mean(gender)

age_avg <- mean(age)

education_avg <- mean(education)

vec_coeffs <- as.numeric(poisson_model$coefficients)

vec_averag <- c(1, relative_avg, work_avg, gender_avg, age_avg, education_avg)

mar_eff_poisson <- vec_coeffs*exp(sum(vec_coeffs*vec_averag))

variabl_poisson <- c("Constant </br> Term", "Relatives </br> Abroad", "Work", "Gender", "Education", "Age" )

plot_ly(x = variabl_poisson, y = mar_eff_poisson, type = "bar")%>%

layout(title = "Factors Influencing the Number of Trips abroad",

xaxis = list(title = "<b>Factors</b>"),

yaxis = list(title = "<b>Marginal Effect</b>"),

margin = list(t = 50, b = 100, l = 50, r = 50, pad = 1))

I got empty graph, and as a beginner of R, I am completely lost, don't know what to do