matrix

  1. L

    extract first value from multiple columns

    i am trying to do this in R. it is equivalent to the stata command rowfirst suppose i have four columns as shown below (T1, T2, T3, T4). I want to create a new column (TX) which contains for each row the first element in columns T1:T4. ID T1 T2 T3 T4 A 0 2 4 5 B . . 6 5 C . 8...
  2. L

    R - bootstrap confidence intervals, Create a matrix, Perform stepwise regressions

    I'm brand to statistics and taking my 1st class in almost 40 years, so I'm quite a bit behind the times. On top of all of that, I am not very computer savvy, and have very little experience using any technical functions with computers, outside of checking email. I have no programming experience...
  3. H

    Correlation matrix with significance

    Does anyone have a ready-made function or know a way to produce a correlation matrix with asterisks marking significance levels in R?
  4. M

    how to assess matris/areas overlapping

    I have two binary matrixes, of the same size (e.j. 5000x5000). Those matrixes represent the same area, divided in cells of the same size. Each cell of one matrix can be true or false, meaning some property is present or not in this cell. One matrix represents the presence of a property A, and...
  5. I

    how to normalize demand/availability matrix for Citibike data

    I am not a statistician but would appreciate an outside perspective on my current project analyzing citibike data. This is a bit complicated so please bear with me. My goal is to determine to what extent bikes are delivered to stations when they need them, that is, the the average amount of...
  6. G

    R Distance Matrix

    I have my data in the following form i.e. Sample,Abundance -- These are the headers of the table. C1,345 C2,280 K1,250 K2,562 Kindly let me know how can I create a distance matrix from this data which I can further use to plot Principle Component Analysis in R. TIA
  7. S

    Test on Two Mean Vectors

    Hello. I am currently taking a multivariate statistics course and having trouble with this problem. Test Ho: μ' =(6,11) ....... 3 10 Y = (6 12) ...... 5 14 ...... 10 9 I know I need to find the combined T^2 but am not really sure where to start or what steps to...
  8. L

    Symmetrical matrix

    Hi, I have a vector representing distances between cities. I have an nxn matrix looking like : Manchester Leeds London Manchester Leeds London I'm trying to get the distances loaded to the matrix but I only have distances in one direction so I need to...
  9. T

    Scaling the rows of a matrix

    I'm facing a problem while scaling(z-transform) the row values of a numeric data matrix,using the following code: rm(list=ls()) set.seed(12345) my.mat <- matrix(rnorm(120,0,0.5),nrow=6,byrow=TRUE) rownames(my.mat) <- paste("s",1:6,sep="") colnames(my.mat) <- paste("g",1:20,sep="")...
  10. C

    Analysis for behavior change over sample treatments

    Hello all! My research examined if social behaviors in animals changed with the distribution of food treatment (clumped vs. dispersed food). My data is non-parametric. I have matrices of interaction rates between individuals. I ran Mantel tests between the interaction matrices of the...
  11. I

    Puzzled by Correlation

    This is a real problem although I'm using a made-up statistic (# of apples) for this. Say I am interested in how many apples people eat in a year. This varies by many factors. First I look at the country difference (the US vs. Canada). From historical data of the average number of apples...
  12. C

    How to create a matrix for Multidimensional Scaling

    Hi, I have the answers from a few respondents with comparisons between organisations. In spss he respondents are in the rows and the variables (columns) are called: Rotary - Unicef, Rotary - Amnesty, Unicef - Amnesty etc. I now want to create a matrix with the responses in it (of one...
  13. L

    Strange behaviour with Cbind

    Hi, I'm trying to reshape data and as part of this I have a data object containing a data frame that can have multiple pairs of XY columns and around 400 rows of numbers. I need to run a function for each pair of XY columns. Eventually I'm looking to loop through the frame and extract...
  14. J

    What is a anti-image correlation matrix?

    Hello, I am currently doing an homework on Factor Analysis and PCA in SPSS and I have to present the Anti-image matrix and explain what it is. However, after having searched on google, all I found was this : The anti-image of the correlation matrix is the negative of the partial correlations...
  15. S

    Averaging rows from a matrix

    I'm fairly new to using R, and wonder if someone could give me some help subsetting large data matrices in specific ways. I've attached a data file. It measures the percent of light reflected off of plants at 2048 different wavelengths. The first column is wavelength, which ranges from 339.99...
  16. J

    Custom function applied to elements in matrix

    So i have the function: p^x/(1-p)^y. I want to produce a 10x10 matrix, where each element within the matrix is evaluated by the above function. where x and y=1,2,..,10, and p=0.3 for example. So the matrix at (1,1) would be (0.3^1 / (1-0.3)^1)=0.4285714 at (1,2) would be (0.3^1 /...
  17. S

    Representing a MLR equation on its matrix form

    Hi everyone, So my teacher was showing us how to find the B coeficients of a Multiple Linear Regression equation (Bo+B1x1+Bnxn) using matrixes and he told us to use this chart to represent the equation in the matrix form but I don't understand how to use it. Supposedly, with this chart you...
  18. Z

    Command to export loadings in CatPCA?

    Hi, In factor analysis, it is possible to automatically export factor loadings using the matrix subcommand, like: /MATRIX OUT (FAC='C:\User\dir\loading$matrix.sav') Under CatPCA, this option is apparently not available. When there's several dozens (in my case: 150+) successive...
  19. Z

    SPSS matrix command will not run within macro

    Hi, Have a matrix command section embedded in a macro. The matrix commands run OK when not within the macro. But they are not executed when placed within a macro. Normally matrix programs should be alright within macros...
  20. T

    Splitting a matrix

    Hi, I have a matrix x with 97 rows and used the function sample like this : rownumbers=sample(1:97,size=70) data1=x[rownumbers,] I'm having trouble to get the rows which are not inside data1 into another matrix. Does anyone have an idea? greets, Taibo