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
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
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
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
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
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
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
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
.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:
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]])
>
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
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[
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
] # 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
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
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
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
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_
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
68690096%" "23.3865814696486%" "23.3865814696486%"
#Male "25.814696485623%" "29.1533546325879%" "29.1533546325879%"
# hibp14 hibp21
#Female "24.1693290734824%" "31.3418530351438%"
#Male &qu
(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
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
(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
; 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
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
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
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
> 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
>
-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
="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
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
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
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="
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
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
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)+
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
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
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/
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
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.).
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
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
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
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
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
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
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
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
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
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
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
: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
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
: [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
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
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
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
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
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
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
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
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
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
> -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
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
66 matches
Mail list logo