Displaying 20 results from an estimated 119 matches for "ranef".
2010 Mar 05
2
Defining a method in two packages
The coxme package has a ranef() method, as does lme4. I'm having
trouble getting them to play together, as shown below. (The particular
model in the example isn't defensible, but uses a standard data set.)
The problem is that most of the time only one of lme4 or coxme will be
loaded, so each needs to define the basic...
2011 Mar 23
1
import question
I have been struggling all day to import a particular function/method
combination (ranef(), which extracts the random effects from a mixed
model fit) from the nlme package into another package ... so far without
success.
The NAMESPACE for nlme contains the following lines:
export(..., ranef, ...)
S3method(ranef, lme)
ranef is defined as a standard S3 generic,
function (object,...
2006 Jul 24
3
standardized random effects with ranef.lme()
Using ranef() (package nlme, version 3.1-75) with an 'lme' object I can
obtain random effects for intercept and slope of a certain level (say:
1) - this corresponds to (say level 1) "residuals" in MLWin. Maybe I'm
mistaken here, but the results are identical.
However, if I try to get...
2003 May 12
1
plot.ranef.lme (PR#2986)
library(nlme)
data(Phenobarb)
na.include <- function(x)x
phe1 <- nlme(conc~phenoModel(Subject, time, dose, lCl, lV),
data = Phenobarb,
fixed = lCl+lV~1,
random= pdDiag(lCl+lV~1),
start = c(-5,0),
na.action = na.include,
naPattern = ~!is.na(conc))
phe.ranef <- ranef(phe1,augFrame=TRUE)
plot(phe.ranef, form=lCl~Wt+ApgarInd)
[Error in max(length(x0), length(x1), length(y0), length(y1)) :
Argument "x0" is missing, with no default]
The cause is plain to see: in plot.ranef.lme we have
staple.ends <- list(x1 = c(rep(X...
2015 Feb 15
2
Imports problem
I'm testing out a new version of coxme and R CMD check fails with "could not find function
ranef" (or random.effects or fixef, or anything from nlme). The NAMESPACE file has the
line below
importFrom(nlme, ranef, random.effects, fixef, fixed.effects, VarCorr)
and nlme is declared in the DESCRIPTION file as an import. I feel that I must be staring
at some obvious (but invisible to...
2006 Aug 02
2
lme4 and lmeSplines
...times20)
dat$Zt20 <- approx.Z(Zt20, times20, dat$time)
fit1.20 <- lme(y~time, data=dat, random=list(all=pdIdent(~Zt20-1)))
# Loess model
dat.lo <- loess(y~time, data=dat)
plot(dat.lo)
# Spline model
with(dat, lines(fitted(fit1.20)~time, col="red"))
# Save random effects for later
ranef.nlme <- unlist(ranef(fit1.20))
(2) Now an attempt to use lme4:
library(lmeSplines)
detach(package:nlme)
library(lme4)
data(smSplineEx1)
# Use 20 spline in lme4
dat <- smSplineEx1
times20 <- seq(1,100,length=20)
Zt20 <- smspline(times20)
dat <- cbind(dat, approx.Z(Zt20, times20, dat...
2015 Mar 02
1
clarification on import/depends for a method
User of the coxme library (mixed effects Cox models) are instructed to use ranef(),
fixed(), VarCorr(), etc to retrieve bits out of a fitted model; it purposely uses the same
methods as nlme and/or lmer.
The current behavior is to "depend" on nlme. If I defined the methods myself in coxme,
then someone who had both nlme and coxme loaded will suffer from "las...
2002 Apr 08
1
Error in nlme ranef plot()
...=list(y = "Height", x = "Time", units = list( y = "(m)", x =
"(Yr)")) )
Warning message:
argument lengths differ in: split(x, f).
The warning did not affect the estimation of a nlme model with parameters
B1, B2, and B3. However, when plotting the estimated ranef versus
covariates, an error resulted
> A1Mod.nlmeRE <- ranef(A1Mod.nlme, aug=T)
> plot(A1Mod.nlmeRE, form = B1 ~ Ps + Dr + El + As + Sl) results in
Error in max(length(x0), length(x1), length(y0), length(y1)) :
Argument "x0" is missing, with no default
The same data...
2011 Feb 19
0
lmer, MCMCsamp and ranef samples?
...nt" "n" "p" "q" ...
..@ fixef : num [1:2, 1:1000] 251.41 10.47 254.56 9.71 262.67 ...
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr [1:2] "(Intercept)" "Days"
.. .. ..$ : NULL
..@ nc : int [1:2] 1 1
..@ ranef : num [1:36, 1:1000] 1.51 -40.37 -39.18 24.52 22.91 ...
..@ sigma : num [1, 1:1000] 25.6 23.6 22.9 22.1 26.2 ...
I assume that there is random effect samples for the intercept
(1|Subject) and the slope (0+Days|Subject).
The trouble is that I would like to get the samp0 at ranef for the...
2011 Nov 03
0
Help in ranef Function
Hi
I'm getting the intercepts of the Random effects as 0. Please help me to
understand why this is coming Zero
This is my R code
Data<- read.csv("C:/FE and RE.csv")
Formula="Y~X2+X3+X4 + (1|State) + (0+X5|State)"
fit=lmer(formula=Formula,data=Data)
ranef(fit).
My sample Data
State Year Y X2 X3 X4 X5 X6
S2 1960 27.8 397.5 42.2 50.7 78.3 65.8
S1 1960 29.9 413.3 38.1 52 79.2 66.9
S2 1961 29.8 439.2 40.3 54 79.2 67.8
S1 1961 30.8 459.7 39.5 55.3 79.2 69.6
S2 1962 31.2 492.9 37.3 54.7 77.4 68.7
S1 1962 33.3 528.6 38.1 63.7 80.2 73.6
S2 1963 35.6 560.3...
2006 Oct 04
1
extracting nested variances from lme4 model
...-lmer( x ~ (1|rtr)+ trth/(1|cs) , data=dtf) #
Here, cs and rtr are crossed random effects.
cs 1-5 are of type TRUE, cs 6-10 are of type FALSE,
so cs is nested in trth, which is fixed.
So for cs I should get a fit for 1-5 and 6-10.
This appears to be the case from the random effects:
> mean( ranef(mod1)$cs[[1]][1:5] )
[1] -2.498002e-16
> var( ranef(mod1)$cs[[1]][1:5] )
[1] 23.53083
> mean( ranef(mod1)$cs[[1]][6:10] )
[1] 2.706169e-16
> var( ranef(mod1)$cs[[1]][6:10] )
[1] 1.001065
However VarCorr(mod1) gives me only
a single variance estimate for the cases.
How do I get the othe...
2006 Jul 31
0
standardized residuals (random effects) using nlme and ranef
...m up, I can't figure out how MLWin calculates the
> standardized residuals. But I understand that this is not a
> question for the R list.
> Nevertheless, it would help if someone could point me to some
> arguments why not to use them and stick to the results
> obtainable by ranef().
Hi Dirk:
Well, it is interesting that mlWin and lmer generate the same exact
random effects but different results for the standardized random
effects. Now, my prior post showed exactly how lme calculates the
standardized random effects, so this is now totally transparent.
What I would recomm...
2011 Dec 30
0
New version of coxme / lmekin
...n-upwardly compatable change:
Extractor functions: beta= fixed effects, b=random effects
nlme lme4 coxme <2.2 coxme 2.2 lmekin 2.2
------------------------------------------------------
beta fixef fixef fixef fixef fixef
b ranef ranef ---- ranef ranef
var(beta) vcov vcov ---- vcov vcov
var(b) VarCorr VarCorr ranef VarCorr VarCorr
Notice that "ranef" in the prior release was out of step with everyone
else, which became obvious when working on...
2006 Dec 31
7
zero random effect sizes with binomial lmer
...(NULL,c("Subject","Item","Response")))
for (s in c(1:23))
for (i in c(1:7))
b[7*(s-1)+i,] <- c(s,i,bb[s,i])
B <- data.frame(b)
A.fit <- lmer(Response~(1|Subject)+(1|Item),A,binomial)
B.fit <- lmer(Response~(1|Subject)+(1|Item),B,binomial)
A.fit
B.fit
ranef(A.fit)$Item
ranef(B.fit)$Item
Generalized linear mixed model fit using Laplace
Formula: Response ~ (1 | Subject) + (1 | Item)
Data: A
Family: binomial(logit link)
AIC BIC logLik deviance
120 129 -56.8 114
Random effects:
Groups Name Variance Std.Dev.
Subject (Intercept) 1.63e+00...
2014 May 23
2
R múltiple archivos de salida
...ra A y para B, pero al ser muchos y teniendo en cuenta el tiempo de
procesamiento, donde el cálculo del modelo no sería necesario procesar
por cada ejecución de variable (A y B).
Expresado de otra forma, (1) es el procesamiento del modelo, (2.1) y
(2.2) son procesos sobre el modelo, por ejemplo ranef para solo A y
ranef para solo B.
El resultado de ranef para A, es decir filtrando solo la vaiable A se
escribe en el archivo A.
Por lo que tendría dos archivos, uno A y otro B, donde ambos tienen una
parte en común (1) y la correspondiente (2.1) para A y (2.2) para B. Mi
deseo es no tener que...
2015 Feb 16
2
Imports problem
On 16/02/2015 8:20 AM, Therneau, Terry M., Ph.D. wrote:
>
>> > I'm testing out a new version of coxme and R CMD check fails with "could not find function
>> > ranef" (or random.effects or fixef, or anything from nlme). The NAMESPACE file has the
>> > line below
>>
>> > importFrom(nlme, ranef, random.effects, fixef, fixed.effects, VarCorr)
>>
>> > and nlme is declared in the DESCRIPTION file as an impo...
2015 Feb 16
0
Imports problem
>>>>> Therneau, Terry M , Ph D <therneau at mayo.edu>
>>>>> on Sun, 15 Feb 2015 17:31:00 -0600 writes:
> I'm testing out a new version of coxme and R CMD check fails with "could not find function
> ranef" (or random.effects or fixef, or anything from nlme). The NAMESPACE file has the
> line below
> importFrom(nlme, ranef, random.effects, fixef, fixed.effects, VarCorr)
> and nlme is declared in the DESCRIPTION file as an import. I feel that I must be staring
>...
2009 Apr 23
1
qqnorm.lme & pairs.lme
...sing lme.
I want to use qqnorm and pairs (similarly to examples given in Pinheiro &
Bates p. 188), but it's not working. Here's some relevant code and the
error message:
library(nlme)
data(Machines)
m1 <- lme(fixed=score~Machine,random=~1|Worker/Machine, data=Machines)
qqnorm(m1, ~ranef(.))
Error in rep(names(fData), rep(nr, nc)) : invalid 'times' argument
In addition: Warning message:
In data.frame(Worker = list("(Intercept)" = c(-7.51429457896346, :
row names were found from a short variable and have been discarded
I also tried changing the last line to qq...
2012 Dec 11
1
Interpretation of ranef output
Hello.
I'm running a generalized linear model and am interested in using the
random effects that are output for further analysis. My random effect is
interacting with two different fixed effects (which which are factors with
two levels each). When I retrieve the random effects I get something like
this:
(Intercept) nutrient (Intercept) light (Intercept)
Aa-0 0.59679192
2006 Aug 03
2
NLME: Problem with plotting ranef vs a factor
...day | subjectno, data=Data1_93)
detach(Data)
Here is the code to check that the covariate called pcat is indeed a factor:
> levels(pcat)
[1] "1" "2" "3"
> is.factor(pcat)
[1] TRUE
and then after the model is fitted I extract the random effects:
D1C2.ran <- ranef(mod11.103nlme,augFrame=T)
and here is an extract from the object:
C R day gamedens pcat site mutcat1 pdens0 log2game
NA02_259 -1.016987007 0.0162825099 15.75000 23.50000 1 Namaacha Mixed 15018 3.761099
NA02_073 -0.939355374 0.013258...