Adjusted mean and mean test for multiple regression in R

I formed a multiple linear regression model:

corona_soz <- lm(LZ~age  + belastet_SZ + belastet_SNZ + guteSeiten_SZ + guteSeiten_SNZ + Zufriedenh_EW + Zufriedenh_BZ + SES_3, data = MF, subset = (sex == 1))
summary(corona_soz)

For this model, I would like to calculate the adjusted mean. For this I have already used the package emmeans. I would like to calculate the adjusted mean for the respective sex (men: sex == 1, women: sex == 2). For this, I also formed an extra regression model again, since sex is already included in the subset in the model above.

mean_MF <- lm(LZ~age  + belastet_SZ + belastet_SNZ + guteSeiten_SZ + guteSeiten_SNZ + Zufriedenh_EW + Zufriedenh_BZ + SES_3, data = MF)
summary(mean_MF)

Then I wanted to calculate the mean value:

emmeans(mean_MF, ~ sex)

And received the following message:

> emmeans(mean_MF, ~ sex)
Error in emmeans(mean_MF, ~sex) : 
  No variable named sex in the reference grid

Is there any other way or simple solution for this? I have also tried various other ways, but unfortunately do not understand where the problem lies.

In addition, I would like to perform a mean test to determine significant differences in the mean values (mean and adjusted mean) and unfortunately I can't find anything suitable.

! How do I handle it if I want to get the emmeans from 3 expressions instead of 2 as in the example above (sex: males == 1, females ==2)? So f.e. the number of children coded as follows (Kinder_A):

  • 1child: 1
  • 2 children: 2
  • ≥3 children: 3
> F_AKind_scor <- lm(LZ~age + belastet_SZ + belastet_SNZ + guteSeiten_SZ + guteSeiten_SNZ + Zufriedenh_EW + Zufriedenh_BZ + SES_3 + Kinder_A, data = Frauen)

Because when I run the code, I only get one EEM instead of 3 EEM's for my 3 expressions (1,2,3).

> emmeans(F_AKind_scor, ~ Kinder_A)
 Kinder_A emmean     SE    df lower.CL upper.CL
      1.2   6.96 0.0223 11415     6.92        7

In addition, I would like to perform a mean test to determine significant differences in the mean values (mean and adjusted mean) and unfortunately I can't find anything suitable.



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation