Displaying 3 results from an estimated 3 matches for "twosam".
2003 Mar 04
4
writing several command line in R console
...R console editor
without breaking the continuity of my code
more clearly : if for example I write a function, 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 t...
2005 Jul 15
4
Can't get sample function from "An Introduction to R" to work
...e
following is what I typed and the last line is R's response when I hit
the return 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]]
2008 Feb 06
0
Suggestions for R-intro manual (PR#10701)
...cording to the classes specified by a
factor. It can also split data frames. This is a useful function,
often used in combination with lapply to avoid for() loops. See
help(split) and help(lapply) for further details.)
--------------------------------------------------
Section 10.1
The current twosam is for a pooled-variance t-statistic.
Give the unpooled version instead (for consistency with t.test,
and because it is better statistical practice).
Give initial comments in functions twosam:
# compute a two-sample t-statistic for the difference in means
and bslash:
# Compute least-squares regr...