apparently there is an unexpected symbol in my coding. this is what is says in the console:
> source('~/.active-rstudio-document')
Error in source("~/.active-rstudio-document") :
~/.active-rstudio-document:27:1: unexpected symbol
26: #main effect model
27: Model_ME
so i know the error is on my 27th line and the first character, this is what is in my script in that location...
Model_ME <- glmer (BinaryResponse ~ 1 + (1|ImageFace) + (1|ImageSex) + (1|ImageEthnicity), data = CompleteData, family = "binomial")
im so confused i did a similar formula to this above and was no issues? ill insert here..
Model_Null <- glmer (BinaryResponse ~ 1 + (1|TrailNumber) + (1|PPTID), data = CompleteData, family = "binomial"
Not necessarily. It is only the where the expression that contains the error begins. Often the unexpected symbol reflects unmatched delimiters. Perhaps, as per @nirgrahamuk on line 25 above. Or it may be due to a delimiter problem, which are easier to detect with formatting as below.
library(lme4)
#> Loading required package: Matrix
cbpp$obs <- 1:nrow(cbpp)
gm2 <- glmer(cbind(incidence, size - incidence) ~ period +
(1 | herd) +
(1 | obs),
family = binomial,
data = cbpp)
gm2
#> Generalized linear mixed model fit by maximum likelihood (Laplace
#> Approximation) [glmerMod]
#> Family: binomial ( logit )
#> Formula: cbind(incidence, size - incidence) ~ period + (1 | herd) + (1 |
#> obs)
#> Data: cbpp
#> AIC BIC logLik deviance df.resid
#> 186.6383 198.7904 -87.3192 174.6383 50
#> Random effects:
#> Groups Name Std.Dev.
#> obs (Intercept) 0.8911
#> herd (Intercept) 0.1840
#> Number of obs: 56, groups: obs, 56; herd, 15
#> Fixed Effects:
#> (Intercept) period2 period3 period4
#> -1.500 -1.226 -1.329 -1.866