[R] Automating R for Hypothesis Testing
Rui Barradas
ruipbarradas at sapo.pt
Wed May 9 03:44:05 CEST 2012
Hello,
I'm not at all sure if I understand your problem. Does this describe it?
test first model for months 1 and 2
if test statistic less than critical value{
test second model for months 1 and 2
print results of the first and second tests? just one of them?
}
move on to months 2 and 3
etc, until months 12 and 1
Please post example data using dput(dataset).
Just copy it's output and paste it in your post.
And example code, what you're already doing.
(Possibly simplified)
Rui Barradas
meredith wrote
>
> R Users-
> I have been trying to automate a manual code that I have developed for
> calling in a .csv file, isolating certain rows and columns that correspond
> to specified months:
> something to the effect
> i=name.csv
> N=length(i$month)
> iphos1=0
> iphos2=0
> isphos3=0
> for i=1,N
> if month=1
> iphos1=iphos+1
> iphos1(iphos1)=i
>
> an so on to call out the months into there own arrays (unless there is a
> way I can wrap it into the next automation)
>
> Next: I would like to run a simple linear regression combining each of the
> months 1 by 1:
> for instance I want to run a regression on a combined model from months 1
> and 2 and a dummy model for 1 and 2, compare them using a Chi-sq
> distribution, if Chi-sq is less than the Critical value, we accept and go
> on to test another set of models with both 1 and 2. If it rejects, then we
> proceed to months 2 and 3. If we move on to the second set on months 1
> and 2, and the critical value is accepted, I want to print an accept or
> reject and move on to months 2 and 3, until finally comparing months 12-1
> at the end.
> Is there a way to loop or automate this in R?
>
> Thanks
> Meredith
>
--
View this message in context: http://r.789695.n4.nabble.com/Automating-R-for-Hypothesis-Testing-tp4618653p4619195.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list