Professor Dalgaard,

Thank you for your reply. My question: shouldn't every statistical function in 
R, every statistical procedure, have some reference in the respective Help file?

Basic functions like sqrt, log, sort, sample, these are part of the base system 
in R, they generally have a clear purpose, a clear calculation to perform, and 
they are supposed to work well, no matter the exact details of their 
mathematical methods.

But higher level statistical functions, like prop.trend.test, or glm, they each 
perform some calculations according to a given method, but the method could 
possibly be somewhat different from the one implemented, with possible 
variations in the results.

Shouldn't the methods of statistical functions be always documented in the Help 
files, with references? Why there is just no information about the method of 
prop.trend.test?

Thank you once again for your attention.

Paulo Barata

Rio de Janeiro - Brazil

-------------------------------------------------------

On 12-Nov-25 9:49, Peter Dalgaard wrote:
There's a worked example of the procedure in Altman: Practical Statistics for 
Medical Research, also featured in help(ISwR::caesarean).

(I have forgotten the origin of example(prop.trend.test), though. If I ever 
knew it. Apparently it is the same as in help(prop.test): Fleiss(1981), p.139, 
but I don't have that edition to hand and I don't see it in Fleiss(1973).)

-pd


On 12 Nov 2025, at 11.55, Michael Dewey <[email protected]> wrote:

Dear Paulo

You did realise that if you type prop.trend.test you get

function (x, n, score = seq_along(x))
{
    method <- "Chi-squared Test for Trend in Proportions"
    dname <- paste(deparse1(substitute(x)), "out of", deparse1(substitute(n)),
        ",\n using scores:", paste(score, collapse = " "))
    x <- as.vector(x)
    n <- as.vector(n)
    p <- sum(x)/sum(n)
    w <- n/p/(1 - p)
    a <- anova(lm(freq ~ score, data = list(freq = x/n, score = 
as.vector(score)),
        weights = w))
    chisq <- c(`X-squared` = a["score", "Sum Sq"])
    structure(list(statistic = chisq, parameter = c(df = 1),
        p.value = pchisq(as.numeric(chisq), 1, lower.tail = FALSE),
        method = method, data.name = dname), class = "htest")
}
<bytecode: 0x0000021d81d4c850>
<environment: namespace:stats>

Does that help?

Michael

On 11/11/2025 18:27, Paulo Barata wrote:
To the R-Help list,
About the prop.trend.test function, in the package stats.
What calculations exactly does that function perform? What test is actually 
carried out? May I have some reference for the calculations performed by that 
function?
I would like to suggest that some references (one or more) be included in the 
Help file for the function.
Thank you very much.
Paulo Barata
Rio de Janeiro - Brazil
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting- guide.html
and provide commented, minimal, self-contained, reproducible code.

--
Michael Dewey

______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to