# Applied regression analysis and generalized linear models

**Applied generalized linear models (GLM), as the name hints, is the application, or rather, the use of various generalized linear modeling techniques in statistical modeling. These techniques enable researchers to analyze data without encountering the problems of statistical inference. GLMs are a more flexible generalization of linear regression; they allow for response variables with error distribution models instead of those with a normal distribution.**

## Regression analysis

responsePearson deviance quantile 2 -0.3181818 -0.5640761 -0.797724 0.1729961 4 0.3636364 0.4558423 0.420354 0.8084259 The response, Pearson, deviance, and quantile residuals for the second and fourth observations is shown above To check if the approximate distribution of the Pearson and deviance residuals are expected to be adequate or poor, we need to know if there is overdispersion. We will check if the mean and variance are close, as shown below, the mean is 1.1 and the variance is 1.83 which is very close which suggeststhe possibility of no overdispersion. Moreover, we find the ratio of deviance and degree of freedom and see if it is 1 or close. The result below shows that the ratio is 1.399 which also supports the possibility of no overdispersion. Next, we conduct a formal test of overdispersion and the result shows that z=-1.506, p=0.934>0.05 which means we cannot reject the null hypothesis that the dispersion parameter is not different from zero. We thus conclude that there is no overdispersion. Since there is no evidence of overdispersion, the approximate distribution of the Pearson and deviance residuals are expectedto be adequate.## z = -1.5061, p-value = 0.934 ## alternative hypothesis: true dispersion is greater than 1 ## sample estimates: ## dispersion ## 0.756564

3).The plot of standardized deviance residuals against fitted values and fitted value transformed on a constant information scale. We see that the points are evenly distributed around the mean for both plots which suggest the model is adequate since there is no over dispersion.

The plot of quantile residuals against fitted values and fitted value transformed on a constant information scale. We see that the points are evenly distributed around the mean for both plots which suggest the model is adequate.
The standardized deviance residuals are more easily interpreted than the quantile because it is standardized and can be interpreted as a deviation from the mean.
For expert assistance with this topic, hire our **regression analysis assignment help** providers.

## Gamma GLM Model

The plot of standardized deviance residuals against fitted values and fitted value transformed on a constant information scale. We see that the points are evenly distributed around the mean for both plots which suggest the model is adequate.

The plot of standardized residuals against diameter is shown below, we see that the plots do not show any pattern suggestive of model misspecification which means that the model is adequately specified.

The plot of standardized residuals against type is a box plot because the type is categorical.

The plot of working responses against the linear predictors is shown above.

The plot of partial residuals against the diameter is shown above. The result shows that the linear specification is of diameter is correct

The plot of partial residuals against the type is shown above. It is a box plot because the type is a categorical variable. qqnorm(std.resid)

The Q-Q plot of the standardized residuals is shown above. library(car) plot(cooks.distance(model.gamma)) abline(h=4/(length(cooks.distance(model.gamma))-2-1),col="red")

The plot of cooks distance is shown above. If we use the threshold value of 1 as suggested by Cooks, we conclude there is no outlier. However, if we use the threshold value of 4/n-k-1, as suggested by other authors, represented by the red horizontal line in the plot, we have 4 observations that are outliers and influential.

## Hypothesis Testing

The wald test statistics are given as

For male model,

The Z-statistics is 1.353 which is lower than the critical value of 1.96 which means that we cannot reject the null hypothesis that for the male model. We conclude that the interaction term is not significantly different from 0 for the male model.
For the female model,

The Z-statistics is -2 which is higher than the critical value of 1.96 which means that we reject the null hypothesis that for the female model. We conclude that the interaction term is significantly different from 0 for the female model. The test statistics for a likelihood ratio test is given as the difference between the deviance of the restricted model and that of the unrestricted model and it is approximately at k degrees of freedom where k is the number of restrictions. For male

The test statistics is 4 while the critical value is . since the test statistics is greater than the critical value, we conclude that the interaction term is necessary for the model.

For female

The test statistics is 3.85 while the critical value is . Since the test statistics is greater than the critical value, we conclude that the interaction term is necessary for the model. The 95% confidence interval is given as

For male,

For Female,

The odds ratio is calculated as

For male,

The odds ratio for a male is 1.284, this means that a male that had engaged in at least one aggressive violence as a youth has 1.284 times the odds of a male that had not engaged in aggressive violence as a youth of engaging in aggressive behavior as an adult. For Female,

The odds ratio for a female is 2.27, this means that a female that had engaged in at least one aggressive violence as a youth has 2.27 times the odds of a female that had not engaged in aggressive violence as a youth of engaging in aggressive behavior as an adult.
To determine if there is overdispersion, we compute the ratio of deviance to the residuals degree of freedom and see if it is extremely greater than 1
For males, residual deviance is 57.4 while the degree of freedom is 1323-13=1310 which means the ratio will surely be less than 1. This means overdispersion is not likely to be a problem in the male model.
For females, residual deviance is 121.67 while the degree of freedom is 1427-13=1413 which means the ratio will surely be less than 1. This means overdispersion is not likely to be a problem in the female model.
The three-way interaction should be significant because the significance of two-way interaction between role stress and adolescent aggression varies between the male and female models (it is insignificant in the male model but significant in the female model) which means the interaction differs by gender.
If you are looking for professional academic support in this area, avail our **hypothesis testing assignment help**.