Skip to content

Commit

Permalink
Merge pull request #268 from orladoylenvs/patch-1
Browse files Browse the repository at this point in the history
SAS v R [updated template]
  • Loading branch information
statasaurus authored Aug 12, 2024
2 parents c747dfa + f926232 commit 79445d6
Showing 1 changed file with 32 additions and 18 deletions.
50 changes: 32 additions & 18 deletions templates/RvsSAS_template.qmd
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
title: "R vs SAS [Name of Method]"
execute:
eval: false
---

------------------------------------------------------------------------


# R vs SAS \[Name of Method\]

Expand All @@ -12,7 +14,7 @@ Provide a brief overview of the analysis, its purpose, and its applications.

**Example:** This section compares the implementation of Poisson Regression in R and SAS. Poisson regression is used to model count data and contingency tables. It's particularly useful for modeling the number of events occurring within a fixed period of time or space.

------------------------------------------------------------------------


## General Comparison Table

Expand All @@ -28,25 +30,25 @@ The following table provides an overview of the support and results comparabilit
| [Scenario 2: Advanced Feature] | Example: [Yes](../R/example_link) | Example: [Yes](../SAS/example_link) | Example 3: Partial | Special considerations for data structure or assumptions |
+-----------------------------------+-----------------------------------+-------------------------------------+--------------------+----------------------------------------------------------+

------------------------------------------------------------------------


## Prerequisites: R Packages

List the R packages required for this analysis. Include a brief description if necessary.

``` r
```{r}
# Example R packages required
library(examplePackage)
library(anotherPackage)
```

------------------------------------------------------------------------


## Example Data

Provide an example of the dataset being used. It's beneficial to include both a small synthetic dataset and instructions on loading a real-world example if applicable.
Provide an example of the dataset being used. For simulated / dummy datasets please provide some context on how you construct the dataset and its relevance to the methodology. For real data please provide the code for how these data can be accessed and a reference that describes the data source.

``` r
```{r}
# Simulate an example dataset for Poisson Regression
set.seed(123)
example_data <- data.frame(
Expand All @@ -73,12 +75,14 @@ proc print data=example_data(obs=10);
run;
```

------------------------------------------------------------------------


## Analysis Scenarios

### Scenario 1: Basic Functionality

Provide a detailed description of the scenario.

#### SAS Code Example

``` sas
Expand All @@ -89,16 +93,21 @@ proc genmod data=example_data;
run;
```

Describe key options utilized in the code, along with a screenshot showcasing the output.


#### R Code Example

``` r
```{r}
# R code for basic Poisson Regression
example_model <- glm(count ~ predictor, family = poisson(link = "log"), data = example_data)
# Summary of the model
summary(example_model)
```

Describe key options utilized in the code, along with a screenshot showcasing the output.

#### Results Comparison

Provide a detailed comparison of the results obtained from both SAS and R. Highlight any differences and provide explanations if possible.
Expand All @@ -109,11 +118,12 @@ Provide a detailed comparison of the results obtained from both SAS and R. Highl
| Coefficient Estimate for Predictor | 0.1 | 0.1 | Yes | |
| p-value | 0.05 | 0.05 | Yes | |

------------------------------------------------------------------------


### Scenario 2: Advanced Feature

Address specific advanced features or configurations that may be necessary for more complex analyses.
Provide a detailed description of the scenario.
**Example:** Address specific advanced features or configurations that may be necessary for more complex analyses.

#### SAS Code Example

Expand All @@ -125,16 +135,20 @@ proc genmod data=example_data;
run;
```

Describe key options utilized in the code, along with a screenshot showcasing the output.

#### R Code Example

``` r
```{r}
# R code for handling overdispersion
alternative_model <- glm(count ~ predictor, family = quasipoisson(link = "log"), data = example_data)
# Summary of the alternative model
summary(alternative_model)
```

Describe key options utilized in the code, along with a screenshot showcasing the output.

#### Results Comparison

Provide a detailed comparison of the results obtained from both SAS and R. Highlight any differences and provide explanations if possible.
Expand All @@ -145,21 +159,21 @@ Provide a detailed comparison of the results obtained from both SAS and R. Highl
| Coefficient Estimate for Predictor | 0.1 | 0.1 | Yes | |
| p-value | 0.05 | 0.05 | Yes | |

------------------------------------------------------------------------


## Special Considerations

Address any additional features or settings that need to be considered. This might include specific configuration settings, handling of special cases, or performance considerations.

**Example:** For handling overdispersion in Poisson Regression, SAS provides the `scale` option in PROC GENMOD, while in R, one may have to switch to a quasi-Poisson family or use negative binomial regression.

------------------------------------------------------------------------


## Summary and Recommendation

Summarize the key findings from the analysis. Highlight any major differences observed and offer recommendations on which software/packages to use. Provide guidance on how to interpret the differences between the results obtained from various software of packages.

------------------------------------------------------------------------


## Troubleshooting and Edge Cases

Expand All @@ -171,7 +185,7 @@ List potential issues that users may encounter and propose solutions or troubles

- **Solution:** Check for multicollinearity among predictors, scale the predictors, or switch to a more appropriate model family.

------------------------------------------------------------------------


## Additional References

Expand All @@ -185,12 +199,12 @@ Provide references and additional reading materials for both R and SAS documenta

- `PROC GENMOD`: <https://documentation.sas.com/doc/en/statcdc/14.2/statug/statug_genmod_overview.htm>

------------------------------------------------------------------------


## Appendix (Optional)

Include any additional information, extended examples, or advanced topics that may be helpful for expert users.

------------------------------------------------------------------------


This template is designed to be comprehensive and flexible, able to accommodate multiple scenarios and diverse datasets. It ensures that each section clearly communicates the necessary information and comparisons, making it easier for users to understand and apply the analyses appropriately across both R and SAS platforms.

0 comments on commit 79445d6

Please sign in to comment.