First Derivative of Cubic Spline on SAS - sas

How to take first derivative of cubic spline on sas
I am stuck at the below:
proc Transreg data=A;
model identity(y)=spline (x/ nknots=4);
Run;

Use ODS OUTPUT SPLINECOEF=<dataset> to capture the spline coefficients.

Related

How do I create a time plot in SAS?

I am trying to create a scatter plot in SAS. I used the following code below;
proc sgplot data = data1;
series y = data_points x = Date;
run;
However the code creates a scatter plot where the data_points are linked together by a line.
I do not want the data_points to be linked together at all.
How do I solve this problem please?
SERIES -> draws a line plot
SCATTER -> draws a scatter plot
Change SERIES to SCATTER, that's the only change you need.

SAS Density plots in proc fmm

I am fitting a mixture model consisting of 3 Poisson distributions. For my report I would like to obtain the histogram of the response together with the fitted distribution. Normally, it is as simple as using plots=density option in the proc fmm statement, so my code is as follows:
ods graphics on;
proc fmm data=hw1 plots=density(bins=30);
model frequency= / dist=poisson k=3 parms(2.21,2.59,3.13);
probmodel / parms(-0.69,0.11);
freq count;
run;
ods graphics off;
My problem is that the code produces only the histogram without the density. I was wondering if anybody knows if it could be related to the Poisson distribution and proc fmm does not support it? Because when I change the dist=poisson to dist=gaussian it works.
Thank you
This is because the Poisson distribution is a discrete and not a continuous distribution. If you need a continuous distribution, try something like the normal or weibull distributions.

How to estimate a Gaussian mixture model with the EM algorithm in SAS?

I am trying to fit a univariate Gaussian Mixture Model with the EM algorithm. But I only found a package in R (mclust). Does anybody know an equivalent proc step in SAS 9.3?
Check out PROC FMM (Finite Mixture Models). I believe that does what you are looking for.
http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_fmm_overview01.htm

how to plot Y*X with a specified x-axis in SAS

I'm trying to use proc gplot to create a plot of my y-variable against response, but have a specific covariate(z) on the x-axis. Is there a way to do this in gplot? Ive tried yxz, yx yz, and a bunch of other similar things but can't figure it out.
Thanks!
It sounds like a basic plot to me, I prefer PROC SGPLOT because its the easiest/clearest way to specify the X/Y. Assuming it's a scatter use SCATTER, if you want a line, use SERIES.
proc sgplot data=MY_DATA;
SCATTER X=TIME Y=PREDICTED_VAR;
RUN;

Vertical instead of horizontal numbers on x-axis proc univariate

I am drawing a normal histogram using the proc univariate procedure in sas:
proc univariate data=test;
histogram variabel;
run;
My question is simple. How do I make SAS write the text on the 1. axis in a vertical and not horizontal way?
I haven't been able to find a proper answer on the forum.
Thanks in advance.
If you are not using ODS Graphics, then this is fairly easy:
ods graphics off;
axis1 value=(angle=90);
proc univariate data=sashelp.class;
histogram age/haxis=axis1;
run;
This uses the axis options. These only apply to old-style graphics.
In ODS graphics, this is not really possible in a simple fashion. Fully, mandatory rotated axis labels are not possible until 9.4, and even then it is in GTL. You can use annotation to create your own axis labels, though, which is probably your best bet. Either way you wouldn't do it in PROC UNIVARIATE but in a PROC SGPLOT histogram.