Skip to main content

Posts

Simulation of hemophilia bleeds

A SAS simulation study describing bleeds in hemophilia type A and B patients. Based on the "proof-of-concept study" Randomized, prospective clinical trial of recombinant factor VIIa for secondary prophylaxis in hemophilia patients with inhibitors by Konkle et. al. published in Journal of Thrombosis and Haemostasis, 5: 1904-1913 in 2007.

The epidemiology and design of the study are not in accordance with CONSORT and SPIRIT as of December 2019. We observe 22 included patients (11 in each group) allocated from 20 sites in 11 countries. Neither the randomization nor the analysis is stratified by center, and it is possible to question the logistics of the experiment. People have asked if a condition on the number of bleeds (above 4 for each month in the pre-prophylaxis period) introduces bias: The study is a comparison of the effect of dose-difference not the effect of the drug, although the mean of bleeds in the first period is obviously higher than in the second period. Suspici…
Recent posts

Indicators from numeric factor variables

The macro call below will generate indicators for all factor levels of xfaktor from the data set regdata represented by at least 5 observations. I have developed the macroes to avoid class variables in SAS regression analyses.

%indicator(xfaktor,regdata,5);

/* Macro to generate dummy variables. */
%MACRO GETCON;
  %DO I = 1 %TO &N;
  %IF &&M&I NE 0 %THEN %PUT &factor&I;
  %IF &&M&I = 0 %THEN %GOTO OUT;
    IF &factor = &&M&I THEN &factor&I = 1;
    ELSE &factor&I = 0;
  %OUT: %END;
%MEND GETCON;

%macro indicator(factor,dataset,size);
data tbl_data_;
set &dataset(keep=&factor);
run;
proc sort data=tbl_data_; by &factor; run;
data tbl_;
set tbl_data_;
by &factor;
retain sz;
if first.&factor then sz=1;
else sz=sz+1;
if last.&factor then output;
run;
PROC SORT DATA=tbl_(where=(sz GE &size)) OUT=UNIQUE NODUPKEY;
  BY &factor;
RUN;
/* Assign the largest value of CON to the macro variable N. */
DATA _NULL_;
  SET UNIQUE E…

Graphics in SAS SGPLOT illustrating ANOVA analysis results.

Output and graphics from statistical programming packages are often time-consuming to read and interpret. In peer-reviewed publications you usually provide both a written assessment, tables and graphics illustrating data and analysis results. ANOVA analysis is still a very common analysis technique and it is possible to beautify the output from analysis using PROC SGPLOT

ods graphics;
proc format lib=work;
value timevar
12='0-12 hrs'
18='12-18 hrs'
24='18-24 hrs'
32='Cumulated 0-24 hrs'
;
run;
proc sql;
  create table estimates
    (  Treatment char(12) label='Treatment Group'
     , Time      num      label='Visit number'
     , Time2     num      label='Visit number'
     , TimeVar   char(18) label='Visit number'
     , Mark      char(8)  label='p values'
     , Est       num      label='Est'
     , LCL       num      label='LCL'
     , UCL       num      label='UCL'
    )
  ;
insert into …

T tests in censored normal distribution

T-tests assume normal distributed random variates. We experience designs in which data take on a particular value and are otherwise normal distributed on a half axis. It might be the case in experiments in which a regimen is only applied due to symptoms or the participant's request. In such case a censored normal distribution assumption will increase the strength of the experiment, i.e. statistical power will be increased and assumptions of an underlying normal distribution will be easier to justify.
The suggested test is based on the chi-square likelihood ratio test. The example is two independent groups of identical independently distributed samples and the null hypothesis is identical distributions. The density function splits into single probability, given as the integral of a normal density from negative infinity to the lower bound and the density of the normal distribution for values larger than the lower bound.
The expression involves the distribution function for a Gaussia…

Free electrical energy from central heating and water supply

Anyone investigated central heating and water installations as a source for the generation of electricity? I have a 6-10 bar pressure on water coming from the public supply.
A drop of 4 bar equals potential energy from a 40m waterfall like Queen Mary Falls, Australia. A lot of wasted energy released in your toilet and other places.
How do we make use of all that energy? Central heating is delivered at high pressure and leaves at high pressure after a temperature drop between 30 and 50 degrees.
Can we use 1 bar, 2 bar or 3 bar to slow down the hot water and generate electrical energy and extract more heat before return? Let's calculate. If 100 cubic meter of heated water falls 40 meter, how much energy could we theoretically get, although practically unreasonable?
Approximately 40*10*(100*1000)J or circa 40 kWh.
40 kWh costs circa DKK 90 in Denmark, or USD 13
... or the price of a LED light bulb.

In the US typical household power consumption is about 11,700 kWh each y…

Up-and-down dose response study design

Dose response model and biased coin up-and-down design estimating EV90. A simulation study with a boundary condition and addition of auxilliary data points. PAVA estimators and 2 parameter isotonic regression. 


Experimental Spreadsheet from study with reporting sheet and random numbers sheet, latter should be blinded during the course of the experiment. The study had a minimum of 25 patients.

#Upper boundary of 30 (mL), steps of 2 (mL) #Estimat for number of patients ANTAL<-NULL MU_1<-NULL MU_2<-NULL MU_3<-NULL EV90<-NULL library(Iso) library(drc) iter<-1 while(iter<=10000){ #MEV MEV<-0.9 #Start dose V<-20 #From previous study start dose is probably around MEV92 P<-0.92-(30-V)*0.014 #Defining vectors for simulation succes<-0 coins<-0 kt<-1 #Increase in dose if failure dosedeltaNeg<-2 dosedeltaPos<-2 while(V[kt]<30){ coins[kt]<-runif(1) if(coins[kt]>P[kt]…