BookmarkSubscribeRSS Feed
Statsconsultancy
Fluorite | Level 6
I have the following data
data no_of_alerts;
Input doctor alerts error;
cards;
1 1 1
2 1 0
3 1 1
4 1 1
5 1 1
1 2 1
2 2 1
3 2 1
4 2 0
5 2 1
1 3 1
2 3 0
3 3 1
4 3 0
5 3 1
1 4 1
2 4 0
3 4 1
4 4 0
5 4 0
;
Suppose I want to run linear regression model alerts = mean_error, where now Mean_error is the mean error of the alerts. As an example ,for alerts = 1 the mean is 0.8 (1+0+1+1+1)/5). Thus my points will be (1,0.8), (2, 0.8), (3, 0.6) and (4,0.4). Can someone help.

If I use proc reg; Model = alerts = error; run. I get the wrong results.
1 REPLY 1
ArtC
Rhodochrosite | Level 12
I only think that I understand the what and certainly not the why, but here is a first pass:

[pre]
data no_of_alerts;
Input doctor alerts error;
cards;
1 1 1
2 1 0
3 1 1
4 1 1
5 1 1
1 2 1
2 2 1
3 2 1
4 2 0
5 2 1
1 3 1
2 3 0
3 3 1
4 3 0
5 3 1
1 4 1
2 4 0
3 4 1
4 4 0
5 4 0
run;

title1 'mean Errors for each alert';
proc means data=no_of_alerts nway;
class alerts;
var error;
output out=meanerr(keep=alerts meanerror)
mean=meanerror;
run;

title1 'Alerts using Mean Errors';
proc reg data=meanerr;
model alerts=meanerror;
run;
[/pre]

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 620 views
  • 0 likes
  • 2 in conversation