# Posts Tagged ‘ matrices ’

## How do I Create the Identity Matrix in R?

June 27, 2012
By

I googled for this once upon a time and nothing came up. Hopefully this saves someone ten minutes of digging about in the documentation. You make identity matrices with the keyword diag, and the number of dimensions in parentheses. > diag(3) [,...

## Selection in R

June 1, 2012
By

The design of the statistical programming language R sits in a slightly uncomfortable place between the functional programming and object oriented paradigms. The upside is you get a lot of the expressive power of both programming paradigms. A downside of this is: the not always useful variability of the language’s list and object extraction operators. Related posts:

## A Function for Adding up Matrices with Different Dimensions

November 24, 2011
By

I was unlucky finding a function that can handle matrices with different dimensions. Thus, I coded a little function that sums up matrices, also coping with matrices with different dimensions.Read more »

## Once you’re comfortable with 2-arrays and 2-matrices, you…

October 15, 2011
By

Once you’re comfortable with 2-arrays and 2-matrices, you can move up a dimension or two, to 4-arrays or 4-tensors. You can move up to a 3-array / 3-tensor just by imagining a matrix which “extends back into the blackboard”. Like a 5 × 5 ma...

## Once you’re comfortable with 2-arrays and 2-matrices, you…

October 15, 2011
By

Once you’re comfortable with 2-arrays and 2-matrices, you can move up a dimension or two, to 4-arrays or 4-tensors. You can move up to a 3-array / 3-tensor just by imagining a matrix which “extends back into the blackboard”. Like a 5 × 5 ma...

## Example 7.37: calculation of Hotelling’s T^2

May 17, 2010
By

Hotelling's T^2 is a multivariate statistic used to compare two groups, where multiple outcomes are observed for each subject. Here we demonstrate how to calculate Hotelling's T^2 using R and SAS, and test the code using a simulation study then apply ...

## Example 7.7: Tabulate binomial probabilities

July 25, 2009
By

Suppose we wanted to assess the probability P(X=x) for a binomial random variate with n = 10 and with p = .81, .84, ..., .99. This could be helpful, for example, in various game settings. In SAS, we ﬁnd the probability that X=x using differences in t...