Description Usage Arguments Value Author(s) References Examples
Based on a data frame containing measurements and errors, the
takeErrorsIntoAccount
will produce another data frame where each measurement of
the original data frame is replaced by another value taken from a random distribution.
The implemented error model is gaussian, so each value of the output data frame will
be a random sampling from a gaussian distribution where the mean is the value in the
original data frame (indicated by the photometricDataIndexes
column argument)
and the standard deviation is the value from its corresponding error (indicated by the
photometricErrorDataIndexes
column argument). The newly constructed dataframe
is returned by the function.
The user can adapt this function so it can take any error model into account during the UPMASK analysis.
1 | takeErrorsIntoAccount(originalData, dataIndexes, errorIndexes)
|
originalData |
a data frame to use as the baseline |
dataIndexes |
an array of integers indicating the columns corresponding to the measurements |
errorIndexes |
an array of integers indicating the columns corresponding to the errors |
A data frame with the new values sampled from the error distributions.
Alberto Krone-Martins, Andre Moitinho
Krone-Martins, A. & Moitinho, A., A&A, v.561, p.A57, 2014
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Create a simple data set with the values and errors
toyDataDF <- data.frame(x=runif(10, 0, 10), dx=rep(0.2, 10), y=runif(10, 0, 10),
dy=rep(0.1, 10))
# Apply the error models to create another data frame
newToyDataDF <- takeErrorsIntoAccount(toyDataDF, c(1,3), c(2,4))
# Plot the results
plot(toyDataDF$x, toyDataDF$y)
points(newToyDataDF$x, newToyDataDF$y, pch=19, cex=0.8, col="red")
# Clean the environment
rm(list=c("toyDataDF", "newToyDataDF"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.