search for: meanse

Displaying 6 results from an estimated 6 matches for "meanse".

Did you mean: means
2002 May 02
2
problem with lme in nlme package
...-24 of nlme in R 1.4.1 under Windows 2000, and both S-PLUS 2000 and 6.0, again under Windows 2000. I've noticed discrepancies in a couple of instances. Here's one, using data from Bryk and Raudenbush's Hierarchical Linear models: From R: > attach(Bryk) > cses <- meanses <- numeric(length(ses)) # initialize > for (sc in unique(school)) { + meanses[school==sc] <- mean(ses[school==sc]) + cses[school==sc]<-ses[school==sc]- meanses[school==sc] + } > Bryk$cses <- cses > Bryk$meanses <- meanses >...
2004 Jan 07
2
problem assigning an array to a variable in a data frame
...- tapply(SES, School, mean) > detach(MathAchieve) > Bryk <- as.data.frame(MathAchieve[, c("School", "SES", "MathAch")]) > names(Bryk) <- c("school", "ses", "mathach") > sample20 <- sort(sample(7185, 20)) > Bryk$meanses <- mses[as.character(Bryk$school)] > Bryk[sample20,] Error in as.data.frame.default(x[[i]], optional = TRUE) : can't coerce array into a data.frame > This is with R 1.8.1 under Windows 2000. The same code works fine with R 1.8.0. As Dirk discovered, the problem disappears...
2003 Jun 25
3
joining columns as in a relational database
In our recent workshop on "Multilevel Modeling in R" we discussed handling data for multilevel modeling. An classic example of such data are test scores of students grouped into schools. We may wish to model the scores as functions of both student-level covariates and school-level covariates. Such data are often organized in a multi-table format with a separate table for each level of
2005 Oct 24
0
aggregating using several functions
Dear R users, I would like to aggregate a data frame using several functions at once (e.g., mean plus standard error). How can I make this work using aggregate()? The help file says scalar functions are needed; can anyone help? Below is the code for my "meanse" function which I??d like to use like this: aggregate(dataframe, list(factorA,factoB),meanse) Thanks for your help! Christoph meanse<-function(x,...,na.rm=T){ if(na.rm) x<-x[!is.na(x)] m<-mean(x) s<-sd(x) l<-length(x) serr<-s/sqrt(l) return(data.frame(list("Mean&q...
2012 May 12
2
Why can we combine design matrix and data-frame in R?
...Pages •VasishthBroebook.R •beauty.txt •mathachieve.txt •mathachschool.txt ------------------------------ MathAchieve <- read.table("mathachieve.txt") colnames(MathAchieve) <- c("School", "Minority", "Sex", "SES", "MathAch", "MEANSES") head(MathAchieve) MathAchSchool <- read.table("mathachschool.txt") colnames(MathAchSchool) <- c("School", "Size", "Sector", "PRACAD", "DISCLIM", "HIMINTY", "MEANSES") MathScores <- merge(MathAchieve,...
1998 Mar 05
1
User time and system time
...on the same machine but R is much slower - like an order of magnitude - than S-PLUS on this problem. It looks curious to me when I run system.time() on this that timing vector shows almost no user time but a huge amount of system time. R> system.time(assign("fm2", + lme(MathAch ~ MEANSES*CSES + Sector + CSES:Sector, ttt, ~ CSES | School, + RML = TRUE ))) iteration = 0 Step: [1] 0 0 0 Parameter: [1] 2.61400 0.16608 3.88195 Function Value [1] 44964 Gradient: [1] -0.014379 -0.143176 -0.646558 iteration = 1 Step: [1] 0.002888 0.028756 0.129857 Parameter: [1] 2.6...