We conducted a study at the U.S. census tract level looking at the relationship between environmental factors and social mobility in the ten largest U.S. cities. We used CARBayes::S.CARmultilevel in R to control for spatial autocorrelation between neighboring tracts and higher-order nested effects of cities (the city was included as a random effect variable).

We want to know how each city influenced the results in the fully adjusted model: In other words, what is the median coefficient for each city, relative to the reference group. We were able to calculate the median random effect coefficients as well as standard deviations and confidence intervals using the following code:

CAR_nwide_m4_re <- as.data.frame(CAR_nwide_m4[["samples"]][["zeta"]])
CAR_nwide_m4_re_median <- as.data.frame(apply(CAR_nwide_m4_re,2,FUN=median))
CAR_nwide_m4_re_ci <- as.data.frame(apply(as.matrix(CAR_nwide_m4_re), 2, function(x){mean(x)+c(-1.96,1.96)*sd(x)/sqrt(length(x))}))
CAR_nwide_m4_re_sd <- as.data.frame(apply(CAR_nwide_m4_re,2,FUN=sd))

Our questions relate to which city is "V1" "V2" etc in the output?

Also, there are values for all 10 variables, so we are unclear what city was left out of the model and is therefore the reference group.

  • Welcome to GIS SE. As a new user, please take the Tour, which emphasizes the importance of asking One question per Question. Additional questions can be asked in other Questions, but you should probably go through the process once before adding new questions. Please remember to always specify the exact version of software in the body of the question, and to format code with the {} button. – Vince Apr 10 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.