search for: nagq

Displaying 16 results from an estimated 16 matches for "nagq".

Did you mean: nag
2008 Aug 25
1
Specifying random effects distribution in glmer()
...a gamma distribution with unknown shape and scale parameters. I've tried the 'lmer4' package's glmer() function, which fits the Poisson regression using: library('lme4') fit5<- glmer(seizures ~ time + progabide + timeXprog + offset(lnPeriod) + (1|id), data=pdata, nAGQ=1, family=poisson) #note: can't use nAGQ>1, not yet implemented summary(fit5) Here 'seizures' is a count and 'id' is the subject number. This fit works, but uses the Poisson distribution with the gamma heterogeneity. Based on the example in the help for glmer(), I tried...
2013 Mar 18
1
try/tryCatch
...,,ii] tmp1<-as.data.frame(tmp) names(tmp1)=c("persons", "d1", "tp", "fn", "fp", "fn", "detect", "d0", "outcome") lm1<-try(lmer(outcome~0+d1+d0+(0+d1+d0 | persons), family=binomial, data=tmp1, nAGQ=3), silent=T) if(class(lm1)[1]!='try-error'){ a[ii,1]=lm1@fixef[1] a[ii,2]=lm1@fixef[2] a[ii,3]=vcov(lm1)[1,2]/prod(sqrt(diag(vcov(lm1)))) a[ii,4:5]=sqrt(diag(vcov(lm1))) } } #k=k+1 #a[ii,6]=k return(a) } ########################...
2010 Feb 04
0
GLMM and false convergence (8) warnings
...0.911792 -0.340779 -0.295436 -0.436908 0.777541 -1.94732 0.191853 0.419920 0.514350 0.165871 Warning message: In mer_finalize(ans) : false convergence (8) > I read the various posts in the R-help list about it, and followed their advice. I standardized the fixed factors and also used glmer with nAGQ, but I still get the same warning message. Is it possible to get this error when the number of zeros in the response variable is very high? I have 30281 observations grouped in 2402 plots (=random factor); 1299 observations from the 30281 correspond to presences, and the rest to absences. Which is...
2009 Aug 28
1
Help with glmer {lme4) function: how to return F or t statistics instead of z statistics.
...value (as Bolker et al. suggests I should use for my data). 2) I?m unsure what the AIC or QAIC value means, other than knowing that it should be as low as possible. Is there a rule of thumb of what is a good AIC value? Mine are in the region of 2230. 3) The default in glmer {lme4) for the argument nAGQ = 1, which uses the Laplace approximation. When nAGQ >1, it uses the GHQ method, but I?m unsure how to determine the correct number of Gauss-Hermite points to enter in the argument when using this method. How is this determined? 4) Some of my data sets have means >5, and are also overdispers...
2013 Nov 05
2
Error message glmer using R: “ 'what' must be a character string or a function”
...e outcome, random as the predictor and clustno as the random effects variable. new<-as.data.frame(read.delim("BABEX.dat", header=TRUE)) install.packages("lme4") library(lme4) model1<- glmer(validatedRS6 ~ random + (1|clustno), data=new, family=binomial("logit"), nAGQ) However, I get the following error Error in do.call(new, c(list(Class = "glmResp", family = family), ll[setdiff(names(ll), : 'what' must be a character string or a function I have absolutely no idea what has gone wrong and have searched the internet. I am sorry but I cannot pr...
2011 Nov 15
1
package installtion
I'm getting the following error in a script: "Error: could not find function "lmer."??? I'm wondering of my lme4 package is installed incorrectly.? Can someone tell me the installation procedure?? I looked at the support docs but couldn't translate that into anything that would work.
2010 Apr 11
1
Matrix is not symmetric under lme4
...2) #names(dan) #b0<-dan$coef[1] #b1<-dan$coef[2] #sigma2<-dan$coef[3] yi1<-NULL yi2<-NULL for (i2 in 1:I){ yi1<-c(yi1,sum(y[u==0 & center==i2])) yi2<-c(yi2,sum(y[u==1 & center==i2])) } ##method2############## fit2 <- glmer(y ~ u + (1|center), family=poisson, data=df,nAGQ=3,verbose = TRUE, REML = FALSE ) #fit2 <- glmer(y ~ u + (1|center), family=poisson, data=df,nAGQ=3) estimate_sigma2<-sigma.hat(fit2)$sigma$center b_estimate<-fit2 at fixef alpha1=b_estimate[1] alpha2=b_estimate[1]+b_estimate[2] T1=exp(alpha1+estimate_sigma2/2) T2=exp(alpha2+estimate_sig...
2009 Aug 28
0
Help with glmer {lme4} function: how to return F or t statistics instead of z statistics?
...Bolker et al. suggests I should use for my data). 2) I?m unsure what the AIC or QAIC value means, other than knowing that it should be as low as possible. Is there a rule of thumb of what is a good AIC value? Mine are in the region of 2230. 3) The default in glmer {lme4) for the argument nAGQ = 1, which uses the Laplace approximation. When nAGQ >1, it uses the GHQ method, but I?m unsure how to determine the correct number of Gauss-Hermite points to enter in the argument when using this method. How is this determined? 4) Some of my data sets have means >5, and are also overdi...
2012 Nov 12
1
R lmer & SAS glimmix
Hi, I am trying to fit a model with lmer in R and proc glimmix in SAS. I have simplified my code but I am surprised to see I get different results from the two softwares. My R code is : lmer(y~age_cat + (1|cat),data=fic,family=binomial(link = "logit"), NaGQ=1) My SAS code is : ods output Glimmix.Glimmix.ParameterEstimates=t_estimates; proc glimmix data=tab_psi method=laplace; class age_cat cat; model psi (event='1') = age_cat / solution dist=B link=logit ; random intercept / subject=cat; run; >From R, I get the following fixed effects...
2016 Apr 15
1
Heteroscedasticity in a percent-cover dataset
Hi, I am currently trying to do a GLMM on a dataset with percent cover of seagrass (dep. var) and a suite of explanatory variables including algal (AC) and epiphyte cover (EC), rainfall, temperature and sunshine hours. M2=glmer(SG~AC+EC+TP+SS+RF+(1|Location/fSi/fTr), family=binomial,data=data,nAGQ=1) As the dependent variable is percent cover, I used a binomial error structure. I also have a random effect due to nested of the data collection strategy. However, I keep getting heteroscedasticity issues as shown in the image below. I have tried using an arcsine transformation (with a lme), but...
2011 May 16
4
Problem on glmer
Hi all, I was trying to fit a Gamma hierarchical model using "glmer", but got weird error message that I could not understand. On the other hand, a similar call to the glmmPQL leads to results that are close to what I expect. I also tried to change tha "nAGQ" argument in "glmer", but it did not solve the problem. The model I was fitting has a simple structure - one hierarchy and one offset, and I did not expect "glmer" to fail on this simple data set. Did I specify something wrong here? I appreciate any help. Thanks in advance....
2011 Dec 16
1
simulation
...hich I did not write) to simulate multilevel data (subjects in locations) used in power calculations. It uses lmer to fit a mixed logistic model to the simulated data based on inputs of means, variances, slopes and proportions: ? (fitmodel <- lmer(modelformula,data,family=binomial(link=logit),nAGQ=1)) where modelformula is set up in another part of the program.? Locations are treated as random and the model is random intercept only.? The program is set?to run 1000 simulations. ? I have temperature, five levels of gestational age (GA), birth wieght (BW) and?four? other categorical pedictors...
2023 Dec 02
1
Try reproduce glmm by hand
...40), rep("C", 40))) x <- c(runif(40, min=10, max=30), runif(40, min=20, max=30), runif(40, min=40, max=60)) x <- (x-min(x))/(max(x)-min(x)) # In g0, I have the results of the glmm library(lme4) g0 <- glmer(formula = df ~ x + (1 | ID), family = binomial(link="logit"), nAGQ=1) -logLik(g0) # 'log Lik.' 268.0188 (df=3) # I get the fitted parameters fixep <- fixef(g0) par <- getME(g0, c("theta","beta")) # _______________________________________________________________________ # Question 1: how theta is converted into the specific effect...
2008 Aug 19
1
R vs Stata on generalized linear mixed models: glmer and xtmelogit
...;- ohio pql <- glmmPQL(resp~smoke+factor(age), random=~1|id, family=binomial,data) summary(pql)$tTable["smoke",1:2] lap <- glmer(resp~smoke+factor(age)+(1|id), family=binomial,data) attributes(summary(lap))$coefs["smoke",1:2] agq7 <- glmer(resp~smoke+factor(age)+(1|id),nAGQ=7,family=binomial,data) write.csv(data,file="data.csv") This is the code for Stata: clear insheet using data.csv xi: xtmelogit resp smoke i.age, || id:, covariance(independent) laplace xi: xtmelogit resp smoke i.age, || id:, covariance(independent) Results: - Both the point estimate...
2009 Feb 15
1
GLMM, ML, PQL, lmer
...r in mer_finalize(ans) : q = 295 > n = 236". require (lme4) require (glmmAK) data(epilepticBC) dat = epilepticBC dat$rand=1:nrow(dat) dat$V4=dat$visit==4 formula1 = Seizure ~ Base + Trt + I(Trt*Base) + Age + V4 fit=lmer (update (formula1, .~. + (1|id) + (1|rand)), family=poisson, data=dat, nAGQ=1) Is it true that there is no way to fit such a model in an ML analysis? In other words, is there a way to approximate the likelihood of fixed effects and variance components without relying on estimates of random effects? The second question is that when it is possible to obtain MLE of a GLMM m...
2012 Apr 17
1
random effects using lmer
Hi, I am trying to run a logistic regression to look at the risk of malaria infection in individuals. I want to account for intra household correlation and so want to include a household level random effect. I have been using the lmer command in lme4 package but am getting some strange results that are completely different to those I get using STATA. Can I just check that this is the correct