similar to: Constructing Matrices

Displaying 20 results from an estimated 10000 matches similar to: "Constructing Matrices"

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,
2005 Jan 03
2
Memory Efficient Methods for Building Matrix
Dear List: I am having to build a block-diagonal matrix (vl) and am currently using the following code. I<-diag(sample.size) vl<-kronecker(I,vl.mat) This code works fine, but for large N, it is a huge memory hog. Is there a more efficient method for constructing vl? Thanks, Harold [[alternative HTML version deleted]]
2005 Feb 10
2
correcting for autocorrelation in models with panel data?
Hi I have some panel data for the 50 US states over about 25 years, and I would like to test a simple model via OLS, using this data. I know how to run OLS in R, and I think I can see how to create Panel Corrected Standard Errors using http://jackman.stanford.edu/classes/350C/pcse.r What I can't figure out is how to correct for autocorrelation over time. I have found a lot of R stuff on
2005 Dec 22
2
bVar slot of lmer objects and standard errors
Hello, I am looking for a way to obtain standard errors for emprirical Bayes estimates of a model fitted with lmer (like the ones plotted on page 14 of the document available at http://www.eric.ed.gov/ERICDocs/data/ericdocs2/content_storage_01/0000000b/80/2b/b3/94.pdf). Harold Doran mentioned (http://tolstoy.newcastle.edu.au/~rking/R/help/05/08/10638.html) that the posterior modes' variances
2005 Feb 04
4
Building a Matrix
Dear List: I am having some difficulty constructing a matrix that must take a specific form. The matrix must be have a lower block of non-zero values and the rest must all be zero. For example, if I am building an n X n matrix, then the first n/2 rows need to be zero and the first n/2 columns must remain as zero with all other elements having a non-zero value that I specify. For example, assume
2004 Oct 08
1
nlme vs gls
Dear List: My question is more statistical than R oriented (although it originates from my work with nlme). I know statistical questions are occasionally posted, so I hope my question is relevant to the list as I cannot turn up a solution anywhere else. I will frame it in the context of an R related issue. To illustrate the problem, consider student achievement test score data with multiple
2004 Sep 08
8
isoMDS
Dear List: I have a question regarding an MDS procedure that I am accustomed to using. I have searched around the archives a bit and the help doc and still need a little assistance. The package isoMDS is what I need to perform the non-metric scaling, but I am working with similarity matrices, not dissimilarities. The question may end up being resolved simply. Here is a bit of substantive
2005 Jan 18
4
Data Simulation in R
Dear List: A few weeks ago I posted some questions regarding data simulation and received some very helpful comments, thank you. I have modified my code accordingly and have made some progress. However, I now am facing a new challenge along similar lines. I am attempting to simulate 250 datasets and then run the data through a linear model. I use rm() and gc() as I move along to clean up the
2010 Jan 07
1
faster GLS code
Dear helpers, I wrote a code which estimates a multi-equation model with generalized least squares (GLS). I can use GLS because I know the covariance matrix of the residuals a priori. However, it is a bit slow and I wonder if anybody would be able to point out a way to make it faster (it is part of a bigger code and needs to run several times). Any suggestion would be greatly appreciated. Carlo
2005 Jan 08
2
Does R accumulate memory
Dear List: I am running into a memory issue that I haven't noticed before. I am running a simulation with all of the code used below. I have increased my memory to 712mb and have a total of 1 gb on my machine. What appears to be happening is I run a simulation where I create 1,000 datasets with a sample size of 100. I then run each dataset through a gls and obtain some estimates. This works
2005 Dec 01
1
Simulate Correlated data from complex sample
Dear List: I have created some code to simulate data from a complex sample where 5000 students are nested in 50 schools. My code returns a dataframe with a variable representing student achievement at a single time point. My actual code for creating this is below. What I would like to do is generate a second column of data that is correlated with the first at .8 and has the same means within
2003 Jun 13
5
covariate data errors
Greetings, I would like to fit a multiple linear regression model in which the residuals are expected to follow a multivariate normal distribution, using weighted least squares. I know that the data in question have biases that would result in correlated residuals, and I have a means for quantifying those biases as a covariance matrix. I cannot, unfortunately, correct the data for these biases.
2013 Apr 19
3
extracting the diagonal of an inverse matrix
Dear R-users, I would like to know whether there is a way to extract a diagonal of an inverse matrix without computing the inverse of the matrix itself. The size of my matrices are really huge and, also using sparse matrix, computing the inverse leads to storage problems and low speed. In other words, given a square matrix A, I aim to know diag(B), where B=solve(A), without computing solve(A).
2007 Jun 29
2
Spectral Decomposition
All of my resources for numerical analysis show that the spectral decomposition is A = CBC' Where C are the eigenvectors and B is a diagonal matrix of eigen values. Now, using the eigen function in R # Original matrix aa <- matrix(c(1,-1,-1,1), ncol=2) ss <- eigen(aa) # This results yields back the original matrix according to the formula above ss$vectors %*% diag(ss$values) %*%
2004 Oct 19
3
matrix of eigenvalues
I thought that the function eigen(A) will return a matrix with eigenvectors that are independent of each other (thus forming a base and the matrix being invertible). This seems not to be the case in the following example A=matrix(c(1,2,0,1),nrow=2,byrow=T) eigen(A) ->ev solve(ev$vectors) note that I try to get the upper triangular form with eigenvalues on the diagonal and (possibly) 1 just
2004 Apr 05
3
2 lme questions
Greetings, 1) Is there a nice way of extracting the variance estimates from an lme fit? They don't seem to be part of the lme object. 2) In a series of simulations, I am finding that with ML fitting one of my random effect variances is sometimes being estimated as essentially zero with massive CI instead of the finite value it should have, whilst using REML I get the expected value. I guess
2005 Mar 01
2
almost lower triangular matrices
I have output from a program which produces a distance matrix I want to read into a clustering program in R. The output is a .txt file and is 'almost' lower triangular in the sense that it is just the triangle below the diagonal. So for example a 4-by-4 distance matrix appears as, 1 2 3 4 5 6 i.e. it looks like a lower triangular of a 3-by3. I thought I might be able
2005 Jul 01
4
Lines for plot (Sweave)
Dear List: I am generating a series of plots iteratively using Sweave. In short, a dataframe is subsetted row by row and variable graphics are created conditional on the data in each row. In this particular case, this code ends up generating 17,000 individual plots. In some cases, all student data (this is working with student achievement data) are available and my code below works very well in
2012 Feb 15
3
built a lower triangular matrix from dataframe
Hello! I'm trying to build a lower triangular matrix (with zeros in the diagonal) from a particular dataframe. The matrix I have to construct has 203 rows and 203 columns and that makes 20503 values to be included within (that's why I can't do it manually). To illustrate the dataframe I have, I'll give you an example of a dataframe and matrix with dimensions 6x6 (to make it
2002 Feb 26
3
a trick ??
Dear R users, Suppose i have an A square matrix rxr. I want to obtain a block matrix B (pxr,pxr) where the p diagonal blocks are A and the others values are 0. I would like to do something like : diag(A,ncol=pr, nrow=pr) How can i do it ?? Thanks in advance, Olivier. -- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- Olivier MARTIN PhD student phone: (33) 04