Displaying 20 results from an estimated 1577 matches for "lambda".
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...
2007 Sep 09
2
What does it mean by "initial value not available"?
...ut my situation does not belong to any of the above cases.
I have attached my code bellow and could you please help me take a look?
Best Wishes
Yuchen Luo
rm(list = ls())
ui=matrix(c(1,-1,0,0,0,0,0,0,1,-1,0,0,0,0,0,0,1,-1),6,3)
ci=c(0,-0.5,0,-2,0,-0.6)
apple=expression(rr*(1.0-rec)*(1.0-(pnorm(-lambda/2.0+log(((ss+(tot/sh*
1000.0)*lbar)/(tot/sh*1000.0
)/lbar*exp(lambda*lambda)))/lambda)-((ss+(tot/sh*1000.0)*lbar)/(tot/sh*
1000.0)/lbar*exp(lambda*lambda))*pnorm(-lambda/2.0-log(((ss+(tot/sh*1000.0
)*lbar)/(tot/sh*1000.0
)/lbar*exp(lambda*lambda)))/lambda))+(exp(rr*(lambda*lambda/(sigmae*ss/(ss+lba...
2011 Apr 19
1
How to Extract Information from SIMEX Output
...List of 24
$ coefficients : Named num [1:2] -17.1 3
..- attr(*, "names")= chr [1:2] "(Intercept)" "x"
$ SIMEX.estimates : num [1:6, 1:3] -1 0 0.5 1 1.5 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:3] "lambda" "(Intercept)" "x"
$ lambda : num [1:5] 0 0.5 1 1.5 2
$ model :List of 31
..$ coefficients : Named num [1:2] -13.27 2.32
.. ..- attr(*, "names")= chr [1:2] "(Intercept)" "x"
..$ residuals...
2020 Oct 23
3
formula mungeing
Suppose I have a formula like this:
f <- y ~ qss(x, lambda = lambdas[1]) + qss(z, lambdas[2]) + s
I?d like a function, g(lambdas, f) that would take g(c(2,3), f) and produce the new
formula:
y ~ qss(x, lambda = 2) + qss(z, 3) + s
For only two qss terms I have been using
g <- function(lambdas, f){
F <- deparse(f)
F <- gsub("lambda...
2007 Jun 11
0
biplot package II
...kages) biplot
# Mail : joseclaudio.faria em terra.com.br
#===============================================================================
# Arguments:
# x Data (frame or matrix: objects in lines variables in columns)
# or a object of the class 'prcomp'.
# lambda.ini First eigenvalue to be considered (default is 1)
# lambda.end Latest eigenvalue to be considered
# (default is 2 to 2d or 3 to 3d)
# center Either a logical value or a numeric vector of length equal
# to the number of columns of x (TRUE is the default)....
2006 Oct 11
3
for loop not working in function
I'm trying to write a small function (below) to compute Box & Cox
transformations of x for arbitrary values of lambda. I'd like to
specify a range of values for lamba (min,max,step) and am having trouble
getting the for loop to work. Suggestions?
Any pointers to resources for learning to write functions in R for
neophyte programmers? Thanks. --Dale
boxcox <- function(x,min,max,step) {
lambda <-...
2007 Jan 19
3
integrate and quadratic forms
Hi all.
I'm trying to numerically invert the characteristic function
of a quadratic form following Imhof's (1961, Biometrika 48)
procedure.
The parameters are:
lambda=c(.6,.3,.1)
h=c(2,2,2)
sigma=c(0,0,0)
q=3
I've implemented Imhof's procedure two ways that, for me,
should give the same answer:
#more legible
integral1 = function(u) {
o=(1/2)*sum(h*atan(lambda*u)+sigma^2*lambda*u/(1+lambda^2*u^2)) - q*u/2
rho=prod((1+lambda^2*u^2)^(h/4))*exp( (1/2)*...
2011 Nov 11
1
Random-walk Metropolis-Hasting
...ead.table("epidemic.txt",header = TRUE)
+ attach(data, warn.conflicts = F)
+ k<-97
+ d <- (sqrt((x-x[k])^2 + (y-y[k])^2))
+ p <- 1-exp(-alpha*d^(-beta))
+ p.alpha<-1 - exp(-3*d^(-beta))
+ p.beta <- 1 - exp(alpha*d^(-2))
+ iterations<-1000
+ mu.lambda <- c(0,0);s.lambda <- c(100,100)
+ prop.s <- c(0.1,0.1)
+ lambda <- matrix(nrow=iterations, ncol=2)
+ acc.prob<-0
+ current.lambda <- c(0,0)
+ for(t in 1:iterations){
+ prop.lambda <- rnorm(2,current.lambda,prop.s)
+ a <- p.beta/p.alpha
*(...
2011 Sep 11
3
(no subject)
Dear all,
Can anyone take a look at my program below?
There are two functions: f1 (lambda,z,p1) and f2(p1,cl, cu).
I fixed p1=0.15 for both functions. For any fixed value of lambda (between
0.01 and 0.99),
I solve f1(p1=0.15, lambda=lambda, z)=0 for the corresponding cl and cu
values.
Then I plug the calculated cl and cu back into the function f2.
Eventually, I want to find the lambda v...
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...
2006 Feb 10
8
Fitdistr and MLE for parameter lambda of Poisson distribution
Hello!
I would like to get MLE for parameter lambda of Poisson distribution. I
can use fitdistr() for this. After looking a bit into the code of this
function I can see that value for lambda and its standard error is
estimated via
estimate <- mean(x)
sds <- sqrt(estimate/n)
Is this MLE? With my poor math/stat knowledge I thought that MLE...
2006 Jul 29
1
uniroot
...0.01036597923,l=list(t=w[i],gp=gp))$root
+ })
Error in uniroot(saeqn, lower = -5000, upper =
0.01036597923, l = list(t = w[i], :
f() values at end points not of opposite sign
>
and here is my fonction "saeqn".
> saeqn<-function(s,l)
+ {
+
+
+ p<- exp(-l$gp$lambda+s)*l$gp$c
+
+
+
k11<-(l$gp$mu*(l$gp$lambda^2)*l$gp$c-s*l$gp$lambda*l$gp$c*l$gp$mu+l$gp$mu*l$gp$lambda)*p
+
+ k12 <-
-l$gp$mu*l$gp$lambda-s^2+2*s*l$gp$lambda-(l$gp$lambda^2)
+
+ k13 <-k11+k12
+
+
k14<-(l$gp$lambda-s)*(-l$gp$mu*s-s*l$gp$lambda+s^2+l$gp$mu*l$gp$lambda*p)
+
+ k1<-...
2007 Sep 24
1
Root finding problem
Hello,
I have a problem finding a root of a function, which I define like this:
tuki <- function(u, x, a, lambda){
if((lambda%%1>0) & u<0) {u<-(u+0i)}
f <- Re(x-(a*(u)^lambda-(1-(u))^lambda)/lambda)
f
}
What I want to do is to find the root, but without specifying the
interval within which to search for it. I can do it easily in MATLAB
with fsolve() or fzero() functions.
I compared results o...
2001 Sep 20
3
indexing an array
Dear everybody,
I have a following problem. I have a 3D array
lambda <- array( dim=c(N,M,M-1))
where I have to extract the elements as follows:
lambda[ 1, state[1], 1]
lambda[ 1, state[1], 2]
...
lambda[ 1, state[1], M-1]
lambda[ 2, state[2], 1]
...
lambda[ 2, state[2], M-1]
...
lambda[ N, state[N], M-1]
i.e. the result should be a 2D array, where the second i...
2004 Jul 03
2
DSTEIN error (PR#7047)
...nd
line):
Parameter 5 to routine DSTEIN was incorrect
Mac OS BLAS parameter error in DSTEIN, parameter #0, (unavailable), is 0
In case it helps, here's the function and function call that causes the crash.
n <- 4
p <- 1
f <- 2; k <- 2
lms.bcn.univar <- function(y, B, p, f, k, lambda.0, mu.0, sigma.0){
n <- length(y)
D11 <- matrix(1, nrow = p, ncol = n)
D1 <- rbind(cbind(D11, matrix(0, nrow = p, ncol = f)),
cbind(matrix(0, nrow = f, ncol = n), diag(f)))
D22 <- rbind(rep(1:0,n),
rep(0:1,n))
x1 <- t(D22)[,1]
x2 &...
2020 Oct 23
0
formula mungeing
...la performing the replacement:
g <- function(e, ...) {
if (length(e) > 1) {
if (identical(e[[2]], as.name(names(list(...))))) {
e <- eval(e, list(...))
}
if (length(e) > 1) for (i in 1:length(e)) e[[i]] <- Recall(e[[i]], ...)
}
e
}
g(f, lambdas = 2:3)
## y ~ qss(x, lambda = 2L) + qss(z, 3L) + s
On Fri, Oct 23, 2020 at 9:33 AM Koenker, Roger W <rkoenker at illinois.edu> wrote:
>
> Suppose I have a formula like this:
>
> f <- y ~ qss(x, lambda = lambdas[1]) + qss(z, lambdas[2]) + s
>
> I?d like a functio...
2013 Feb 12
8
Help with functions as arguments
Hi,
I am trying to write a function which defines some arguments, then uses those arguments as arguments of other function calls. It's a bit tricky to explain, so a simple example will have to suffice. I imagine this has a simple solution, but perusing through environments and other help lists has not helped. Suppose I have two functions:
f1 = function(a)
{
b = a + 1
b
}
f2 =
2011 Nov 14
2
how to include integrate in a function that can be solved with uniroot?
...find the distribution parameter
for a given expectation.
However I fail to understand how to define properly
the functions involved and pass the parameters correctly.
Can anyone help me out?
Thanks,
Gerrit Draisma.
This what I tried:
=======
> # exponential density
> g <- function(x,lambda){ lambda *exp(-lambda*x) }
>
> # expectation with lambda=1/10
> integrate(f = function(x,lambda=1/10) {x*g(x,lambda)}, 0,Inf)
10 with absolute error < 6.7e-05
>
> # *how to write this as a function?*
> E <- function(lambda) {
+ integrate( f = function(x,th){x*g(x,...
2004 May 19
3
greek letters in plots
Hi,
I want to write in x axis label "fitted value of lambda" (lambda in greek
letter).
xlab=expression(lambda) gives the "lambda", I tryed things like xlab=paste
("fitted value of ", expression(lambda)) but I didn't get the greek letter.
Thanks in advance for any hint.
Antonio Olinto
---------------------------------------...
2004 Sep 23
1
noncentrality paramter in power.anova.test (PR#7244)
Full_Name:
Version: 1.9.0
OS: Windows XP
Submission from: (NULL) (134.126.93.191)
I believe the noncentrality parameter, lambda, in power.anova.test is incorrect.
The noncentrality paramter is defined as lambda <- (groups - 1) * n *
(between.var/within.var). The n should not be there. The function pf defines the
noncentrality parameter as the sum of squares of the means. Therefore, the
noncentrality paramter, lambda, in...