similar to: matrix not positive definite (while it should be)

Displaying 20 results from an estimated 10000 matches similar to: "matrix not positive definite (while it should be)"

2011 Oct 18
1
Repeat a loop until...
Dear all, I know there have been various questions posted over the years about loops but I'm afraid that I'm still stuck. I am using Windows XP and R 2.9.2. I am generating some data using the multivariate normal distribution (within the 'mnormt' package). [The numerical values of sanad and covmat are not important.] > datamat <-
2011 Feb 09
2
Generate multivariate normal data with a random correlation matrix
Hi All. I'd like to generate a sample of n observations from a k dimensional multivariate normal distribution with a random correlation matrix. My solution: The lower (or upper) triangle of the correlation matrix has n.tri=(d/2)(d+1)-d entries. Take a uniform sample of n.tri possible correlations (runi(n.tr,-.99,.99) Populate a triangle of the matrix with the sampled correlations Mirror the
2009 Aug 20
1
Understanding R code
What is 1. par.ests <- optimfit$par 2. fisher <- hessb(negloglik, par.ests, maxvalue=maxima); 3. varcov <- solve(fisher); 4. par.ses <- sqrt(diag(varcov)); Thanks a lot, fit.GEV <- function(maxima) { sigma0 <- sqrt((6. * var(maxima))/pi) mu0 <- mean(maxima) - 0.57722 * sigma0 xi0 <- 0.1 theta <- c(xi0, mu0, sigma0) #10/5/2007: removed assign() for maxima.nl
2008 Jun 26
2
constructing arbitrary (positive definite) covariance matrix
Dear list, I am trying to use the 'mvrnorm' function from the MASS package for simulating multivariate Gaussian data with given covariance matrix. The diagonal elements of my covariance matrix should be the same, i.e., all variables have the same marginal variance. Also all correlations between all pair of variables should be identical, but could be any value in [-1,1]. The problem I am
2008 Oct 01
1
Please help me to produce smoothed contour plots
Please help me to produce smoothed contour plots. I have dependent data generated at regular intervals of two independent variables and would like to produce smoothed contour plots - I cannot get interp (alima) to produce cubic interpolations of the data, only linear ones. I'm interested in smoothing as the data generation process is stochastic and produces small variations which I'd
2008 Jul 22
1
scatter plot using ggplot
I used ggplot to create a scatter plot : library(ggplot) library(mnormt) Sigma = matrix(c(1, 0.6, 0.6, 1), 2, 2) x = rmnorm(20, c(0,0), Sigma) xx = x[order(x[,1]),] y = xx[,1] z = xx[,2] qplot(z, y, type="point", main="x-y plot", xlab="x", col="blue") However I want following: 1. Plot color must be Blue (where it is displaying as red) 2. There should not
2009 Apr 15
2
Split string
> (FICB[,"temp"]) [1] "0.30" "0.55" "0.45" "2.30" "0.45" "0.30" "0.25" "0.30" "0.30" "1.05" "1.00" "1.00" [13] "0.30" "0.30" "0.30" "0.55" "0.30" "0.30" "0.30" "0.25" "1.00"
2013 May 19
1
Generate positive definite matrix with constraints
Hi, I have a question for my simulation problem: I would like to generate a positive (or semi def positive) covariance matrix, non singular, in wich the spectral decomposition returns me the same values for all dimensions but differs only in eigenvectors. Ex. sigma [,1] [,2] [1,] 5.05 4.95 [2,] 4.95 5.05 > eigen(sigma) $values [1] 10.0 0.1 $vectors [,1]
2013 May 27
1
Question about subsetting S4 object in ROCR
Dear list I'm testing a predictor and I produced nice performance plots with ROCR package utilizing the 3 standard command pred <- prediction(predictions, labels) perf <- performance(pred, measure = "tpr", x.measure = "fpr") plot(perf, col=rainbow(10)) The pred object and the perfo object are S4 with the following slots An object of class "performance"
2009 Aug 10
3
Bug in "seq" (or a "feature") ?
(I use R 2.9.1 with win XP) If I run this code: seq(-0.1,.9, by = .05)[seq(-0.1,.9, by = .05) <= 0.5] I get this output: [1] -0.10 -0.05 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 Why is 0.50 not in the results ? (It seems that it gives a slightly bigger number then 0.5 but I don't understand why it does that) Where as if I try: seq(-0.1,.9, by = .05)[seq(-0.1,.9, by = .05) <=
2010 Apr 13
0
Error using reshape method
To be fair I don't really understand what the error is telling me so I don't know how to correct it. I'm trying to reshape my data so that I do repeated measures ANOVA on it. The warning message: "Error in d[, timevar] <- times[1L] : subscript out of bounds" The program: library(QRMlib) library(Hmisc) ss<-5 mu<- c(0,2,3,12) mu2<- c(0,2,10,20)
2012 Sep 28
2
Converting array to matrix
Hi, I have a 3d array as below, I want to make this array to a matrix of p=50(rows) and n=20(columns) with the coverage values . The code before the array is: library(binom) Loading required package: lattice pi.seq<-seq(from = 0.01, to = 0.5, by = 0.01) no.seq<-seq(from = 5, to = 100, by = 5) cp.all = binom.coverage( p = pi.seq, n = no.seq , conf.level = 0.95, method = "exact")
2005 Feb 02
0
Not reproducing GLS estimates
Dear List: I am having some trouble reproducing some GLS estimates using matrix operations that I am not having with other R procedures. Here are some sample data to see what I am doing along with all code: mu<-c(100,150,200,250) Sigma<-matrix(c(400,80,16,3.2,80,400,80,16,16,80,400,80,3.2,16,80,400),n c=4) sample.size<-100 temp <-
2004 Dec 29
3
gls model and matrix operations
Dear List: I am estimating a gls model and am having to make some rather unconventional modifications to handle a particular problem I have identified. My aim is to fit a GLS with an AR1 structure, obtain the variance-covariance matrix (V), modify it as needed given my research problem, and then reestimate the GLS by brute force using matrix operations. All seems to be working almost perfectly,
2009 Jul 21
1
problem with heatmap.2 in package gplots generating non-finite breaks
I have written a wrapper for heatmap.2 called heatmap.w.row.and.col.clust which auto-generates breaks using breaks<-round((c(seq(from=(-20 * stddev), to=(20 * stddev))))/20, digits = 2) #(stddev in this case = 2.5) This has always worked well in the past but now I am getting an error that non-finite breaks are being generated. Drilling down, it seems that my wrapper is generating finite
2011 Feb 10
3
help - "the condition has length > 1 and only the first element will be used"
Hello there, I don't know if I'm addressing my question to the right e-mail address, I hope I do. Actually I have a little problem concerning writing a code in R. I try to briefly sum up my problem. As you can see below, I created the functions "Equation1" and "Equation2" with some conditions. Equation1 <-function(x){ if
2010 Nov 06
1
Extracting elements of a particular slot from S4 object
Hi there, can anyone tell me how to extract to values of a particular slot for some S4 object? Let take following example: > library(fOptions) > val <-GBSOption(TypeFlag = "c", S = 60, X = 65, Time = 1/4, r = 0.08, b = 0.08, sigma = 0.30) > val Title: Black Scholes Option Valuation Call: GBSOption(TypeFlag = "c", S = 60, X = 65, Time = 1/4, r = 0.08, b =
2013 Jan 24
3
From table to data.frame
Hello, I have a dataframe (test.df) with intervals that were generated by table (see below). I would prefer a dataframe labeled like this: > test.tab <- table(cut(skn.test$density, seq (0,1, by=0.05))) > test.tab (0,0.05] (0.05,0.1] (0.1,0.15] (0.15,0.2] (0.2,0.25] (0.25,0.3] (0.3,0.35] 68 87 85 72 65 73 74 (0.35,0.4] (0.4,0.45]
2003 Apr 11
2
princomp with not non-negative definite correlation matrix
$ R --version R 1.6.1 (2002-11-01). So I would like to perform principal components analysis on a 16X16 correlation matrix, [princomp(cov.mat=x) where x is correlation matrix], the problem is princomp complains that it is not non-negative definite. I called eigen() on the correlation matrix and found that one of the eigenvectors is close to zero & negative (-0.001832311). Is there any way
1998 Nov 14
1
seq() in 0.62.4 and 0.63
Solaris 2.6, R Version 0.63.0 (November 14, 1998) Version 0.62.4 (October 24, 1998) > seq(0.15, 0.70, 0.05) [1] 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 The much reviled (on r-help) 0.62.3 got such simple cases right (even if 0.62.1 did not). Jim Lindsey insisted that such bugs are reported here, so I am. And yes, this is a real example and leads to an