Set Magento website template, skin and layout programmatically

$groups['theme']['fields']['template']['value'] = 'template_name';
$groups['theme']['fields']['skin']['value'] = 'skin_name';
$groups['theme']['fields']['layout']['value'] = 'layout_name';
$groups['theme']['fields']['default']['value'] = 'template_name';
Mage::getModel('adminhtml/config_data')  
      ->setSection('design')  
      ->setWebsite('your_website')  
      ->setGroups($groups)  
      ->save(); 

Alternate method:

$installer->setConfigData('design/theme/template', 'facebook', 'stores', $store->getId());
$installer->setConfigData('design/theme/skin', 'facebook', 'stores', $store->getId());
$installer->setConfigData('design/theme/layout', 'facebook', 'stores', $store->getId());
$installer->setConfigData('design/theme/default', 'facebook', 'stores', $store->getId());