Hello after struggling with using R for the last couple of days I was hoping someone could help me with a statistical analysis I am completing for an environmental science honours project. Using R statistics is not something we have been taught and I am worried that I may have bitten of more then I can chew, however my whole project is based around the hierarchical partitioning method and the exhaustive search multiple regression analysis method.
I have converted my dataset to a .csv file with seven independent variables and one dependant variable with around 400 replicates (my intention is to do this analysis on eight datasets in total with different amounts of replicates and another dependant variable, but I am starting with this one). The dependant variable is GPP, the independent variables are, NDVI, Temperature, Precipitation, Solar Radiation, Nutrient Availability and Soil Available Water Capacity.
Secondly I imported the .csv file into R using the script
GPPANDDRIVER <- read.table("C:\\etc, header=T, sep=",")
This works fine and I can edit the table using
After looking at the
hier.part package documentation available here it seems like I need to define Y which in the script below is the dependent variable and define
scan which is the independent variables (mentioned before).
hier.part(y, xcan, family = "gaussian", gof = "RMSPE", barplot = TRUE)
I was defining the dependant
y vector as
y <- as.vector(GPPANDDRIVER["GPP"])
This also works fine and I have my y vector. However I am not sure how to load independent variables onto the xcan dataframe part of the script. I have tried typing in two scripts but they have not worked.
xcan <- as.vector(GPPANDDRIVER[-GPP]) ## AND xcan <- data.frame(GPPANDDRIVER[-GPP])
If anyone could help me find the right script for representing my independant variables as xcan that would be greatly appreciated. Also once defined if I entered in the hier.part script mentioned above would R then show me results of the analysis after processing? I will be moving onto to the regression analysis after this if anyone can shed some light on this first problem.
*information on hier.part arguments.* **Arguments** y a vector containing the dependent variables xcan a dataframe containing the n independent variables family family argument of glm gof Goodness-of-fit measure. Currently "RMSPE", Root-mean-square ’prediction’ error, "logLik", Log-Likelihood or "Rsqu", R-squared print.vars if FALSE, the function returns a vector of goodness-of-fit measures. If TRUE, a data frame is returned with first column listing variable combinations and the second column listing goodness-of-fit measures.