Displaying 2 results from an estimated 2 matches for "fa3".
Did you mean:
a3
2004 Oct 04
1
Using model operator in stepwise function's upper scope formula
...olaris2.9
system sparc, solaris2.9
status
major 1
minor 9.0
year 2004
month 04
day 12
language R
> testdata
effect fa1 fa2 fa3
1 0.5054526 -1.4 1 -15.42
2 0.1366526 -2.5 3 -14.72
3 0.4798526 -1.1 3 -16.43
4 0.5566526 -4.6 2 -17.62
5 0.6568526 -3.5 7 -5.41
6 0.6653526 0.0 5 -11.88
7 0.6376526 0.0 5 -11.72
8 0.5203526 -2.9 -1 -14.72
9 0.4905526 -2.1 2 -17.68
10 0.6376526 -1.1 1 -13.39
> ste...
2013 Jan 27
2
Loops
...ays get confused with.
I would like to perform the following procedure in a compact way.
Consider that p is a matrix composed of 100 rows and three columns. I need
to calculate the sum over some rows of each
column separately, as follows:
fa1<-(colSums(p[1:25,]))
fa2<-(colSums(p[26:50,]))
fa3<-(colSums(p[51:75,]))
fa4<-(colSums(p[76:100,]))
fa5<-(colSums(p[1:100,]))
and then I need to apply to each of them the following:
fa1b<-c()
for (i in 1:3){
fa1b[i]<-(100-(100*abs(fa1[i]/sum(fa1[i])-(1/3))))
}
fa2b<-c()
for (i in 1:3){
fa2b[i]<-(100-(100*abs(fa2[...