class_docstr: # From R
  setwd('c:/workspace')
  data <- read.csv('cpunish.csv', sep=",")
  
  library(statmod)
  library(tweedie)
  
  summary(glm(EXECUTIONS ~ INCOME + SOUTH - 1,
          family=tweedie(var.power=2, link.power=1),
          data=data))
class_docstr_tok: ["#","From","R","setwd","(","'","c",":","\/workspace","'",")","data","<","-","read.csv","(","'cpunish.csv","'",",","sep=","''",",","''",")","library","(","statmod",")","library","(","tweedie",")","summary","(","glm","(","EXECUTIONS","~","INCOME","+","SOUTH","-","1",",","family=tweedie","(","var.power=2",",","link.power=1",")",",","data=data",")",")"]
code: def __init__(self):
      resid_resp = [
          28.9397568116168,
          0.605199215492085,
          4.30845487128123,
          -3.7059362524505,
          -4.91921022348665,
          0.46200835064931,
          0.068864196242604,
          -6.07952005594693,
          -1.01093636580438,
          -6.9396210244365,
          -0.768038385056284,
          -0.573568809339664,
          -6.94944844711606,
          -1.16600175635393,
          -0.641510318056987,
          -0.403667790321936,
          -0.737611172529194,
      ]
      resid_dev = [
          2.03295746713119,
          0.0704291140028282,
          1.60058476017728,
          -0.591230836989137,
          -0.836067997150736,
          0.274690511542166,
          0.0352446721149477,
          -1.13465831620614,
          -0.625909330466303,
          -1.5477830210949,
          -0.520517540529698,
          -0.421531194473357,
          -1.54848147513823,
          -0.684927882583903,
          -0.45784673829438,
          -0.320960880764019,
          -0.505992145923248,
      ]
      resid_pear = [
          3.59043221590711,
          0.0720921473930558,
          2.54705286789752,
          -0.480919661289957,
          -0.621174344999372,
          0.300397177607798,
          0.0356599448410699,
          -0.752460543924524,
          -0.502719222246499,
          -0.874049404005278,
          -0.434401419984914,
          -0.364501892726482,
          -0.874205109115113,
          -0.538319857282425,
          -0.390804925805356,
          -0.287580717535275,
          -0.424497254731367,
      ]
      resid_work = [
          28.9397568116168,
          0.605199215492085,
          4.30845487128123,
          -3.7059362524505,
          -4.91921022348665,
          0.46200835064931,
          0.068864196242604,
          -6.07952005594693,
          -1.01093636580438,
          -6.9396210244365,
          -0.768038385056284,
          -0.573568809339664,
          -6.94944844711606,
          -1.16600175635393,
          -0.641510318056987,
          -0.403667790321936,
          -0.737611172529194,
      ]
      self.resid_response = resid_resp
      self.resid_deviance = resid_dev
      self.resid_pearson = resid_pear
      self.resid_working = resid_work
      # self.null_deviance = 3731.85161919 # N/A
      self.params = [4.72472244209477e-05, 6.43243456540827]
      self.bse = [1.86839521185429e-05, 3.83231672422612]
      # self.aic_R = 522.14215776 # R adds 2 for dof to AIC
      # self.aic_Stata = 7.459173652869477  # stata divides by nobs
      # self.deviance = 70.6652992116034   # from Stata
      self.deviance = 15.7840685407599  # from R
      # self.scale = 1.0
      # self.llf = -250.0710778504317  # from Stata, ours with scale=1
      # self.bic_Stata = -179.9959200693088 # no bic in R?
      self.df_model = 1
      self.df_resid = 15
  
      # TODO: taken from Stata; not available in sm yet
      # self.chi2 = 2699.138063147485
  
      self.fittedvalues = [
          8.06024318838318,
          8.39480078450791,
          1.69154512871877,
          7.7059362524505,
          7.91921022348665,
          1.53799164935069,
          1.9311358037574,
          8.07952005594693,
          2.01093636580438,
          7.9396210244365,
          1.76803838505628,
          1.57356880933966,
          7.94944844711606,
          2.16600175635393,
          1.64151031805699,
          1.40366779032194,
          1.73761117252919,
      ]
  
imports: import os
  import numpy
  import pandas
  from statsmodels.api import add_constant
  from statsmodels.genmod.tests.results import glm_test_resids
label_desc: Use image node_id 1 to create a new CpunishTweediePower2 object  with example: obj = CpunishTweediePower2()