-2

I am trying to run a Generalized linear mixed model (GLMM) on r, I have two fixed factors and two random factors however there are a lot of holes in my data set and the I am struggling to find a code to run the glmm all I found is the glm Can someone please walk me through this, I know very little about R and coding

MrFlick
  • 195,160
  • 17
  • 277
  • 295
  • 1
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. Show your code attempts for far. Stack Overflow is for specific programming questions, not requests for tutorials or walkthroughs. There are examples in the help pages for most functions. If you want statistical modeling advice, you should instead ask for help at [stats.se] – MrFlick Sep 01 '21 at 18:32
  • You may use `glmm` package. `library(glmm); glmm(y~x1 + x2)`. `y` is dependent vraiable and `x1` `x2` are independent variable. – Nad Pat Sep 02 '21 at 04:56
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Sep 04 '21 at 22:17

1 Answers1

0

You can use the lme4 package as well. The command for a generalized linear mixed model is glmer().

Example:

install.packages("lme4") #If you still haven't done it.
library(lme4)
myfirstmodel <- glmer(variable_to_study  ~ fixed_variable + (1|random_effect_varible), data = mydataset, family = poisson)

Family = poisson was just an example. Choose the 'family' according to the nature of the variable_to_study (eg. poisson for discrete data).

Andres
  • 59
  • 6