similar to: How to replace the values in a column

Displaying 20 results from an estimated 100 matches similar to: "How to replace the values in a column"

2006 Jun 06
1
Problems using quadprog for solving quadratic programming problem
Hi, I'm using the package quadprog to solve the following quadratic programming problem. I want to minimize the function (b_1-b_2)^2+(b_3-b_4)^2 by the following constraints b_i, i=1,...,4: b_1+b_3=1 b_2+b_4=1 0.1<=b_1<=0.2 0.2<=b_2<=0.4 0.8<=b_3<=0.9 0.6<=b_4<=0.8 In my opinion the solution should be b_1=b_2=0.2 und b_3=b_4=0.8. Unfortunately R doesn't find
2013 Mar 05
2
Issues when using interaction term with a lagged variable
Hi there! Today I tried to estimate models using both plm and pgmm functions, with an interaction between X1 and lag(X2, 1). And I notice two issues. Let "Y=b_1 * X_1 + b_2 * X_2 + b_3 * X_1 * x_2 + e" be our model. 1) When using plm, I got different results when I coded the interaction term with I(X1 * lag(X2, 1)) and when I just saved this multiplication X1 * lag(X2, 1) in a
2006 Sep 22
2
Merge problem
Hello all, I have read as many merge issues as I possibly could tonight and although I presume this is a small error, I have not found the solution to my problem. I'm trying to merge two data sets: dat0 and TransTable. As you can see below, dat0 has 8000 rows, whereas TransTable has 47296 rows. I would expect when I merge the two data sets, with all.x=F, and all.y=F, that the
2010 Jan 19
1
change codes into loops
Hi, See example. for (i in 1:2) { for (j in 1:3) { b_1[i,j]<-rank(c(a1[i,j],a2[i,j],a3[i,j]))[1] b_2[i,j]<-rank(c(a1[i,j],a2[i,j],a3[i,j]))[2] b_3[i,j]<-rank(c(a1[i,j],a2[i,j],a3[i,j]))[3] } } The inner codes is really repeated, so i want to change the inner codes into loops. Take nn is from 1 to 3, something like, for (nn in 1:3) {
2011 Dec 05
1
Summary coefficients give NA values because of singularities
Hello, I have a data set which I am using to find a model with the most significant parameters included and most importantly, the p-values. The full model is of the form: sad[,1]~b_1 sad[,2]+b_2 sad[,3]+b_3 sad[,4]+b_4 sad[,5]+b_5 sad[,6]+b_6 sad[,7]+b_7 sad[,8]+b_8 sad[,9]+b_9 sad[,10], where the 9 variables on the right hand side are all indicator variables. The thing I don't understand
2004 Oct 01
2
multiple dimensional diag()
Hi I have two arbitrarily dimensioned arrays, "a" and "b", with length(dim(a))==length(dim(b)). I want to form a sort of "corner-to-corner" version of abind(), or a multidimensional version of blockdiag(). In the case of matrices, the function is easy to write and if a=matrix(1,3,4) and b=matrix(2,2,2), then adiag(a,b) would return: [,1] [,2] [,3] [,4] [,5]
2008 Jul 25
3
Numerical question
Hi all, I have n independent variables A_1, A_2, A_3,......,A_n, and each with known variances var(A_1), var(A_2),..., but unknown mean. How can I get the approximation of the variance of the product of the variables using numerical computation, i.e. var(A_1*A_2*A_3*.....*A_n)? Thanks. Sincerely, Yanwei Zhang Department of Actuarial Research and Modeling Munich Re America Tel: 609-275-2176
2013 Mar 22
1
Integration of vector syntax unknown
Hello, I'm very new to using R, but I was told it could do what I want. I'm not sure how best to enter the information but here goes... I'm trying to transfer the following integral into R to solve for ln(gamma_1), on the left, for multiple instances of gamma_i and variable N_i. gamma_i is, for example, (0, 0.03012048, 0.05000000, 0.19200000, 0.44000000, 0.62566845) N_i (N_1 or
2007 Mar 29
3
Tail area of sum of Chi-square variables
Dear R experts, I was wondering if there are any R functions that give the tail area of a sum of chisquare distributions of the type: a_1 X_1 + a_2 X_2 where a_1 and a_2 are constants and X_1 and X_2 are independent chi-square variables with different degrees of freedom. Thanks, Klaus -- "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
2011 Jan 17
2
How to still processing despite bug errors?
Hi, everybody. I am working processing EEG data from 1000 pacients. I have a specific syntax to perform the Spectral Analysis and a loop to analyse all subjects. each subject data are in separate folders (P1, P2 P3...) My question is: in some cases, some errors can appear in one subject. I want to know if is possible to jump to the next subject and perform the same syntax , exibiting an error
2004 Dec 09
3
surf.ls
Hello, I am looking into description of surf.ls(spatial) and see under value $beta - the coefficients. When I use polynomial of degree 2 to fit surface I expect to get 4 coefficients: z = a_1 x^2 + a_2 xy + a_3 y^2 + a_4 What do beta really stand for and why do I get $beta vector of length 6? Thakns, Mark
2005 Oct 13
3
Do Users of Nonlinear Mixed Effects Models Know Whether Their Software Really Works?
Do Users of Nonlinear Mixed Effects Models Know Whether Their Software Really Works? Lesaffre et. al. (Appl. Statist. (2001) 50, Part3, pp 325-335) analyzed some simple clinical trials data using a logistic random effects model. Several packages and methods MIXOR, SAS NLMIXED were employed. They reported obtaining very different parameter estimates and P
2003 Feb 19
4
fitting a curve according to a custom loss function
Dear R-Users, I need to find a smooth function f() and coefficients a_i that give the best fit to y ~ a_0 + a_1*f(x_1) + a_2*f(x_2) Note that it is the same non-linear transformation f() that is applied to both x_1 and x_2. So my first question is how can I do it in R? A more general question is this: suppose I have a utility function U(a_i, f()), where f() is say a spline. Is there a general
2011 Nov 06
2
how to use quadrature to integrate some complicated functions
Hello to all, I am having trouble with intregrating a complicated uni-dimensional function of the following form Phi(x-a_1)*Phi(x-a_2)*...*Phi(x-a_{n-1})*phi(x-a_n). Here n is about 5000, Phi is the cumulative distribution function of standard normal, phi is the density function of standard normal, and x ranges over (-infty,infty). My idea is to to use quadrature to handle this integral. But
2011 Sep 02
1
Using capture.output within a function
Dear R-users I'm running a maximum likelihood procedure using the spg package. I'd like to save some output produced in each iteration to a file, but if I put the capture.output() within the function I get the following message; Error in spg(par = startval, fn = loglik, gr = NULL, method = 3, lower = lo, : Failure in initial function evaluation!Error in -fn(par, ...) : invalid argument
2004 Oct 13
0
RE: [R] debugging non-visible functions
On Wed, 13 Oct 2004, Duncan Temple Lang wrote: > Prof Brian Ripley wrote: > > On Wed, 13 Oct 2004, Liaw, Andy wrote: > > > > > > > On a slightly different topic: In R-2.0.0, packages with NAMESPACE no > > > longer need to use the package= argument in .C/.Fortran. Does that mean if > > > I remove those arguments, I should put R version >=
2005 Mar 05
4
How to use "lag"?
Is it possible to fit a lagged regression, "y[t]=b0+b1*x[t-1]+e", using the function "lag"? If so, how? If not, of what use is the function "lag"? I get the same answer from y~x as y~lag(x), whether using lm or arima. I found it using y~c(NA, x[-length(x)])). Consider the following: > set.seed(1) > x <- rep(c(rep(0, 4), 9), len=9) > y <-
2007 Jul 14
0
ts model challenge (transfer function)
Dear useRs, I am trying to model a time series with a transfer function. I think it can be put into the ARMA framework, and estimated with the 'arima' function (and others have made similar comments on this list). I have tried to do that, but the results have so far been disappointing. Maybe I am trying to make 'arima' do something it can't... The data are time series of
2006 Oct 10
4
generate random numbers that sum up to 1
As I have previously asked, in response to a similar question: Is this a homework problem? cheers, Rolf Turner rolf at math.unb.ca
2013 Sep 26
1
Queue Management
Dear All, I have six different campaign and 5 different agent have login on that campaign.*Same thing i have done using agi and database,i never use queue management on this scenario. Agent** can also shuffling one campaign to anther campaign. * Now i want to do some work with queue.I want to use single queue to managing this. Eg: campaign Agent Login A a_1,a_3