greg_all {gregRy} | R Documentation |
greg_all
Description
This function runs the Generalized Regression estimator, also know as GREG, on a set of data.
Usage
greg_all(plot_df, estimation, pixel_estimation_means, formula)
Arguments
plot_df |
A data frame containing the response variable, predictors, estimation unit, and resolution unit for each "plot" |
estimation |
A character specifying the estimation column name within the other dataframes |
pixel_estimation_means |
A dataframe with a column for the estimation unit and a column for the mean response variable value per that estimation unit |
formula |
Formula to be used for the model, names should be consistent with the column names in plot_df and pixel_estimation_means |
Value
A dataframe with each row representing each estimation unit, its estimate, and its estimated variance.
Examples
#create plot data
planet_plot_data <- data.frame(plot_number = 1:20,
planet = c(rep("Kashyyyk", 5),
rep("Forest Moon of Endor", 5),
rep("Dagobah", 5),
rep("Naboo", 5)),
count_of_trees = c(204, 156, 240, 286, 263,
112, 167, 131, 25, 145,
141, 65, 127, 15, 98,
100, 12, 49, 94, 69),
forest_cover = c(85, 74, 89, 95, 92,
70, 73, 69, 11, 68,
67, 30, 62, 15, 42,
59, 5, 17, 25, 22))
#create mean data
planet_means <- data.frame(planet = c("Kashyyyk",
"Forest Moon of Endor",
"Dagobah",
"Naboo"),
forest_cover = c(95,
85,
50,
30))
x1 <- greg_all(plot_df = planet_plot_data,
estimation = "planet",
pixel_estimation_means = planet_means,
formula = count_of_trees ~ forest_cover)
x1
[Package gregRy version 0.1.0 Index]