search for: orthodont

Displaying 20 results from an estimated 131 matches for "orthodont".

2008 Jul 18
2
column wise paste of data.frames
Hi everybody! I'm sure that I overlook something and feel quite stupid to ask, but I have not found an easy solution to the following problem: Take e.g. the Orthodont data from the nlme package: > head(Orthodont) Grouped Data: distance ~ age | Subject distance age Subject Sex 1 26.0 8 M01 Male 2 25.0 10 M01 Male 3 29.0 12 M01 Male 4 31.0 14 M01 Male 5 21.5 8 M02 Male 6 22.5 10 M02 Male Suppose now,...
2010 Jun 22
2
xyplot: adding pooled regression lines to a paneled type="r" plot
Consider the following plot that shows separate regression lines ~ age for each subject in the Pothoff-Roy Orthodont data, with separate panels by Sex: library(nlme) #plot(Orthodont) xyplot(distance ~ age|Sex, data=Orthodont, type='r', groups=Subject, col=gray(.50), main="Individual linear regressions ~ age") I'd like to also show in each panel the pooled OLS regression line for each...
2009 Mar 16
1
Please help! How do I change the class of a numeric variable in a grouped data object to a factor?
Hi all I’m in desperate need of help. I’m working with a grouped data object, called Orthodont in the nlme package in R, and am trying to fit various models (learning methods for my thesis), but one of the variables in the object is numeric, (age) and I need it to be a factor. I’ve tried: as.factor(Orthodont$age) as.factor(as.character(Orthodont$age)) and various other things, but when I t...
2011 Feb 28
3
Measuring correlations in repeated measures data
R-helpers: I would like to measure the correlation coefficient between the repeated measures of a single variable that is measured over time and is unbalanced. As an example, consider the Orthodont dataset from package nlme, where the model is: fit <- lmer(distance ~ age + (1 | Subject), data=Orthodont) I would like to measure the correlation b/t the variable "distance" at different ages such that I would have a matrix of correlation coefficients like the following: age...
2008 May 09
1
Using lme() inside a function
...unction doesn't work with the stepAIC()-function.) Since I have many groups, and I wish to do the same thing for each group, I have constructed a function which takes the dataset as input variable and gives a prediction result (here mean absolute error) as output. This is an example using the Orthodont dataset: library(MASS) library(nlme) PredRes<-function(D1) { lmemod=lme(distance~age*Sex, random=~1|Subject, data=subset(D1,age!=14),method="ML") themod=stepAIC(lmemod,dir="both") prs=predict(themod,newdata=subset(D1,age==14)) obs<-subset(D1,age==14)$distance pri...
2010 Jul 15
4
Sweave: infelicities with lattice graphics
...in the article text the print() wrapper I need in code chunks for the graphs to appear. I can solve this by including each chunk twice, with different options, as in <<ortho-xyplot1-code, keep.source=TRUE, eval=FALSE>>= library(nlme) library(lattice) xyplot(distance ~ age|Sex, data=Orthodont, type='b', groups=Subject, pch=15:25, col=palette(), cex=1.3, main="Orthodont data") @ <<ortho-xyplot1,fig=TRUE, include=FALSE, echo=FALSE, width=6, height=6>>= library(nlme) library(lattice) print(xyplot(distance ~ age|Sex, data=Orthodont, type='b', grou...
1999 Jul 01
1
lme
I am using rw0641. In my continuing quest to understand repeated measures analysis, I again return to lme. I exported the Potthoff and Roy data Orthodont.dat from S-PLUS 4.5 to avoid capture errors and ran the examples in the R help. I imported the data.frame with data <- read.table("Orthodont.dat",header=T) attach(data) and created the objects Orthodont.fit1 <- lme(fixed=distance~age,random=~age) Orthodont.fit2 <- lme(fixe...
2006 Jun 28
3
lme convergence
Dear R-Users, Is it possible to get the covariance matrix from an lme model that did not converge ? I am doing a simulation which entails fitting linear mixed models, using a "for loop". Within each loop, i generate a new data set and analyze it using a mixed model. The loop stops When the "lme function" does not converge for a simulated dataset. I want to
2008 May 09
2
How can one make stepAIC and lme
...unction doesn't work with the stepAIC()-function.) Since I have many groups, and I wish to do the same thing for each group, I have constructed a function which takes the dataset as input variable and gives a prediction result (here mean absolute error) as output. This is an example using the Orthodont dataset: library(MASS) library(nlme) PredRes<-function(D1) { lmemod=lme(distance~age*Sex, random=~1|Subject, data=subset(D1,age!=14),method="ML") themod=stepAIC(lmemod,dir="both") prs=predict(themod,newdata=subset(D1,age==14)) obs<-subset(D1,age==14)$distance print(mean(o...
2004 Aug 27
2
degrees of freedom (lme4 and nlme)
Hi, I'm having some problems regarding the packages lme4 and nlme, more specifically in the denominator degrees of freedom. I used data Orthodont for the two packages. The commands used are below. require(nlme) data(Orthodont) fm1<-lme(distance~age+ Sex, data=Orthodont,random=~1|Subject, method="REML") anova(fm1) numDF DenDF F-value p-value (Intercept) 1 80 4123.156 <.0001 age 1...
2002 Dec 17
1
lme invocation
Hi Folks, I'm trying to understand the model specification formalities for 'lme', and the documentation is leaving me a bit confused. Specifically, using the example dataset 'Orthodont' in the 'nlme' package, first I use the invocation given in the example shown by "?lme": > fm1 <- lme(distance ~ age, data = Orthodont) # random is ~ age Despite the Comment ("# random is ~ age"), > summary(fm1) says that [...] Random effects:...
2005 Jul 12
1
nlme plot
Hello, I am running this script from Pinheiro & Bates book in R Version 2.1.1 (WinXP). But, I can't plot Figure 2.3. What's wrong? TIA. Rod. --------------------------------------------------------- >library(nlme) > names( Orthodont ) [1] "distance" "age" "Subject" "Sex" > levels( Orthodont$Sex ) [1] "Male" "Female" > OrthoFem <- Orthodont[ Orthodont$Sex == "Female", ] > > fm1OrthF <- lme( distance ~ age, data = OrthoFem, rand...
2006 Jul 03
1
panel ordering in nlme and augPred plots
Hi, I'm new at this, I'm very confused, and I think I'm missing something important here. In our pet example we have this: > fm <- lme(Orthodont) > plot(Orthodont) > plot(augPred(fm, level = 0:1)) which gives us a trellis plot with the females above the males, starting with "F03", "F04", "F11", "F06", etc. I thought the point of this was to create an ordering where the females are ordered (&qu...
2005 Jan 03
1
different DF in package nlme and lme4
Hi all I tried to reproduce an example with lme and used the Orthodont dataset. library(nlme) fm2a.1 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1 | Subject) anova(fm2a.1) > numDF denDF F-value p-value > (Intercept) 1 80 4123.156 <.0001 > age 1 80 114.838 <.0001 > Sex 1 25 9.29...
1999 Jun 02
1
lme problem ?
...ve project with many contributors. Type "?contributors" for a list. Type "demo()" for some demos, "help()" for on-line help, or "help.start()" for a HTML browser interface to help. Type "q()" to quit R. > library(lme) > data(Orthodont) > fm1 <- lme(distance ~ age, data = Orthodont) # random is ~ age Error: Singularity in backsolve at level 2, block 1> > fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1) Error: singular matrix in chol > Troels Ring, MD Department of Nephrology Aalborg Hospital Aa...
1999 Jun 02
0
Sv: lme problem ?
...ve project with many contributors. Type "?contributors" for a list. Type "demo()" for some demos, "help()" for on-line help, or "help.start()" for a HTML browser interface to help. Type "q()" to quit R. > library(lme) > data(Orthodont) > fm1 <- lme(distance ~ age, data = Orthodont) # random is ~ age Error: Singular precision matrix in level 1, block 1> > fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1) warning: NA/Inf replaced by maximum positive value Error: Singularity in backsolve at level 2, b...
2005 Jun 08
0
bug in predict.lme?
...a from the variable. THe code below demonstrates this. Is this a known or expected behavour of predict.lme or is this a bug? kind regards, Arne (R-2.1.0) > library(nlme) ... > mod <- distance ~ age + Sex # example from ?lme > mod distance ~ age + Sex > fm2 <- lme(mod, data = Orthodont, random = ~ 1) > anova(fm2) numDF denDF F-value p-value (Intercept) 1 80 4123.156 <.0001 age 1 80 114.838 <.0001 Sex 1 25 9.292 0.0054 > fm2 Linear mixed-effects model fit by REML Data: Orthodont Log-restricted-likelihood: -2...
2006 May 27
1
Recommended package nlme: bug in predict.lme when an independent variable is a polynomial (PR#8905)
...nerated by poly() is used as an explanatory variable, and a new data.frame is used for predictions. I guess this is related to * not * using, for predictions, the coefs used in constructing the orthogonal polynomials before fitting the model: > fm <- lme(distance ~ poly(age, 3) + Sex, data = Orthodont, random = ~ 1) > > # data for predictions > Newdata <- head(Orthodont) > Newdata$Sex <- factor(Newdata$Sex, levels = levels(Orthodont$Sex)) > > # "naive" model matrix for predictions > mm1 <- model.matrix(~ poly(age, 3) + Sex, data = Newdata) > > # &...
1999 Nov 27
0
lme
...ihood. In my opinion, substituting the REML estimate obtained from the marginal or conditional likelihood back into the full likelihood makes no sense. Best wishes, Jim ------------------------------------------------------------------------ library(nlme) library(growth) # example from lme data(Orthodont) summary(fm1 <- lme(distance ~ age, data = Orthodont)) # random is ~ age summary(fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1)) # set up data object distance <- matrix(Orthodont[1],ncol=4,byrow=T) age <- matrix(Orthodont[2],ncol=4,byrow=T) sex <- Orthodont[4][seq(...
2003 Mar 04
2
How to extract R{i} from lme object?
Hi, lme() users, Can some one tell me how to do this. I model Orthodont with the same G for random variables, but different R{i}'s for boys and girls, so that I can get sigma1_square_hat for boys and sigma2_square_hat for girls. The model is Y{i}=X{i}beta + Z{i}b + e{i} b ~ iid N(0,G) and e{i} ~ iid N(0,R{i}) i=1,2 orth.lme <- lme(distance ~ Sex * age, data=Ort...