Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

poisson random data

# decide poisson theta values
theta_noalcohol_meds = 1    # no alcohol, took an antihist
theta_alcohol_meds = 3      # alcohol, took an antihist
theta_noalcohol_nomeds = 6  # no alcohol, no antihist
theta_alcohol_nomeds = 36   # alcohol, no antihist

# create samples
q = 1000
df = pd.DataFrame({
        'nsneeze': np.concatenate((np.random.poisson(theta_noalcohol_meds, q),
                                   np.random.poisson(theta_alcohol_meds, q),
                                   np.random.poisson(theta_noalcohol_nomeds, q),
                                   np.random.poisson(theta_alcohol_nomeds, q))),
        'alcohol': np.concatenate((np.repeat(False, q),
                                   np.repeat(True, q),
                                   np.repeat(False, q),
                                   np.repeat(True, q))),
        'nomeds': np.concatenate((np.repeat(False, q),
                                      np.repeat(False, q),
                                      np.repeat(True, q),
                                      np.repeat(True, q)))})
Comment

poisson random data

# decide poisson theta values
theta_noalcohol_meds = 1    # no alcohol, took an antihist
theta_alcohol_meds = 3      # alcohol, took an antihist
theta_noalcohol_nomeds = 6  # no alcohol, no antihist
theta_alcohol_nomeds = 36   # alcohol, no antihist

# create samples
q = 1000
df = pd.DataFrame({
        'nsneeze': np.concatenate((np.random.poisson(theta_noalcohol_meds, q),
                                   np.random.poisson(theta_alcohol_meds, q),
                                   np.random.poisson(theta_noalcohol_nomeds, q),
                                   np.random.poisson(theta_alcohol_nomeds, q))),
        'alcohol': np.concatenate((np.repeat(False, q),
                                   np.repeat(True, q),
                                   np.repeat(False, q),
                                   np.repeat(True, q))),
        'nomeds': np.concatenate((np.repeat(False, q),
                                      np.repeat(False, q),
                                      np.repeat(True, q),
                                      np.repeat(True, q)))})
Comment

poisson random data

# decide poisson theta values
theta_noalcohol_meds = 1    # no alcohol, took an antihist
theta_alcohol_meds = 3      # alcohol, took an antihist
theta_noalcohol_nomeds = 6  # no alcohol, no antihist
theta_alcohol_nomeds = 36   # alcohol, no antihist

# create samples
q = 1000
df = pd.DataFrame({
        'nsneeze': np.concatenate((np.random.poisson(theta_noalcohol_meds, q),
                                   np.random.poisson(theta_alcohol_meds, q),
                                   np.random.poisson(theta_noalcohol_nomeds, q),
                                   np.random.poisson(theta_alcohol_nomeds, q))),
        'alcohol': np.concatenate((np.repeat(False, q),
                                   np.repeat(True, q),
                                   np.repeat(False, q),
                                   np.repeat(True, q))),
        'nomeds': np.concatenate((np.repeat(False, q),
                                      np.repeat(False, q),
                                      np.repeat(True, q),
                                      np.repeat(True, q)))})
Comment

PREVIOUS NEXT
Code Example
Python :: python regex compile 
Python :: parsing date columns when reading csv 
Python :: tutorial on how to search the database in your django project 
Python :: why do we write f before double quotes in print statement in python 
Python :: telegram bot python 
Python :: python 2 factor authentication 
Python :: initialise a 3D tab in python 
Python :: pandas to_csv adds unnamed column 
Python :: Passive to active Python 
Python :: words repeating in word cloud python 
Python :: debug forbidden by robots.txt scrappy 
Python :: bold colors in pytohn 
Python :: python sort by last name using lambda 
Python :: Understand the most appropriate graph to use for your dataset visualization 
Python :: create date by column values pandas 
Python :: django error column last_login cannot be null 
Python :: how to unpack the whole list without index them individually python 
Python :: upload file to SQL server pyodbc python 
Python :: scale just one column pandas 
Python :: python chatbot speech recognition 
Python :: qubesos 
Python :: python print list in dictionary 
Python :: python requests json backslash 
Python :: python tuples number Multiplication 
Python :: The module in NAME could not be imported: django.contrhtmlib.auth.password_validation.UserAttributeSimilarityValidator. Check your AUTH_PASSWORD_VALIDATORS setting. 
Python :: username__icontains in django 
Python :: django phone number 
Python :: Perform a left outer join of self and other. 
Python :: Prints out the schema in the tree format 
Python :: how to create a custom function in python 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =