cran / saslm Goto Github PK
View Code? Open in Web Editor NEW:exclamation: This is a read-only mirror of the CRAN R package repository. sasLM — 'SAS' Linear Model. Homepage: https://cran.r-project.org/package=sasLM
:exclamation: This is a read-only mirror of the CRAN R package repository. sasLM — 'SAS' Linear Model. Homepage: https://cran.r-project.org/package=sasLM
Hello,
Many thanks to the authors of this new package.
I have been testing it against the reference datasets provided as supplementary materials to this paper:
https://link.springer.com/article/10.1208%2Fs12248-014-9661-0
The results agree with those from the software packages commonly used in the statistical analysis of bioequivalence studies (table 1 of the paper). However, CPU time is much longer (see below) using sasLM than when using author's function "Analyse222BE" which only relies on lm() and drop1(). I noticed that there are some ancillary functions in sasLM which have not been vectorized.
Whereas sasLM may be useful for more complex study designs, there is no clear advantage in using it (only speaking here about its current version i.e. 0.6.3) for balanced and unbalanced 2x2x2 crossover designs.
On a Windows 10 x64 computer with an i7-2600K
File "12248_2014_9661_MOESM7_ESM.txt" contains 2000 rows of data.
##########################################################
library(sasLM)
library(data.table)
BEsasLM <- function (file, alpha=0.05) {
dta <- fread(file=file,header=TRUE)
mescols <- c("Subj","Seq","Per","Trt")
dta <- dta[,mescols:=lapply(.SD,as.factor),.SDcols=mescols]
f1 <- log(Var) ~ Seq/Subj + Per + Trt
print(T3test(f1, dta, "Seq:Subj"))
ci0 <- CIest(f1, dta, "Trt", c(-1, 1),1-2*alpha) ; ci0 # 90% CI
print(exp(ci0[1,c("Estimate", "Lower CL", "Upper CL")])) # 90% CI of GMR
}
system.time(BEsasLM("12248_2014_9661_MOESM7_ESM.txt", alpha=0.05))
$Seq
Error: 1Seq:Subj + 0MSE
Df Sum Sq Mean Sq F value Pr(>F)
Seq 1 129.18 129.176 426.75 < 2.2e-16
Error 998 302.09 0.303
$The Rest Terms
Df Sum Sq Mean Sq F value Pr(>F)
Per 1 221.566 221.566 719.2442 < 2.2e-16
Trt 1 3.342 3.342 10.8472 0.001024
Seq:Subj 998 302.090 0.303 0.9826 0.609149
RESIDUALS 998 307.438 0.308
Estimate Lower CL Upper CL
0.9215024 0.8846037 0.9599403
user system elapsed
2083.15 2.89 2089.66
============ to compare with ====================================
system.time(Analyse222BE("12248_2014_9661_MOESM7_ESM.txt", alpha=0.05))
222-BE analysis executed for '12248_2014_9661_MOESM7_ESM.txt' on 22-NOV.-2021 20:03:50.
_
Type I sum of squares: Analysis of Variance Table
Response: log(Var)
Df Sum Sq Mean Sq F value Pr(>F)
Trt 1 3.3415 3.3415 10.84720 0.0010242
Per 1 221.5658 221.5658 719.24417 < 2.22e-16
Seq 1 129.1755 129.1755 419.32802 < 2.22e-16
Subj 998 302.0898 0.3027 0.98261 0.6091493
Residuals 998 307.4376 0.3081
Type III sum of squares: (mimicking SAS/SPSS but with Seq tested against Subj)
log(Var) ~ Trt + Per + Seq + Subj
Df Sum Sq Mean Sq F value Pr(>F)
Trt 1 3.3415 3.3415 10.84720 0.0010242
Per 1 221.5658 221.5658 719.24417 < 2.22e-16
Seq 1 129.1755 129.1755 426.75115 < 2.22e-16
Subj 998 302.0898 0.3027 0.98261 0.6091493
Residuals 998 307.4376 0.3081
Back-transformed PE and 90% confidence interval
CV (%) ..................................: 60.06
Point estimate (GMR).(%).................: 92.15
Lower confidence limit.(%)...............: 88.46
Upper confidence limit.(%)...............: 95.99
user system elapsed
5.32 0.04 5.41
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.