Inthe code below I was trying to to obtain the GMM estimates for CAPM (REGRESSION) for 36 stocks each have 180 observations,however it only gives me one output rather than 36.
In SAS i would just put in a *By statement*. I have a variable TICKER that categorize them into 36 groups. *How can I obtain all 36 output instead of just one.* ** DataMat<-read.table(file="C://Users//ssenriqu//Dropbox//Work//Risk//data//CRSP//CRPS 2 original1.csv",sep=",",dec=".",header=TRUE) require(gmm) Returns <- DataMat[1:6480,"Returns"] VWRET <- DataMat[1:6480,"VWRET"] RF <- DataMat[1:6480,"RF"] z<-as.matrix(Returns-RF) zm<-as.matrix(VWRET-RF) res <- gmm(z ~ zm, x = zm) coef(res) -- Sherlene Enriquez-Savery, Doctoral Candidate Department of Mathematics & Statistics University of South Florida 4202 East Fowler Avenue Tampa,FL, 33620 (813) 974-5439 (813) 974 6126 Fax ssenr...@usf.edu ssenr...@mail.usf.edu [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.