Thursday
TomHsiung
Pyrite | Level 9
Member since
01-04-2018
- 130 Posts
- 50 Likes Given
- 3 Solutions
- 7 Likes Received
-
Latest posts by TomHsiung
Subject Views Posted 563 a week ago 727 a week ago 1065 a week ago 1168 2 weeks ago 1189 2 weeks ago 1217 2 weeks ago 363 2 weeks ago 554 03-09-2025 04:04 AM 628 03-08-2025 06:02 AM 679 03-08-2025 01:41 AM -
Activity Feed for TomHsiung
- Liked Re: Can we do the approximately unbiased estimator for the probability density function of cont. var for Season. a week ago
- Posted Re: Can we do the approximately unbiased estimator for the probability density function of cont. var on Statistical Procedures. a week ago
- Liked Re: Can we do the approximately unbiased estimator for the probability density function of cont. var for FreelanceReinh. a week ago
- Liked Re: Can we do the approximately unbiased estimator for the probability density function of cont. var for Season. a week ago
- Posted Re: Can we do the approximately unbiased estimator for the probability density function of cont. var on Statistical Procedures. a week ago
- Liked Re: Can we do the approximately unbiased estimator for the probability density function of cont. var for Season. a week ago
- Got a Like for Re: Can we do the approximately unbiased estimator for the probability density function of cont. var. a week ago
- Posted Re: Can we do the approximately unbiased estimator for the probability density function of cont. var on Statistical Procedures. a week ago
- Liked Re: Can we do the approximately unbiased estimator for the probability density function of cont. var for Season. a week ago
- Liked Re: Can we do the approximately unbiased estimator for the probability density function of cont. var for Sa_S. 2 weeks ago
- Posted Re: Can we do the approximately unbiased estimator for the probability density function of cont. var on Statistical Procedures. 2 weeks ago
- Liked Re: Can we do the approximately unbiased estimator for the probability density function of cont. var for Season. 2 weeks ago
- Got a Like for Re: Can we do the approximately unbiased estimator for the probability density function of cont. var. 2 weeks ago
- Posted Re: Can we do the approximately unbiased estimator for the probability density function of cont. var on Statistical Procedures. 2 weeks ago
- Liked Re: Can we do the approximately unbiased estimator for the probability density function of cont. var for Sa_S. 2 weeks ago
- Got a Like for Can we do the approximately unbiased estimator for the probability density function of cont. var?. 2 weeks ago
- Posted Can we do the approximately unbiased estimator for the probability density function of cont. var? on Statistical Procedures. 2 weeks ago
- Liked Re: SAS data platform, where? Accessible? for Ksharp. 2 weeks ago
- Liked Re: SAS data platform, where? Accessible? for quickbluefish. 2 weeks ago
- Posted SAS data platform, where? Accessible? on Administration and Deployment. 2 weeks ago
-
My Liked Posts
Subject Likes Posted 1 a week ago 1 2 weeks ago 1 2 weeks ago 2 04-23-2024 02:51 AM 2 04-19-2024 11:38 AM
10-30-2024
09:21 AM
Thanks for the suggestion, sir. But I think I must first understand the G- and R-side models first. I know understand the formula of a general linear mixed model but the textbook I read does not discuss this topic in detail.
... View more
10-24-2024
08:08 AM
Hello, @Ksharp
I spent a couple of weeks learning the general linear mixed model. The model is in the form of the formula in the screenshot.
We can use the maximum likelihood method or matrix of variance-covariance to solve the point and interval estimation of the regression coefficients. What I don't understand is: What is the difference between the G- and R-side models? Both belong to the general linear mixed model, so they have the same model formula.
... View more
- Tags:
- to
09-30-2024
10:52 AM
Thanks for the update and I have additional questions.
What is the function of this line?
*random intercept / subject = Patient_ID;
With this line un-asterisked, I had the error:
NOTE: An R-side variance component is confounded with the profiled variance.
NOTE: The GLIMMIX procedure is modeling the probability that inr_attain='1'.
NOTE: Did not converge.
NOTE: The GLIMMIX procedure deleted the model item store WORK.MIXEDMODEL because of incomplete information for a subsequent
analysis.
In addition, in proc mixed, the random and repeated statements are used to represent between- and within-individual differences. What about the proc glimmix?
... View more
09-11-2024
08:47 AM
The fix should be this,
proc glimmix data = highlow_1;
class Patient_ID Gender measure;
model inr_attain(event = '1') = measure Gender / dist = binary solution;
*random intercept / subject = Patient_ID;
random measure / subject = Patient_ID residual;
store out = mixedmodel;
run;
proc plm source = mixedmodel;
effectplot interaction(x = measure sliceby = Gender) / limits connect;
run;
The graph
... View more
09-11-2024
08:38 AM
But we would like to treat the variable of measure as a class variable.
proc glimmix data = highlow_1;
class Patient_ID Gender measure;
model inr_attain(event = '1') = measure Gender / dist = binary solution;
random intercept / subject = Patient_ID;
random measure / subject = Patient_ID residual;
store out = mixedmodel;
run;
proc plm source = mixedmodel;
effectplot interaction(x = measure sliceby = Gender) / limits connect;
run;
And this produced the "Did not converge." outcome.
... View more
09-11-2024
08:34 AM
proc glimmix data = highlow_1;
class Patient_ID Gender;
model inr_attain(event = '1') = measure Gender / dist = binary solution;
random intercept / subject = Patient_ID;
*random measure / subject = Patient_ID residual;
store out = mixedmodel;
run;
proc plm source = mixedmodel;
effectplot slicefit(x = measure sliceby = Gender) / limits;
run;
This is the measure as G side random effect and it produces the graph.
... View more
08-30-2024
08:47 AM
Update on 30Aug2024
I edited the raw data using SAS Viya for Learners. Then I made the chord diagram by the "circlize" package in R. Below is the medical reference I read recently, and the strips connect journal names and article tags. Cool stuff!
Many thanks for your attention!
... View more
08-29-2024
12:34 AM
Hi, I have received replies form SAS support staff. It looks like it is not possible to connect SAS Viya for Learners from python SWAT on a client.
Hi Tom,
Thanks for your enquiry to SAS.
SAS Viya for Learners is typically sandboxed so REST API calls outside of the environment are generally not possible.
Can you please specify if you are participating in the SAS Hackathon or or what you are trying to do exactly ?
And
Hey Tom,
This is *** from SAS Technical Support. We've received your case *** regarding the Python access to the SAS Viya issue.
The question you are inquiring about falls under concerns relating to the usage of SAS OnDemand for Academics/ SAS Viya for Learners, Unfortunately, Technical Support is limited to access assistance and unable to assist with usage issues for SAS OnDemand for Academics/ SAS Viya for Learners, as per the SAS OnDemand for Academics license agreement, and you get trouble with software regarding usage, how do you get support?
I would recommend checking out the SAS Software for Learning Community. The SAS Communities has wonderful resources available on our SAS Software for Learning Community for help with programming and content questions. Click here for instructions on how to get fast, helpful answers. Additionally, you may also want to consult your instructor for further usage assistance
I hope this helps!
Best Regards,
... View more
08-26-2024
01:24 AM
Update:
I can install and use the circlize library in JupyterLab R console. But when I tried to do the same in JupyterLab SAS console, I got errors.
WARNING: R: Warning in install.packages("circlize") :
WARNING: R: 'lib = "/opt/sas/viya/home/sas-pyconfig/R-4.2.2.1717422377/lib64/R/library"' is not writable
ERROR: R: Error in askYesNo(gettext("Would you like to use a personal library instead?"), :
ERROR: R: Unrecognized response “library(circlize)”
Output from JupyterLab R console:
Codes in JupyterLab SAS console:
proc iml;
submit / R;
Sys.setenv(R_LIBS_USER="/opt/conda/lib/R/library")
install.packages("circlize")
library(circlize)
# Input matrix
values <- c(
1,0,0,2,0,
1,0,1,1,0,
1,0,0,0,0,
1,0,0,0,0,
4,0,3,4,0,
7,2,4,10,0,
2,0,0,0,0,
1,0,1,1,1,
1,0,0,0,0,
7,0,10,15,0,
0,0,0,1,0,
1,0,0,0,0,
1,0,0,1,0,
4,0,1,6,0,
4,0,0,4,0,
1,0,0,1,0,
1,0,0,2,0,
0,0,0,1,0,
1,0,0,2,0,
11,1,36,33,6
)
matrix <- matrix(values, 5, 20)
# Labeling
rownames(matrix) <- c("Age 65 to 80", "Over 80", "Age 30 to 50", "Age 50 to 65", "Less than 30") # Label the row categories
colnames(matrix) <- c("Atrial fibrillation", "AF, DM", "AF, DM, HF", "AF, DM, HF, HTN", "AF, HF", "AF, HF, HTN", "AF, HF, Stroke", "AF, HTN",
"AF, HTN, Stroke", "AF, Stroke", "Diabetes", "DM, HF, HTN", "DM, HTN", "DM, HTN, Stroke", "Heart failure", "HF, HTN", "Hypertension",
"HTN, Stroke", "No comorbidity", "Stroke") # Label the column categories
# Define colors
colors <- c("Over 80" = "Red", "Age 50 to 65" = "#008000", "Age 30 to 50" = "Orange", "Age 65 to 80" = "#ffef00", "Less 30" = "#2a52be", "No comorbidity" = "black", "Atrial fibrillation" = "#ff0800", "Diabetes" = "#a52a2a", "Hypertension" = "#ffbcd9")
# Generate the chord diagram
# chordDiagram(matrix, transparency = 0.6, annotationTrack = c("axis", "grid")) # Make the chord diagram
circos.par(canvas.xlim = c(-0.80, 0.80), canvas.ylim = c(-0.80, 0.80))
chordDiagram(matrix, grid.col = colors, scale = FALSE, annotationTrack = c("grid", "axis"),
preAllocateTracks = list(track.height = max(strwidth(unlist(dimnames(matrix))))))
circos.track(track.index = 1, panel.fun = function(x, y) {
circos.text(CELL_META$xcenter, CELL_META$ylim[1], CELL_META$sector.index,
facing = "clockwise", niceFacing = TRUE, adj = c(-0.30, 0), cex = 0.50)
}, bg.border = NA) # here set bg.border to NA is important
title(main = "Figure 1 Relationship between age categories and comorbidities", font.main = 1)
endsubmit;
quit;
... View more
08-26-2024
12:57 AM
Thank you very much and it works. Although by default the package of circlize is not installed, I just built it up. Great!
Regards,
Tom
... View more
08-25-2024
10:10 AM
Hi, Pal Many thanks. I access SAS Viya for learners and I believe I cannot modify the R_Home environment.
... View more
08-25-2024
02:07 AM
@ballardw Thank you for the clarification. And based on your codes, i.e. the cats(F_sex, F_age) part. I developed my own code lines. Below,
proc sql noprint;
create table food_2 as
select *,
cats(Category) as xvar,
'By category' as Group
from food_raw
union all
select *,
case
when Day lt 10 then '1 Early'
when Day ge 10 and Day lt 20 then '2 Middle'
when Day ge 20 then '3 Late'
end as xvar,
'By date' as Group
from food_raw;
quit;
proc sgpanel data = food_2;
title 'Quarterly total cost';
panelby quarter;
vbar xvar / groupdisplay = cluster group = Group response = Cost stat = sum transparency = 0.00;
label Category = 'Spending category';
label Cost = 'Total cost & Total cost (mean, 95%CI)';
label xvar = 'Spendings';
run;
Output:
... View more
08-25-2024
01:22 AM
Hello, pals
CAS does not support the R library circlize. Codes:
proc iml;
run ExportDataSetToR("WORK.chord_1", "RCBD_IN_R");
submit / R;
library(circlize) values <- c(2, 0, 0, 3, 7, 1, 29, 1, 22, 15, 0, 3, 0, 0, 1, 1, 18, 0, 15, 5, 1, 15, 0, 10, 9)
matrix <- matrix(values, 5, 5) # a matrix with 5 rows and 5 columns
matrix2 <- t(matrix)
print(matrix)
print(matrix2)
rownames(matrix2) <- c("Day 4 Danger", "Day 4 Optimal", "Day 4 Over", "Day 4 Suboptimal", "Day 4 Under")
colnames(matrix2) <- c("Day 7 Danger", "Day 7 Optimal", "Day 7 Over", "Day 7 Suboptimal", "Day 7 Under")
colors <- c("Day 4 Danger" = "Red", "Day 4 Optimal" = "#008000", "Day 4 Over" = "Orange", "Day 4 Suboptimal" = "#318ce7", "Day 4 Under" = "Yellow", "Day 7 Danger" = "#ff033e", "Day 7 Optimal" = "#a4c639", "Day 7 Over" = "#ffbf00", "Day 7 Suboptimal" = "#5d8aa8", "Day 7 Under" = "#e9d66b")
chordDiagram(matrix2, grid.col = colors, transparency = 0.6);
endsubmit;
quit;
Logs:
ERROR: R: Error in library(circlize) : there is no package called ‘circlize’
Can we import the library in the SAS Viya CAS? Thanks.
... View more
08-24-2024
04:42 AM
Thanks for the code lines.
Hmmm, so the xvar variable contains two category systems - by sex and by age. There must be repeated rows in the dataset, I think, that is the rows whose xvar variable has either F or M values, in addition to the same rows but instead whose xvar values are those age categories. Correct?
... View more