Skip to content

lme

6 messages · Emmanuel Paradis, Peter Dalgaard, Mark Myatt

#
At 18:03 25/09/00 +1200, you wrote:
I guess you are under Windows. In the R for Windows-FAQ...

3.1 Can I install packages (libraries) in this version?

Yes, of course. The easy way is to see if a pre-compiled binary version of
the package is available: look on CRAN at
bin/windows/windows-NT/contrib. If there is, download the zip file and
unpack it in the rwXxxx\library
directory, using unzip or similar, or using the installer rwinst.exe.
Perhaps even easier is to use the R function
install.packages(): check out its help page. 
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Dear R Folk,

Is there a function to do a chi-square test for trend or equivalent in
R. I can write one myself but I was wondering, before I get down to it,
if I need to re-invent the wheel.

Thanks

Mark

--
Mark Myatt


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Mark Myatt <mark at myatt.demon.co.uk> writes:
Will prop.trend.test do what you want?
#
Peter,
I wrote:

            
You replied:
The name sounds right. Where do I find this function? I am running RWin
1.1.0.

Mark

--
Mark Myatt


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Mark Myatt <mark at myatt.demon.co.uk> writes:
That'll be 0.0.1 too little. It slipped throught the cracks for 1.1.0
and got inserted in 1.1.1

However, it is hardly rocket science:

prop.trend.test <-
function (x, n, score = 1:length(x)) 
{
    method <- "Chi Square Test for Trend in Proportions"
    dname <- paste(deparse(substitute(x)), "out of", deparse(substitute(n)))
    dname <- paste(dname, ",\n using scores:", paste(score, collapse = " "))
    freq <- x/n
    p <- sum(x)/sum(n)
    w <- n/p/(1 - p)
    a <- anova(lm(freq ~ score, weight = w))
    chisq <- a["score", "Sum Sq"]
    names(chisq) <- "X-squared"
    df <- 1
    names(df) <- "df"
    pval <- 1 - pchisq(chisq, 1)
    rval <- list(statistic = chisq, parameter = df, p.value = pval, 
        method = method, data.name = dname)
    class(rval) <- "htest"
    return(rval)
}
#
Peter,

Thanks. That did the trick.

Mark
--
Mark Myatt


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._