similar to: Creating 3 vectors that sum to 1

Displaying 20 results from an estimated 10000 matches similar to: "Creating 3 vectors that sum to 1"

2007 Jun 18
4
triangle contour plots
Suppose I have three numbers p1, p2, p3 with 0 <= p1,p2,p3 <= 1 and p1+p2+p3=1, and a function f=f(p1,p2,p3) = f(p1,p2,1-p1-p2). How to draw a contour plot of f() on the p1+p2+p3=1 plane, that is, an equilateral triangle? Functions triplot(), triangle.plot(), and ternaryplot() give only scatterplots, AFAICS -- Robin Hankin Uncertainty Analyst National Oceanography Centre,
2007 Apr 11
1
Programming Problem (for loop, random # control, 3 dimentional graph)
Dear List, This is just a programming problem which i cannot seem to figure out. I am trying to get a set of power from a test (say, kolmogorov smirnov) out of a distribution (say, G-K distribution) as follows. I am trying to reduce to pain of writing the whole set of data points (p# below) using "for" loop. However, I seem to have some problem in it as the output "M" does not
2010 Feb 19
1
Quadprog help
I am having some problems using Quadprog in R. I want to minimize the objective function : 200*P1-1/2*10*P1^2+100*P2-1/2*5*P2^2+160*P3-1/2*8*P3^2+50*P4-1/2*10*P4^2+50*P 5-1/2*20*P5^2+50*P6-1/2*10*P6^2, Subject to a set of constrains including not only the variables P1, P2, P3, P4, P5, P6, but also the variables X1, X2,X3,X4,X5,X6,X7,X8,X9. As the set of variables X's are not
2010 Jul 23
1
(no subject)
Dear R list, I use the constrOptim to maximize a function with four constriants but the answer does not leave from the starting value and there is only one outer iteration. The function is defined as follows: tm<-function(p){ p1<-p[1]; p2<-p[2]; p3<-p[3]; p4<-1-p1-p2-p3; p1*p2*p3*p4} ##the constraints are p1>=0; p2>=0; p3>=0 and p4>=0 i.e. p1+p2+p3<=1
2024 Jan 30
1
linear programming in R | limits to what it can do, or my mistake?
Apart from the fact that the statement "such that t1+t2+t3+t4=2970 (as it must)" is not correct, the LP can be implemented as follows: library(lpSolve) LHS <- rbind( c(0,0,0,0, 1, 0, 0,0), c(1,0,0,0,-1, 1, 0,0), c(0,1,0,0, 0,-1, 1,0), c(0,0,1,0, 0, 0,-1,1), cbind(-diag(4),diag(4)), c(0,0,0,0,0,1,0,0), c(0,0,0,0,0,0,1,0), c(0,0,0,0,0,0,0,1) ) RHS <-
2024 Jan 29
1
linear programming in R | limits to what it can do, or my mistake?
Question for 'experts' in LP using R (using the lpSolve package, say) -- which does not apply to me for the sort of problem I describe below. I've run any number of LP's using lpSolve in R, but all of them to date have objective and constraint functions that both contain the same variables. This lets you set up a LHS and RHS matrix/vector that are symmetrical. But, for a
2012 May 22
1
RNORM matrix based on CSV file values for MEAN and SD
This should (hopefully) be a pretty simple task. What I'd like to do is read in a csv file containing means and standard deviations for a large number of 'n' parameters (up to 2000). The list would be in the following format (see attached read.csv): Paramter(1), mean, standard dev., Paramter(2), mean, standard dev., Paramter(3), mean, standard dev., ... Paramter(n), mean, standard
2012 Feb 13
3
Change dataframe-structure
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120213/d2a5afa6/attachment.pl>
2005 Jul 20
2
Turning off return warning messages.
Dear All, Is there a way I can turn off the following warning message for using multi-argument returns? multi-argument returns are deprecated in: return(p1, p2, p3, p4) Steve. ************************************************************************************** Steve Su (s.su@qut.edu.au) Postdoctoral fellow Faculty of Business Queensland University of Technology Postal
2010 Jun 13
1
Pairwise cross correlation from data set
Dear list, Following up on an earlier post, I would like to reorder a dataset and compute pairwise correlations. But I'm having some real problems getting this done. My data looks something like: Participant Stimulus Measurement p1 s`1 5 p1 s`2 6.1 p1 s`3 7 p2 s`1 4.8 p2
2010 Oct 01
1
add a new column to data frame
Hi, I am wondering if anyone can propose a simple/best way to do the following: Let's say I have a data frame dat <- cbind(expand.grid(mode=c('right','left'),time=0:3,id=c('p1','p2','p3')),y=c(3,5,rep(4,6),6,2,rep(3,6),4,4,rep(2,6))) dat mode time id y 1 right 0 p1 3 2 left 0 p1 5 3 right 1 p1 4 4 left 1 p1 4 5 right 2
2000 Jan 06
1
nlme
Among others, datam contains the columns: logconc, tm, dose, subj, bilirubin. None of these are factor variables. The following compartment models work (the first still has not converged after 100 interations): res1 <- nlme(logconc~p2+p3+log(dose/(exp(p1)-exp(p2))* (exp(-exp(p2)*tm)-exp(-exp(p1)*tm))),start=list(fixed=c(5,-2,-0.1)), fixed=list(p1+p2+p3~1),control=list(maxIter=100),
2006 Mar 15
2
Regarding aov Error()
The following dummy data frame has factor Q (with 2 levels) nesting factor P (with levels p1 and p2 nested under q1, and p3 and p4 nested under q2), but both crossing the random variate s, which has 8 levels. The dependent measure is dv. > # The data frame: > testnest dv s P Q 1 1 s1 p1 q1 2 2 s2 p1 q1 3 1 s3 p1 q1 4 2 s4 p1 q1 5 1 s5 p1 q1 6 3 s6 p1 q1 7 3 s7
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
2002 Dec 06
2
Fitting 2D vs. 2D data with nls()
Dear R-experts! I have y(x) data, dim(y) == dim(x) == c(2000, 2) I'd like to fit them with nls: fit.result <- nls ( y ~ f(x, p1, p2, p3), start = list(p1 = ... , p2 = .. , p3 = ..) ) Actually I want to fit y[,1] ~ x[,1] and y[,2] ~ x[,2] *simulaneously*, with the same parameters set {p1, p2, p3}. I tried to feed R tha above formula, R errors with:
2012 Oct 05
2
problem with convergence in mle2/optim function
Hello R Help, I am trying solve an MLE convergence problem: I would like to estimate four parameters, p1, p2, mu1, mu2, which relate to the probabilities, P1, P2, P3, of a multinomial (trinomial) distribution. I am using the mle2() function and feeding it a time series dataset composed of four columns: time point, number of successes in category 1, number of successes in category 2, and
2009 Jan 18
4
data management
Dear Rxperts, I have a varaibles data file that looks like this p(1) 10 p(1) 3 p(1) 4 p(2) 20 p(2) 30 p(2) 40 p(3) 4 p(3) 1 p(1) 2 I cannot process these data with R because it does not like the parentheses. How can I get these to look like: p1 10 p1 3 p1 4 p2 20 p2 30 p2 40 p3 4 p3 1 p3 2 The data is in a tab delimited text file and I want to get it into a data.frame(). Many thanks in
2012 Sep 26
3
replace string values with numbers
Hi everyone, I have a data frame Gene with SNPs eg. P1 P2 P3 CG CG GG -- -- AC -- AC CC AC -- AC I tried to replace all the GG with a value 3. Gene[Gene=="GG"]<-3 It always give me: Warning in `[<-.factor`(`*tmp*`, thisvar, value = 3) : invalid factor level, NAs generated Does any know if there is anything wrong with my code? Thanks, Zhengyu
2005 Jun 05
3
function and apply
Dear all    I think my problem is not complicated but I'm having difficulties to solve it. v is a vector: v=c(p1 , p2 , p3 , p4), and f  is a function: f : v -> w , where w=c(p1 , p2*(1-p1) , p3*(1-p2)*(1-p1) , p4*(1-p3)*(1-p2)*(1-p1))   I write the function f as: f<- function(w,x,y,z) {c(w,x*(1-w),y*(1-x)*(1-w),z*(1-y)*(1-x)*(1-w))} f(a,b,c,d) it
2005 Jun 21
2
TEQL and Subnet problem
TEQL and Subnet problem I have a network topology shown below, and I am trying to use TEQL. My problem is: When I ping to P3.teql0 from P2 ("[P2]# ping 16.119.144.66"), the traffic can never go from P2.eth1, and all traffic only goes to P1.eth0. What P2.eth1 (16.119.144.33) did is broadcasting an ARP asking for the MAC address of 16.119.144.66, although I have specified the route to