1/22/2024 0 Comments Plotly line graph r regression![]() ![]() # Residual standard error: 0.3951 on 648 degrees of freedom In the above model, smoke is not a significant predictor, but if we drop the interaction term, it becomes significant. This difference will depend on height as there is a significant quadratic term. Thus taller children (of the same smoking status) will have higher fev compared to shorter children of the same age. Height has an additional positive effect on fev which is significant once accounting for age and smoking status. Below this age the estimated average fev will be higher for smokers (red surface) and the difference increases as children get younger! Notice on the plot though that there are no red points below 9 years of age - i.e. there are no smokers among children under 9, so the model is extrapolating in this region of the predictor space.įurthermore, the difference in slopes is due to the interaction term which is not statistically significant - so there is no evidence in the data that slopes should be different. The slopes intersect at around 7 years of ages. Thus smoking reduces lung capacity, but the drop in fev due to smoking increases with age. Therefore, for children smokers aged over 10 the fev is lower compared to non-smoking children of the same age. In other words, the model predicts that fev increases with age, but for smokers the slope of this increase is smaller. The surfaces are almost parallel, however, for non smokers (blue), the surface is slightly more tilted along age and the two surfaces intersect (this is easiest to see when rotationg the plot to a marginal view of age vs fev). Instead we can plot this data in 3D (points are coloured by smoking status.) and the fitted model is two surfaces, curved along height and tilted along age. The planes are not parallel, but the inteaction term is very small and statistically insignificant, so if we could visualise them they would be almost parallel. This model fits two hyper-planes (one for smoker and one for non-smokers) in 4D space with age, height, height \(^2\) and fev as dimensions. ![]() # Multiple R-squared: 0.7916, Adjusted R-squared: 0.79 ![]() # Residual standard error: 0.3974 on 648 degrees of freedom Let’s visualise some models (fitted in an earlier post): fit6 |t|) For children older than 10, boys are taller than girls. Males (red) have higher fev, but this is confounded with height. Predictors: age, height, gender and smoke. Response variable: fev (forced expiratory volume) measures respiratory function. Revisit an example with two continuous and two categorical predictors ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |