Displaying 2 results from an estimated 2 matches for "mymedian".
Did you mean:
mymedians
2005 Jun 16
5
Vectorization
Greetings,
Can anyone suggest me if we can vectorize the following problem
effectively?
I have two datasets, one dataset is portfolio of stocks returns on a
historical basis and another dataset consist of a bunch of factors (again on
a historical basis). I intend to compute a rolling n-day sensitivitiesfor
each stock for each factor, so the output will be a data frame with
2009 Nov 18
2
Median on Aggregated data
...------------
N <- 1005 * 14;
myNorm <- data.frame(PaydexNormingCategory = numeric(N),
SIC = numeric(N), CatMedian = numeric(N));
k=1;
#j = 7941; ## For testing only
for (j in levels(SIC)){
for (i in levels(PaydexNormingCategory)){
myData <- dfpaydex[(Paydex==i) & (SIC==j),];
myMedian <- with(myData, levels(Paydex)[median(rep(as.numeric(Paydex),
Counts))]);
myNorm[k] <-c( as.numeric(i), as.numeric(j), as.numeric(myMedian) );
k <- k+1;
}
}
---------------------- Begin SAS code
------------------------------------
proc summary data=SASUser.PaydexNormfull nway;...