Displaying 20 results from an estimated 31 matches for "lambda2".
Did you mean:
lambda
2009 May 16
1
maxLik pakage
...-&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]
omega<-a[5] ...
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 - lambda2 * lga...
2006 Jul 07
1
convert ms() to optim()
...quot; 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 * V.
Bt.W.B &l...
2008 Sep 11
0
Loop for the convergence of shape parameter
...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-10^a+18^a-14^a)))
logl<-log...
2008 Jul 25
1
transcript a matlab code in R
...following :
=======================================================================================
local.whittle <- function(d, x, m)
{
n <- length(x)
t <- matrix(c(0:n1), nrow = n, ncol=1)
lambda <- (2*pi*t)/n
wx <- (2*pi*n)^(-1/2)*Conj(fft( Conj(x)))*exp(1i*lambda)
M1 <- m+1
lambda2 <- lambda[2:M1]
wx2 <- wx[2:M1]
ix <- wx2*Conj(wx2)
g <- mean((lambda2^(2*d))*ix)
r <- log(mean((lambda2^(2*d))*ix)) - 2*d*mean(log(lambda2))
}
=======================================================================================
which seems to run, but when I am trying to call t...
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 message in c...
2008 Sep 12
1
Error in "[<-"(`*tmp*`, i, value = numeric(0)) :
...ollowing:
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/k ~ x, family=binom...
2009 Oct 14
1
different L2 regularization behavior between lrm, glmnet, and penalized?
...;, lambda = 1, alpha
= 0, standardize = FALSE)
> coef(g)
1
-0.1098361
x 0.2196721
> library(penalized)
> fit = penalized(z ~ x)
> coefficients(fit, "all")
(Intercept) x
-0.2224843 0.4449687
> fit = penalized(z ~ x, lambda2 = 1)
> coefficients(fit, "all")
(Intercept) x
-0.2060658 0.4121315
> sessionInfo()
R version 2.9.2 (2009-08-24)
i386-pc-mingw32
locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_Unit...
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:
2011 Apr 11
1
pseudo-R by hand
...gn::lrm. however, I'm not sure wheter mle helps me at all and I
am uncertain about the logLik call I have implemented:
#cox&snell
lambda<- -2*log((logLik(null.model)[1]/logLik(model)[1]))
out<-1-exp(-lambda/n)
#nagelkerke
lambda<- -2*log( logLik(model)[1]/logLik(null.model)[1] )
lambda2<- -2*log( logLik(model)[1] )
out<-(1-exp(-lambda/n))/(1-exp(-lambda2/n))
can anyone help me out?
2005 Dec 09
1
O-ring statistic
...n dataset 'amacrine'
provided in the spatstat package. The dataset has points of two types
labelled "on" and "off".
data(amacrine)
K12 <- Kcross(amacrine, "on", "off")
g12 <- pcf(K12, method="d", spar=0.7)
lambda2 <- summary(amacrine)$marks["off","intensity"]
Oring <- eval.fv(lambda2 * g12)
plot(Oring, ylab="Oring(r)")
regards
Adrian Baddeley
2001 Sep 14
1
Supply linear constrain to optimizer
...ponential
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) being
between interval [0,1], whi...
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 Oct 25
0
penalized regression analysis
...ng 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 = -154.1055
L1...
2017 Oct 31
0
lasso and ridge regression
...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
w4 <-a+b+c
w4[w4[,1] == Inf] <- 9
# Fit modified procedure
fit<- glmnet(x, y, family...
2012 Oct 03
1
Errors when saving output from WinBUGS to R
...lts. Then I
tried to save the simulation draws in R, using read.bugs() function. Here is
a simple test:
######################
library(coda)
library(R2WinBUGS)
#fake some data to test
beta0=1
beta1=1.5
beta2=-1
beta3=2
N=200
x1=rnorm(N, mean=0,sd=1)
x2=rnorm(N, mean=0,sd=1)
x3=rnorm(N, mean=0,sd=1)
lambda2= exp(beta0+ beta1*x1+ beta2 * x2 + beta3 * x3)
y=rep(NA,N)
for (i in 1: N) {
y[i]=rpois(1,lambda2[i])
}
#generate inputs required by winbugs
data <- list(Y20=y,x1=x1, x2=x2, x3=x3, N=N)
inits<- function(){
list(beta0=0, beta1=0, beta2=0, beta3=0)}
parameters <- c("beta0", "b...
2008 Dec 16
0
[LLVMdev] Another compiler shootout
...d), disc = b*b - dot(v, v) + r*r, t1, t2;
if (disc < 0.0) return INFINITY;
disc = sqrt(disc);
t2 = b + disc;
if (t2 < 0.0) return INFINITY;
t1 = b - disc;
return (t1 > 0.0 ? t1 : t2);
}
void intersect(Vec o, Vec d, real *lambda, struct Scene **t, struct Scene
*scene) {
real lambda2 = ray_sphere(o, d, scene->center, scene->radius);
if (lambda2 < *lambda) {
if (scene->child) {
int i;
for (i=0; i<5; ++i)
intersect(o, d, lambda, t, &scene->child[i]);
} else {
*lambda = lambda2;
*t = scene;
}
}
}
Vec neglight;...
2009 Oct 30
0
different L2 regularization behavior between lrm, glmnet, and penalized? (original question)
...n unit second central moment. In your example:
x = c(-2, -2, -2, -2, -1, -1, -1, 2, 2, 2, 3, 3, 3, 3)
z = c(0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1)
You got:
> g = lrm(z ~ x, penalty = 1)
> g$coefficients
Intercept x
-0.1620727 0.3241454
Now:
> coef(penalized(z ~ x, lambda2 = 1,standardize=T))
(Intercept) x
-0.1651565 0.3303130
is already more similar. To counter the difference between dividing by n
(penalized) or n-1 (lrm), do
> coef(penalized(z ~ x, lambda2 = 14/13,standardize=T))
(Intercept) x
-0.1620727 0.3241454
The glmn...
2007 Aug 14
2
State Space Modelling
Hey all,
I am trying to work under a State Space form, but I didn't get the help
exactly.
Have anyone eles used this functions?
I was used to work with S-PLUS, but I have some codes I need to adpt.
Thanks alot,
Bernardo
[[alternative HTML version deleted]]
2008 Dec 16
6
[LLVMdev] Another compiler shootout
FYI. http://leonardo-m.livejournal.com/73732.html
If anyone is motivated, please file bugs for the losing cases. Also,
it might make sense to incorporate the tests into our nightly tester
test suite.
Thanks,
Evan