I am having difficulty in creating the plot like this.
summary plot of regressions
A~H are different exposures for same outcome. The blue line is estimates/95%CI from univariate models (for example, regression of outcome~A and outcome~B) and the red line is estimates/95%CI from a multivariable model (outcome~A+B+C+D+E+F+G+H).
I tried 'plot_summs' function but it cannot process many univariate models.
Thank you for your help. Looking forward to hearing from you.
Related
I am trying to perform univariate analysis for multiple predictors independently for the outcome of an even in Cox regression model. I want to present these results (Hazard Ratios, HR) in a forest plot. Which package and method do you recommend? Thank you in advance.
I have only managed to do this for multivariate analysis.
I'm using the (meta) package in R to analyze a meta-analysis. I have two random-effects models, both rma objects. One model, x1, is all the studies included in the analysis and x2 is the same model but with a few studies excluded. I am trying to create a forest plot with all of the studies using the forest function, but I can't figure out how to get it to display the overall effects including confidence intervals, of both x1 and x2 together on the same forest plot. I've searched everywhere online and can't seem to find an appropriate answer.
Does anyone know of a solution or have any ideas?
I have ran a multinomial regression model with multiple independent variables and interactions.
Next, I would like to use this multinom model to predict future values of my outcome variables based on past values.
My end goals is to have a line graph with my predicted outcome versus time from my multinom model and future predictions for the next, let's say, 10 years if all other variables are help constant.
I know of the forecast() function in R, but I believe that would be for linear models, but mine is a multinomial. Any advice on how to proceed?
Thank you.
I'm fitting a multiple linear regression model with 6 predictiors (3 continuous and 3 categorical). The residuals vs. fitted plot show that there is heteroscedasticity, also it's confirmed by bptest().
summary of sales_lm
rediduals vs. fitted plot
Also I calculated the sqrt for my train data and test data, as showed below:
sqrt(mean(sales_train_lm_pred-sales_train$SALES)^2)
2 3533.665
sqrt(mean(sales_test_lm_pred-sales_test$SALES)^2)
2 3556.036
I tried to fit glm() model, but still didn't rectify heteroscedasticity.
glm.test3<-glm(SALES~.,weights=1/sales_fitted$.resid^2,family=gaussian(link="identity"), data=sales_train)
resid vs. fitted plot for glm.test3
it looks weird.
glm.test3 plot
Could you please help me what should I do next?
Thanks in advance!
That you observe heteroscedasticity for your data means that the variance is not stationary. You can try the following:
1) Apply the one-parameter Box-Cox transformation (of the which the log transform is a special case) with a suitable lambda to one or more variables in the data set. The optimal lambda can be determined by looking at its log-likelihood function. Take a look at MASS::boxcox.
2) Play with your feature set (decrease, increase, add new variables).
2) Use the weighted linear regression method.
I am trying to compare differences between coefficients in different regression equations.
Specifically, I have 2 regressions looking at the effect of Importance to Donate on Guilt, Feeling, and Responsibility
aov_I <- aov(newdata_I$AV_importance_to_donate~newdata_I$AV_guilty+newdata_I$AV_percieved_resp+feeling_I)
summary(aov_I)
aov_S <- aov(newdata_S$AV_importance_to_donate~newdata_S$AV_guilty+newdata_S$AV_percieved_resp+feeling_S)
summary(aov_S)
I would like to compare the differences between the coefficients in these two different regression equations.
How can I do this??
Thank you so much in advance!
You can view just the coefficients by doing aovI$coefficients[2] and aovS$coefficients[2] and then combine them into a dataframe using cbind, then just view with a bar graph if you don't need to do a real statistical comparison