Displaying 2 results from an estimated 2 matches for "yb2".
Did you mean:
nb2
2003 Mar 04
4
writing several command line in R console
...ction, so far i have to write the
all code inside on the same line wich may become obscure as the function is
more and more complex.
I would like to do like in the example of the manuels:
>twosam <- function(y1, y2) {
n1 <- length(y1); n2 <- length(y2)
yb1 <- mean(y1); yb2 <- mean(y2) s1 <- var(y1); s2 <- var(y2)
s <- ((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2)
tst <- (yb1 - yb2)/sqrt(s2*(1/n1 + 1/n2)) tst }
all I can do is something like that:
>twosam <- function(y1, y2) { n1 <- length(y1); n2 <- length(y2)
+ yb1 <...
2005 Jul 15
4
Can't get sample function from "An Introduction to R" to work
...key after the penultimate line. I've re-checked and
re-typed the code many times to no avail. I wasn't able to find this
issue using search options, either. Any help is GREATLY appreciated!
> twosam<-function(y1, y2) {
+ n1<-length(y1);n2 <-length(y2)
+ yb1<-mean(y1); yb2<-mean(y2)
+ s1<-var(y1);s2<-var(y2)
+ s<-((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2)
+ tst<-(yb1-yb2)/sqrt(s*(1/n1+1/n2))
Error: syntax error
David
[[alternative text/enriched version deleted]]