BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
John4
Obsidian | Level 7

I split my data into 70% training 20% validation and 10% test sets.

and i run this code :

 

proc genmod data=valid;
class sexe country job;
model price = country sexe job / dist=gamma link=log;
run;

 

 

 

how can I compute Mean Square Error on validation data set?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Use CODE statement to get VALID table 's predict value.

Once you got predict value , it is easy to get MSE.

 

proc genmod data=train;
class sex country job;
model price=country sex job/dist=gamma link=log;
code file='c:\mycode.sas';
run;
data Score;
set vallid(rename=(price=old_price)) end=last;
%include 'c:\mycode.sas';

sum+(price-old_price)**2;
if last then mse=sum/_n_;
run;

View solution in original post

4 REPLIES 4
Ksharp
Super User

Use CODE statement to get VALID table 's predict value.

Once you got predict value , it is easy to get MSE.

 

proc genmod data=train;
class sex country job;
model price=country sex job/dist=gamma link=log;
code file='c:\mycode.sas';
run;
data Score;
set vallid(rename=(price=old_price)) end=last;
%include 'c:\mycode.sas';

sum+(price-old_price)**2;
if last then mse=sum/_n_;
run;
John4
Obsidian | Level 7

why it's

proc genmod data=train;

and not :

proc genmod data=valid;

I change into "valid" but I got zero as MSE. Is there any function to compute MSE on SAS ?

Ksharp
Super User

use TRAIN to get parameter estimator , so you can use it to score VALID data.

Yes.there is function  MSE to compute, check documentation and better use IML code to get MSE. 

Reeza
Super User

1. Use STORE statement in PROC GENMOD to get model

2. Use PROC PLM with FITSTATISTICS to score dataset and generate stats. 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 5261 views
  • 3 likes
  • 3 in conversation