search for: k1

Displaying 20 results from an estimated 334 matches for "k1".

Did you mean: 1k
2010 Aug 20
5
paired samples, matching rows, merge()
Hi everyone! I'm matching two samples to create one sample that have pairs of observations equal for the k1 variable. Merge() doesn't work because I dont't want to recycle the values. x <- data.frame(k1=c(1,1,2,3,3,5), k2=c(20,21,22,23,24,25)) x y <- data.frame(k1=c(1,1,2,2,3,4,5,5), k2=c(10,11,12,13,14,15,16,17)) y merge(x,y,by="k1") k1 k2.x k2.y 1 1 20 10 2 1 20...
2006 Mar 11
1
Non-linear Regression : Error in eval(expr, envir, enclos)
Hi.. i have an expression of the form: model1<-nls(y~beta1*(x1+(k1*x2)+(k1*k1*x3)+(k2*x4)+(k2*k1*x5)+(k2*k2*x6)+(k3*x7)+(k3*k4*x8)+(k3*k2*x9)+(k3*k3*x10)+ (k4*x11)+(k4*k1*x12)+(k4*k2*x13)+(k4*k3*x14)+(k4*k4*x15)+(k5*x16)+(k5*k1*x17)+(k5*k2*x18)+(k5*k3*x19)+ (k5*k4*x20)+(k5*k5*x21)+(k6*x22)+(k6*k1*x23)+(k6*k2*x24)+(k6*k3*x25)+(k6*k4*x26)+(k6*k5...
2004 Jan 23
0
cmptl_analy.R
Dear Michael, One key is adjustment of nls optimizer tolerance. I notice it has to be higher than usual, but, I recovered your noisy "known" parameter values with an error of K1 (-7%) and k1 (-6%): #### Miller problem with Dalgaard modifications ## Linares 1/22/2004 ## Solution 1 nls(noisy ~ lsoda(xstart, time, one.compartment.model, c(K1=K1, k2=k2))[,2], data=C1.lsoda, start=list(K1=0.3, k2=0.7), control=nls.control(maxiter=50,tol=1),...
2009 May 26
2
using lsoda() and nls() together
Thanks to Dieter Menne and Spencer Graves I started to get my way through lsoda() Now I need to use it in with nls() to assess parameters I have a go with a basic example dy/dt = K1*conc I try to assess the value of K1 from 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...
2011 Nov 22
5
x, y for point of intersection
Hi everyone, ? I am trying to get a point of intersection between a polyline and a straight line ?.. and get the x and y coordinates of this point. For exemplification consider this: ? ? set.seed(123) ? k1 <-rnorm(100, mean=1.77, sd=3.33) ?k1 <- sort(k1) q1 <- rnorm(100, mean=2.37, sd=0.74) q1 <- sort(q1, decreasing = TRUE) plot(k1, q1, xlim <- c((min(k1)-5), (max(k1)+5)), type="l") ? ya <- 2 xa = -5 yb=4 xb=12 ? lines(c(xa, xb), c(ya, yb), col = 2) ? # I want...
2007 Feb 16
1
pinning down symbol values (Scoping/Promises) question
I would like to define a function using symbols, but freeze the symbols at their current values at the time of definition. Both symbols referring to the global scope and symbols referring to arguments are at issue. Consider this (R 2.4.0): > k1 <- 5 > k [1] 100 > a <- function(z) function() z+k > a1 <- a(k1) > k1 <- 2 > k <- 3 > a1() [1] 5 > k <- 10 > k1 <- 100 > a1() [1] 12 First, I'm a little surprised that that the value for k1 seems to get pinned by the initial evaluation of a1. I...
2007 Oct 23
1
How to avoid the NaN errors in dnbinom?
...: 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 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=...
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]]
2009 May 13
2
ode first step
Hi all, I try to assess the parameters (K1,K2) of a model that describes the adsorption of a molecule onto on adsorbent. equation: dq/dt = K1*C*(qm-q)-K2*q I know the value of 'qm' and I experimentally measure the variables 'q', 'C', and the time 't'. t C q 1 0 144.05047 0.00000...
2006 Jul 14
1
Optim()
Dear all, I have two functions (f1, f2) and 4 unknown parameters (p1, p2, p3, p4). Both f1 and f2 are functions of p1, p2, and p3, denoted by f1(p1, p2, p3) and f2(p1,p2,p3) respectively. The goal is to maximize f1(p1, p2, p3) subject to two constraints: (1) c = k1*p4/(k1*p4+(1-k1)*f1(p1,p2,p3)), where c and k1 are some known constants (2) p4 = f2(p1, p2, p3) In addition, each parameter ranges from 0 to 1, and both f1 and f2 involve integrations. I tried to use lagrange multipliers to eliminate two equality constraints and then use optim() to find the m...
2010 Mar 16
0
recursive term
...c(delta1,delta2,delta3) [1]  3.224772  6.391966 10.091279   Then I wrote this the following code:   term <- function(i, lamda, lamda_m)      {sum(sapply(lamda, function(lamda, lamda_m,i) ((1-lamda_m/lamda)^i), lamda_m, i))} sm <- sapply(1:N, term,  lamda, lamda_m);sm #now calculate the deltas k1 <- 3+1 delta <- rep(1, k1);delta delta_calc <- function(k1, delta, sm, alp) { k <- k1-1   alp/k*sum(sapply(1:k, function(i, delta, sm, k1) (sm[i]*delta[k1-i]), delta, sm, k1)) } delta[2:k1] <- sapply(2:k1, delta_calc, delta, sm, alp);delta[2:k1]   > delta[2:k1] <- sapply(2:k1,...
2015 Jun 23
2
Call for testing: OpenSSH 6.9
...} +#endif /* WITH_OPENSSL */ diff --git a/regress/unittests/sshkey/test_file.c b/regress/unittests/sshkey/test_file.c index fa95212..452ab6e 100644 --- a/regress/unittests/sshkey/test_file.c +++ b/regress/unittests/sshkey/test_file.c @@ -44,8 +44,10 @@ sshkey_file_tests(void) { struct sshkey *k1, *k2; struct sshbuf *buf, *pw; - BIGNUM *a, *b, *c; char *cp; +#ifdef WITH_OPENSSL + BIGNUM *a, *b, *c; +#endif TEST_START("load passphrase"); pw = load_text_file("pw"); @@ -102,6 +104,7 @@ sshkey_file_tests(void) sshkey_free(k1); #endif +#ifdef WITH_OPENSSL TES...
2013 May 07
2
recode categorial vars into binary data
...ice solution to do that in R. I thought there might be a better way than ordering each column and recoding the first 50% into 0 and the second into 1. If I use ifelse I have a problem with cases that share the same rank being all median. e.g. df<-as.data.frame(cbind(snr=c(1,2,3,4,5,6,7,8,9,10),k1=c(1,1,4,2,3,2,2,5,2,2),k2=c(1,2,3,2,1,2,1,3,3,2),result=c(4,3,5,4,2,6,4,4,2,3))) now I want to recode k1 and k2 so that I have half of the values recoded 0 and half recoded 1, split around the median point. The median of k1 is 2 which would lead to unequal groupsize if used 2 as cutoff, so all val...
2013 May 07
2
recode categorial vars into binary data
...ice solution to do that in R. I thought there might be a better way than ordering each column and recoding the first 50% into 0 and the second into 1. If I use ifelse I have a problem with cases that share the same rank being all median. e.g. df<-as.data.frame(cbind(snr=c(1,2,3,4,5,6,7,8,9,10),k1=c(1,1,4,2,3,2,2,5,2,2),k2=c(1,2,3,2,1,2,1,3,3,2),result=c(4,3,5,4,2,6,4,4,2,3))) now I want to recode k1 and k2 so that I have half of the values recoded 0 and half recoded 1, split around the median point. The median of k1 is 2 which would lead to unequal groupsize if used 2 as cutoff, so all val...
2012 Mar 02
5
Calculation of standard error for a function
Dear list, If I know the standard error for k1 and k2, is there anything I can call in R to calculate the standard error of k1/k2? Thanks. Jun [[alternative HTML version deleted]]
2007 Sep 22
0
error messages
...nitial values given. My program is shown below: library(circular) ######################################## 4 parameters ######################################## z<-rvonmises(100,0,1) z<-as.vector(z) x<-rvonmises(100,0,2+cos(z)) x<-as.vector(x) f<-function(x){ k1<-x[1] k2<-x[2] k12<-x[3] g<-x[4] -2*sum(log( exp(k1*cos(x))*integrate(function(y)exp((k2+k12*cos(x))*cos(y)),g,2*pi,subdivisions=1000000)$value /(2*pi*integrate(function(y)besselI(k1+k12*cos(y),0)*exp(k2*cos(y)),g,2*pi,subdivisions=1000000)$value) )) } gr<-function(...
2010 Dec 15
5
Solution to differential equation
Hello, I am trying to find the analytical solution to this differential equation dR/dt = k1*(R^k2)*(1-(R/Rmax)); R(0) = Ro k1 and k2 are parameters that need to fitted, while Ro and Rmax are the baseline and max value (which can be fitted or fixed). The response (R) increases initially at an exponential rate governed by the rate constants k1 and k2. Response has a S-shaped curve as a fu...
2012 Jun 14
0
fixed trimmed mean for j-group
...=1 sd4=1 a=rnorm(n1,miu,sd1) b=rnorm(n2,miu,sd2) c=rnorm(n3,miu,sd3) d=rnorm(n4,miu,sd4) ## data transformation g=0 h=0 w<-a*exp(h*a^2/2) x<-b*exp(h*b^2/2) y<-c*exp(h*c^2/2) z<-d*exp(h*d^2/2) mat1<-sort(w) mat2<-sort(x) mat3<-sort(y) mat4<-sort(z) alpha=0.15 k1=floor(alpha*n1)+1 k2=floor(alpha*n2)+1 k3=floor(alpha*n3)+1 k4=floor(alpha*n4)+1 r1=k1-(alpha*n1) r2=k2-(alpha*n2) r3=k3-(alpha*n3) r4=k4-(alpha*n4) ## j-group trimmed mean e1=k1+1 f1=n1-k1 e2=k2+1 f2=n2-k2 e3=k3+1 f3=n3-k3 e4=k4+1 f4=n4-k4 trim1=1/((1-2*alpha)*n1)*(sum(mat1[e1:f1]) + r1*(ma...
2006 Jul 18
5
SQL query question
Hello, I know it''s off-topic. But I''m sure you are using SQL and can help me ;) I''ve a table CARS and a table KEYS and a LOCKS table. CARS id|name 1|audi 2|ford 3|mazda 4|porsche ... KEYS id|car_id|lock_id 1|1|1 2|2|1 3|2|2 4|3|1 5|3|2 6|4|1 7|4|2 8|4|3 ... LOCKS id|name 1|main 2|spare 3|engine ... A car can have many keys. Keys are for different locks. How can I
2009 Aug 03
3
Help with reshaping data.frame
...o wide. (I think that's the right terminology; feel free to educate me.) I've looked at the reshape function and package and plyr package, but I can't quite figure out how to do this after a dozen variations. I have a data.frame with more levels than this, but similar to: > tst K1 K2 K3 V1 V2 V3 1 10 D a 0.08 99 105 2 20 D a 0.00 79 522 3 30 D a 0.31 70 989 5 20 E a 0.08 73 251 6 30 E a NA 38 323 7 10 D b NA 76 775 8 20 D b 0.26 84 372 9 30 D b 0.24 51 680 10 10 E b 0.11 85 532 12 30 E b 0.07 20 364 > dput(tst) structure(list(K1 = c(10,...