search for: xbar2

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

Did you mean: bar2
2009 Sep 28
1
help with lda function
...it manually, "rawdata<-matrix(scan("tab1_1. > > dat"),ncol=3,byrow=T) > group <- rawdata[,1] > X <- 100 * rawdata[,2:3] > Apf <- X[group==1,] > Af <- X[group==0,] > xbar1 <- apply(Af, 2, mean) > S1 <- var(Af) > N1 <- dim(Af)[1] > xbar2 <- apply(Apf, 2, mean) > S2 <- var(Apf) > N2 <- dim(Apf)[1] > S<-((N1-1)*S1+(N2-1)*S2)/(N1+N2-2) > Sinv=solve(S) > d<-xbar1-xbar2 > b <- Sinv %*% d > v <- X %*% b", > > I get; > > [,1] > [1,] 164.4283 > [2,] 166.2492 > [3,]...
2012 Jun 04
1
simulation of modified bartlett's test
...N=60 k=3 v1=var(g1) v2=var(g2) v3=var(g3) #pooled variance A=((n1-1)*v1+(n2-1)*v2+(n3-1)*v3)/(N-k) #calculate B B=((N-k)*(log(A)))-((n1-1)*log(v1)+(n2-1)*log(v2)+(n3-1)*log(v3)) #calculate C C=1+(1/(3*(k-1))*(((1/(n1-1))+(1/(n2-1))+(1/(n3-1)))-(1/(N-k)))) #calculate layard estimator xbar1=mean(g1) xbar2=mean(g2) xbar3=mean(g3) sum1=sum((g1-xbar1)^4) sum2=sum((g2-xbar2)^4) sum3=sum((g3-xbar3)^4) sum4=sum((g1-xbar1)^2) sum5=sum((g2-xbar2)^2) sum6=sum((g3-xbar3)^2) y= (N*(sum1+sum2+sum3))/((sum4+sum5+sum6)^2) #calculate bartlett modified statistic bar2=B/(C*(1/2)*(y-1)) bar2 pv[i]<-pchisq(bar2,2,l...
2009 Sep 29
1
help with lda function from MASS package
...gt; dat"),ncol=3,byrow=T) >>> group <- rawdata[,1] >>> X <- 100 * rawdata[,2:3] >>> Apf <- X[group==1,] >>> Af <- X[group==0,] >>> xbar1 <- apply(Af, 2, mean) >>> S1 <- var(Af) >>> N1 <- dim(Af)[1] >>> xbar2 <- apply(Apf, 2, mean) >>> S2 <- var(Apf) >>> N2 <- dim(Apf)[1] >>> S<-((N1-1)*S1+(N2-1)*S2)/(N1+N2-2) >>> Sinv=solve(S) >>> d<-xbar1-xbar2 >>> b <- Sinv %*% d >>> v <- X %*% b", >>> >>> I get...
2013 Feb 12
0
error message from predict.coxph
...ta = ndf, type = "expected", se.fit = TRUE) : # subscript out of bounds #mypc <- getAnywhere(predict.coxph) #mypc2 <- mypc$objs[[1]] #debug(mypc2) #mypc2(mod2, newdata=ndf, type="expected", se.fit=TRUE) # The error appears to be an incorrect subscripting of xbar (and xbar2) in defining dt (and dt2) in one part of predict.coxph: # #if (ncol(y) == 2) { # if (se.fit) { # dt <- (chaz * newx[indx2, ]) - xbar[indx2, ] # *** SHOULD BE JUST xbar # se[indx2] <- sqrt(varh + rowSums((dt %*% object$var) * dt)) * newrisk[indx2] # } #} #else { # j2 <- approx(afi...
1998 Nov 16
1
PB Mandeville can't be reached
# Peter B. Mandeville kindly offered to send me code for Hotelling's T^2 # Test. Unfortunately there seems to be no route to his machine. # So i'm trying to reach him via the Mailing List. ------------------------------------------------------------------------ Sir, this morning i recieved your message about the availability of the code for Hotelling's Test. I hurried to find out
1998 Nov 16
0
Re: Hotelling corrected
By accident, I left out the lines defining n1 and n2. Here it is as a function. Peter B. hotelling <- function(d1,d2){ k <- ncol(d1) n1 <- nrow(d1) n2 <- nrow(d2) xbar1 <- apply(d1,2,mean) xbar2 <- apply(d2,2,mean) dbar <- xbar2-xbar1 v <- ((n1-1)*var(d1)+(n2-1)*var(d2))/(n1+n2-2) t2 <- n1*n2*dbar%*%solve(v)%*%dbar/(n1+n2) f <- (n1+n2-k-1)*t2/((n1+n2-2)*k) cat("F:",f,"\n") cat("PROBABILITY:",1-pf(f,k,n1+n2-k-1),"\n&q...