Displaying 2 results from an estimated 2 matches for "dfcl".
Did you mean:
decl
2010 Nov 29
3
data.frame and formula classes of aggregate
...tion handles missing values differently depending if a data
frame or a formula is the first argument ? For example,
(d<- data.frame(sex=rep(0:1,each=3),
wt=c(100,110,120,200,210,NA),ht=c(10,20,NA,30,40,50)))
x1<- aggregate(d, by = list(d$sex), FUN = mean);
names(x1)[3:4]<- c('mean.dfcl.wt','mean.dfcl.ht')
x2<- aggregate(cbind(wt,ht)~sex,FUN=mean,data=d);
names(x2)[2:3]<- c('mean.formcl.wt','mean.formcl.ht')
cbind(x1,x2)[,c(2,3,6,4,7)]
The output from the data.frame class has an NA if there are missing values
in the group for the variable with...
2005 Sep 08
0
Effect of data set size on calculation
...which performs an ANOVA type of analysis on 2D GC
data. The code is shown below:
# ANOVA 2D GC analysis
# maxc <- number of samples
# nreps <- number of samples
maxc <- 2
nreps <- 4
sscl <- NULL
cmean <- NULL
#
# Initial stat. variable
#
dftot <- nrow(mat)-1
dfcl <- maxc - 1
dferr <- dftot - dfcl
totmean <- mean(mat)
sstot <- sd(mat)^2*dftot
#
# Calculate class-to-class variance
#
for (j in 1:maxc) {
cmean <- rbind(cmean,mean(mat[((j-1)*nreps+1):((j-1)*nreps+nreps),]))
}
for (j in 1:ncol(mat)) {
cmean[,j] <- cmean[,j]-totmea...