search for: lambda1

Displaying 20 results from an estimated 36 matches for "lambda1".

Did you mean: lambda
2009 May 16
1
maxLik pakage
...g(\nu\pi)\\ &-&n\log\Gamma(\frac{\nu}{2})-\frac{\nu+1}{2}\sum_{i=1}^{n}\log(1+\frac{(x_i-\xi)^2}{\omega^2\nu})+\sum_{i=1}^{n}\log\Phi(\lambda_1\frac{(x_i-\xi)}{\sqrt{\omega^2+\lambda_2(x_i-\xi)^2}}) \end{eqnarray*} ############## G2StNV178<-function(a){ require(maxLik) II=0 nu<-(a[1]) lambda1<-a[2] lambda2<-a[3] ksi<-a[4] omega<-a[5] II<-log(prod((2*dt((x-ksi)/omega,nu)*pnorm((lambda1*(x-ksi)/omega)/sqrt(1+lambda2*((x-ksi)/omega)^2)))/omega)) II } ########definition of gradient  function gradlik<- function(a){ nu<-a[1] lambda1<-a[2] lambda2<-a[3] ksi<-a[4]...
2009 Jan 05
1
transform R to C
Dear R users, i would like to transform the following function from R-code to C-code and call it from R in order to speed up the computation because in my other functions this function is called many times. `dgcpois` <- function(z, lambda1, lambda2) { `f1` <- function(alpha, lambda1, lambda2) return(exp(log(lambda1) * (alpha - 1) - lambda2 * lgamma(alpha))) `f2` <- function(lambda1, lambda2) return(integrate(f1, lower=1, upper=Inf, lambda1=lambda1, lambda2=lambda2)$value) return(exp(log(lambda1) * z - lamb...
2008 Sep 11
0
Loop for the convergence of shape parameter
...^alpha-14^alpha) r<-c(1,0,0,1) k<-c(3,2,2,2) x<-c(0.5,0.5,1.0,1.0) % estimate lambda (lambda=beta0+beta1*x) GLM_results <- glm(r/k ~ x, family=binomial(link='cloglog'), offset=log(verpi),weights=k) beta0<-GLM_results$coefficients[[1]] beta1]<-GLM_results$coefficients[[2]] lambda1<-beta0+beta1*x[1] lambda2<-beta0+beta1*x[2] % using lambda, estimate alpha (a=alpha) through ML estimation L<-function(a){ s1_f1<-(exp(-lambda1*(0^a-0^a))-exp(-lambda1*(5^a-0^a))) s2_f2<-(exp(-lambda1*(10^a)-lambda2*(14^a-10^a+14^a-14^a)) -exp(-lambda1*(10^a)-lambda2*(14^a-1...
2008 Sep 12
1
Error in "[<-"(`*tmp*`, i, value = numeric(0)) :
...estimation is as following: 1) with alpha=0, estimate lambda (estimate beta0 and beta1 via GLM) 2) with lambda, estimate alpha via ML estimation 3) with updated alpha, replicate 1) and 2) until alpha is converged to a value My source code is alpha=rep(1,100) beta0=rep(0,100) beta1=rep(0,100) lambda1=rep(0,100) lambda2=rep(0,100) verpi=rep(0,100) L=rep(0,100) alpha[0]=1 i=1 while(i<=100){ repeat{ verpi[i]<-c(5^alpha[i-1],10^alpha[i-1]-5^alpha[i-1],14^alpha[i-1]-10^alpha[i-1],18^alpha[i-1]-14^alpha[i-1]) r<-c(1,0,0,1) k<-c(3,2,2,2) x<-c(0.5,0.5,1.0,1.0) GLM_results <- glm(r/...
2006 Jul 07
1
convert ms() to optim()
...The "Calc" function is also attached. ms(~ Calc(a.init, B, v, off, d, P.a, lambda.a, P.y, lambda.y, 10^(-8), FALSE, 20, TRUE)$Bic, start = list(lambda.a = 0.5, lambda.y = 240), control = list(maxiter = 10, tol = 0.1)) Calc <- function(A.INIT., X., V., OFF., D., P1., LAMBDA1., P2., LAMBDA2., TOL., MONITOR., MAX.ITER., TRACE.){ lambda1 <- abs(LAMBDA1.) lambda2 <- abs(LAMBDA2.) P <- lambda1 * P1. + lambda2 * P2. a <- Estimate(A.INIT., X., V., OFF., D., P, TOL., MONITOR., MAX.ITER.) Ita <- OFF. + X. %*% a Mu <- c(exp(Ita)) Wt <- Mu *...
2007 Mar 06
2
Estimating parameters of 2 phase Coxian using optim
Hi, My name is Laura. I'm a PhD student at Queen's University Belfast and have just started learning R. I was wondering if somebody could help me to see where I am going wrong in my code for estimating the parameters [mu1, mu2, lambda1] of a 2-phase Coxian Distribution. cox2.lik<-function(theta, y){ mu1<-theta[1] mu2<-theta[2] lambda1<-theta[3] p<-Matrix(c(1, 0), nrow=1, ncol=2) Q<-Matrix(c(-(lambda1 + mu1), 0, lambda1, -mu2), nrow=2, ncol=2) q<-Matrix(c(mu1,...
2013 Feb 12
0
error message from predict.coxph
...ssage. Namely: stratified data, predict='expected', new data, se=TRUE. I think I found the error but I'll leave that to you to decide. Thanks, Chris ######## CODE library(survival) set.seed(20121221) nn <- 10 # sample size in each group lambda0 <- 0.1 # event rate in group 0 lambda1 <- 0.2 # event rate in group 1 t0 <- 10 # time to estimate expected numbers of events # 'correct' number of events at time t0 = rate of events (lambda) times time (t0) t0*lambda0 t0*lambda1 # generate uncensored data T0 <- rexp(nn, rate=lambda0) T1 <- rexp(nn, rate=lambda1) th...
2011 Jul 02
1
Simulating inhomogeneous Poisson process without loop
Dear all I want to simulate a stochastic jump variance process where N is Bernoulli with intensity lambda0 + lambda1*Vt. lambda0 is constant and lambda1 can be interpreted as a regression coefficient on the current variance level Vt. J is a scaling factor How can I rewrite this avoiding the loop structure which is very time-consuming for long simulations? for (i in 1:N){ ... N <- rbinom(n=1, size=1, prob=(la...
2008 Sep 19
2
Error: function cannot be evaluated at initial parameters
I have an error for a simple optimization problem. Is there anyone knowing about this error? lambda1=-9 lambda2=-6 L<-function(a){ s2i2f<-(exp(-lambda1*(250^a)-lambda2*(275^a-250^a)) -exp(-lambda1*(250^a)-lambda2*(300^a-250^a))) logl<-log(s2i2f) return(-logl)} optim(1,L) Error in optim(1, L) : function cannot be evaluated at initial parameters Thank you in advance -- View this m...
2007 Sep 10
2
Are the error messages of ConstrOptim() consisten with each other?
...onstrOptim(c(0.5,0.9,0.5), f=fit.error, gr=fit.error.grr, ui=ui,ci=ci) Error in constrOptim(c(0.5, 0.9, 0.5), f = fit.error, gr = fit.error.grr, : initial value not feasible > constrOptim(c(0.3,0.5,0.5), f=fit.error, gr=fit.error.grr, ui=ui,ci=ci) Error in f(theta, ...) : argument "lambda1" is missing, with no default I only changed the parameters, how come the lambda1 that is not missing in the first 2 cases suddently become missing? For your convenience, I put the complete code below: Best Wishes Yuchen Luo ######################################## rm(list = ls()) mat=5 r...
2011 May 01
1
Different results of coefficients by packages penalized and glmnet
...y, I learn to use penalized logistic regression. Two packages (penalized and glmnet) have the function of lasso. So I write these code. However, I got different results of coef. Can someone kindly explain. # lasso using penalized library(penalized) pena.fit2<-penalized(HRLNM,penalized=~CN+NoSus,lambda1=1,model="logistic",standardize=TRUE) pena.fit2 coef(pena.fit2) opt<-optL1(HRLNM,penalized=~CN+NoSus,fold=5) opt$lambda coef(opt$fullfit) prof<-profL1(HRLNM,penalized=~CN+NoSus,fold=opt$fold,steps=20) plot(prof$lambda, prof$cvl, type="l") plotpath(prof$fullfit) pena.fit2&lt...
2006 Oct 02
1
multilevel factor model in lmer
...ponse model. The one parameter model is straightforward. A two-factor model requires a set of factor loadings multiplying a single random effect. For example, a logit model for the ith subject responding correctly to the jth item (j=1,..,J) is logit[p(ij)] = a1*item1(i) + ... + aJ * itemJ(i) + lambda1*item1(i)*u(i) + ... + lambdaJ*itemJ(i)*u(i) where the lambdas are factor loadings, with lambda1 fixed to 1.0 and item1-itemJ are dummy variables for the items. Thanks, Dan =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Daniel A. Powers, Ph.D. Department of Sociology University of Texas at Austin...
2007 Mar 13
0
multiplying matrix by vector of times
...versity Belfast >>>>> and have >>>>> just started learning R. I was wondering if somebody could help me >>>>> to see >>>>> where I am going wrong in my code for estimating the parameters >>>>> [mu1, mu2, >>>>> lambda1] of a 2-phase Coxian Distribution. >>>>> >>>>> cox2.lik<-function(theta, y){ >>>>> mu1<-theta[1] >>>>> >>>>> mu2<-theta[2] >>>>> >>>>> lambda1<-theta[3] >>>&g...
2008 Nov 15
1
rgamma with rate as vector
Hi - I have a question about the following code from Bayesian Computation with R (Jim Albert). par(mfrow=c(2,2)) m = 500 alphas = c(5, 20, 80, 400) for (j in 1:4) { mu = rgamma(m, shape=10, rate=10) lambda1 = rgamma(m, shape=alphas[j], rate=alphas[j]/mu) lambda2 = rgamma(m, shape=alphas[j], rate=alphas[j]/mu) plot(lambda1, lambda2) title(main=paste('alpha=', alphas[j])) } How does the function rgamma work in the instance with the rate specified as a vector of values? My understa...
2011 Jun 14
2
How to generate bivariate exponential distribution?
Any one know is there any package or function to generate bivariate exponential distribution? I gusee there should be three parameters, two rate parameters and one correlation parameter. I just did not find any function available on R. Any suggestion is appreciated. -- View this message in context:
2001 Sep 14
1
Supply linear constrain to optimizer
...finite mixture of negative exponential distributions using maximum likelihood based on the example given in MASS. So far I had much success in fitting two components. The problem started when I tried to extend the procedure to fit three components. More specifically, likelihood = sum( ln(c1*exp(-x/lambda1)/lambda1 + c2*exp(-x/lambda2)/lambda2 + (1-c1-c2)*exp(-x/lambda3)/lambda3) ) I've used optimizers such as ms and nlminb (SPLUS 5.0 for UNIX), and provided parameters constrains (0 <= c1, c2 <= 1) to nlminb via lower and upper. But these constrains provide no protection for (1-c1-c2) bein...
2023 Aug 27
1
Query on finding root
On Fri, 25 Aug 2023 22:17:05 +0530 ASHLIN VARKEY <ashlinvarkey at gmail.com> wrote: > Sir, Please note that r-help is a mailing list, not a knight! ?? > I want to solve the equation Q(u)=mean, where Q(u) represents the > quantile function. Here my Q(u)=(c*u^lamda1)/((1-u)^lamda2), which is > the quantile function of Davies (Power-pareto) distribution. Hence I > want to
2010 Nov 15
2
Zero truncated Poisson distribution & R2WinBUGS
...##################### library("R2WinBUGS") # Load R2WinBUGS package sink("Model.txt") cat(" model { # Priors: new uniform priors p0~dunif(0,1) lam1~dgamma(.01,.01) # Likelihood # Biological model for true abundance for (i in 1:R) { # Loops over R sites N1[i] ~ dpois(lambda1[i]) lambda1[i] <- lam1 } # Observation model for replicated counts for (i in 1:n) { # Loops over all n observations C1[i] ~ dbin(p1[i], N1[site.p[i]]) p1[i] <-p0 } # Derived quantities totalN1 <- sum(N1[]) # Estimate total population size across all sites } ",fill=TRUE...
2010 Oct 25
0
penalized regression analysis
...am struggling to understand is where do I get the variance explained information from and how do I determine the relative importance of the 4 variables selected? It does not appear to be a part of the penalized procedure. I submit the final call to 'penalized' with the estimated values of lambda1 and lambda2 > fitfinal <- penalized(CHAB~.,data=chabun,lambda1=356.0856,lambda2=3.458605,model = "linear",steps=1,standardize = TRUE) # nonzero coefficients: 5 > fitfinal Penalized linear regression object 10 regression coefficients of which 5 are non-zero Loglikelihood = -...
2017 Oct 31
0
lasso and ridge regression
...erty is proposed The proposed method is given <https://i.stack.imgur.com/Ta8FR.jpg> The problem is how to adapt "glmnet" to accomplish our task. The extract of the code used is reproduced as follows; cv.ridge<- glmnet(x, y, family="gaussian", alpha=0, lambda=lambda1, standardize=TRUE) cv.lasso<- glmnet(x, y, family="gaussian", alpha=1, lambda=lambda2, standardize=TRUE) ##weight a=1/abs(matrix(coef(cv.ridge, s=lambda1)[, 1][2:(ncol(x)+1)] ))^1 b=1/abs(matrix(coef(cv.lasso, s=lambda2)[, 1][2:(ncol(x)+1)] ))^1 c=a*b...