// import the data and transform the variables Data = webimport("www.bayeconsoft.com/datasets/PWT.csv"); Data.constant = 1; Data.logY = log(Data.Y); Data.logK = log(Data.K); Data.logL = log(Data.L); // normalize inputs and create interaction terms Data.logK = Data.logK - mean(Data.logK); Data.logL = Data.logL - mean(Data.logL); Data.logKlogK = Data.logK.*Data.logK; Data.logKlogL = Data.logK.*Data.logL; Data.logLlogL = Data.logL.*Data.logL; Data.tlogK = Data.trend.*Data.logK; Data.tlogL = Data.trend.*Data.logL; // run the Cobb-Douglas model and request the calculation of the Chib and // Jeliazkov approximation to the logarithm of the marginal likelihood CobbDouglas = lm(logY ~ constant logK logL trend, "logML_CJ" = true); // run the translog model and request the calculation of the Chib and // Jeliazkov approximation to the logarithm of the marginal likelihood Translog = lm(logY ~ constant logK logL trend logKlogK logKlogL logLlogL tlogK tlogL, "logML_CJ" = true); // compare the two models using the Lewis-Raftery approximation pmp( { CobbDouglas, Translog } ); // compare the two models using the Chib-Jeliazkov approximation pmp( { CobbDouglas, Translog }, "logML_CJ"=true );