[R] polyroot behaviour

2025-10-02 Thread tgs77m--- via R-help
Colleagues, g <- function(x) ( x^11 + 1000*x^10 + 500 *x^9 + 1 ) coeffs <- c(1, rep(0, 8), 500, 1000, 1) roots <- polyroot(coeffs) Output [1]0.25770068+3.958197e-01i [2] -0.34615184+3.782848e-01i [3] -0.04089779-4.838134e-01i [4]0.44124314-1.517731e-01i [5] -0.04089779+4.838134

[R] polyroot

2025-10-02 Thread tgs77m--- via R-help
Colleagues, f <- function(x) ( x^11 + 1000*x^10 + 500 *x^9 + 1 ) ^0.01 coeffs <- c(1, rep(0, 8), 500, 1000, 1) roots <- polyroot(coeffs) # output [1]0.25770068+3.958197e-01i [2] -0.34615184+3.782848e-01i [3] -0.04089779-4.838134e-01i [4]0.44124314-1.517731e-01i [5] -0.04089779+

[R] dplyr summarize by groups

2024-11-22 Thread tgs77m--- via R-help
# Get mean, min, max sigma and skew by group options (digits = 3) library (ISwR data(energy) data %>% group_by(stature) %>% summarize( Mean = mean(expend), Min = min(expend), Max = max(expend), Sigma = sd(expend), Skew = skew(expend)) # Output stature Mean Min

[R] JASP vs R

2024-10-16 Thread tgs77m--- via R-help
Colleagues, Many of my colleagues come to me for a recommendation for statistical software. Since I am an R user, that's my typical answer. Some colleagues of mine refuse to use it because of its steep learning curve and lack of a GUI. They wanted a statistical software that's free and that had a

[R] Discriminant of a cubic polynomial

2024-10-09 Thread tgs77m--- via R-help
Colleagues Given the coefficients of a cubic polynomial, a,b,c,d and using discriminant_cubic <- function(a, b, c, d) { D <- 18 * a * b * c * d - 4 * b^3 * d + b^2 * c^2 - 4 * a * c^2 - 27 * a^2 * d^2 return(D) } I can find the discriminant of a cubic polynomial. Is there an R package which

[R] prop.trend.test question

2023-09-24 Thread tgs77m--- via R-help
Colleagues, The code for prop.trend.test is given by: 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

[R] Mantel Haenszel test

2023-09-23 Thread tgs77m--- via R-help
Colleagues, I am trying to write a script for the Mantel Haenszel test. For the MH test, the test statistic is chi-square (MH) = (W-1) * r^2 Where W = sum of the case weights. This is straight forward. I'm having difficulty with r^2. The r^2 is the squared Pearson correlation between row and co