添加一个带有 code/formula 的新变量,该变量与前一个变量产生适度关联

Adding a new variable with a code/formula that generates a moderate association with a previous one

我尝试添加一个与前一个变量有关联的新变量。是否有 math/code trick/formula 来增加此关联中的置信带宽度?

library(tidyverse)

d = tibble(a = rnorm(50, 100, 20))

#adding a new variable that correlates with the previous
d = d %>% mutate(b = a*10) #<- this is the formula

#plotting association
d %>% ggplot(aes(a, b))+
  geom_smooth(method = "lm")

是这样的吗?

d %>% 
mutate(b = a*10 + rnorm(50, 0, 100)) %>%
ggplot(aes(a, b)) + geom_smooth(method = "lm")