covCMB: Sample covariance function

Description Usage Arguments Value References Examples

View source: R/Statistics.R

Description

This function provides an empirical covariance function for data in a CMBDataFrame or data.frame. It assumes that data are from a stationary spherical random field and the covariance depends only on a geodesic distance between locations. Output is a binned covariance.

Usage

1
2
3
4
5
6
7
8
9
covCMB(
  cmbdf,
  num.bins = 10,
  sample.size,
  max.dist = pi,
  breaks,
  equiareal = TRUE,
  calc.max.dist = FALSE
)

Arguments

cmbdf

is a CMBDataFrame or data.frame

num.bins

specifies the number of bins

sample.size

optionally specify the size of a simple random sample to take before calculating covariance. This may be useful if the full covariance computation is too slow.

max.dist

an optional number between 0 and pi specifying the maximum geodesic distance to use for calculating covariance. Only used if breaks are unspecified.

breaks

optionally specify the breaks manually using a vector giving the break points between cells. This vector has length num.bins since the last break point is taken as max.dist. If equiareal = TRUE then these breaks should be cos(r_i) where r_i are radii. If equiareal = FALSE then these breaks should be r_i.

equiareal

if TRUE then the bins have equal spherical area. If false then the bins have equal annular widths. Default is TRUE.

calc.max.dist

if TRUE then the max.dist will be calculated from the locations in cmbdf. Otherwise either max.dist must be specified or max.dist will default to pi.

Value

An object of the class CMBCovariance that is a modification of variog from the package geoR with variogram values replaced by covariances.

The attribute "breaks" contains the break points used to create bins. The result has num.bins + 1 values since the first value, the sample variance, is not counted as a bin.

u

a vector with distances.

v

a vector with estimated covariance values at distances given in u.

n

number of pairs in each bin

sd

standard deviation of the values in each bin

bins.lim

limits defining the interval spanned by each bin

ind.bin

a logical vector indicating whether the number of pairs in each bin is greater or equal to the value in the argument pairs.min

var.mark

variance of the data

beta.ols

parameters of the mean part of the model fitted by ordinary least squares

output.type

echoes the option argument

max.dist

maximum distance between pairs allowed in the covariance calculations

n.data

number of data

direction

direction for which the covariance was computed

call

the function call

References

geoR package, variog, variogramCMB, corrCMB

Examples

1
2
3
4
5
6
## Download the map first
# downloadCMBMap(foreground = "smica", nside = 1024)
# df <- CMBDataFrame("CMB_map_smica1024.fits")
# cmbdf <- sampleCMB(df, sample.size = 100000)
# Cov <- covCMB(cmbdf, max.dist = 0.03, num.bins = 10)
# Cov

rcosmo documentation built on Dec. 11, 2021, 9:29 a.m.