Re: [R] Random effects in package mgcv

2016-04-28 Thread Simon Wood
If you want to include random intercepts in a model fit by bam/gam, then include s(g,bs="re") in the model formula, where g is a factor variable with one level for each group requiring a random intercept. Now suppose that for each level of group g you want a random slope w.r.t. x. You should

[R] Random effects in package mgcv

2016-04-27 Thread Dean Force
Hello R users, I have a quick question I was hoping to get your input on. I am new to R and the smooth statistical regression world, and am trying to wrap my mind around the issues concerning using splines for mixed effect modeling. My question is the following: in the ‘gamm’ function, generaliz

[R] Random effects in GAMs

2016-02-13 Thread Julian Chen
I am now trying to use random effects in GAMs developed by Professor Simon Wood. Prof Wood uses s(...,bs="re") to account for the random effects. Random intercepts models or random slopes models are two different types of mixed linear models or general random effects model (Cameron and Trivedi, 20

Re: [R] Random effects in GAMs

2016-02-13 Thread Julian Chen
I am now using random effects of GAM to predict crash frequency at intersections. The family is negative binomial distribution. I wonder if this term bs="re" developed by Prof Simon Wood can account for both random intercepts and random slopes effects together? It is longitudinal data. The number

[R] Random effects model with PLM: "System is computationally singular"-Error?

2014-03-15 Thread Millo Giovanni
Machiavelli 3, 34132 Trieste (Italy) tel. +39 040 671184 fax +39 040 671160 original message -- Message: 14 Date: Fri, 14 Mar 2014 05:25:42 -0700 (PDT) From: tahaus To: r-help@r-project.org Subject: [R] Random effects model with PLM: "System is computatio

[R] Random effects model with PLM: "System is computationally singular"-Error?

2014-03-14 Thread tahaus
Dear readers, I am currently trying to estimate some panel data models in R using PLM package. This includes the estimation of basic pooled, fixed effects and random effects models. Therefore I make use of this code: Now here's the problem: Now here's the problem: I can without any problem esti

Re: [R] random effects model

2013-01-18 Thread rex2013
om: rex2013 <[hidden > email]<http://user/SendEmail.jtp?type=node&node=4655802&i=1>> > > To: [hidden email] <http://user/SendEmail.jtp?type=node&node=4655802&i=2> > Cc: > Sent: Wednesday, January 16, 2013 5:06 AM > Subject: Re: [R] random effec

Re: [R] random effects model

2013-01-16 Thread arun
ou to read lme4 book (http://lme4.r-forge.r-project.org/lMMwR/) #lrgprt.pdf A.K. - Original Message - From: rex2013 To: r-help@r-project.org Cc: Sent: Wednesday, January 16, 2013 5:06 AM Subject: Re: [R] random effects model Hi I tried removing the missing values and installing &qu

Re: [R] random effects model

2013-01-16 Thread rex2013
.jtp?type=node&node=4655612&i=0>> > > To: arun <[hidden > email]<http://user/SendEmail.jtp?type=node&node=4655612&i=1>> > > Cc: R help <[hidden > email]<http://user/SendEmail.jtp?type=node&node=4655612&i=2>> > > Sent:

Re: [R] random effects model

2013-01-15 Thread arun
library(lme4) >fm1<-lmer(HiBP~time+(1|CODEA), family=binomial,data=BP.stack3) #check codes, >not sure >print(dotplot(ranef(fm1,post=TRUE), >  scales = list(x = list(relation = "free")))[[1]]) >qmt1<- qqmath(ranef(fm1, postVar=TRUE)) >print(qmt1[[1]]) >

Re: [R] random effects model

2013-01-15 Thread Usha Gurunathan
t; fm1<-lmer(HiBP~time+(1|CODEA), family=binomial,data=BP.stack3) #check > codes, not sure > print(dotplot(ranef(fm1,post=TRUE), > scales = list(x = list(relation = "free")))[[1]]) > qmt1<- qqmath(ranef(fm1, postVar=TRUE)) > print(qmt1[[1]]) > > A.K

Re: [R] random effects model

2013-01-14 Thread arun
could try lmer() from lme4.  library(lme4) fm1<-lmer(HiBP~time+(1|CODEA), family=binomial,data=BP.stack3) #check codes, not sure print(dotplot(ranef(fm1,post=TRUE),   scales = list(x = list(relation = "free")))[[1]]) qmt1<- qqmath(ranef(fm1, postVar=TRUE)) print(qmt1[

Re: [R] random effects model

2013-01-14 Thread arun
0  0  1    1 0  1 #8.1 8    0  1  0    1 1  1 #3.2 3    0  1  0    2 1  1 #7.2 7    0  0  1    2 1      1 #8.2 8    0  1  0    2 0  0 A.K. - Original Message - Fr

Re: [R] random effects model

2013-01-14 Thread Usha Gurunathan
] # your code was BP.sub5a <- > BP.sub3a[order(BP.sub5a$CODEA),] > > ^ was not defined before > #Next line > BPsub3$Categ[BPsub6$Overweight==1&BPsub3$time==1&BPsub3$Obese==0]<- > "Overweight14" #It should be BP.sub3 and what is BPsub6, it was n

Re: [R] random effects model

2013-01-14 Thread rex2013
set=!(is.na(Sex)| is.na(Education)|is.na > (Birthplace)|is.na(Education)|is.na(hibp14)| is.na(hibp21))) > nrow(BP.sub3a) > #[1] 3364 > BP.sub5a <- BP.sub3a[order(BP.sub3a$CODEA),] # your code was BP.sub5a <- > BP.sub3a[order(BP.sub5a$CODEA),] > > ^ was not defined before

Re: [R] random effects model

2013-01-13 Thread arun
fore #Next line BPsub3$Categ[BPsub6$Overweight==1&BPsub3$time==1&BPsub3$Obese==0]<- "Overweight14"  #It should be BP.sub3 and what is BPsub6, it was not defined previously. #Error in BPsub3$Categ[BPsub6$Overweight == 1 & BPsub3$time == 1 & BPsub3$Obese ==  :   #object

Re: [R] random effects model

2013-01-13 Thread arun
To: arun Sent: Sunday, January 13, 2013 1:51 AM Subject: Re: [R] random effects model HI AK Thanks a lot  for explaining that. 1. With the chi sq. ( in order to find out if the diffce is significant between groups) do I have create a separate excel file and make a dataframe.How do I go

Re: [R] random effects model

2013-01-12 Thread arun
nathan To: arun Cc: R help Sent: Saturday, January 12, 2013 5:59 PM Subject: Re: [R] random effects model Hi AK That works. I was trying to get  similar results from any other package. Being a beginner, I was not sure how to modify the syntax to get my output. lapply(split(BP_2bSexNoMV,BP_

Re: [R] random effects model

2013-01-12 Thread Usha Gurunathan
Hi AK That works. I was trying to get similar results from any other package. Being a beginner, I was not sure how to modify the syntax to get my output. lapply(split(BP_2bSexNoMV,BP_ 2bSexNoMV$Sex),function(x) (nrow(x[!complete.cases(x[,-2]),])/nrow(x))*100) #gives the percentage of rows of miss

Re: [R] random effects model

2013-01-12 Thread arun
68690096%" "23.3865814696486%" "23.3865814696486%" #Male   "25.814696485623%"  "29.1533546325879%" "29.1533546325879%" #   hibp14  hibp21 #Female "24.1693290734824%" "31.3418530351438%" #Male   &qu

Re: [R] random effects model

2013-01-12 Thread arun
(is.na(x[,-1]))/nrow(x))*100,"%",sep=""))) From ur reply, it seemed like you were trying different codes: as data(df,package, package="vmv") A.K. From: Usha Gurunathan To: arun Cc: R help Sent: Saturday, January 12, 2013 1:42 A

Re: [R] random effects model

2013-01-12 Thread arun
lapply(split(dat1,dat1$Gender),function(x) paste((colSums(is.na(x[,-1]))/nrow(x))*100,"%",sep="")))  colnames(res)<-colnames(dat1)[-1]  res #  V1    V2   #F "0%"  "20%" #M "50%" "20%" A.K. - Original Message - From: rex2

Re: [R] random effects model

2013-01-11 Thread Usha Gurunathan
(dat1,dat1$Gender),function(x) > paste((colSums(is.na(x[,-1]))/nrow(x))*100,"%",sep=""))) > colnames(res)<-colnames(dat1)[-1] > res > # V1V2 > #F "0%" "20%" > #M "50%" "20%" > A.K. > > > > > > - Original Mes

Re: [R] random effects model

2013-01-11 Thread rex2013
; From: rex2013 <[hidden > email]<http://user/SendEmail.jtp?type=node&node=4655274&i=0>> > > To: [hidden email] <http://user/SendEmail.jtp?type=node&node=4655274&i=1> > Cc: > Sent: Friday, January 11, 2013 2:16 AM > Subject: Re: [R] random effects mo

Re: [R] random effects model

2013-01-11 Thread arun
t. Hope it helps. A.K. - Original Message - From: rex2013 To: r-help@r-project.org Cc: Sent: Friday, January 11, 2013 2:16 AM Subject: Re: [R] random effects model Hi AK Regarding the missing values, I would like to find out the patterns of missing values in my data set. I know the overall

Re: [R] random effects model

2013-01-11 Thread rex2013
he same cluster with the values of the vector of > k respectively l have > a correlation of rkl ." > > Hope it helps. > A.K. > > > > > - Original Message - > From: rex2013 <[hidden > email]<http://user/SendEmail.jtp?type=node&node=4654996&i=1&g

Re: [R] random effects model

2013-01-08 Thread arun
ues of the vector of k respectively l have a correlation of rkl ." Hope it helps. A.K. - Original Message - From: rex2013 To: r-help@r-project.org Cc: Sent: Tuesday, January 8, 2013 5:29 PM Subject: Re: [R] random effects model Hi Thanks a lot, the corstr "exchangeable"does wo

Re: [R] random effects model

2013-01-08 Thread rex2013
> Have a look at > > http://stats.stackexchange.com/questions/21771/how-to-perform-model-selection-in-gee-in-r > It's not clear to me "reference to write about missing values". > A.K. > > > > > - Original Message - > From: Usha Gurunathan >

Re: [R] random effects model

2013-01-07 Thread arun
-selection-in-gee-in-r It's not clear to me  "reference to write about missing values".    A.K. - Original Message - From: Usha Gurunathan To: arun Cc: Sent: Monday, January 7, 2013 6:12 PM Subject: Re: [R] random effects model Hi AK 2)I shall try putting exch. and c

Re: [R] random effects model

2013-01-07 Thread arun
="ar1".   Why do you gave the option "unstructured"? A.K. ----- Original Message - From: rex2013 To: r-help@r-project.org Cc: Sent: Monday, January 7, 2013 6:15 AM Subject: Re: [R] random effects model Hi A.K Below is the comment I get, not sure why. BP.sub3 i

Re: [R] random effects model

2013-01-07 Thread arun
55454 #age0 0.45322698 #age1     0.01187725 #smoke1   0.86262269 #age-1:smoke1 0.17239050 #age0:smoke1  0.32223942 #age1:smoke1  0.36686706 A.K. - Original Message - From: rex2013 To: r-help@r-project.org Cc: Sent: Monday, January 7, 2013 6:15 AM Subject: Re: [R] random

Re: [R] random effects model

2013-01-07 Thread rex2013
me),] > seiz.l$t <- ifelse(seiz.l$time == 0, 8, 2) > seiz.l$x <- ifelse(seiz.l$time == 0, 0, 1) > m1 <- geese(y ~ offset(log(t)) + x + trt + x:trt, id = id, > data=seiz.l, corstr="exch", family=poisson) > summary(m1) > > sum

Re: [R] random effects model

2013-01-06 Thread arun
0:4, direction="long") seiz.l <- seiz.l[order(seiz.l$id, seiz.l$time),] seiz.l$t <- ifelse(seiz.l$time == 0, 8, 2) seiz.l$x <- ifelse(seiz.l$time == 0, 0, 1) m1 <- geese(y ~ offset(log(t)) + x + trt + x:trt, id = id, data=seiz.l, corstr="

Re: [R] random effects model

2013-01-06 Thread rex2013
Hi A.K Regarding my question on comparing normal/ obese/overweight with blood pressure change, I did finally as per the first suggestion of stacking the data and creating a normal category . This only gives me a obese not obese 14, but when I did with the wide format hoping to get a obese14,norm

Re: [R] Random effects in gam (mgcv 1.7-19)

2012-08-24 Thread Simon Wood
Silje, Thanks for reporting this. Should be fixed for version 1.7-20 (but please let me know if not!) best, Simon On 14/08/12 12:08, silje skår wrote: Hi, I am using the gam function in the mgcv package, I have random effects in my model (bs="re") this has worked fine, but after I updated t

[R] Random effects in gam (mgcv 1.7-19)

2012-08-14 Thread silje skår
Hi, I am using the gam function in the mgcv package, I have random effects in my model (bs="re") this has worked fine, but after I updated the mgcv package to version 1.7-19 I recive an error message when I run the model. > fit1<-gam(IV~s(RUTE,bs="re")+s(T13)+s(H40)+factor(AAR)+s(V3)+s(G1)+s(H1)+

Re: [R] random effects in library mgcv

2012-04-27 Thread Mabille, Geraldine
Thanks Simon...it's always clearer when you say it!!! Geraldine -Original Message- From: Simon Wood [mailto:s.w...@bath.ac.uk] Sent: 27. april 2012 12:41 To: Mabille, Geraldine Cc: r-help@r-project.org Subject: Re: [R] random effects in library mgcv Geraldine, I think that yo

Re: [R] random effects in library mgcv

2012-04-27 Thread Simon Wood
ril 2012 19:28 To: r-help@r-project.org Subject: Re: [R] random effects in library mgcv On 25/04/12 14:02, Mabille, Geraldine wrote: Hi, I am working with gam models in the mgcv library. My response variable (Y) is binary (0/1), and my dataset contains repeated measures over 110 individuals (same nu

Re: [R] random effects in library mgcv

2012-04-27 Thread Mabille, Geraldine
uot; smooth??? Am I interpreting those things right??? Cheers, Geraldine -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Simon Wood Sent: 26. april 2012 19:28 To: r-help@r-project.org Subject: Re: [R] random effects in library mgcv On 25/

Re: [R] random effects in library mgcv

2012-04-26 Thread Simon Wood
On 25/04/12 14:02, Mabille, Geraldine wrote: Hi, I am working with gam models in the mgcv library. My response variable (Y) is binary (0/1), and my dataset contains repeated measures over 110 individuals (same number of 0/1 within a given individual: e.g. 345-zero and 345-one for individual A, 22

[R] random effects in library mgcv

2012-04-25 Thread Mabille, Geraldine
Hi, I am working with gam models in the mgcv library. My response variable (Y) is binary (0/1), and my dataset contains repeated measures over 110 individuals (same number of 0/1 within a given individual: e.g. 345-zero and 345-one for individual A, 226-zero and 226-one for individual B, etc.).

Re: [R] random effects using lmer

2012-04-18 Thread Ben Bolker
HughSt hotmail.com> writes: > 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

[R] random effects using lmer

2012-04-17 Thread HughSt
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 tha

Re: [R] random effects

2011-09-30 Thread Rich Shepard
On Fri, 30 Sep 2011, Rosario Garcia Gil wrote: I have a data set with fixed and random effects, therefore I am using the lme function: Rosario, Allow me to recommend reading "Mixed Effects Models and Extentions in Ecology with R" by Zuur, et al. There are (potentially) serious limitations

[R] random effects

2011-09-30 Thread Rosario Garcia Gil
Hello I have a data set with fixed and random effects, therefore I am using the lme function: lm(y ~ xfixed, random=~1|xrandom, data) After this I want to get the F-values for both the fixed and random predictors. I can easily get the F-value and df for the xfixed predictors (anova()), but ho

Re: [R] random effects

2011-09-29 Thread David Winsemius
On Sep 29, 2011, at 5:34 PM, Rosario Garcia Gil wrote: Hello I have a data set with fixed and random effects, therefore I am using the lme function: lm(y ~ xfixed, random=~1|xrandom, data) After this I want to get the F-values for both the fixed and random predictors. I can easily get t

[R] random effects

2011-09-29 Thread Rosario Garcia Gil
Hello I have a data set with fixed and random effects, therefore I am using the lme function: lm(y ~ xfixed, random=~1|xrandom, data) After this I want to get the F-values for both the fixed and random predictors. I can easily get the F-value and df for the xfixed predictors (anova()), but ho

Re: [R] Random Effects Meta Regression

2011-01-16 Thread Viechtbauer Wolfgang (STAT)
Sent: Saturday, January 15, 2011 19:27 To: r-help@r-project.org Subject: Re: [R] Random Effects Meta Regression > Thank you Mike - that has worked brilliantly. > > I have one further question that I was hoping someone on the forum > may be able to help with. > > For most of my met

Re: [R] Random Effects Meta Regression

2011-01-16 Thread s306
Thank you Mike - that has worked brilliantly. I have one further question that I was hoping someone on the forum may be able to help with. For most of my meta regressions I am interested in the impact of a one unit increase in the explanatory variable, however for one I want to estimate the effe

Re: [R] Random Effects Meta Regression

2011-01-07 Thread Mike Cheung
Hi Steph, You may try the metafor package http://cran.r-project.org/web/packages/metafor/index.html Regards, Mike -- - Mike W.L. Cheung Phone: (65) 6516-3702 Department of Psychology Fax: (65) 6773-1843

[R] Random Effects Meta Regression

2011-01-07 Thread s306
Hi All, I have run a series of random effects meta regressions on binomial outcomes using the metabin function in R. Now I would like to conduct some random effects meta regressions on the outcomes. Is there a command available which will allow for me to test the impact of a certain variable on t

Re: [R] random effects in mixed model not that 'random'

2009-12-13 Thread Thomas Mang
oject.org] On Behalf Of Thomas Mang Sent: Friday, December 11, 2009 6:19 PM To: r-h...@stat.math.ethz.ch Subject: [R] random effects in mixed model not that 'random' Hi, I have the following conceptual / interpretative question regarding random effects: A mixed effects model was fit on biol

Re: [R] random effects in mixed model not that 'random'

2009-12-13 Thread Robert A LaBudde
:r-help-boun...@r-project.org] On Behalf Of Thomas Mang Sent: Friday, December 11, 2009 6:19 PM To: r-h...@stat.math.ethz.ch Subject: [R] random effects in mixed model not that 'random' Hi, I have the following conceptual / interpretative question regarding random effects: A mixed e

Re: [R] random effects in mixed model not that 'random'

2009-12-13 Thread Thomas Mang
Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Thomas Mang Sent: Friday, December 11, 2009 6:19 PM To: r-h...@stat.math.ethz.ch Subject: [R] random effects in mixed model not that 'random' Hi, I have the following conceptual / int

Re: [R] random effects in mixed model not that 'random'

2009-12-13 Thread Daniel Malter
: [R] random effects in mixed model not that 'random' Hi, I have the following conceptual / interpretative question regarding random effects: A mixed effects model was fit on biological data, with observations coming from different species. There is a clear overall effect of certain

[R] random effects in mixed model not that 'random'

2009-12-11 Thread Thomas Mang
Hi, I have the following conceptual / interpretative question regarding random effects: A mixed effects model was fit on biological data, with observations coming from different species. There is a clear overall effect of certain predictors (entering the model as fixed effect), but as diffe

Re: [R] random effects correlation in lmer

2009-11-24 Thread Daniel Malter
Malter Betreff: Re: [R] random effects correlation in lmer HI Daniel: I liked your explanation, but in the code snippet you provided, y1 and y2 are the same. Did you mean to put y2 <- 10 + rand.slop + time + e or y2 <- 10 + rand.int * rand.slop + tim + e? Dennis On Tue, Nov 24, 2009

Re: [R] random effects correlation in lmer

2009-11-24 Thread Daniel Malter
It implies that the random intercept is perfectly collinear with the random slope, as you suggested. I attach an example. The data generating process of y1 has a random intercept, but no random slope. When you fit a model with random intercept and random slope, the correlation between the two is

[R] random effects correlation in lmer

2009-11-23 Thread Kurt Smith
I am having an issue with lmer that I wonder if someone could explain. I am trying to fit a mixed effects model to a set of longitudinal data over a set of individual subjects: (fm1 <- lmer(x ~ time + (time|ID),aa)) I quite often find that the correlation between the random effects is 1.0: Linea

[R] Random effects aov

2009-05-20 Thread Christine Griffiths
Dear All I have a repeated measures design in which abundance was measured repeatedly over 10 months in three treatments (Tortoise A; Tortoise B and control) established in 6 blocks, i.e. crossed fixed effects. My original design incorporated two tortoises per treatment, however as fieldwork g

[R] random effects in lmer

2008-08-22 Thread Line Johansen
Dear all<> I am running several generalized mixed model using lmer. <>The models typical look like this: model2xx<-lmer(numbers~Treatment+b+(1|Genotype)+(1|Field)+(1|Genotype:Treatment), family=quasipoisson)<> All factors are categorical. <>And the output looks like this: Generalized linear

[R] random effects mixed model, different regressors

2008-07-31 Thread Fensis
Hi everybody, I have built a model that includes subject ID as a random effect, and has a continous variable (time) and I want to test whether the slope of this line differs between treatments (this is tested with the interaction between treatment and "time"). My question now is that I also want

[R] Random effects and lme4

2008-07-03 Thread wmh
I'm running some multi-level binomial models with lme4 and have a question regarding the estimated random effects. Suppose I have nested data e.g. clinic and then patient within clinic. The standard deviations of the random effects at each level are roughly equal in a model for real life data. At

[R] Random effects dimension in nlme and P-values

2008-06-10 Thread Marc Bernard
Dear All, I don't know whether this question is appropriate for this list or not. My question is as follows: I am fitting a non-linear mixed model using the SSlogis function. When the parameters xmid and scal are both considered as random (let us say model M1), the p-value for my

Re: [R] Random Effects

2008-02-12 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Samuel Braithwaite > Sent: Tuesday, February 12, 2008 8:14 AM > To: r-help@r-project.org > Subject: [R] Random Effects > > > Hi All: > > I have a panel data

[R] Random Effects

2008-02-12 Thread Samuel Braithwaite
Hi All: I have a panel data set with i individuals and t time periods for which i am required to estimate the model parameters allowing for Random Effects. How can i go about this in R? Thanks Sam "There would be no heroes if there were no battles or no arduous tasks, and there are no