Learn R Programming

CosmoPhotoz (version 0.1)

CosmoPhotoZestimator: Photometric redshift estimation from a training dataset and a test dataset

Description

CosmoPhotoZestimator returns photometric redshift estimated from photometric data and a training dataset with photometry and spectroscopy. The estimation is based on generalized linear models (see glmTrainPhotoZ and glmPredictPhotoZ).

Usage

CosmoPhotoZestimator(trainData, testData, numberOfPcs, method, family, robust)

Arguments

trainData
vector containing spectroscopic redshift data and photometry (at least one column shall be called redshift)
testData
vector containing spectroscopic redshift data and photometry (at least one column shall be called redshift)
numberOfPcs
an integer indicating the number of principal components to consider
method
a string containing the chosen GLM method. Two options are available: Frequentist will use the function glm from the package stats; Bayesian will use the function bayesglm from the package arm
family
a string containing gamma or inverse.gaussian (a description of the error distribution and link function to be used in the model)
robust
a boolean indicating if robust PCA should be used or not

Value

a vector with the estimated photometric redshifts

Examples

Run this code
## Not run: 
# # Load the data
# data(PHAT0train)
# data(PHAT0test)
# 
# # Run the analysis
# photoZest <- CosmoPhotoZestimator(PHAT0train, PHAT0test, 6)
# 
# # Create a boxplot showing the results
# plotDiagPhotoZ(photoz = photoZest, specz = PHAT0test$redshift, type = "box")
# ## End(Not run)

Run the code above in your browser using DataLab