Hi,
I ran a survey (n=38) and now I'm trying to analyze one hypothesis with Rstudio:
H4: People workout more when working from home, than in office.
I'm trying to combine two items to test this hypothesis.
1. sporting activity (frequency per week; ordinal scale) in 4 different periods (pre-covid, first lockdown, between lockdowns, second lockdown)
2. homeoffice [homeoffice, no homeoffice] in 4 different periods (as above)
I tried to do a GEE-test (someone recommended that). For that I created another variable time [1;2;3;4] for the periods, but not sure if I'm on the right track.
Thing is, I don't know nothing about GEE, but it seems the only way.
1. The created the dataset:
2. Then I set a factor & formula (I don't know, if either are correct) and ran geeglm:
I have no clue if anything in this procedure is correct or if GEE is even the right model I'm supposed to use.
I would appreciate any help. Looking forward.
Kind regards,
rokochan95
I ran a survey (n=38) and now I'm trying to analyze one hypothesis with Rstudio:
H4: People workout more when working from home, than in office.
I'm trying to combine two items to test this hypothesis.
1. sporting activity (frequency per week; ordinal scale) in 4 different periods (pre-covid, first lockdown, between lockdowns, second lockdown)
2. homeoffice [homeoffice, no homeoffice] in 4 different periods (as above)
I tried to do a GEE-test (someone recommended that). For that I created another variable time [1;2;3;4] for the periods, but not sure if I'm on the right track.
Thing is, I don't know nothing about GEE, but it seems the only way.
1. The created the dataset:
Code:
id = subject [1,38], time = periods [1,4], sport = frequency per week [0,4], homeoffice [0,1]
> head(gee)
# A tibble: 6 x 4
id time sport homeoffice
<dbl> <dbl> <dbl> <fct>
1 1 1 2 1
2 2 1 4 0
3 3 1 4 0
4 4 1 2 0
5 5 1 3 0
6 6 1 2 0
Code:
gee$homeoffice <- as.factor(gee$homeoffice)
mf <- formula(sport ~ time + homeoffice)
geeInd <- geeglm(mf, id=id, data=gee, family=gaussian, corstr="ind")
summary(geeInd)
##I don't know, if the "arguments" id, family, corstr are correctly chosen
Coefficients:
Estimate Std.err Wald Pr(>|W|)
(Intercept) 2.2927 0.2574 79.34 <2e-16 ***
time -0.1309 0.0911 2.06 0.1507
homeoffice1 -0.7092 0.2190 10.49 0.0012 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation structure = independence
Estimated Scale Parameters:
Estimate Std.err
(Intercept) 1.41 0.142
Number of clusters: 152 Maximum cluster size: 1
I would appreciate any help. Looking forward.
Kind regards,
rokochan95