search for: parms

Displaying 20 results from an estimated 715 matches for "parms".

2009 Sep 08
1
optim() argument scoping: passing parameter values into user's subfunction
.... This function allows for the parameters to enter as arguments to various probability distribution functions. However, I am violating some scoping convention, as somewhere within the hierarchy of calls a variable is not visible. I will give a genericized example here. > myFxn <- function(parms, Y, phi, <other args>) {<body of function>} ### I want to optimize this over its first argument > optim(par=<numeric(>2)>, fn=myFxn, ### end of named args, next are all in "..." Y=<data>, <other args>, phi=function(r) pnorm...
2011 Nov 12
1
State space model
Hi, I'm trying to estimate the parameters of a state space model of the following form measurement eq: z_t = a + b*y_t + eps_t transition eq y_t+h = (I -exp(-hL))theta + exp(-hL)y_t+ eta_{t+h}. The problem is that the distribution of the innovations of the transition equation depend on the previous value of the state variable. To be exact: y_t|y_{t-1} ~N(mu, Q_t) where Q is a diagonal
2007 Apr 05
1
Plotting multiple curves with lattice graphs
Hi List, I would like to plot multiple curves (parametric density curves) in one plot. For example: # parameters for three normal density curves parms = data.frame(ID=c(1,2,3),mu=c(50,55,60),sigma=c(10,12,15)) # I can easily draw three normal density curves using curve(): curve(dnorm(x,mean=parms$mu[1],sd=parms$sigma[1]),from=0, to=150, ylab="density", col="red") curve(dnorm(x,mean=parms$mu[2],sd=parms$sigma[2]),from=0, to=15...
2006 Apr 20
2
nlminb( ) : one compartment open PK model
...it has converged, but the estimated parameters are always identical to the initial values.... I am certain that I have committed "ein dummheit" somewhere in the following code, but not sure what... Any help would be greatly appreciated. Kind regards, Greg model2 <- function(parms, dose, time, log.conc) { exp1 <- exp(-parms[1]*time) exp2 <- exp(-parms[2]*time) right.hand <- log(exp1 - exp2) numerator <- dose*parms[1]*parms[2] denominator <- parms[3]*(parms[2] - parms[1]) left.hand <- log(numerator/(denominator)) pred <- left.hand + right.hand #...
2005 Jul 19
2
Michaelis-menten equation
...value when i use wrong model definiens. The value of Vd and Vmax are correct in these two models. #-----right model definiens-------- PKindex<-data.frame(time=c(0,1,2,4,6,8,10,12,16,20,24), conc=c(8.57,8.30,8.01,7.44,6.88,6.32,5.76,5.20,4.08,2.98,1.89)) mm.model <- function(time, y, parms) { dCpdt <- -(parms["Vm"]/parms["Vd"])*y[1]/(parms["Km"]+y[1]) list(dCpdt)} Dose<-300 modfun <- function(time,Vm,Km,Vd) { out <- lsoda(Dose/Vd,time,mm.model,parms=c(Vm=Vm,Km=Km,Vd=Vd), rtol=1e-8,atol=1e-8) out...
2008 Dec 19
0
"parm" argument in confint.multinom () nnet package
Dear R users, The nnet package includes the multinom method for the confint function. The R Help file (?confint) for the generic function in the stats package and the help files for the glm and nls methods in the MASS package indicate that one can use the "parm" argument as "a specification of which parameters are to be given confidence intervals, either a vector of numbers or
2006 Aug 08
1
Fitting data with optim or nls--different time scales
Hi, I have a system of ODE's I can solve with lsoda. Model=function(t,x,parms) { #parameter definitions lambda=parms[1]; beta=parms[2]; d = parms[3]; delta = parms[4]; p=parms[5]; c=parms[6] xdot[1] = lambda - (d*x[1])- (beta*x[3]*x[1]) xdot[2] = (beta*x[3]*x[1]) - (delta*x[2]) xdot[3] = (p*x[2]) - (c*x[3]) return(list...
2007 Mar 03
3
How to convert List object to function arguments?
...the problem is passing "..." to CDF function (for instance, see ks.test above) in the "right form". The "..." is passed (to "goftests") as a list object and it should be converted to an "argument list". For instance: ##### BEGIN CODE SNIP ##### parms <- list( shape1 = 2, shape2 = 5 ); goftests( x, "beta", parms[["shape1"]], parms[["shape2"]] ); # Works! goftests( x, "beta", parms ) # Don't Works! parms <- list( aNum = 5, aVector = c(1,2,3), aMatrix = matrix(c(4,5,6,7,8,9),nrow=2,byrow=T) ); go...
2008 Nov 14
0
Error in optim when i call it from a function
Dear R-users I've got the next problem: I've got this *function*: fitcond=function(x,densfun,pcorte,start,...){ myfn <- function(parm,x,pcorte,...) -sum(log(dens(parm,x,pcorte,...))) Call <- match.call(expand.dots = TRUE) if (missing(start)) start <- NULL dots <- names(list(...)) dots <- dots[!is.element(dots, c("upper",
2008 Feb 06
10
Xen 3.1 / Xen 3.2 + DRBD 8.2.4
Hi all ! Is anyone using xen kernel + drbd 8.2.4 ? I don''t know exactly if my problems come from the addition of the two packages, or from drbd 8.2.4, but I encoutered kernel panic 2 times when trying to do first sync of drbd resources :s Cheers, -- Serge Dewailly _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com
2013 Feb 10
4
A Hodgkin Huxley Model
...paper. The equations are as follows: v' = 0.04v^2 + 5v + 140 - u - I u' = a(bv - u) if v=30 then v<-c else u<-u+d I don't know how to implement the if condition in my R code. I'm using deSolve. Here is my code so far. library(deSolve); Izhikevich <- function(time, init, parms) { with(as.list(c(init, parms)),{ dv <- (0.04*v^2)+(5*v)+140-u+I; du <- a*(b*v-u); if (v>=30) v<-c else v<-u+d; list( c(dv, du)) })} parms=c( a=0.02, b=0.2, c=-65, d=8,I=10); times=seq(from=1, to=1000, by=1); init=c(v=-65, u=0.2); out<-ode(y=init, times=times,...
2015 Jun 08
2
Problem with GT218 (GeForce GT210)
Hello, I'm facing issues with a Point of View GT210/218 and nouveau drivers. I'm using ubuntu server with LXDE on top of it... *lshw -c video* output: *-display description: VGA compatible controller product: GT218 [GeForce 210] vendor: NVIDIA Corporation physical id: 0 bus info: pci at 0000:01:00.0 version: a2 width: 64 bits clock:
2013 Feb 21
1
using and event in deSolve
...g neurons. However, I'm not too sure of defining the event. The deSolve documentation says: An event is triggered when the ball hits the ground (height = 0) Then velocity (y2) is reversed and reduced by 10 percent. The root function, y[1] = 0, triggers the event: > root <- function(t, y, parms) y[1] Firstly I couldn't see where y[1] became 0, but I implemented Izchikevich as follows: library(deSolve); Izhikevich <- function(time, init, parms) { with(as.list(c(init, parms)),{ dv <- (0.04*v^2)+(5*v)+140-u+I; du <- a*(b*v-u); #if (v>=30) v<-c else v<-u+...
2011 Sep 22
1
Error in as.vector(data) optim() / fkf()
Dear R users, When running the program below I receive the following error message: fit <- optim(parm, objective, yt = tyield, hessian = TRUE) Error in as.vector(data) : no method for coercing this S4 class to a vector I can't figure out what the problem is exactly. I imagine that it has something to do with "tyield" being a matrix. Any help on explaining what's going on
2010 Sep 09
5
Help on simple problem with optim
Dear all, I ran into problems with the function "optim" when I tried to do an mle estimation of a simple lognormal regression. Some warning message poped up saying NANs have been produced in the optimization process. But I could not figure out which part of my code has caused this. I wonder if anybody would help. The code is in the following and the data is in the attachment. da <-
2006 Jan 20
1
Passing variable arguments to functions
Hi, Is there another way to pass arguments via a vector to arbitrary functions as in the following code example without using a series of if else statements? f <- test(func, x, parms, fargs1, fargs2, ...) { # parms is a vector of parameters to func. # ... is for use by f, not by func. n <- length(parms) if (n == 0) y <- func(x) else if (n == 1) y <- func(x, parms[1]) else if (n == 2) y <- func(x, parms[1], parms[2]) # remaining body of...
2007 Oct 23
1
How to avoid the NaN errors in dnbinom?
...iles that for dnbinom "Invalid size or prob will result in return value NaN, with a warning", but I am not able to find a workaround for this in my code to avoid it. I appreciate the help. Thanks. Below is the reproducible code: mixnbinom=function(y,k1,mu1,k2,mu2,prob,eps= 1/100000){ new.parms=c(k1,mu1,k2,mu2,prob) err=1 iter=1 maxiter=100 hist(y,probability=T,nclass=30,col="lightgrey",main="The EM algorithm") xvals=seq(min(y),max(y),1) lines(xvals,prob*dnbinom(xvals,size=k1,mu=mu1)+ (1-prob)*dnbinom(xvals,size=k2,mu=mu2),col="green") while(err>eps){ if(i...
2006 Mar 02
1
Named parameters in optim()
If I name the elements of the vector of initial values passed to optim(), then it attaches the names to the final result, e.g. > f <- function(parms) (parms[1]-1)^2+(parms[2]-2)^2 > optim(c(x=3,y=4), f) $par x y 0.9999635 2.0003241 $value [1] 1.063637e-07 $counts function gradient 65 NA $convergence [1] 0 $message NULL However, the vector that gets passed to f doesn't have its names attached: > f...
2001 Aug 12
2
rpart 3.1.0 bug?
...There are a number of changes between this and previous versions, and some of the code I've been using with earlier versions (e.g. 3.0.2) no longer work. Here is a simple illustration of a problem I'm having with xpred.rpart. iris.test.rpart<-rpart(iris$Species~., data=iris[,1:4], parms=list(prior=c(0.5,0.25, 0.25))) + ) > xpred.rpart(iris.test.rpart) Error in as.double.default(fit$parms) : (list) object cannot be coerced to vector type 14 > The problem seems to be with the parms parameter in the call to rpart. If I leave parms out of the fit statement, xpred.rpart work...
2009 May 26
2
using lsoda() and nls() together
...m a simulated data set with a K1 close to 2. Here is (I think) the best code that I've done so far even though it crashes when I call nls() -------------------------------------------------------------- x<-seq(0,10,,100) y<-exp(2*x) y<-rnorm(y,y,0.3*y) test.model<-function(t,conc,parms){ dy.dt = parms["K1"]*conc list(dy.dt) } require(deSolve) foo<-lsoda(c(conc=1),times=seq(0,10,,100),test.model,parms=c(K1=2)) foo #####################use of nls func<-function(K1) { foo<-lsoda(c(conc=1),times=seq(0,10,,100),test.model,parms=c(K1=K1)) foo[,"conc"...