Quantiles without regression

Quarto

Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see https://quarto.org.

Running Code

When you click the Render button a document will be generated that includes both content and the output of embedded code. You can embed code like this:

## Now we are trying the qunantiles with out the regression#
# Read the CSV data

setwd("C:/Users/anune/Downloads")
data <- read.csv("PIC_65_FIRE.AN.csv")

# List of specific ID values
specific_ids <- c("97257312", "96954301", "97916940", "97178088", "96587426", "96587437", "97178318", "96804950", "97257832")

# Subsetting the data based on specific IDs
id_data <- data[data$ID %in% specific_ids, ]

# Specify the quantiles you're interested in (e.g., 0.25, 0.5, 0.75)
quantiles <- c(0.25, 0.5, 0.75)

# Calculate quantiles for the FEED_INTK column
quantile_values <- quantile(id_data$FEED_INTK, probs = quantiles)

# Create a data frame to store the quantiles
quantiles_df <- data.frame(Quantile = names(quantile_values), Value = quantile_values)
# Print the quantiles
print(quantiles_df)
    Quantile Value
25%      25%   235
50%      50%   679
75%      75%  1116
##Now i am including the STAY_IN at the X axis##

# Read the CSV data
data <- read.csv("PIC_65_FIRE.AN.csv")

# List of specific ID values
specific_ids <- c("97257312", "96954301", "97916940", "97178088", "96587426", "96587437", "97178318", "96804950", "97257832")

# Subsetting the data based on specific IDs
#id_data <- as.tibble(subset(data, ID %in% specific_ids))
#id_data <- group_by(id_data, ID)
id_data <- data[data$ID %in% specific_ids, ]


# Specify the quantiles you're interested in (e.g., 0.25, 0.5, 0.75)
quantiles <- c(0.25, 0.5, 0.75)

# Calculate quantiles for the TIME (STAY-IN) column
quantile_values <- quantile(id_data$STAY_IN, probs = quantiles)

# Create a data frame to store the quantiles
quantiles_df <- data.frame(Quantile = names(quantile_values), Value = quantile_values)

# Print the quantiles
print(quantiles_df)
    Quantile Value
25%      25%   602
50%      50%  1730
75%      75%  3183
# Load the necessary libraries (ggplot2 for plotting)
library(ggplot2)
Warning: package 'ggplot2' was built under R version 4.1.3
# Create a bar plot of the quantiles
ggplot(quantiles_df, aes(x = Quantile, y = Value)) +
  geom_bar(stat = "identity", fill = "blue", alpha = 0.7) +
  labs(title = "Quantiles of STAY_IN",
       x = "Quantile",
       y = "STAY_IN") +
  theme_minimal()

##trying a plot for each ID##
# Load the necessary libraries
library(ggplot2)
library(gridExtra)
Warning: package 'gridExtra' was built under R version 4.1.3
# List of specific ID values
specific_ids <- c("97257312", "96954301", "97916940", "97178088", "96587426", "96587437", "97178318", "96804950", "97257832")

# Split the data by ID
data_by_id <- split(data, data$ID)

# Create a list to store the individual QQ plots
qq_plots <- list()

# Create QQ plots for each ID and store them in the list
for (id in specific_ids) {
  id_data <- data_by_id[[id]]
  
  # Create a QQ plot against a theoretical normal distribution
  qq_plot <- ggplot(id_data, aes(sample = FEED_INTK)) +
    geom_qq() +
    geom_qq_line() +
    labs(title = paste("QQ Plot for ID:", id)) +
    theme_minimal()
  
  qq_plots[[id]] <- qq_plot
}

# Arrange the QQ plots in a grid
grid.arrange(grobs = qq_plots, ncol = 3)

You can add options to executable code like this

[1] 4

The echo: false option disables the printing of code (only output is displayed).