library(lme4)
(Language) vs (Language): (Method Name)
Introduction
This first section should provide a brief background on the methodology with links to associated journal articles, or relevant sources. This should give the reader a high level overview of the method and its implementation. This will be helpful in setting the stage for the examples and discussion that follow.
Comparisons of Languages
When comparing between languages, it is helpful to have a table with links to the pages with deeper dive of each language for a given method method. For example, this table shows summaries for ANCOVA between R and SAS:
Analysis | Supported in R | Supported in SAS | Results Match | Notes |
---|---|---|---|---|
ANCOVA using general linear model and lsmeans | Yes | Yes | Yes | GLM() function from sasLM with EMEANS=TRUE is the easiest to use and matches SAS |
Further, this table provides a summary of the examples that will be showcased further down in the document related to Poisson regression in R and SAS:
Analysis | Supported in R | Supported in SAS | Results Match | Notes |
---|---|---|---|---|
Scenario 1: Basic Functionality | Example: Yes | Example: Yes | Example 1: Yes Example 2: No |
Specific settings or packages required for exact match |
Scenario 2: Advanced Feature | Example: Yes | Example: Yes | Example 3: Partial | Special considerations for data structure or assumptions |
Libraries or Extensions Needed
This section should describe what libraries, packages, or additional materials needed for the analysis described.
Data Sources for the Analysis
For real data, please provide a means of accessing these data and describe the data source used in the example, especially if it is a new dataset not already in the CAMIS/data/
folder.
For simulated/dummy datasets, please provide reproducible code to generate these data. This includes setting a random seed for reproducible random number generation.
# Simulated dataset for Poisson Regression
set.seed(123)
<- data.frame(
example_data count = rpois(100, lambda = 2),
predictor = rnorm(100)
)
/* Set random seed for reproducibility */
data example_data;
call streaminit(123);
do id = 1 to 100;
count = ranpoi(0, 2); /* Generate random Poisson variable */
predictor = rannor(0);/* Generate random normal variable */
output;
end;
run;
Again, it is important to give credit to the original source of the data used in your example
Statistical Method
Provide any further details or clarifying comments about the methods comparison between the languages here.
Now you can start adding specific examples of how to use these packages or methods to conduct the analysis. It is helpful to include some notes and comments throughout.
Scenario 1: Basic Functionality
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.
For R packages, it is helpful to prepend package names to functions so new readers can understand where specific functions originate, especially with new packages.
# R code for basic Poisson Regression
<- stats::glm(
example_model ~ predictor,
count family = stpoisson(link = "log"),
data = example_data
)
# Summary of the model
summary(example_model)
/* SAS code for basic Poisson Regression */
proc genmod data=example_data;
class predictor;
model count = predictor / dist=poisson link=log;
run;
Describe key options utilized in the code, along with a screenshot showcasing the output.
Scenario 2: Advanced Feature
Provide a detailed description of the scenario. Example: Address specific advanced features or configurations that may be necessary for more complex analyses.
# R code for handling overdispersion
<- stats::glm(
alternative_model ~ predictor,
count family = quasipoisson(link = "log"),
data = example_data
)
# Summary of the alternative model
summary(alternative_model)
/* SAS code for handling overdispersion */
proc genmod data=example_data;
class predictor;
model count = predictor / dist=poisson link=log scale=pearson;
run;
Describe key options utilized in the code, along with a screenshot showcasing the output.
Comparison of Languages
Provide a detailed comparison of the results obtained from the comparison of the langauges and methods. Highlight any differences/similarities and provide explanations if possible.
Statistic | R Result | SAS Result | Match | Notes |
---|---|---|---|---|
Degrees of Freedom | 98 | 98 | Yes | |
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.
Troubleshooting and Edge Cases
List potential issues that users may encounter and propose solutions or troubleshooting steps.
Example:
Issue: Non-convergence in Poisson Regression.
Solution: Check for multicollinearity among predictors, scale the predictors, or switch to a more appropriate model family.
Conclusion
Finally, add a conclusion section to the page. This may take on different forms but should broadly summarize the findings in the comparison of languages, packages, or approaches. In summarizing, be sure to include the advantages/limitations of the packages and approaches so the reader can understand the capabilities of the approaches to the statstical methodology.
There may be instances where you recommend specific languages, packages, or functions. Be sure to provide your rationale for these recommendations.
References
Be sure to include any references or sources used for the analysis here. These could be external links to pages or in-text citations. This will all help the reader find material needed for further evaluation.
R Documentation:
SAS Documentation:
Also, include this Session Info
section. Manually add the packages used in your analysis in a vector, like shown below. This captures the environment used, which is important for reproducibility.
─ Session info ───────────────────────────────────────────────────────────────
setting value
version R version 4.4.2 (2024-10-31)
os Ubuntu 24.04.3 LTS
system x86_64, linux-gnu
ui X11
language (EN)
collate C.UTF-8
ctype C.UTF-8
tz UTC
date 2025-09-17
pandoc 3.6.3 @ /opt/quarto/bin/tools/ (via rmarkdown)
─ Packages ───────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
janitor 2.2.0 2023-02-02 [1] RSPM (R 4.4.0)
readr 2.1.5 2024-01-10 [1] RSPM (R 4.4.0)
survival 3.7-0 2024-06-05 [2] CRAN (R 4.4.2)
[1] /home/runner/work/CAMIS/CAMIS/renv/library/linux-ubuntu-noble/R-4.4/x86_64-pc-linux-gnu
[2] /opt/R/4.4.2/lib/R/library
─ External software ──────────────────────────────────────────────────────────
setting value
SAS 9.04.01M7P080520
──────────────────────────────────────────────────────────────────────────────