Re: [R] Setting up hypothesis tests with the infer library?

2025-03-29 Thread David Winsemius via R-help
> On Mar 29, 2025, at 9:59 AM, Kevin Zembower via R-help > wrote: > > Hi, Rui and Michael, thank you both for replying. > > Yeah, I'm not supposed to know about Chi-squared yet. So far, all of > our work with hypothesis tests has involved creating the sample data, > then resampling it to cre

Re: [R] [External] Creating model formulas programmatically

2025-03-29 Thread Bert Gunter
As always, I would like to thank all who responded for their insights and suggestions. I have learned from them. Thus far, my own aesthetic preference -- and therefore not to be considered in any sense as a "best" approach -- is to use Duncan's suggestion to produce the call directly with call() r

Re: [R] [External] Creating model formulas programmatically

2025-03-29 Thread Ebert,Timothy Aaron
I am confused. Richard's answer that Bert did not like did not use parse explicitly. Richard pasted together a string that a function like lm() will have to parse to run the analysis. However, the answers so far do not use parse(). In the reply to Richard, Bert indicated we cannot use strings. E

Re: [R] [External] Creating model formulas programmatically

2025-03-29 Thread Richard M. Heiberger
my take of the assignment was to avoid 'parse' specifically. we start with a character vector, so avoiding characters is not possible. i was dealing with the fortune "if parse is the answer, you have the wrong question" Sent from my iPhone On Mar 29, 2025, at 15:39, Bert Gunter wrote:  Thanks

Re: [R] Creating model formulas programmatically

2025-03-29 Thread Duncan Murdoch
Your approach seems reasonable to me, though I wouldn't do it that way. The way I work this sort of thing out is to get R to do a simple example, then see what it did, and duplicate that. For example, f <- ~ (Heigh + Ho + Silver + Away)^2 Then look at as.list(f), as.list(f[[2]]), as.list(

Re: [R] [External] Creating model formulas programmatically

2025-03-29 Thread Ebert,Timothy Aaron
The general formula is y ~ a + b + c + ... There is this approach: formula <- reformulate(independent_vars, response = "y") model <- lm(formula, data = mydata) summary(model) It does not generate a string object, but the formula is still a string even if it is of class formula. Also, in this app

Re: [R] [External] Creating model formulas programmatically

2025-03-29 Thread Richard M. Heiberger
> somenames <- c("Heigh", "Ho", "Silver", "Away") > as.formula(paste("~(",paste(somenames, collapse="+"),")^2")) ~(Heigh + Ho + Silver + Away)^2 > > On Mar 29, 2025, at 14:30, Bert Gunter wrote: > > somenames <- c("Heigh", "Ho", "Silver", "Away") __

Re: [R] Setting up hypothesis tests with the infer library?

2025-03-29 Thread Ebert,Timothy Aaron
The computer intensive approaches (randomization, permutation, bootstrap, jackknife) are awesome when you have enough data. In this age we are all about huge data sets. Yet basic agricultural research often does not come close. I have three to ten replicates per treatment. -Original Message

Re: [R] Setting up hypothesis tests with the infer library?

2025-03-29 Thread Rui Barradas
Às 19:19 de 29/03/2025, Ebert,Timothy Aaron escreveu: How about calculating a 95% confidence interval about the estimated proportion in favor. The PooledInfRate package will do this for you. If confidence intervals overlap then there is no significant difference. -Original Message- Fro

[R] Creating model formulas programmatically

2025-03-29 Thread Bert Gunter
Note: I am almost certain that this has been asked and answered here before, so my apologies for the redundant query. I also know that there are several packages that will do this, but I wish to do it using base R functions only (see below). The query: Suppose I have a character vector of names l

Re: [R] Setting up hypothesis tests with the infer library?

2025-03-29 Thread Neal Fultz
> > I've been setting up problems like this with code similar to: > === > df <- data.frame( > survey = c(rep("1980", 1000), rep("2010", 1000)), > DP = c(rep("Y", 0.66*1000), rep("N", 1000 - (0.66*1000)), >rep("Y", 0.64*1000), rep("N", 1000 - (0.64*1000)))

Re: [R] Setting up hypothesis tests with the infer library?

2025-03-29 Thread Ebert,Timothy Aaron
How about calculating a 95% confidence interval about the estimated proportion in favor. The PooledInfRate package will do this for you. If confidence intervals overlap then there is no significant difference. -Original Message- From: R-help On Behalf Of Kevin Zembower via R-help Sent:

Re: [R] Setting up hypothesis tests with the infer library?

2025-03-29 Thread Rui Barradas
Às 16:09 de 29/03/2025, Kevin Zembower via R-help escreveu: Hello, all, We're now starting to cover hypothesis tests in my Stats 101 course. As usual in courses using the Lock5 textbook, 3rd ed., the homework answers are calculated using their StatKey application. In addition (and for no extra c

[R] Setting up hypothesis tests with the infer library?

2025-03-29 Thread Kevin Zembower via R-help
Hello, all, We're now starting to cover hypothesis tests in my Stats 101 course. As usual in courses using the Lock5 textbook, 3rd ed., the homework answers are calculated using their StatKey application. In addition (and for no extra credit), I'm trying to solve the problems using R. In the case

Re: [R] Setting up hypothesis tests with the infer library?

2025-03-29 Thread Michael Dewey
Dear Kevin Unless it is a course requirement that you do it this way it would be easier to use the chisq.test function. You can then just use the frequencies which you have (660, 340, 640, 360). I will not give you example code since your learning would be enhanced by having to do it yourself

Re: [R] Help Coding error

2025-03-29 Thread Behaylu Ayalew
This is great, thank you so much for your help! I found the problem, the data contains 3 and 4 numbers. I solved it. Thank you On Sat, Mar 29, 2025 at 2:21 AM CALUM POLWART wrote: > So either: > > XX contains some non-finite numbers > > Or > > Something produced from it does. > > Non finite mea

Re: [R] Help Coding error

2025-03-29 Thread CALUM POLWART
So either: XX contains some non-finite numbers Or Something produced from it does. Non finite means things like 1÷0. R might show Inf or -Inf. But if there is maths happening in the function it might be passing something to it the is a 0 and so creating a Inf. But if there is a test of is.fini

[R] Help Coding error

2025-03-29 Thread Behaylu Ayalew
How are you dear Helper? I am from Africa, Ethiopia , I have faced this type of problem Error in optim(seq(-3, 3, length.out = k), wle.fit, method = "BFGS", control = list(maxit = max.it)) : initial value in 'vmmin' is not finite when I want to run RM.w > wt = beha$wt> rr = RM.w(XX, wt) libra