In glm() you can use the summary() function to recover the shape parameter (the reciprocal of the dispersion parameter). How do you recover the scale parameter? Also, in the given example, how I estimate and save the geometric mean of the predicted values? For a simple model you can use fitted() or predicted() functions. I will appreciate any help. #Call required R packages require(plyr) require(stats) require(fitdistrplus) require(MASS) #Grouped vector n <- c(1:10) yr <-c(1:10) ny <- list(yr=yr,n=n) require(utils) ny <- expand.grid(ny) y = rgamma(100, shape=1.5, rate = 1, scale = 2) Gdata <- cbind(ny,y) Gdata2<- Gdata Gdata$x1 <- cos((3.14*yr)/365.25) Gdata$x2 <- sin((3.14*yr)/365.25) #Fitting Generalized Linear Models Gdata <- split(Gdata,Gdata$n) FGLM <- lapply(Gdata, function(x){ m <- as.numeric(x$y) x1 <- m <- as.numeric(x$x1) x2 <- m <- as.numeric(x$x2) summary(glm(m~1+x1+x2, family=Gamma),dispersion=NULL) })
#Save the results of the estimated parameters str(FGLM,no.list = TRUE) SFGLMC<- ldply(FGLM, function(x) x$coefficients) SFGLMD<- ldply(FGLM, function(x) x$dispersion) GLM <- cbind(SFGLMC,SFGLMD) ______________________________________________ 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.