Was this page helpful?

The score and mean matrices have different sizes. How do I get the mean for a particular sample?

From $1

    Table of contents
    No headers

    Here are two ways to do this:

    • figure out which cell corresponds to a given sample and pulse:

    sample <- 213;  pulse <- 561                            ## just example numbers
    cell.row  <- 1 + floor((sample - 1) / RSS$cell.dims[1])
    cell.col  <- 1 + floor((pulse - 1)  / RSS$cell.dims[2])
    cell.mean <- RSS$mean.mat[cell.row, cell.col]
    cell.dev  <- RSS$dev.mat [cell.row, cell.col]

    • create a full-size mean matrix by replicating values:

    cell.rows <- c(1 + floor((row(RSS$scan.mat[]) - 1) / RSS$cell.dims[1]))
    cell.cols <- c(1 + floor((col(RSS$scan.mat[]) - 1) / RSS$cell.dims[2]))
    means <- matrix(RSS$mean.mat[cbind(cell.rows, cell.cols)], dim(RSS$scan.mat))
    devs  <- matrix(RSS$dev.mat [cbind(cell.rows, cell.cols)], dim(RSS$scan.mat))

    To confirm the calculations, move the pointer over a spot in the plot window and record the sample, pulse, mean and deviance from the pointerinfo popup.  Then use the sample and pulse numbers in the calculations for the first method, or look up the mean and deviance from the second method:

    means[sample, pulse]
    devs[sample, pulse]

    These should be identical to the values from the pointerinfo popup.

    Was this page helpful?
    Tags: (Edit tags)
    • No tags
     
    Comments (0)

     
    Powered by MindTouch Core