Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeated measurements using relmatGlmer #5

Closed
MelLinde opened this issue Jan 15, 2018 · 4 comments
Closed

Repeated measurements using relmatGlmer #5

MelLinde opened this issue Jan 15, 2018 · 4 comments
Labels

Comments

@MelLinde
Copy link

Hi,

I am trying to analyse count data with relmatGlmer accounting for relatedness and repeated measurements. When including repeated measurements I get the error “nrow(Ztlist[[i]])%%ncol(Ztlist[[i]]) == 0 is not TRUE”.

When I transform the example data “dat40” into count data (trait1, trait2) relmatGlmer works (but outputs warnings). When I then add repeated measurements to the example data, relmatGlmer doesn’t work and outputs the same error as mentioned above.

Here is the code I run:

##########
library(lme4) # needed for VarCorr function
library(lme4qtl)

data(dat40)

data.count <- read.table("data.count.txt", sep="\t")
data.count.repeat <- read.table("data.count.repeat.txt", sep="\t")

No repeated measurements (works):

relmatGlmer(cbind(trait1, trait2) ~ AGE + SEX + (1|FAMID) + (1|ID), data.count, relmat = list(ID = kin2), family = binomial)

relmatGlmer((trait1/(trait1+trait2)) ~ AGE + SEX + (1|FAMID) + (1|ID), data.count, weights=(trait1+trait2), relmat = list(ID = kin2), family = binomial)

Repeated measurements (does not work):

mod <- relmatGlmer(cbind(trait1, trait2) ~ AGE + SEX + (1|FAMID) + (1|ID), data.count.repeat, relmat = list(ID = kin2), family = binomial)

mod <- relmatGlmer((trait1/(trait1+trait2)) ~ AGE + SEX + (1|FAMID) + (1|ID), data.count.repeat, weights=(trait1+trait2), relmat = list(ID = kin2), family = binomial)

##########

Please find the input data attached. Any hint how to model data with relamtGlmer including repeated measurements would help me a lot!

Many thanks and best regards,
Melanie

data.count.repeat.txt
data.count.txt

@variani
Copy link
Owner

variani commented Jan 19, 2018

Hi Melanie,

I started to address this issue using data from the pedigreemm R package, which also have repeated measurements.

Now I remember that I faced this problem in the vignette by running lmer and fixed it that time. It assumed to be straightforward to do the same fix for glmer. Let me a bit more time.

Best,
Andrey

@variani variani added the bug label Jan 19, 2018
@MelLinde
Copy link
Author

Hi Andrey,

many thanks for the update. But pleas remember that I also need to include a relatedness/kinship matrix. So, need to work with relmatGlmer.

Best,
Melanie

@variani
Copy link
Owner

variani commented Jan 20, 2018

Hi Melanie,

It should now work. I put some relevant R scripts here https://github.com/variani/lme4qtl/tree/master/misc/issues/05.

Best,
Andrey

@MelLinde
Copy link
Author

Hi Andrey,

yes, it works fine. Thanks a lot!

Best,
Melanie

@variani variani closed this as completed Jan 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants