I would like to get the variation (variance component) in incidence (inc.) within each habitat while being mindful of random factors such as season and site
This is my data set:
Incidence:
Inc. Habitat Season Site 0.4400 Crop Summer M1 0.5102 Crop Summer M2 0.2979 Crop Summer M3 0.2667 Crop Summer M4 0.0000 Edge Autumn L1 0.0000 Edge Autumn L2 0.0200 Edge Autumn L3 0.0213 Edge Autumn L4 0.0000 Edge Spring L1 0.0238 Edge Spring L2 0.0256 Edge Spring L3 0.0000 Edge Spring L4 0.0000 Edge Summer L1 0.1538 Edge Summer L2 0.0417 Edge Summer L3 0.0000 Oakwood Autumn Q1 0.0734 Oakwood Autumn Q2 0.0000 Oakwood Autumn Q3 0.0000 Oakwood Autumn Q4 0.0000 Oakwood Spring Q1 0.1293 Oakwood Spring Q2 0.0072 Oakwood Spring Q3 0.0000 Oakwood Spring Q4 0.0078 Wasteland Autumn E1 0.0000 Wasteland Autumn E2 0.0000 Wasteland Autumn E3 0.0000 Wasteland Autumn E4 0.0068 Wasteland Spring E1 0.0000 Wasteland Spring E2 0.0000 Wasteland Spring E3 0.0068 Wasteland Spring E4 With the aim to get the variation I check previously with a shapiro wilk test how is the distribution of my dataset by Rstudio.
shapiro.test(x = Incidence$Inc.): Shapiro-Wilk normality test data: Incidence$Incidence W = 0.56708, p-value = 2.092e-08 Moreover, I got the homocedasticity with a levene test:
leveneTest(y = Incidence$Inc., group = Incidence$Habitat, center = "median") Levene's Test for Homogeneity of Variance (center = "median") Df F value Pr(>F) group 3 6.3481 0.002129 ** 27 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Afterward I check how is the distribution using:
Input_2<-Incidence$Inc. library(rriskDistributions) Prueba<-fit.cont(as.vector(t(Input_2))) and I got a normal distribution:
Then I performed a glmm of this dataset in R:
GlM_habitats <- glmer(Inc. ~ Habitat + (1|Season)+(1|Site), data = Incidence) summary(GlM_habitats) Linear mixed model fit by REML ['lmerMod'] Formula: Incidence ~ Habitat + (1 | Season) + (1 | Site) Data: Incidence REML criterion at convergence: -78.9 Scaled residuals: Min 1Q Median 3Q Max -1.45229 -0.30319 -0.01575 0.20558 2.53994 Random effects: Groups Name Variance Std.Dev. Site (Intercept) 0.0031294 0.05594 Season (Intercept) 0.0005702 0.02388 Residual 0.0008246 0.02872 Number of obs: 31, groups: Site, 16; Season, 3 Fixed effects: Estimate Std. Error t value (Intercept) 0.35450 0.03607 9.827 HabitatEdge -0.32669 0.04475 -7.301 HabitatOakwood -0.31616 0.04637 -6.818 HabitatWasteland -0.33973 0.04637 -7.326 Correlation of Fixed Effects: (Intr) HbttEd HbttOk HabitatEdge -0.698 HabitatOkwd -0.701 0.576 HabttWstlnd -0.701 0.576 0.588 I tried to extract the variance of fixed effect but It only allow me extract the variance of the random effec.
vc <- VarCorr(GlM_habitats) print(vc,comp=c("Variance","Std.Dev."),digits=2) Groups Name Variance Std.Dev. Site (Intercept) 0.00313 0.056 Season (Intercept) 0.00057 0.024 Residual 0.00082 0.029 How can I extract the variance of the fixed effect in glmm output? Thank in advance.
