search for: gamma

Displaying 20 results from an estimated 1587 matches for "gamma".

2001 Dec 13
2
inconsistency between gamma and choose functions
Please can someone explain why I seem to get these contradictory results? choose(5,2) [1] 10 gamma(6)/(gamma(3)*gamma(4)) [1] 10 gamma(6)/(gamma(3)*gamma(4)) == choose(5,2) [1] TRUE # all's well so far. # now look what happens: gamma(21)/(gamma(6)*gamma(16)) == choose(20,5) [1] FALSE # check individual terms: gamma(21)/(gamma(6)*gamma(16)) [1] 15504 choose(20,5) [1] 15504 # so they are the...
2005 Oct 31
2
nls() fit to Kahnemann/ Tversky function
Dear WizaRds, I would like to fit a curve to ten points with nls() for one unknown parameter gamma in the Kahnemann/ Tversky function, but somehow it won't work and I am unable to locate my mistake. p.kum <- seq(0.1,1, by=0.1) felt.prob.kum <- c(0.16, 0.23, 0.36, 0.49, 0.61, 0.71, 0.85, 0.89, 0.95, 1) ## how to find a function that fits these points nicely? plot(p.kum, felt.prob.kum...
2017 Aug 09
2
Package nleqslv ERROR
...iculty in understanding an error i get when running a code to solve a system of non-linear equations, with four equations and two variables. This is my code: ALPHA <- c(-0.0985168033402, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4) BETA <- c(-0.0985168033402, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4) GAMMA <- c(0.3940672148378, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4) MEA <- 30000 MIA <- 10000 MAA <- 50000 DEA <- 0.385 fun <- function(x) { f <- numeric(length(x)) f[1] <- 1*x[1] - ((((MEA*((0.5*((MIA-MEA)^2))^(-BETA[1+j]))*((0.5*((MAA-MEA)^2))^(-ALPHA[1+i]))*((DEA)^(-GAMMA...
2010 Apr 15
2
using nls for gamma distribution (a,b,d)
Dear all i want to estimated the parameter of the gamma density(a,b,d) f(x) = (1/gamma(b)*(a^b)) * ((x-d)^(b-1)) * exp{-(x-d)/a)} for x>d f(x) = Age specific fertility rate x = age when i run this in R by usling nls() gamma.asfr <- formula(asfr ~ (((age-d)^(b-1))/((gamma(b))*(a^b)))* exp(-((age-d)/a))) gamma.asfr1 <- nls(gamma.asfr, data= a...
2008 Nov 19
1
F-Tests in generalized linear mixed models (GLMM)
Hi! I would like to perform an F-Test over more than one variable within a generalized mixed model with Gamma-distribution and log-link function. For this purpose, I use the package mgcv. Similar tests may be done using the function "anova", as for example in the case of a normal distributed response. However, if I do so, the error message "error in eval(expr, envir, enclos) : object "...
2005 Jun 24
1
interpreting Weibull survival regression
Hi, I was wondering if someone can help me interpret the results of running weibreg. I run the following and get the following R output. > weibreg(Surv(time, censor)~covar) fit$fail = 0 Call: weibreg(formula = Surv(time, censor)~covar) Covariate Mean Coef Rel.Risk L-R p Wald p covar 319.880 -0.002 0.998 0.000 log(scale) 0.000 8.239
2009 Oct 21
2
How to average subgroups in a dataframe? (not sure how to apply aggregate(..))
Dear all, Lets say I have the following data frame: > set.seed(1) > col1 <- c(rep('happy',9), rep('sad', 9)) > col2 <- rep(c(rep('alpha', 3), rep('beta', 3), rep('gamma', 3)),2) > dates <- as.Date(rep(c('2009-10-13', '2009-10-14', '2009-10-15'),6)) > score=rnorm(18, 10, 3) > df1<-data.frame(col1=col1, col2=col2, Date=dates, score=score) col1 col2 Date score 1 happy alpha 2009-10-13 8.120639 2 happy alph...
2011 Oct 12
2
Nonlinear regression aborting due to error
Colleagues, I am fitting an Emax model using nls. The code is: START <- list(EMAX=INITEMAX, EFFECT=INITEFFECT, C50=INITC50) CONTROL <- list(maxiter=1000, warnOnly=T) #FORMULA <- as.formula(YVAR ~ EMAX - EFFECT * XVAR^GAMMA / (XVAR^GAMMA + C50^GAMMA)) ## alternate version of formula FORMULA <- as.formula(YVAR ~ EMAX - EFFECT / (1 + (C50/XVAR)^GAMMA)) FIT <- nls(FORMULA, start=START, control=CONTROL, trace=T) If GAMMA equals 10-80, nls converges successfully and the fit tracks the fit from a smoother (Supe...
2010 Aug 18
1
Displaying Results in Two Columns
Could I have some suggestions as to how (various ways) I can display my confidence interval results? rm(list = ls()) set.seed(1) func <- function(d,t,beta,lambda,alpha,p.gamma,delta,B){ d <- c(5,1,5,14,3,19,1,1,4,22) t <- c(94.32,15.72,62.88,125.76,5.24,31.44,1.048,1.048,2.096,10.48) post <- matrix(0, nrow = 11, ncol = B) theta <- c(lambda,beta) beta.hat <- 2.471546 for(j in 1:B){ for(i in 1:(B-1)){ c.lambda <- rgamma(10,d+alpha,t+beta.hat)...
2010 Jun 16
2
Fitting Gamma distribution
I'm looking for goodness of fit tests for gamma distributions with large data sizes and for different data. I have a matrix with around 4.000 data values in it and i have fitted a gamma distribution with "fitdistr". You can see the example: > fitdistr(corpo,"gamma",lower=0.001) Errore in optim(x = c(5000, 5000, 5000...
2004 May 12
1
Sem error - subscript out of bounds
What??s happening with this following code: require(sem) Celpe.Mod.RAM <- matrix(c( # path parametro Inicio "Produ????o -> T1", "gamma.11", NA, "Produ????o -> T2", "gamma.12", NA, "Produ????o -> T3", "gamma.13", NA, "Produ????o -> T4", "gamma.14...
2011 Feb 09
3
precision of gamma function
Dear R users, I have to calculate gamma functions for negative numbers beyond -171.4. e.x. gamma(-500.4) I got following: > gamma(-170.4) [1] -5.824625e-308 > gamma(-171.4) [1] 0 Warning message: underflow occurred in 'gammafn' I have tried to use a recursion getting values a little futher -180. How could I solve this pro...
2008 Jun 11
2
MLE Estimation of Gamma Distribution Parameters for data with 'zeros'
...hole. Lower bound is 0 (no fractures in the selected data interval), and upper bound is ~ 10 - 50, depending on what scale you are conducting the analysis on. I read in the data from a text file, convert it to numerics, and then calculate initial estimates of the shape and scale parameters for the gamma distribution from moments. I then feed this back into the fitdistr() function. R code (to this point): ######################################## data.raw=c(readLines("FSM_C_9m_ENE.inp")) data.num <- as.numeric(data.raw) data.num library(MASS) shape.mom = ((mean(data.num))/ (sd(data.num...
2011 Feb 25
5
Substituting inside expression
I am having following problem: I?m constructing model for calculation of area of triangle. I know sides a, b, and gamma angle. I wish to calculate the area using heron?s formula: S <- sqrt(s*(s-a)*(s-b)*(s-c)) where s <- (a+b+c)/2 and c is calculated using law of cosines: c <- sqrt(a^2 + b^2 -2*a*b*cos(gamma)) since i am calculating a regression model, i need derivation of this expression for area S. somet...
2017 Aug 09
0
Package nleqslv ERROR
...error i get when running a code to solve a system of non-linear equations, with four equations and two variables. > > This is my code: > > ALPHA <- c(-0.0985168033402, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4) > BETA <- c(-0.0985168033402, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4) > GAMMA <- c(0.3940672148378, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4) > MEA <- 30000 > MIA <- 10000 > MAA <- 50000 > DEA <- 0.385 > fun <- function(x) { > f <- numeric(length(x)) > f[1] <- 1*x[1] - ((((MEA*((0.5*((MIA-MEA)^2))^(-BETA[1+j]))*((0.5*((MAA-MEA)^2...
2009 Dec 11
3
how can generate from trunceted gamma distribution in R ?
Hi, all How can generate a sample from truncated inverse gamma distribution in R? thanks
2004 Jul 03
1
samba+obsd+subnets
...to my problems/setup, and I've also googled my ass off :( So here I am, resorting to you guys in hope of help =] Sorry to say, but I don't have much experience, and therefore I'm a bit lost at the moment. Not sure what exactly to do to straighten this out. So, my setup is as follows: GAMMA 192.168.1.2 | | 192.168.1.1 [Clavister FW] | 192.168.0.1 | ALFA 192.168.0.3 Client1-N DHCP I've left out a number of irrelevant boxes. Everything of this is connected through a switch, but is div...
2013 Mar 26
2
NaNS Error Message
...of calculation and I have gotten several warnings that say "NaNS produced". Whatever I could read on line gives me an idea that this warning is produced when the number is use is a negative log or otherwise mathematically problematic. I'm getting this error while using factorial() and gamma () on strictly positive numbers (always greater than zero). Here is a snippet of my code: k goes from 1 to a positive limit. S is always 100. Only positive values of n are allowed into the loop. if(n>0) { while(k<=lim) { sn<-(S-n);snfact<-gamma(sn); sn2<-(2...
2006 Sep 01
1
integration problem with gamma function
...es for easy reproduction) and can be pasted directly into R. The problematic part (which is included below of course) is <--- Original Mathematica ---> (* p_svbar *) UiA = Ni (Dsi - 2Di A + A^2)/2; UiiA = Nii (Dsii - 2Dii A + A^2)/2; psvbar = NIntegrate[1/(UiA^(Ni/2)) 1/(UiiA^(Nii/2)) Gamma[Ni/2,UiA/(sH^2),UiA/(sL^2)] Gamma[Nii/2,UiiA/(sH^2),UiiA/(sL^2)],{A,L,H}, MinRecursion->3]; PSVbar = psvbar/(4 Log[sH/sL]); Print["p(s?v|D_1D_2I) = const. ",N[PSVbar,6]]; </---> <--- translation to R ---> integpsvbar <- function(A) { # Mathematica: gamma[a,z0,z...
2005 Dec 05
3
The gamma function and infinity
I have to calculate some formula like: gamma(x)/(gamma(x+y) and I observed that for relatively big values of x, R returns infinity and so cannot compute the formula. Is it possible to force R to give the real value of gamma(x) instead of Inf ? thanks