similar to: manipulating (extracting) data from distance matrices

Displaying 20 results from an estimated 1000 matches similar to: "manipulating (extracting) data from distance matrices"

2008 Jul 06
2
Issue with postscript figures using WinAnsi encoding
Hi there, I've hit a bump in writing postscript files with special characters in the WinAnsi encoding on a windows machine. Here's some sample code: ########################################### postscript(file = "test.eps", encoding="WinAnsi.enc", width = 3, height = 5.5, onefile = TRUE, horizontal=FALSE, family = "sans", title =
2008 Jul 09
2
sorting a data frame by rownames
Hi there, I'm sure there's an easy answer to this, and I can't wait to see it. The question: is there an easy way to sort a data frame by it's row names? My dilemma: I've had to pull apart a data frame, run it through a loop to do some calculations and generate new variables, and then re-construct the chunks back into a data frame at the end. Doing this preserves the row
2008 Jul 09
1
matplot help
Hi, My question is how do I gain control over what values the X and Y axis show. Below is a sample plot I have made and want the X axis to represent a time vector with values taking the form Q1.60, Q2.60, Q3.60...Q1.90..etc...Currently the X axis starts with value 0 and increases by 1 through the end of the sample. win.graph() matplot(v.0,log.diff.v.6,type="l",lty=1, col=2,
2008 Jul 15
2
extracting elements from print object of Manova()
Hi there, Does anyone know how to extract elements from the table returned by Manova()? Using the univariate equivalent, Anova(), it's easy: a.an<-Anova(lm(y~x1*x2)) a.an$F This will return a vector of the F-values in order of the terms of the model. However, a similar application using Manova(): m.an<-Manova(lm(Y~x1~x2)) m.an$F Returns NULL. So does any attempt at calling the
2008 May 07
1
interpreting significance of path coefficients from sem() output
Hi there, Quick question about the output from the sem() function in the library of the same name. If I am getting probabilities >0.05 for some of my estimates of path coefficients, I'm assuming the interpretation here is that the coefficient is not significantly different from zero, correct? In that case, might it make sense that I should disregard path coefficients between
2007 Mar 12
2
distance metrics
Hello: Does anyone know if there exists a package that handles methods for [ for dist objects? I would like to access a dist object using matrix notation e.g. dMat = dist(x) dMat[i,j] Thanks in advance to anyone who can point me in the right direction. [[alternative HTML version deleted]]
2007 Apr 05
1
Indexing in anova summary output of the form: summary(aov(y ~ x1, Error = (x1/x2)))
Hi, there I'm trying to get the value of the Mean Square from the ANOVA model summary that comes from specifying the error term, and am wondering if one can actually do this ( I know it's possible when using anova(lm) objects and the like, but I'm having a tough time with it under this framework). There does appear to be some indexing in the output of this type, but perhaps not
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
2007 Feb 12
1
Trying to replicate error message in subset()
Hi, there I am trying to replicate an error message in subset() to see what it is that I'm doing wrong with the datasets I am trying to work with. Essentially, I am trying to pass a string vector to subset() in order to select a specific collection of cases (i.e., I have data for these cases in one table, and want to select data from another table that match up with the cases in the
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
2007 Jan 23
1
How to evaluate an lm() object for generating warning statement in a function
Hi, there I tried this post on R-help but did not generate any replies, so I thought I might try the waters here since it's a more programming-based group. I have written a function that will allow me to calculate the variance components for a model II (random effects) single factor ANOVA (perhaps this is me re-inventing the wheel, but I handn't yet come across anything in R that does
2007 Feb 01
2
Losing factor levels when moving variables from one context to another
Hi, there I'm currently trying to figure out how to keep my "factor" levels for a variable when moving it from one data frame or matrix to another. Example below: vec1<-(rep("10",5)) vec2<-(rep("30",5)) vec3<-(rep("80",5)) vecs<-c(vec1, vec2, vec3) resp<-rnorm(2,15) dat<-as.data.frame(cbind(resp, vecs))
2003 Jun 02
1
Help with factorized argument in solve.QP
Hi I'm having problems getting the "factorized" argument in solve.QP (part of the quadprog library) to work as expected. The helpfile states that when the factorized argument is set to TRUE, then the function requires the inverse of a square-root factor of the Hessian instead of the Hessian itself. That is, when factorized=TRUE, the Dmat argument should be a matrix R^(-1), such
2008 Jul 15
4
Iterations
I have a command that reads in some data: x <- read.csv("Sales2007.dat", header=TRUE) Then I try to organize the data: sc <- split(x, list(x$Category, x$SubCategory), drop=TRUE) Then I want to iterate through the data. I was able to get the following to run on the R console: for(i in 1:length(sc)) { sum(sc[[i]]$Quantity) } But notiing is primted on the console. I find
2007 Sep 03
2
The quadprog package
Hi everybody, I'm using Windows XP Prof, R 2.5.1 and a Pentium 4 Processor. Now, I want to solve a quadratic optimization program (Portfolio Selection) with the quadprog package I want to minimize (\omega'%*%\Sigma%*%\omega) Subject to (1) \iota' %*% \omega = 1 (full investment) (2) R'%*%\omega = \mu (predefined expectation value) (3) \omega \ge 0 (no short sales). Where
2010 Dec 04
1
Quadratic programming with semi-definite matrix
Hello. I'm trying to solve a quadratic programming problem of the form min ||Hx - y||^2 s.t. x >= 0 and x <= t using solve.QP in the quadprog package but I'm having problems with Dmat not being positive definite, which is kinda okay since I expect it to be numerically semi-definite in most cases. As far as I'm aware the problem arises because the Goldfarb and Idnani method first
2008 May 09
3
Query: how to add quotes when importing a txt file
Dear R users, I have a txt file of the form 10092007 24.62 24.31 24.90 11092007 19.20 23.17 22.10 13092007 24.71 27.33 23.10 14092007 27.33 27.90 24.10 15092007 28.22 28.55 24.30 16092007 28.53 29.24 27.40 17092007 24.19 30.64 26.80 18092007 22.60 20.62 28.40 19092007 8.89 1.70 14.70 20092007 21.27 2.92 17.30 21092007 22.38 24.72 8.80 22092007 23.94 24.73 20.40 23092007 25.33 25.12 22.60
2009 Feb 16
2
solve.QP with box and equality constraints
Dear list, I am trying to follow an example that estimates a 2x2 markov transition matrix across several periods from aggregate data using restricted least squares. I seem to be making headway using solve.QP(quadprog) as the unrestricted solution matches the example I am following, and I can specify simple equality and inequality constraints. However, I cannot correctly specify a constraint
2005 Jan 13
1
how to use solve.QP
At the risk of ridicule for my deficient linear algebra skills, I ask for help using the solve.QP function to do portfolio optimization. I am trying to following a textbook example and need help converting the problem into the format required by solve.QP. Below is my sample code if anyone is willing to go through it. This problem will not solve because it is not set up properly. I hope I
2007 Dec 22
1
using solve.qp without a quadratic term
I was playing around with a simple example using solve.qp ( function is in the quadprog package ) and the code is below. ( I'm not even sure there if there is a reasonable solution because I made the problem up ). But, when I try to use solve.QP to solve it, I get the error that D in the quadratic function is not positive definite. This is because Dmat is zero because I don't have a