similar to: Error in J[time] : invalid subscript type 'closure'

Displaying 20 results from an estimated 6000 matches similar to: "Error in J[time] : invalid subscript type 'closure'"

2013 Feb 10
4
A Hodgkin Huxley Model
Hi All It has been suggested to me that the folks in this list might be able to help me out of my misery. As part of my learning curve to building a rather detailed model of a small neurone complex I am implementing some existing models in R. For the moment I want to implement the Izhikevich model as described in his 2003 paper. The equations are as follows: v' = 0.04v^2 + 5v + 140 - u - I
2013 Feb 18
1
attempt to apply non-function
Hi All I am getting the above mentioned error when I run the code below. I don't know why because I have implemented the function and I'm calling the function with a parameter. I'm obviously missing the plot ... Can someone perhaps point out the error of my ways? Error: > out<-ode(y=init, times=times, func=G1999, parms=parms, method="lsoda") Error in m_Na(v) : attempt
2013 Feb 24
3
filling an array
Hi All I'm just wondering if there is a quick way of filling a way with the following. I want to declare array I with a specific length and then alternatively fill it with 10 zeros and 10 specified values: v<- 14 I <- c(0,length(t)) But in stead of just filling I with 0 I want 10 zeros and then 10 fourteens (i.e. the value in v) Hope that makes sense. Regards Jannetta --
2013 Feb 13
1
An extended Hodgkin-Huxley model that doesn't want to work.
Hi All I have been struggling with this model for some time now and I just can't get it to work correctly. The messages I get when running the code is: DLSODA- Warning..Internal T (=R1) and H (=R2) are such that in the machine, T + H = T on the next step (H = step size). Solver will continue anyway. In above message, R = [1] 0 0 DINTDY- T (=R1) illegal In above message, R = [1]
2013 Feb 21
1
using and event in deSolve
Hi All Having been pointed the use of events and roots in deSolve, I was able to implement the Izchikevich model of spiking 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: >
2003 Jan 14
1
Running Sage from a Samba server
Hi folks I have a client with a Samba 2.2.0a server. I haven't upgraded it yet because it has been working so smoothly that I don't want to fix what isn't broken. The problem we are having at the moment is with only one application and that is Sage Accounting. The client is complaining that when more than one person tries to update or run searches, things seem to "lock up".
2011 Mar 19
2
problem running a function
Dear people, I'm trying to do some analysis of a data using the models by Royle & Donazio in their fantastic book, particular the following function: http://www.mbr-pwrc.usgs.gov/pubanalysis/roylebook/panel4pt1.fn that applied to my data and in the console is as follows: > `desman.y` <- structure(c(3L,4L,3L,2L,1L), .Names = c("1", "2", "3",
2009 Sep 08
1
optim() argument scoping: passing parameter values into user's subfunction
Dear useRs, I have a complicated function to be optimized with optim(), and whose parameters are passed to another function within its evaluation. 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
2006 Apr 20
2
nlminb( ) : one compartment open PK model
All, I have been able to successfully use the optim( ) function with "L-BFGS-B" to find reasonable parameters for a one-compartment open pharmacokinetic model. My loss function in this case was squared error, and I made no assumptions about the distribution of the plasma values. The model appeared to fit pretty well. Out of curiosity, I decided to try to use nlminb( ) applied to a
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")
2005 Jul 19
2
Michaelis-menten equation
Dear R users: I encountered difficulties in michaelis-menten equation. I found that when I use right model definiens, I got wrong Km vlaue, and I got right Km 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),
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(xdot)) } I want
2007 Mar 03
3
How to convert List object to function arguments?
Dear R gurus, I have a function "goftests" that receives the following arguments: * a vector "x" of data values; * a distribution name "dist"; * the dots list ("...") containing a list a parameters to pass to CDF function; and calls several goodness-of-fit tests on the given data values against the given distribution. That is: ##### BEGIN CODE SNIP #####
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,
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
2007 Oct 23
1
How to avoid the NaN errors in dnbinom?
Hi, The code below is giving me this error message: Error in while (err > eps) { : missing value where TRUE/FALSE needed In addition: Warning messages: 1: In dnbinom(x, size, prob, log) : NaNs produced 2: In dnbinom(x, size, prob, log) : NaNs produced I know from the help files that for dnbinom "Invalid size or prob will result in return value NaN, with a warning", but I am not able
2001 Aug 12
2
rpart 3.1.0 bug?
I just updated rpart to the latest version (3.1.0). 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))) + ) >
2017 Sep 22
0
update numeric values of list with new values...
Solved it: test <- list(a=1,b=2,c=3) new <- c(4,5,6) hold <- as.list(new) updated_test <- replace(test,c(1:3),hold) $a [1] 4 $b [1] 5 $c [1] 6 mean.parms <- as.list(mean.parms) mm.parms <- replace(far.parms,c(1:length(far.parms)),mean.parms) On 9/22/2017 10:34 AM, Evan Cooch wrote: > Suppose I have the following: > > test <- list(a=1,b=2,c=3) > > I
2002 Feb 01
1
typo and user-proofing in odesolve() (PR#1295)
A couple of minor points about the odesolve package (which I am otherwise enjoying very much): 1. "scalar" is misspelled as "scaler" in the definitions of the rtol and atol parameters 2. it is possible to crash R by doing something dumb, e.g failing to read the documentation carefully enough and (a) returning only a vector of derivatives and not a list of (derivatives,
2005 Oct 25
2
solving ODE's in matrix form with lsoda()
Hello there, Suppose you want to solve the following system of ODE's (a simple Lotka-Volterra predator prey model) dP/dt = beta*P*V - mu*P dV/dt = r*V - beta*P*V where P and V are the numbers of predators and prey. Now, this is easy to do, but suppose you have a system of equations like this, dP1/dt = beta1*P1*V1 - mu1*P1 dP2/dt = beta2*P2*V2 - mu2*P2 dV1/dt = r1*V1 - beta1*P1*V1