Displaying 20 results from an estimated 600 matches similar to: "Alternate error structures in lme4?"
2012 Sep 04
5
Associations and Math between Models
I''ve setup two models, 1 and 2, that are associated by
has_and_belongs_to_many. I''m trying to get an attribute from model_1 to use
in a method in model_2. When I use the code below, I get an error saying
''undefined method model_1_id''. What am I missing? Thanks!
Model_2.rb
Class Model_2 < ActiveRecord::Base
...
has_and_belongs_to_many :model_1
def
2005 Aug 16
1
predict nbinomial glm
Dear R-helpers,
let us assume, that I have the following dataset:
a <- rnbinom(200, 1, 0.5)
b <- (1:200)
c <- (30:229)
d <- rep(c("q", "r", "s", "t"), rep(50,4))
data_frame <- data.frame(a,b,c,d)
In a first step I run a glm.nb (full code is given at the end of this mail) and
want to predict my response variable a.
In a second step, I would
2005 Aug 15
1
error in predict glm (new levels cause problems)
Dear R-helpers,
I try to perform glm's with negative binomial distributed data.
So I use the MASS library and the commands:
model_1 = glm.nb(response ~ y1 + y2 + ...+ yi, data = data.frame)
and
predict(model_1, newdata = data.frame)
So far, I think everything should be ok.
But when I want to perform a glm with a subset of the data,
I run into an error message as soon as I want to predict
2006 Aug 26
1
problems with loop
Dear all,
I am trying to evaluate the optimisation behaviour of a function. Originally
I have optimised a model with real data and got a set of parameters. Now I
am creating simulated data sets based on these estimates. With these
simulations I am estimating the parameters again to see how variable the
estimation is. To this end I have written a loop which should generate a new
simulated data
2006 Jul 28
2
negative binomial lmer
To whom it may concern:
I have a question about how to appropriately conduct an lmer analysis for negative binomially distributed data. I am using R 2.2.1 on a windows machine.
I am trying to conduct an analysis using lmer (for non-normally distributed data and both random and fixed effects) for negative binomially distributed data. To do this, I have been using maximum likelihood,
2011 Oct 05
2
gamm: problems with corCAR1()
Dear all,
I?m analyzing this dataset containing biodiversity indices, measured over
time (Week), and at various contaminant concentrations (Treatment). We have
two replicates (Replicate) per treatment.
I?m looking for the effects of time (Week) and contaminant concentration
(Treatment) on diversity indices (e.g. richness).
Initial analysis with GAM models showed temporal autocorrelation of
2005 May 25
1
question: corCAR1 in lme
Hello all,
I am trying to use lme to examine how a response variable (Chla) changes
over time in different treatments (2 Temp & 2 Light levels). Within each
treatment combination, there are two replicate tanks (each with unique
TankID) with coral fragments in them. All tanks are subject to the same
environment until Time=0, when treatments are imposed, and Chla is measured
for each
2006 Jul 18
2
Using corStruct in nlme
I am having trouble fitting correlation structures within nlme. I would like to
fit corCAR1, corGaus and corExp correlation structures to my data. I either
get the error "step halving reduced below minimum in pnls step" or
alternatively R crashes.
My dataset is similar to the CO2 example in the nlme package. The one major
difference is that in my case the 'conc' steps are
2009 Mar 18
1
error with effects package.
Dear R helpers,
I have the following model
model_1<-glm(y~A+B+C+E+A:D,contrasts=list(D=contrasts_D),data=mydata,na.action=na.omit)
with: options(contrasts=c("contr.sum", "contr.poly"))
A,B and E are 2-levels factor,
C is covariate,
D is 20 levels factor with 10 in relation with the first levels of
factor A, the other in relation with the second levels of factor A
2009 Sep 01
1
Syntax for crossed random effects in nlme
Hello R users,
I've read the posts on this topic, and had a look at the R documentation for
nlme, but I can't seem to make this work. I'd like to be able to fit a mixed
effects model with crossed random effects, but also be able to specify the
covariance matrix structure for the residuals. Here's the syntax using the
lmer function in lme4 (which doesn't currently allow
2009 Oct 30
1
exact string match?
Dear R users:
I need to compare character strings stored in 2 separate data frames. I need
an exact match, so finding "a" in "animal" is no good.
I've tried regexpr, match, and grepl, but to no avail.
Anybody know how to accomplish this?
Ben
--
View this message in context: http://old.nabble.com/exact-string-match--tp26136677p26136677.html
Sent from the R help mailing
2005 Nov 07
1
repeated values, nlme, correlation structures
Dear listers,
As an exercise, I am trying to fit a logistic model with nlme. Blue tit
pulli (youngs) were weighted occasionnally (for field reasons) along
time in 17 nestboxes. Individuals where not idenfied but their age was
known. This means that for a given age several measurements were done
but individuals could not be identified from a time to the other. This
makes repeated values for
2009 Feb 12
1
Setting optimizer in lme
I am using R 2.7.0 on a linux platform.
I am trying to reproduce a 2002 example using lme from the nlme library.
I want to change the otimizer from the default (nlminb) to optim.
Specifically, this is what I am trying to do:
R> library(nlme)
R> library(car) # for data only
R> data(Blackmoor) # from car
R> Blackmoor$log.exercise <- log(Blackmoor$exercise + 5/60, 2)
R>
2009 Nov 03
2
Exact String Compare in R?
Dear R users:
Here's a barebones example of what I can't make work.
As you can see, regexpr() does not perform an exact string match, which only
occurs in row 1 of these data frames. Instead, as it's supposed to do, it
finds "b" in "bb" and "c" in "cc". Does anybody know what function I can use
such that only the first rows would be matched (ie,
2011 Dec 07
1
MIXED MODEL WITH REPEATED MEASURES
I am trying to specify a mixed model for my research, but I can't quite get
it to work. I've spent several weeks looking thru various online sources to
no avail. I can't find an example of someone trying to do precisely what I'm
trying to do. I'm hoping some smart member of this mailing list may be able
to help.
First off, full disclosure: (1) I'm an engineer by trade, so
2010 Apr 14
1
creating a new corClass for lme()
Hi,
I have been using the function lme() of the package nlme to model grouped
data that is auto-correlated in time and in space (the data was collected on
different days via a moving monitor). I am aware that I can use the
correlation classes corCAR1 and corExp (among other options) to model the
temporal and spatial components of the auto-correlation. However, as far as
I can tell, I can only
2006 Dec 01
1
mixed effects model and r-squared
Heya
I am fitting linear mixed effects model in R and want to assess the model fit (with Animal number as random factor; repeated measures for Animals):
ts.model <- lme(LOG_FOC_MW ~ R_DN_SUM + ANIMAL + SEX+ YY, data = t.data, random = ~ 1 | ANIMAL, correlation=corCAR1(0.2, form = ~1 | ANIMAL ), method='ML', na.action=na.omit)).
Is there a possability to easly compute an
2011 Mar 29
1
lme:correlationstructure AR1 and random factor
Dear helpers,
I tried these models to run in the package nlme, but allways got the same
error message...
I have a correlation in 5 sessions within a field (n=12) with ten traps in
one field.
res2a <- lme(response~x+y+z+treatment),correlation =
corARMA(form = ~ session|trapfield, p = 1, q = 0), random=~1|field,
na.action=na.omit, data=plates, method="ML")
res2a <-
2005 Apr 27
1
Is this a bug in R?
Dear all,
I am trying to fit a nonlinear model with a autocorrelation term, but everytime I type in the command, I got an error message from Winwows and R closes itself.
The command line is as follows:
mod1<-nlme(V~A*exp(-B*A.O)*Vac.t.1.,data,fixed=A+B~1,random=A+B~1|ORDINAL,+
correlation=corCAR1(0.3179,~A.O|ORDINAL,TRUE),start=c(A=1.2,B=0.2))
I have already fitted this model allowing Phi to
2006 Oct 16
1
linear mixed effects models with breakpoints
Hi folks
I have some data to which I've been fitting linear mixed effects
models. I am currently using a lme model in the nlme package, with terms
for random effects due to repeated measures on individuals and the
corCAR1 serial correlation structure. However, there is some suggestion
in the data (and from theory) that a breakpoint (change point) model may
be more appropriate. Scott, Norman