How to test for the significance of a "simple random slope" in R (lme4) I am conducting a linear mixed model involving two levels with the lme4 package in R: individual respondents are nested within country (a random factor). There are several predictors that I let vary linearly and quadratically across countries (slopes vary as a function of country). How can I test whether this random slope is statistically significant within a country (using e.g., the  lmerTest package)? In other words, I would like to test for simple slopes within countries without conducting individual regressions.   
 A: In general, you can statistically test if adding extra random-effects terms (e.g., random slopes) improved the fit of your model using a likelihood ratio test. This is performed in R using the anova() function. For example,
# random intercepts model    
fm0 <- lmer(y ~ age + sex + (1 | id), data = some_data)

# random intercepts and random slopes model    
fm1 <- lmer(y ~ age + sex + (age | id), data = some_data)

# likelihood ratio test between the two models
anova(fm0, fm1)

If the p-value is significant at some prespecified significance level, then the more complex model (i.e., the model under the alternative hypothesis) here the random intercepts and random slopes model provides a better fit to the data.
Caveat: The $\chi^2$ distribution used to calculate the p-value in this test is not actually correct because we are testing for some parameters on the boundary of the corresponding parameter space. Often, a mixture of $\chi^2$ distributions is used in this case. This makes a practical difference when the p-value is just a bit larger than the significance level.

EDIT: Inference for a specific cluster/group.
The estimation of the random effects of a specific cluster/group is based on empirical Bayes methodology. In particular, note that to estimate the random effects we use the conditional distribution:
$$p(b_i \mid y_i) = \frac{p(y_i \mid b_i) \, p(b_i)}{p(y_i)},$$
where $y_i$ are the observed data for the $i$-th country, and $b_i$ the unobserved random effects. This is a whole distribution, but we typically use as an “estimate” for the random effects the mean or mode. Hence, if you want to make inference for a particular county, you could go back to this distribution to quantity its variability, e.g., construct a 95% credible interval. In the case you have a linear mixed model you can do that using the variance of this posterior distribution of each cluster/group, which is provided by the ranef() function.
A: One way of thinking of random effects is "just" that you are partitioning the random error $\epsilon_i$ from a single error term into error terms on various parameters.  I don't know that testing individual random effects for significance makes a whole lot of sense.  You can do overall model fit tests to see whether having a random effect in your model is better than not having one.   You can also look at the distributions of the random effects and (for example) look at the 95% intervals to see which do and don't overlap zero.   But the whole concept of a random effect (something that is a sample from a population of adjustments to parameters) means that the difference between one group being significant and another not doesn't really fit.
