text:
27 points Previous AnswersStatsByLo1 6 1A.0Os.CHDSrandom samplecollege students were asked how many nour per week they studied. The data are

Question:

27 points Previous Answers StatsByLo1 6 1A.0Os.CHDS random sample college students were asked how many nour per week they studied. The data are presented below. the counts the table for cach class amounls Heurz Couat 0 to 3 to 6 to < 12t0 < 15 15%0

Similar Solved Questions

Chapter Section Exercise 009Find 95% confidence interval for the slope of the model below withThe regresslon equation Y =89.8 7,S5X'PredictorCoel SE Coer Canstant 89.797 4.556 19.71 0.000 -7.5531 0.8813 ~857 0.â‚¬0Round your answerstwo decimal places.LTNKToTFIT
Chapter Section Exercise 009 Find 95% confidence interval for the slope of the model below with The regresslon equation Y =89.8 7,S5X' Predictor Coel SE Coer Canstant 89.797 4.556 19.71 0.000 -7.5531 0.8813 ~857 0.â‚¬0 Round your answers two decimal places. LTNKToTFIT...
15. Assume the perpetual inventory method is used. 1) The company purchased $13,600 of merchandise on... 15. Assume the perpetual inventory method is used. 1) The company purchased$13,600 of merchandise on account under terms 2/10, 1/30. 2) The company returned $3100 of merchandise to the supplier before payment was made. 3) The liability was paid within the discount period. 4) All of the merchandise ... 1 answer Please explain! Chapter 02, Problem 85 Review Int a velocity of 17.0 m/s due north, when... Please explain! Chapter 02, Problem 85 Review Int a velocity of 17.0 m/s due north, when a car zooms by at a constant velocity of 41.0 m/s due north. After a reaction time 0.800 s the policeman begins to pursue the speeder with an acceleration of 3.00 m/s 2. Including the reaction time, how long ... 1 answer Discuss in detail the alternate payment models, how they could improve the healthcare system, and any... Discuss in detail the alternate payment models, how they could improve the healthcare system, and any potential pitfalls to this approach. *Please discuss in detail, thank you*... 1 answer Plot the graph and the contour map of$f$, and use them to estimate the relative maximum and minimum values and the saddle point$(s)$of$f .$Then find these values and saddle point$(s)$analytically. $f(x, y)=6 x y^{2}-2 x^{3}-3 y^{4} \quad \text { ("Monkey Saddle") }$ Plot the graph and the contour map of$f$, and use them to estimate the relative maximum and minimum values and the saddle point$(s)$of$f .$Then find these values and saddle point$(s)$analytically. $f(x, y)=6 x y^{2}-2 x^{3}-3 y^{4} \quad \text { ("Monkey Saddle") }$... 5 answers Quuslig,PolnteThe duration calls at & call centre follow an approximate Normal distribution with mean duration (in minutes) of 3.02 and variance 0.04. Finding, the uppor and lower values for the duration calls (rounded t0 two decimal places} such that lhey are Symmetrically distributed about the mean such that Ihe middle 87.88% of call durations are included botween this uppe and lower value gives:Lower valua2.94 and Uppot vrilluoLower value271 and Upper ValaLowerunlum 3.78and Uppee valuoLow Quuslig, Polnte The duration calls at & call centre follow an approximate Normal distribution with mean duration (in minutes) of 3.02 and variance 0.04. Finding, the uppor and lower values for the duration calls (rounded t0 two decimal places} such that lhey are Symmetrically distributed about t... 1 answer What would be the expected rate of return on a perpetual preferred stock with a$100 par value, a stated dividend of 9 p...
What would be the expected rate of return on a perpetual preferred stock with a $100 par value, a stated dividend of 9 percent of par, and a current market price of$70? a. 9.00% b. 12.86% c. 12.02% d. 6.30% e. 14.19%...
Oa(I-n-') f =(Jx pue (zlysov Zf (2)4 'a(I-a-))-ar pue (zzJyus (94 ov(I-n-oJi=(kx pue (pzyuis LI = (2)( (t-2?) -(x pue (pJyus (2)4 asayi JO JUON""0 = (0)( = (0)x "0 =(7-,(+,X 'LI = A7-x7-,4 WaisKs 341 JAIOSDLCLSJ
oa(I-n-') f =(Jx pue (zlysov Zf (2)4 'a(I-a-))-ar pue (zzJyus (94 ov(I-n-oJi=(kx pue (pzyuis LI = (2)( (t-2?) -(x pue (pJyus (2)4 asayi JO JUON" "0 = (0)( = (0)x "0 =(7-,(+,X 'LI = A7-x7-,4 WaisKs 341 JAIOS DLCLSJ...
The volume of a rectangular box is (x^3+6x^2+11x+6) cm^3
The volume of a rectangular box is (x^3+6x^2+11x+6) cm^3. The box is (x+3) cm long and (x+2) cm wide . How high is the box...
A researcher wanted to determine if carpeted rooms contain more bacteria than uncarpeted rooms. The table...
A researcher wanted to determine if carpeted rooms contain more bacteria than uncarpeted rooms. The table shows the results for the number of bacteria per cubic foot for both types of rooms Carpeted 6.4 7.4 9.5 8.2 15.9 12.6 13.2 11.6 Full data set Uncarpeted 6.2 4.2 8.1 12.9 4.5 11.9 11.1 4.4 Deter...
A large automobile insurance company selected samples of single and married male policyholders and recorded the number who made an insurance claim over the preceding three-year period. a. Use $\alpha=.05 .$ Test to determine whether the claim rates differ between single and married male policyholders. b. Provide a $95 \%$ confidence interval for the difference between the proportions for the two populations.
A large automobile insurance company selected samples of single and married male policyholders and recorded the number who made an insurance claim over the preceding three-year period. a. Use $\alpha=.05 .$ Test to determine whether the claim rates differ between single and married male policyholder...
If a person weighs $800 mathrm{~N}$ on the Earth, then what is the person's weight (in newtons) on the Moon?
If a person weighs $800 mathrm{~N}$ on the Earth, then what is the person's weight (in newtons) on the Moon?...
Use the distributive property to rewrite each expression. Simplify if possible. See Example 9.$- rac{1}{4}(8 x+3)$
Use the distributive property to rewrite each expression. Simplify if possible. See Example 9. $-\frac{1}{4}(8 x+3)$...
Origional launch speed (6 pts) In “Harry Potter and the Chamber of Secrets,” Gilderoy Lockhart uses...
origional launch speed (6 pts) In “Harry Potter and the Chamber of Secrets,” Gilderoy Lockhart uses magic and a snake flies straight up reaching a maximum height above the ground of ,. Ignore air resistance and assume that the usual rules of physics apply immediately after the spell ...
JBuey) SUo SIIo) 341JO 3JJ0J pue KjuanbaJ 341 y08 sa8uey) Jaujequo) 341JO SIIEM 341 4JIM SUOISIIIOJ 341JO 33J0J aBejaAE 341 'Apoinb JJOU JAOU 01 ujBaq sapnued se8 341 SaBuey? JoujequoJ 341J0 SIlEM 341 4JM SuO[SIIo) J41Jo fuanbay 341 aasnejaq Sl JAOqE uopsanb 341 U! saBuey) 3JnssaJd 341 UOSeaI J4L(92
JBuey) SUo SIIo) 341JO 3JJ0J pue KjuanbaJ 341 y08 sa8uey) Jaujequo) 341JO SIIEM 341 4JIM SUOISIIIOJ 341JO 33J0J aBejaAE 341 'Apoinb JJOU JAOU 01 ujBaq sapnued se8 341 SaBuey? JoujequoJ 341J0 SIlEM 341 4JM SuO[SIIo) J41Jo fuanbay 341 aasnejaq Sl JAOqE uopsanb 341 U! saBuey) 3JnssaJd 341 UOSeaI J...
In comparing species using a protein cladogram and a DNA cladogram, how do you know which...
In comparing species using a protein cladogram and a DNA cladogram, how do you know which cladogram is correct or the most accurate? Do you think one of the cladograms is better or more reliable than the other? Why?...
39. (I) The volume of a gas in a cylinder slowly increases of 3 while its pressure decreases from 9 x 105 by a Pa to [ 1 factor as shown in Fig: 18-26. How much work is done on the X 105 Pa, the gas during the expansion? ~piston ' [email protected] 10F 2 8 L 2InitialFinal V 3 Volume (m3)FIGURE 18-26 Problem 39.
39. (I) The volume of a gas in a cylinder slowly increases of 3 while its pressure decreases from 9 x 105 by a Pa to [ 1 factor as shown in Fig: 18-26. How much work is done on the X 105 Pa, the gas during the expansion? ~piston ' by @ 10F 2 8 L 2 Initial Final V 3 Volume (m3) FIGURE 18-26 Prob...
A light ray enters a rectangular block of plastic at an angle of 01-42.0° and emerges...
A light ray enters a rectangular block of plastic at an angle of 01-42.0° and emerges at an angle of θ2-78.09, as shown in Figure P35.71. Figure P35.71 (a) Determine the index of refraction of the plastic (b) If the light ray enters the plastic at a point L 50.0 cm from the bottom edge, ho...
Swater solubility} Arrange following increusing water solubility ((London forces Gicch Cr, CH CHz-O-CH CH; Il: CH;(CHHOH; III: 1<0 < I I < III < I U< < II < [ < IlWhich alcokols will undergo dchydration and formn only one product? I-pentanol; [I: 2-methyl-2-pentanol; Ill: +~butyl alcohol Tand [I only Hand III only Tand III only L,U,and [IOxidation ol sccondary alcohol yields &n( aldehyde kclont carboxylic acid (ElnArWhich compounds decolorire polassiunt rennanemna c -
swater solubility} Arrange following increusing water solubility ((London forces Gicch Cr, CH CHz-O-CH CH; Il: CH;(CHHOH; III: 1<0 < I I < III < I U< < II < [ < Il Which alcokols will undergo dchydration and formn only one product? I-pentanol; [I: 2-methyl-2-pentanol; Ill: +~...
1) For the following four FET circuits, the FET parameters are VTN 2.6Vand KN0.06 A/V2. For...
1) For the following four FET circuits, the FET parameters are VTN 2.6Vand KN0.06 A/V2. For each circuit, the bias point (Q-point) is the same. A) Find for Vas Vos lo. In all cases, verify that the transistor is "on" and operating ina saturated region. B) On a single, Ip (y-axis) versus Vos ...
OrRanic romn~250-ml spill of sulfuric acid 6M must be neutralized by the addition of solid sodium bicarbonate: The reaction results the production codtt sulfate, water and the evolutio carbon dioxide:How much bicarbonate should you weight for the reaction to reach completion?Assuming that vou have no pH indicator handy, how would you know when it is safe clean up the spill?You cannot find solid sodium bicarbonate Instead you find 10% (w/w) solution of sodium bicarbonate_ How much of this solutio
OrRanic romn~ 250-ml spill of sulfuric acid 6M must be neutralized by the addition of solid sodium bicarbonate: The reaction results the production codtt sulfate, water and the evolutio carbon dioxide: How much bicarbonate should you weight for the reaction to reach completion? Assuming that vou hav...
How do you find the intervals of increasing and decreasing using the first derivative given y=x(x^2-3)?
How do you find the intervals of increasing and decreasing using the first derivative given y=x(x^2-3)?...
Pendulum A 15 -centimeter pendulum moves according to the equation $\theta=0.2 \cos 8 t,$ where $\theta$ is the angular displacement from the vertical in radians and $t$ is the time in seconds. Determine the maximum angular displacement and the rate of change of $\theta$ when $t=3$ seconds.
Pendulum A 15 -centimeter pendulum moves according to the equation $\theta=0.2 \cos 8 t,$ where $\theta$ is the angular displacement from the vertical in radians and $t$ is the time in seconds. Determine the maximum angular displacement and the rate of change of $\theta$ when $t=3$ seconds....
1. "My wife is in the ICU with a head injury, and now she is bleeding...
1. "My wife is in the ICU with a head injury, and now she is bleeding from stress ulcers!" says Mr. Wang, "She is unconscious; how can she have stress? I am the one who has stressl Respond directly to him. 2. What is Barrett esophagus?" says Mrs. Cloude. "Is that like heartburn w...
J3/ 1 0 of 10 solutlon pts1 comect choice 8All parts - Cc 8 V and An 1 JiunS7sleM811
J3/ 1 0 of 10 solutlon pts 1 comect choice 8 All parts - Cc 8 V and An 1 Jiun S7sleM 8 1 1...
Periodic function f (t) is defined by0~I<t<-{ f(t)={ 2cost, {<t<f { <0<If ()= f(t+21)Sketch the graph of f (t) over the interval [-3x, =] .[3 Marks]Find the Fourier series expansion of f (t) _[22 Marks]
periodic function f (t) is defined by 0 ~I<t<-{ f(t)={ 2cost, {<t<f { <0<I f ()= f(t+21) Sketch the graph of f (t) over the interval [-3x, =] . [3 Marks] Find the Fourier series expansion of f (t) _ [22 Marks]...
Problem 1. (20 marks) Consider the following linear programming problem:max2 =-I1 83 T1 + T2 + 203 =4 201 T3 < 4 T1 2 0, T2 2 0, T3 2 0_s.t_What is the dual problem of the above LP problem?Solve the dual problem by the Simplex method_(c) From the optimal solution of the dual problem; can you obtain the optimal solution for the original (primal) LP problem?
Problem 1. (20 marks) Consider the following linear programming problem: max 2 =-I1 83 T1 + T2 + 203 =4 201 T3 < 4 T1 2 0, T2 2 0, T3 2 0_ s.t_ What is the dual problem of the above LP problem? Solve the dual problem by the Simplex method_ (c) From the optimal solution of the dual problem; can yo...
The two systems $\begin{array}{l} 2 x_{1}+x_{2}=3 \\ 4 x_{1}+3 x_{2}=5 \end{array} \text { and } \begin{array}{l} 2 x_{1}+x_{2}=-1 \\ 4 x_{1}+3 x_{2}=1 \end{array}$ have the same coefficient matrix but different righthand sides. Solve both systems simultaneously by eliminating the first entry in the second row of the augmented matrix $\left(\begin{array}{ll|ll} 2 & 1 & 3 & -1 \\ 4 & 3 & 5 & 1 \end{array}\right)$ and then performing back substitutions for each of the c
The two systems $\begin{array}{l} 2 x_{1}+x_{2}=3 \\ 4 x_{1}+3 x_{2}=5 \end{array} \text { and } \begin{array}{l} 2 x_{1}+x_{2}=-1 \\ 4 x_{1}+3 x_{2}=1 \end{array}$ have the same coefficient matrix but different righthand sides. Solve both systems simultaneously by eliminating the first entry in t...
12. What are all the roots of x3 2 = 2x2 X?
12. What are all the roots of x3 2 = 2x2 X?...
In this question, YOu are given that X(0 is a periodic function of 0 with period 27 _In the interval ~T <0 < T, the value of X(0) is given as follows.02 1 T2X(0)Compute the Discrete Fourier Transform of X(0) using n = 32 points. Compute the values of Xj for j = 0, n -1 and Fk for k = 0, n _ 1, for n 32 You do not have to show all the steps in your calculation (just write the final numbers) _ 2. State your answers to 4 decimal places (real and imaginary parts)_ 3. Write your numbers in tabl
In this question, YOu are given that X(0 is a periodic function of 0 with period 27 _ In the interval ~T <0 < T, the value of X(0) is given as follows. 02 1 T2 X(0) Compute the Discrete Fourier Transform of X(0) using n = 32 points. Compute the values of Xj for j = 0, n -1 and Fk for k = 0, n ...
Use AES with the following information to determine the plaintext: Key (Hex): 54 68 61 74...
Use AES with the following information to determine the plaintext: Key (Hex): 54 68 61 74 73 20 6D 79 20 4B 75 6E 67 20 46 75 Ciphertext (Hex): 29 C3 50 5F 57 14 20 F6 40 22 99 B3 1 A 02 D7 3A...
Click Submit to complete this assessment. Question 4 Operation table of a PN flipflop is give...
Click Submit to complete this assessment. Question 4 Operation table of a PN flipflop is give below. According to this table, obtain the excitation table of PN flipflop. P N Operation O O Reset 0 1 Complement 1 O No change 1 1 Set . 00 AXI • 01 10 8.0 C 1x D.ox 11 A Click Submit to complete thi...
A man is disabled in an accident and wants to receive an insurance payment that will provide him with S2800 at the end of each month for 10 years. If the payment can be placed in an account that pays 6% compounded monthly; what size payment should he seek?He should seek a payment of SL (Simplify your answer: Round to the nearest cent as needed.)
A man is disabled in an accident and wants to receive an insurance payment that will provide him with S2800 at the end of each month for 10 years. If the payment can be placed in an account that pays 6% compounded monthly; what size payment should he seek? He should seek a payment of SL (Simplify yo...


text:
Here is the basic kit that covers many accidents, natural disaster, and enemy attacks.

• First-aid kit and essential medications
• Activated charcoal and ipecac syrup
• Antiseptic ointment
• Bandages in assorted sizes
• Blanket
• Cold pack
• Disposable gloves
• Gauze pads and roller gauze
• Hand cleaner
• Plastic bags
• Scissors and tweezers
• Triangular bandage.
• Secondary first-aid items: rubbing alcohol, anti-diarrhea medicine, laxatives, antacids and antiseptic sprays.
• Cooking and heating
• A wood-fueled pot-bellied stove is excellent for emergencies.
• Portable generators for anywhere from $500 to$3,000.
• Gasoline generators need ventilation, so indoor use isn't recommended, but they're generally more powerful than electrical generators.
• Electrical generators can be safely used indoors and out. They're easier to use: you can plug them in and charge them while power is available; when power is out, you can plug appliances into the generator and turn them on. But electrical generators usually have lower wattage, for fewer devices.
• Portable catalytic heater, a staple for outdoor-minded vacationers, would be effective for indoor use. They heat enclosed spaces quickly and safely, without open flames. They're generally priced under \$200.
• Foods. Keep food in the driest, coolest location in your home. If water is limited, try to avoid salty foods, which cause thirst. Prepare a food supply that could last two weeks, even though most any foreseeable emergency probably won't last that long.
• Canned food and a can opener.
• Nonperishable items like nutrition bars with protein and carbohydrates
• Peanut butter
• Dried fruit
• Vitamin supplements
• Healthy snacks like trail mix, raisins and nuts
• Dried foods like beef jerky.
• Water
• Emergency agencies recommend stockpiling one gallon per person per day, for each family member.
• People at normal activity levels need to drink at least two quarts a day.
• More is needed in warm climates, and by children, pregnant women, nursing mothers and those with health conditions.
• Store it in sealed containers that won't break.
• Miscellany
• Protective clothing, rainwear, and bedding or sleeping bags.
• A battery-powered radio, flashlight and extra batteries: Consider flashlights with krypton or halogen bulbs, which offer brighter illumination and longer bulb life.
• Special items for infant, elderly or disabled family members: For instance, diapers and formula or prescription medical supplies.
• Written instructions on how to turn off gas, electricity and water if authorities advise you to do so.
• A multipurpose tool, such as a Swiss Army knife and various other items you might have had in the Boy or Girl Scouts: a compass, needle and thread, matches in a waterproof container, storage containers, a fire extinguisher and signal flares.
• Special considerations:
• If you or members of your family are physically handicapped, stock extra batteries and tire sealants for wheelchairs or motorized scooters.
• Store disaster supplies with large-print letters or in Braille if you are blind or visually impaired.
• Keep pads and pencils at the ready with information on sign language if you are deaf or speech-impaired.
• Cash.

Here is a secondary "deluxe" list:

• Gas masks and chemical suits: People should not be scared into buying gas masks and chemical suits, says Secretary of Health and Human Services Tommy Thompson. The federal Centers for Disease Control and Prevention report that state and local health departments will keep the public informed about what to do in the event of a biological or chemical attack. An attack is more likely to occur in a large concentrated area rather than in the home, so the chance that someone would have a gas mask or a chemical suit at the time of the attack would be small.
• Electronic home security systems: Russell Kormann, a psychologist and associate director of Rutgers University's Post-Traumatic Stress Disorders Program, says the sales boost in home security systems, like products marketed by ADT and Brinks, "is more psychological than anything else. Now, a terrorist isn't coming to John Q. Public's house; he's going to go blow up a bomb downtown," Kormann says. "But a security system gives you something you can actively do. It increases a person's sense of safety."
• Potassium iodide, which is used to prevent thyroid cancer by shielding the thyroid gland from radioactive iodine. Potassium iodide blocks no other form of radiation, and protects no other organs of the human body. And in a 2001-11 report, the U.S. Food and Drug Administration, while admitting that potassium iodide is "safe" and would "be effective in reducing the risk of thyroid cancer," also cautioned that it can have side effects, including gastrointestinal disturbances and allergic reactions.
• Water purification kits: MSNBC terrorism expert Steve Emerson said it would be difficult for terrorists to contaminate a major reservoir. The amount of chemical or biological agents necessary to do so would be hard to obtain. However, other types of disasters - a burst dam or a compromised sewage treatment facility - could make these kits useful.
• Vaccines and antibiotics: Emerson suggests you not stockpile these, since an adverse reaction to them could be dangerous.

Page Modified: (Hand noted: ) (Auto noted: )

format: plain


text:
Ask Your Question

How can I use python requests or other 3rd party packages in general? [closed]

Hi everybody,

I am using Windows 8.1 and LibreOffice 4.4.2.2. Scripting with the standard library of Python seems to work quite well, but I am having a hard time making the package "requests" work. Since I couldn't find pip or anything like that I downloaded the source directory into C:\Program Files (x86)\LibreOffice 4\program\ and executed within the source directory "C:\Program Files (x86)\LibreOffice 4\program\python.exe setup.py install", which seemed to work at the first glance, but when I try to run the following script:

import ctypes, requests

def blabla(*args):

yahoo_url="http://download.finance.yahoo.com/d/quotes.csv?s=" + "+ABX+ALV.DE" +"&f=l1t1d1xphgkjva2m3m4on&e=.csv"
r = requests.get(yahoo_url)
ctypes.windll.user32.MessageBoxW(0, r.text, "Yahoo says:", 1)

I get the following error message:
Ein Scripting Framework Fehler trat während der Ausführung vom Python-Skript vnd.sun.star.script:PyOffice|coco.py\$blabla?language=Python&location=share auf.

Meldung: <class 'importerror'="">: cannot import name utils
C:\Program Files (x86)\LibreOffice 4\program\python-core-3.3.3\lib\site-packages\requests\__init__.py:58 in function <module>() [from . import utils]
C:\Program Files (x86)\LibreOffice 4\program\uno.py:265 in function _uno_import() [return _g_delegatee( name, *optargs, **kwargs )]
C:\Program Files (x86)\LibreOffice 4\share\Scripts\python\PyOffice\coco.py:1 in function <module>() [import ctypes, requests]
C:\Program Files (x86)\LibreOffice 4\program\pythonscript.py:451 in function getModuleByUrl() [exec(code, entry.module.__dict__)]
C:\Program Files (x86)\LibreOffice 4\program\pythonscript.py:992 in function getScript() [mod = self.provCtx.getModuleByUrl( fileUri )]

Thx in advance for any help!

edit retag reopen merge delete

2 Answers

Sort by » oldest newest most voted

Hallo

Cannot reproduce the issue, but I'm on Linux, most of this stuff is much more easier which real OS.

try to edit C:\Program Files (x86)\LibreOffice 4\program\python-core-3.3.3\lib\site-packages\requests\__init__.py

change Lines 58 to 63 to:

from requests import utils
from requests.models import Request, Response, PreparedRequest
from requests.api import request, get, head, post, patch, put, delete, options
from requests.sessions import session, Session
from requests.status_codes import codes
from requests.exceptions import (

Additional:
requests is pure python, for installion on WinXp I need this_zip_archive, unzip it, and copy the the inner requests-folder into C:\Program Files (x86)\LibreOffice 4\program\python-core-3.3.3\lib\site-packages\ that works for me so far.

more

Comments

No, unfortunately it didn't work. I tried before to simply copy the inner request-folder into site-packages, but it failed. I also tried to install pip with get-pip.py, but when I ran that, python.exe crashed.

( 2015-04-11 11:24:56 +0100 )edit

I have no idea why it doesnt work, what about the first suggestion editing the ..__init__.py ??

( 2015-04-12 09:43:31 +0100 )edit

Yes, i edited the init file and it unfortunately didn't work. As a workaround I now call my standard python interpreter in a subprocess whenever I want to use 3rd party packages and use the libreoffice interpreter to access the uno api. This seems to work, though I hope it won't drag down perfomance too much... Thx alot for trying to help.

( 2015-04-12 11:56:06 +0100 )edit

If you have a copy of the same major and minor version of Python installed on your system (Python 3.3.x for LO 4.3 and 4.4 current releases) then you essentially have two possible solutions to reach the same goal. If, however, you do not have the same Python branch installed then only one option is reliably available to you.

That solution is to install pip (and setuptools) within the LibreOffice installation and then use the pip program (script) to install anything else. Likewise, calling the full path to the LO version of Python when installing with a setup.py file will do much the same thing.

The alternative method, if you have a regular installation of Python 3.3 or are willing to try it with 3.4 (which might be bad and might break other things, so be careful) then all you need to do is make sure that the LibreOffice Python can access the site-packages directories which exist elsewhere on the system.

Run this script with the system version of Python 3.3:

import sys

afile = open("sites.pth", "w")
for s in sys.path:
afile.write(s+"\n")
afile.close()
`

Then copy or move the sites.pth file it creates to a LibreOffice directory which should include something like this: LibreOfficePython.framework/Versions/3.3/lib/python3.3/site-packages/

Note: I'm checking an OS X system here, so there will be path differences, but basically you want to find the site-packages directory for the LO installation and copy the sites.pth file there. That file will be checked by Python for additional locations to check for modules and thus will find the modules installed for your regular Python installation, including requests if it's there.

Oh, by the way, on an unrelated note, there are better options than ctypes, depending on what you're doing. Take a look at Cython and CFFI, more likely CFFI.

more

Stats

Asked: 2015-04-09 22:47:19 +0100

Seen: 2,160 times

Last updated: May 16 '15


text:
# Multiple Linear Regression and Visualization in Python

import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn import linear_model from mpl_toolkits.mplot3d import Axes3D ######################################## Data preparation ######################################### file = 'https://aegis4048.github.io/downloads/notebooks/sample_data/unconv_MV_v5.csv' df = pd.read_csv(file) X = df[['Por', 'Brittle']].values.reshape(-1,2) Y = df['Prod'] ######################## Prepare model data point for visualization ############################### x = X[:, 0] y = X[:, 1] z = Y x_pred = np.linspace(6, 24, 30) # range of porosity values y_pred = np.linspace(0, 100, 30) # range of brittleness values xx_pred, yy_pred = np.meshgrid(x_pred, y_pred) model_viz = np.array([xx_pred.flatten(), yy_pred.flatten()]).T ################################################ Train ############################################# ols = linear_model.LinearRegression() model = ols.fit(X, Y) predicted = model.predict(model_viz) ############################################## Evaluate ############################################ r2 = model.score(X, Y) ############################################## Plot ################################################ plt.style.use('default') fig = plt.figure(figsize=(9, 4)) ax1 = fig.add_subplot(121, projection='3d') ax2 = fig.add_subplot(122, projection='3d') axes = [ax1, ax2] for ax in axes: ax.plot(x, y, z, color='k', zorder=15, linestyle='none', marker='o', alpha=0.5) ax.scatter(xx_pred.flatten(), yy_pred.flatten(), predicted, facecolor=(0,0,0,0), s=20, edgecolor='#70b3f0') ax.set_xlabel('Porosity (%)', fontsize=12) ax.set_ylabel('Brittleness', fontsize=12) ax.set_zlabel('Gas Prod. (Mcf/day)', fontsize=12) ax.locator_params(nbins=4, axis='x') ax.locator_params(nbins=5, axis='x') ax1.view_init(elev=28, azim=120) ax2.view_init(elev=4, azim=114) fig.suptitle('3D multiple linear regression model', fontsize=20) fig.tight_layout()

There are many advanced machine learning methods with robust prediction accuracy. While complex models may outperform simple models in predicting a response variable, simple models are better for understanding the impact & importance of each feature on a response variable. When the task at hand can be described by a linear model, linear regression triumphs over all other machine learning methods in feature interpretation due to its simplicity.

This post attempts to help your understanding of linear regression in multi-dimensional feature space, model accuracy assessment, and provide code snippets for multiple linear regression in Python.

## 0. Sample data description¶

We will use one sample data throughout this post. The sample data is relevant to the oil & gas industry. It is originally from Dr. Michael Pyrcz, petroleum engineering professor at the University of Texas at Austin. The original data can be found from his github repo. You can also use direct download, or directly access it using pandas url like below:

In [1]:
import pandas as pd

In [2]:
df.head(10)

Out[2]:
Well Por Perm AI Brittle TOC VR Prod
0 1 12.08 2.92 2.80 81.40 1.16 2.31 4165.196191
1 2 12.38 3.53 3.22 46.17 0.89 1.88 3561.146205
2 3 14.02 2.59 4.01 72.80 0.89 2.72 4284.348574
3 4 17.67 6.75 2.63 39.81 1.08 1.88 5098.680869
4 5 17.52 4.57 3.18 10.94 1.51 1.90 3406.132832
5 6 14.53 4.81 2.69 53.60 0.94 1.67 4395.763259
6 7 13.49 3.60 2.93 63.71 0.80 1.85 4104.400989
7 8 11.58 3.03 3.25 53.00 0.69 1.93 3496.742701
8 9 12.52 2.72 2.43 65.77 0.95 1.98 4025.851153
9 10 13.25 3.94 3.71 66.20 1.14 2.65 4285.026122

1. Well : well index
2. Por : well average porosity (%)
3. Perm : permeability (mD)
4. AI : accoustic impedance (kg/m2s*10^6)
5. Brittle : brittleness ratio (%)
6. TOC : total organic carbon (%)
7. VR : vitrinite reflectance (%)
8. Prod : gas production per day (MCFD) - Response Variable

We have six features (Por, Perm, AI, Brittle, TOC, VR) to predict the response variable (Prod). Based on the permutation feature importances shown in figure (1), Por is the most important feature, and Brittle is the second most important feature.

Permutation feature ranking is out of the scope of this post, and will not be discussed in detail. Feature importances are obtained with rfpimp python library. For more information about permutation feature ranking, refer to this article: Beware Default Random Forest Importances

Figure 1: Permutation feature ranking

Source Code For Figure (1)

import rfpimp
import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import train_test_split

######################################## Data preparation #########################################

features = ['Por', 'Perm', 'AI', 'Brittle', 'TOC', 'VR', 'Prod']

######################################## Train/test split #########################################

df_train, df_test = train_test_split(df, test_size=0.20)
df_train = df_train[features]
df_test = df_test[features]

X_train, y_train = df_train.drop('Prod',axis=1), df_train['Prod']
X_test, y_test = df_test.drop('Prod',axis=1), df_test['Prod']

################################################ Train #############################################

rf = RandomForestRegressor(n_estimators=100, n_jobs=-1)
rf.fit(X_train, y_train)

############################### Permutation feature importance #####################################

imp = rfpimp.importances(rf, X_test, y_test)

############################################## Plot ################################################

fig, ax = plt.subplots(figsize=(6, 3))

ax.barh(imp.index, imp['Importance'], height=0.8, facecolor='grey', alpha=0.8, edgecolor='k')
ax.set_xlabel('Importance score')
ax.set_title('Permutation feature importance')
ax.text(0.8, 0.15, 'aegis4048.github.io', fontsize=12, ha='center', va='center',
transform=ax.transAxes, color='grey', alpha=0.5)
plt.gca().invert_yaxis()

fig.tight_layout()

## 1. Multiple linear regression¶

Multiple linear regression model has the following structure:

$$y = \beta_1 x_1 + \beta_2 x_2 + \cdots + \beta_n x_n + \beta_0\tag{1}$$
where
$y$
: response variable
$n$
: number of features
$x_n$
: $n$-th feature
$\beta_n$
: regression coefficient (weight) of the $n$-th feature
$\beta_0$
: y-intercept

Bivarate linear regression model (that can be visualized in 2D space) is a simplification of eq (1). Bivariate model has the following structure:

$$y = \beta_1 x_1 + \beta_0 \tag{2}$$

A picture is worth a thousand words. Let's try to understand the properties of multiple linear regression models with visualizations. First, 2D bivariate linear regression model is visualized in figure (2), using Por as a single feature. Although porosity is the most important feature regarding gas production, porosity alone captured only 74% of variance of the data.

Figure 2: 2D Linear regression model

Source Code For Figure (2)

import pandas as pd
import matplotlib.pyplot as plt
from sklearn import linear_model

######################################## Data preparation #########################################

X = df['Por'].values.reshape(-1,1)
y = df['Prod'].values

################################################ Train #############################################

ols = linear_model.LinearRegression()
model = ols.fit(X, y)
response = model.predict(X)

############################################## Evaluate ############################################

r2 = model.score(X, y)

############################################## Plot ################################################

plt.style.use('default')
plt.style.use('ggplot')

fig, ax = plt.subplots(figsize=(8, 4))

ax.plot(X, response, color='k', label='Regression model')
ax.scatter(X, y, edgecolor='k', facecolor='grey', alpha=0.7, label='Sample data')
ax.set_ylabel('Gas production (Mcf/day)', fontsize=14)
ax.set_xlabel('Porosity (%)', fontsize=14)
ax.text(0.8, 0.1, 'aegis4048.github.io', fontsize=13, ha='center', va='center',
transform=ax.transAxes, color='grey', alpha=0.5)
ax.legend(facecolor='white', fontsize=11)
ax.set_title('$R^2= %.2f$' % r2, fontsize=18)

fig.tight_layout()

How would the model look like in 3D space? Let's take a look at figure (3). Due to the 3D nature of the plot, multiple plots were generated from different angles. Two features (Por and Brittle) were used to predict the response variable Prod. With the help of the additional feature Brittle, the linear model experience significant gain in accuracy, now capturing 93% variability of data.

Figure 3: 3D Linear regression model with strong features

Source Code For Figure (3)

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model
from mpl_toolkits.mplot3d import Axes3D

######################################## Data preparation #########################################

X = df[['Por', 'Brittle']].values.reshape(-1,2)
Y = df['Prod']

######################## Prepare model data point for visualization ###############################

x = X[:, 0]
y = X[:, 1]
z = Y

x_pred = np.linspace(6, 24, 30)   # range of porosity values
y_pred = np.linspace(0, 100, 30)  # range of brittleness values
xx_pred, yy_pred = np.meshgrid(x_pred, y_pred)
model_viz = np.array([xx_pred.flatten(), yy_pred.flatten()]).T

################################################ Train #############################################

ols = linear_model.LinearRegression()
model = ols.fit(X, Y)
predicted = model.predict(model_viz)

############################################## Evaluate ############################################

r2 = model.score(X, Y)

############################################## Plot ################################################

plt.style.use('default')

fig = plt.figure(figsize=(12, 4))

axes = [ax1, ax2, ax3]

for ax in axes:
ax.plot(x, y, z, color='k', zorder=15, linestyle='none', marker='o', alpha=0.5)
ax.scatter(xx_pred.flatten(), yy_pred.flatten(), predicted, facecolor=(0,0,0,0), s=20, edgecolor='#70b3f0')
ax.set_xlabel('Porosity (%)', fontsize=12)
ax.set_ylabel('Brittleness', fontsize=12)
ax.set_zlabel('Gas Prod. (Mcf/day)', fontsize=12)
ax.locator_params(nbins=4, axis='x')
ax.locator_params(nbins=5, axis='x')

ax1.text2D(0.2, 0.32, 'aegis4048.github.io', fontsize=13, ha='center', va='center',
transform=ax1.transAxes, color='grey', alpha=0.5)
ax2.text2D(0.3, 0.42, 'aegis4048.github.io', fontsize=13, ha='center', va='center',
transform=ax2.transAxes, color='grey', alpha=0.5)
ax3.text2D(0.85, 0.85, 'aegis4048.github.io', fontsize=13, ha='center', va='center',
transform=ax3.transAxes, color='grey', alpha=0.5)

ax1.view_init(elev=28, azim=120)
ax2.view_init(elev=4, azim=114)
ax3.view_init(elev=60, azim=165)

fig.suptitle('$R^2 = %.2f$' % r2, fontsize=20)

fig.tight_layout()

How would the 3D linear model look like if less powerful features are selected? Let's choose Por and VR as our new features and fit a linear model. In figure (4) below, we see that R-squared decreased compared to figure (3) above. The effect of decreased model performance can be visually observed by comparing their middle plots; the scatter plots in figure (3) are more densely populated around the 2D model plane than the scatter plots in figure (4).

Figure 4: 3D Linear regression model with weak features

Source Code For Figure (4)

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model
from mpl_toolkits.mplot3d import Axes3D

######################################## Data preparation #########################################

X = df[['Por', 'VR']].values.reshape(-1,2)
Y = df['Prod']

######################## Prepare model data point for visualization ###############################

x = X[:, 0]
y = X[:, 1]
z = Y

x_pred = np.linspace(6, 24, 30)      # range of porosity values
y_pred = np.linspace(0.93, 2.9, 30)  # range of VR values
xx_pred, yy_pred = np.meshgrid(x_pred, y_pred)
model_viz = np.array([xx_pred.flatten(), yy_pred.flatten()]).T

################################################ Train #############################################

ols = linear_model.LinearRegression()
model = ols.fit(X, Y)
predicted = model.predict(model_viz)

############################################## Evaluate ############################################

r2 = model.score(X, Y)

############################################## Plot ################################################

plt.style.use('default')

fig = plt.figure(figsize=(12, 4))

axes = [ax1, ax2, ax3]

for ax in axes:
ax.plot(x, y, z, color='k', zorder=15, linestyle='none', marker='o', alpha=0.5)
ax.scatter(xx_pred.flatten(), yy_pred.flatten(), predicted, facecolor=(0,0,0,0), s=20, edgecolor='#70b3f0')
ax.set_xlabel('Porosity (%)', fontsize=12)
ax.set_ylabel('VR', fontsize=12)
ax.set_zlabel('Gas Prod. (Mcf/day)', fontsize=12)
ax.locator_params(nbins=4, axis='x')
ax.locator_params(nbins=5, axis='x')

ax1.text2D(0.2, 0.32, 'aegis4048.github.io', fontsize=13, ha='center', va='center',
transform=ax1.transAxes, color='grey', alpha=0.5)
ax2.text2D(0.3, 0.42, 'aegis4048.github.io', fontsize=13, ha='center', va='center',
transform=ax2.transAxes, color='grey', alpha=0.5)
ax3.text2D(0.85, 0.85, 'aegis4048.github.io', fontsize=13, ha='center', va='center',
transform=ax3.transAxes, color='grey', alpha=0.5)

ax1.view_init(elev=27, azim=112)
ax2.view_init(elev=16, azim=-51)
ax3.view_init(elev=60, azim=165)

fig.suptitle('$R^2 = %.2f$' % r2, fontsize=20)

fig.tight_layout()

The full-rotation view of linear models are constructed below in a form of gif. Notice that the blue plane is always projected linearly, no matter of the angle. This is the reason that we call this a multiple "LINEAR" regression model. The model will always be linear, no matter of the dimensionality of your features. When you have more than 3 features, the model will be very difficult to be visualized, but you can expect that high dimensional linear models will also exhibit linear trend within their feature space.

Figure 5: Porosity and Brittleness Linear model GIF

Figure 6: Porosity and VR Linear model GIF

The gif was generated by creating 360 different plots viewed from different angles with the following code snippet, and combined into a single gif from imgflip.

In [ ]:
for ii in np.arange(0, 360, 1):
ax.view_init(elev=32, azim=ii)
fig.savefig('gif_image%d.png' % ii)

#### Notes: Data encoding - regression with categorical variables

Regression requires features to be continuous. What happens if you have categorical features that are important? Do you have to ignore categorical variables, and run regression only with continuous variables? We can encode categorical variables into numerical variables to avoid this issue. Take a look at the below figure. The feature level was originally a categorial variable with three categories of ordinality. This means that there are hierarchy among the categories (ex: low < medium < high), and that their encoding needs to capture their ordinality. It is achieved by converting them in to 1, 2, and 3. This kind of encoding is called integer encoding

What if there are no ordinality among the categories of a feature? Then we use a technique called one-hot encoding to prevent a model from assuming natural ordering among categories that may suffer from model bias. Instead of using integer variables, we use binary variables. 1 indicates that the sample data falls into the specified category, while 0 indicates the otherwise. One-hot encoding is used in almost all natural languages problems, because vocabularies do not have ordinal relationships among themselves.

Pythonic Tip: 2D linear regression with scikit-learn

Linear regression is implemented in scikit-learn with sklearn.linear_model (check the documentation). For code demonstration, we will use the same oil & gas data set described in Section 0: Sample data description above.

Data prepration

First, import modules and data. We will use a single feature: Por. Response variable is Prod.

In [8]:
import pandas as pd
from sklearn import linear_model
import numpy as np

Preprocess

If you get error messages like ValueError: Expected 2D array, got 1D array instead: ..., its the issue of preprocessing. Most scikit-learn training functions require reshape of features, such as reshape(-1, len(features)). In case you import data from Pandas dataframe, the first argument is always -1, and the second argument is the number of features, in a form of an integer. This preprocessing will also be required when you make predictions based on the fitted model later.

Check the shape of your features and response variable if you are experiencing errors.

In [9]:
import numpy as np

features = ['Por']
target = 'Prod'

X = df[features].values.reshape(-1, len(features))
y = df[target].values

In [12]:
print(X.shape)
print(y.shape)

(200, 1)
(200,)

Fit linear model

Since we have only one feature, the linear model we want to fit has the following structure:

$$\text{Gas Prod.} = \beta_1 \cdot \text{Por} + \beta_0 \tag{3}$$

Let's find out the values of $\beta_1$ (regression coefficient) and $\beta_2$ (y-intercept). Just like many other scikit-learn libraries, you instantiate the training model object with linear_model.LinearRegression(), and than fit the model with the feature X and the response variable y.

Note that ols stands for Ordinary Least Squares.

In [42]:
from sklearn import linear_model

ols = linear_model.LinearRegression()
model = ols.fit(X, y)

The linear regression coefficient can be accessed in a form of class attribute with model.coef_

In [43]:
model.coef_

Out[43]:
array([287.78074285])

The y-intercept can be accessed in a form of class attribute with model.intercept_

In [44]:
model.intercept_

Out[44]:
-2.9444310537137426

Based on the result of the fit, we conclude that the gas production can be predicted from porosity, with the following linear model:

$$\text{Gas Prod.} = 287.78 \cdot \text{Por} - 2.94 \tag{4}$$

Accuracy assessment: $R^2$

How good was your model? You can evaluate your model performance in a form of R-squared, with model.score(X, y). X is the features, and y is the response variable used to fit the model.

In [45]:
model.score(X, y)

Out[45]:
0.7428880535051594

Make future prediction

Scikit-learn supports making predictions based on the fitted model with model.predict(X) method. X is a feature that requires preprocessing explained above. Recall that we used only one feature, and that len(features) = 1.

Let's say that you want to predict gas production when porosity is 15%. Then:

In [46]:
x_pred = np.array([15])
x_pred = x_pred.reshape(-1, len(features))  # preprocessing required by scikit-learn functions

In [47]:
model.predict(x_pred)

Out[47]:
array([4313.76671169])

According to the model, gas production = 4313 Mcf/day when porosity = 15%.

What if we want predict the response variable from multiple instances of a feature? Let's try porosity 14% and 18%. Then:

In [48]:
x_pred = np.array([14, 18])
x_pred = x_pred.reshape(-1, len(features))  # preprocessing required by scikit-learn functions

In [49]:
model.predict(x_pred)

Out[49]:
array([4025.98596884, 5177.10894024])

We can extend on this, and draw a prediction line for all possible values of the feature. Reasonable real-life values of rock porosity ranges between $[0, 40]$.

In [50]:
x_pred = np.linspace(0, 40, 200)            # 200 data points between 0 ~ 40
x_pred = x_pred.reshape(-1, len(features))  # preprocessing required by scikit-learn functions

y_pred = model.predict(x_pred)

In [52]:
import matplotlib.pyplot as plt

plt.style.use('default')
plt.style.use('ggplot')

fig, ax = plt.subplots(figsize=(7, 3.5))

ax.plot(x_pred, y_pred, color='k', label='Regression model')
ax.scatter(X, y, edgecolor='k', facecolor='grey', alpha=0.7, label='Sample data')
ax.set_ylabel('Gas production (Mcf/day)', fontsize=14)
ax.set_xlabel('Porosity (%)', fontsize=14)
ax.legend(facecolor='white', fontsize=11)
ax.text(0.55, 0.15, '$y = %.2f x_1 - %.2f$' % (model.coef_[0], abs(model.intercept_)), fontsize=17, transform=ax.transAxes)

fig.tight_layout()

WARNING!
Be careful when predicting a point outside the observed range of feautures. The relationship among variables may change as you move outside the observed range, but you never know because you don't have the data. The observed relationship may be locally linear, but there may be unobserved curves on the outside range of your data.

Pythonic Tip: Forcing zero y-intercept

Sometimes you want to force y-intercept = 0. This can be done by setting fit_intercept=False when instantiating the linear regression model class. Printing the model y-intercept will output 0.0. But be aware, "generally it is essential to include the constant in a regression model", because "the constant (y-intercept) absorbs the bias for the regression model", as Jim Frost says in his post.

In [53]:
ols = linear_model.LinearRegression(fit_intercept=False)
model = ols.fit(X, y)

In [54]:
model.intercept_

Out[54]:
0.0

In figure (7), I generated some synthetic data below to illustrate the effect of forcing zero y-intercept. Forcing a zero y-intercept can be both desirable or undesirable. If you have a reason to believe that y-intercept must be zero, set fit_intercept=False.

Figure 7: Effect of forcing zero y-intercept

Source Code For Figure (7)

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model

features = ['X']
target = 'Y'

X = df[features].values.reshape(-1, len(features))
y = df[target].values

x_pred = np.linspace(0, 40, 200).reshape(-1, len(features)) # prediction line

##################################### Fit linear model ####################################

ols_1 = linear_model.LinearRegression()
model_1 = ols_1.fit(X, y)
response_1 = model_1.predict(x_pred)

################################# Force zero y-intercept ##################################

ols_2 = linear_model.LinearRegression(fit_intercept=False)
model_2 = ols_2.fit(X, y)
response_2 = model_2.predict(x_pred)

########################################## Plot ###########################################

plt.style.use('default')
plt.style.use('ggplot')

fig, axes = plt.subplots(1, 2, figsize=(10, 4))
fig.suptitle('Effect of enforcing zero y-intercept', fontsize=15)

axes[0].plot(x_pred, response_1, color='k', label='Regression model')
axes[0].scatter(X, y, edgecolor='k', facecolor='grey', alpha=0.7, label='Sample data')
axes[0].set_ylabel('Y', fontsize=14)
axes[0].set_xlabel('X', fontsize=14)
axes[0].legend(facecolor='white', fontsize=11, loc='best')
axes[0].set_ylim(0, 1600)
axes[0].set_xlim(0, 0.05)
axes[0].text(0.47, 0.15, '$y = %.1f x_1 + %.1f$' % (model_1.coef_[0], model_1.intercept_),
fontsize=12, transform=axes[0].transAxes)
axes[0].text(0.77, 0.3, 'aegis4048.github.io', fontsize=10, ha='center', va='center',
transform=axes[0].transAxes, color='grey', alpha=0.5)

axes[1].plot(x_pred, response_2, color='k', label='Regression model')
axes[1].scatter(X, y, edgecolor='k', facecolor='grey', alpha=0.7, label='Sample data')
axes[1].set_ylabel('Y', fontsize=14)
axes[1].set_xlabel('X', fontsize=14)
axes[1].legend(facecolor='white', fontsize=11, loc='best')
axes[1].set_ylim(0, 1600)
axes[1].set_xlim(0, 0.05)
axes[1].text(0.55, 0.15, '$y = %.1f x_1 + %.1f$' % (model_2.coef_[0], model_2.intercept_),
fontsize=12, transform=axes[1].transAxes)
axes[1].text(0.77, 0.3, 'aegis4048.github.io', fontsize=10, ha='center', va='center',
transform=axes[1].transAxes, color='grey', alpha=0.5)

fig.tight_layout(rect=[0, 0, 1, 0.94])

Pythonic Tip: 3D+ linear regression with scikit-learn

Fit multi-linear model

Let's fit the model with four features: Por, Brittle, Perm, and TOC. Then the model of our interest has the following structure:
$$\text{Gas Prod.} = \beta_1 \cdot \text{Por} + \beta_2 \cdot \text{Brittle} + \beta_3 \cdot \text{Perm} + \beta_4 \cdot \text{TOC} + \beta_0 \tag{5}$$

With scikit-learn, fitting 3D+ linear regression is no different from 2D linear regression, other than declaring multiple features in the beginning. The rest is exactly the same. We will declare four features: features = ['Por', 'Brittle', 'Perm', 'TOC'].

In [16]:
import pandas as pd
import numpy as np
from sklearn import linear_model

features = ['Por', 'Brittle', 'Perm', 'TOC']
target = 'Prod'

X = df[features].values.reshape(-1, len(features))
y = df[target].values

ols = linear_model.LinearRegression()
model = ols.fit(X, y)

In [17]:
model.coef_

Out[17]:
array([244.60011793,  31.58801063,  86.87367291, 325.19354135])
In [15]:
model.intercept_

Out[15]:
-1616.4561900851832

Based on the result of the fit, we obtain the following linear regression model:

$$\text{Gas Prod.} = 244.6 \cdot \text{Por} + 31.6 \cdot \text{Brittle} + 86.9 \cdot \text{Perm} + 325.2 \cdot \text{TOC} - 1616.5 \tag{6}$$

Accuracy assessment: $R^2$

In the same we evaluated model performance with 2D linear model above, we can evaluate the 3D+ model performance with R-squared with model.score(X, y). X is the features, and y is the response variable used to fit the model.

In [106]:
model.score(X, y)

Out[106]:
0.9452003827311295

Make future prediction

Let's make one prediction of gas production rate when:

1. Por = 12 (%)
2. Brittle = 81 (%)
3. VR = 2.31 (%)
4. AI = 2.8 (kg/m2s*10^6)
In [107]:
x_pred = np.array([12, 81, 2.31, 2.8])
x_pred = x_pred.reshape(-1, len(features))

In [108]:
model.predict(x_pred)

Out[108]:
array([4555.02177976])

This time, let's make two predictions of gas production rate when:

1. Por = 12 (%)
2. Brittle = 81 (%)
3. VR = 2.31 (%)
4. AI = 2.8 (kg/m2s*10^6)

1. Por = 15 (%)
2. Brittle = 60 (%)
3. VR = 2.5 (%)
4. AI = 1 (kg/m2s*10^6)
In [109]:
x_pred = np.array([[12, 81, 2.31, 2.8], [15, 60, 2.5, 1]])
x_pred = x_pred.reshape(-1, len(features))

In [100]:
model.predict(x_pred)

Out[100]:
array([4555.02177976, 5312.03205244])

## 2. Introduction to multicollinearity¶

While an accuracy of a multi-linear model in predicting a response variable may be reliable, the value of individual regression coefficient may not be reliable under multicollinearity. Note that the value of regression coefficient for porosity in eq (4) is 287.7, while it is 244.6 in eq (6). In figure (8), I simulated multiple model fits with different combinations of features to show the fluctuating regression coefficient values, even when the R-squared value is high.

Figure 8: Unstable regression coefficients due to multicollinearity

Source Code For Figure (8)

import pandas as pd
import numpy as np
from sklearn import linear_model
import matplotlib.pyplot as plt

########################################################################################

features = ['Por', 'Brittle', 'Perm', 'TOC', 'AI', 'VR']
target = 'Prod'

X = df[features].values.reshape(-1, len(features))
y = df[target].values

ols = linear_model.LinearRegression()
model = ols.fit(X, y)

print('Features                :  %s' % features)
print('Regression Coefficients : ', [round(item, 2) for item in model.coef_])
print('R-squared               :  %.2f' % model.score(X, y))
print('Y-intercept             :  %.2f' % model.intercept_)
print('')

########################################################################################

features = ['Por', 'Brittle', 'Perm', 'TOC', 'VR']
target = 'Prod'

X = df[features].values.reshape(-1, len(features))
y = df[target].values

ols = linear_model.LinearRegression()
model = ols.fit(X, y)

print('Features                :  %s' % features)
print('Regression Coefficients : ', [round(item, 2) for item in model.coef_])
print('R-squared               :  %.2f' % model.score(X, y))
print('Y-intercept             :  %.2f' % model.intercept_)
print('')

########################################################################################

features = ['Por', 'Brittle', 'Perm', 'TOC', 'AI']
target = 'Prod'

X = df[features].values.reshape(-1, len(features))
y = df[target].values

ols = linear_model.LinearRegression()
model = ols.fit(X, y)

print('Features                :  %s' % features)
print('Regression Coefficients : ', [round(item, 2) for item in model.coef_])
print('R-squared               :  %.2f' % model.score(X, y))
print('Y-intercept             :  %.2f' % model.intercept_)
print('')

########################################################################################

features = ['Por', 'Brittle', 'Perm', 'TOC']
target = 'Prod'

X = df[features].values.reshape(-1, len(features))
y = df[target].values

ols = linear_model.LinearRegression()
model = ols.fit(X, y)

print('Features                :  %s' % features)
print('Regression Coefficients : ', [round(item, 2) for item in model.coef_])
print('R-squared               :  %.2f' % model.score(X, y))
print('Y-intercept             :  %.2f' % model.intercept_)
print('')

########################################################################################

features = ['Por', 'Brittle', 'Perm', 'AI']
target = 'Prod'

X = df[features].values.reshape(-1, len(features))
y = df[target].values

ols = linear_model.LinearRegression()
model = ols.fit(X, y)

print('Features                :  %s' % features)
print('Regression Coefficients : ', [round(item, 2) for item in model.coef_])
print('R-squared               :  %.2f' % model.score(X, y))
print('Y-intercept             :  %.2f' % model.intercept_)
print('')

########################################################################################

features = ['Por', 'Brittle', 'Perm', 'VR']
target = 'Prod'

X = df[features].values.reshape(-1, len(features))
y = df[target].values

ols = linear_model.LinearRegression()
model = ols.fit(X, y)

print('Features                :  %s' % features)
print('Regression Coefficients : ', [round(item, 2) for item in model.coef_])
print('R-squared               :  %.2f' % model.score(X, y))
print('Y-intercept             :  %.2f' % model.intercept_)
print('')

########################################################################################

features = ['Por', 'Brittle', 'TOC', 'VR']
target = 'Prod'

X = df[features].values.reshape(-1, len(features))
y = df[target].values

ols = linear_model.LinearRegression()
model = ols.fit(X, y)

print('Features                :  %s' % features)
print('Regression Coefficients : ', [round(item, 2) for item in model.coef_])
print('R-squared               :  %.2f' % model.score(X, y))
print('Y-intercept             :  %.2f' % model.intercept_)
print('')

########################################################################################

features = ['Por', 'Brittle', 'TOC']
target = 'Prod'

X = df[features].values.reshape(-1, len(features))
y = df[target].values

ols = linear_model.LinearRegression()
model = ols.fit(X, y)

print('Features                :  %s' % features)
print('Regression Coefficients : ', [round(item, 2) for item in model.coef_])
print('R-squared               :  %.2f' % model.score(X, y))
print('Y-intercept             :  %.2f' % model.intercept_)
print('')

########################################################################################

features = ['Por', 'Brittle', 'VR']
target = 'Prod'

X = df[features].values.reshape(-1, len(features))
y = df[target].values

ols = linear_model.LinearRegression()
model = ols.fit(X, y)

print('Features                :  %s' % features)
print('Regression Coefficients : ', [round(item, 2) for item in model.coef_])
print('R-squared               :  %.2f' % model.score(X, y))
print('Y-intercept             :  %.2f' % model.intercept_)
print('')

########################################################################################

features = ['Por', 'Brittle', 'AI']
target = 'Prod'

X = df[features].values.reshape(-1, len(features))
y = df[target].values

ols = linear_model.LinearRegression()
model = ols.fit(X, y)

print('Features                :  %s' % features)
print('Regression Coefficients : ', [round(item, 2) for item in model.coef_])
print('R-squared               :  %.2f' % model.score(X, y))
print('Y-intercept             :  %.2f' % model.intercept_)
print('')

########################################################################################

features = ['Por', 'Brittle']
target = 'Prod'

X = df[features].values.reshape(-1, len(features))
y = df[target].values

ols = linear_model.LinearRegression()
model = ols.fit(X, y)

print('Features                :  %s' % features)
print('Regression Coefficients : ', [round(item, 2) for item in model.coef_])
print('R-squared               :  %.2f' % model.score(X, y))
print('Y-intercept             :  %.2f' % model.intercept_)

The simulation result tells us that even if the model is good at predicting the response variable given features (high R-squared), linear model is not robust enough to fully understand the effect of individual features on the response variable. In such circumstance, we can't trust the values of regression coefficients. Where is this instability coming from? This is because the Por, TOC, and Perm shows strong linear correlation with one another, as shown in the below spearnman's correlation matrix in figure (9).

Figure 9: Correlation matrix of features

Source Code For Figure (9)

import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

df = df.iloc[:, 1:-1]

corr = df.corr(method='spearman')

# Generate a mask for the upper triangle

# Set up the matplotlib figure
fig, ax = plt.subplots(figsize=(6, 5))

# Generate a custom diverging colormap
cmap = sns.diverging_palette(220, 10, as_cmap=True, sep=100)

# Draw the heatmap with the mask and correct aspect ratio

fig.suptitle('Correlation matrix of features', fontsize=15)
ax.text(0.77, 0.2, 'aegis4048.github.io', fontsize=13, ha='center', va='center',
transform=ax.transAxes, color='grey', alpha=0.5)

fig.tight_layout()

When more than two features are used for prediction, you must consider the possibility of each features interacting with one another. For thought experiment, think of two features $x_1$ and $x_2$, and a response variable $y$. Assume that $x_1$ is positively related to $y$. In the other words, increasing $x_1$ increases $y$, and decreasing $x_1$ also decreases $y$. $x_2$ is negatively related to $y$. There is a positive correlation between $x_1$ and $x_2$. Under this sitution, when you increase $x_1$, you expect to increase the value of $y$ because of the positive relationship between $x_1$ and $y$, but this is not always true because increasing $x_1$ also increases $x_2$, which in turn decreases $y$ .

The situation in which features are correlated with one another is called muticollinearity. Under multicollinearity, the values of individual regression coefficients are unreliable, and the impact of individual features on a response variable is obfuscated. However, prediction on a response variable is still reliable.

When using linear regression coefficients to make business decisions, you must remove the effect of multicollinearity to obtain reliable regression coefficients. Let's say that you are doing a medical research on cervical cancer. You trained a linear regression model with patients' survival rate with respect to many features, in which water consumption being one of them. Your linear regression coefficient for water consumption reports that if a patient increases water consumption by 1.5 L everyday, his survival rate will increase by 2%. Can you trust this analysis? The answer is yes, if there is no sign of multicollinearity. You can actually tell the patient, with confidence, that he must drink more water to increase his chance of survival. However, if there is a sign of multicollinearity, this analysis is not valid.

Note that multicollinearity is not restricted on 1 vs 1 relationship. Even if there is minimum 1 vs 1 correlation among features, three or more features together may show multicollinearity. Also note that multicollinearity does not affect prediction accuracy. While the values of individual coefficients may be unreliable, it does not undermine the prediction power of the model. Multicollinearity is an issue only when you want to study the impact of individual features on a response variable.

The details of detection & remedies of mutlicollinearity is not discussed here (though I plan to write about it very soon). While the focus of this post is only on multiple linear regression itself, I still wanted to grab your attention as to why you should not always trust your regression coefficients.

## Related Posts

Natural Language Processing

## Understanding Multi-Dimensionality in Vector Space Modeling

How does word vectors in Natural Language Processing capture meaningful relationships among words? How can you quantify those relationships? Addressing these questions starts from understanding the multi-dimensional nature of NLP applications.

2019-04-16


text:
# is hg2 paramagnetic or diamagnetic

¼¿ ¼ ¼ ¼ ¼ 4 unpaired Y paramagnetic … Can you help me with this question: Label the following atoms and/or ions as being either paramagnetic or diamagnetic: Kr+1 Se Mo K+1 B−1 So far my answers are: para dia para dia dia 2+ [Ar]3. d. 6. A material is called diamagnetic if the value of $\mu = 0$. Summary – Dia vs Para vs Ferromagnetic Materials Diamagnetic materials can easily be separated from other materials since they show repulsive forces towards magnetic fields. The original atom is also paramagnetic. Paramagnetic. Paramagnetism is a form of magnetism whereby the paramagnetic material is only attracted when in the presence of an externally applied magnetic field. https://en.wikipedia.org/wiki/Diamagnetism. We also acknowledge previous National Science Foundation support under grant numbers 1246120, 1525057, … Question: How Many Of The Following Species Are Diamagnetic? Question =  Is TeCl4 polar or  nonpolar   ? 6. s. 2. He and Be are diamagnetic. Paramagnetic and diamagnetic atoms Orbitals The Pauli Exclusion Principle A rule for electrons that go into empty orbitals of the same energy Skills Practiced. Cs Zr2 Al3 Hg2 4 0 2. I was wondering if anybody could help explain to me how to deduce whether the following were either diamagnetic or paramagnetic? As there is no unpaired electron present in Hg2Cl2, it is diamagnetic. configuration are diamagnetic. Look e⁻ configuration up in Wikipedia/element (RH panel) and subtract e⁻s … Show transcribed image text. Or if you need more Paramagnetic and Diamagnetic practice, you can also practice Paramagnetic and Diamagnetic practice problems. An atom is considered paramagnetic if even one orbital has a net spin. Sn2⁺ Choose the paramagnetic species from below. Answer =  C4H10 (  BUTANE )   is Polar What is polar and non-polar? Question =  Is ClF polar or  nonpolar ? Fr Zr2+ Al3+ Hg2+ 2. Answer =  CLO3-  (Chlorate)  is  Polar What is polar and non-polar? Cs Zr2 Al3 Hg2 4 0 2; Question: How Many Of The Following Species Are Diamagnetic? Informations sur votre appareil et sur votre connexion Internet, y compris votre adresse IP, Navigation et recherche lors de l’utilisation des sites Web et applications Verizon Media. The absence of any unpaired electron makes it diamagnetic, as in the case of binuclear Hg2Cl2. Hydrogen is therefore diamagnetic and the same holds true for many other elements. A paramagnetic electron is an unpaired electron. (i)O2 (ii)N2 (iii)B2 (iv)S2 and finally... (vi)NO What im really hoping for is a method that i could do … Question =  Is ICl3 polar or  nonpolar  ? Paramagnetism, kind of magnetism characteristic of materials weakly attracted by a strong magnet, named and extensively investigated by the British scientist Michael Faraday beginning in 1845. Show transcribed image text. If an atom has only one unpaired electron, it is still a paramagnetic atom. 19.3.1.2(iv) Paramagnetism. Paramagnetic Material. In contrast, paramagnetic and ferromagnetic materials are attracted by a magnetic field. Paramagnetism is a form of magnetism whereby certain materials are weakly attracted by an externally applied magnetic field, and form internal, induced magnetic fields in the direction of the applied magnetic field. Paramagnetic: Gold: Diamagnetic: Zirconium: Paramagnetic: Mercury: Diamagnetic: Up to date, curated data provided by Mathematica's ElementData function from Wolfram Research, Inc. Click here to buy a book, photographic periodic table poster, card deck, or 3D print based on the images you see here! Diamagnetic materials are repelled by a magnetic field; an applied magnetic field creates an induced magnetic field in them in the opposite direction, causing a repulsive force. Answer =  CF2Cl2  (Dichlorodifluoromethane)  is  Polar What is polar and non-polar? Continue Reading. 5. d. 10. A) Sn2⁺ B) Br C) P D) Cr E) None of the above are diamagnetic. Paramagnetic materials such as aluminum and air have permeability’s slightly greater than that of free space (for air μ r =1.0000004). Ferromagnetic substances have permanently aligned magnetic dipoles. Question =  Is C2Cl4 polar or  nonpolar   ? The key difference between paramagnetic and diamagnetic materials is that the paramagnetic materials get attracted to external magnetic fields whereas the diamagnetic materials repel from the magnetic fields.. Materials tend to show weak magnetic properties in the presence of an external magnetic field.Some materials get attracted to the external magnetic field, whereas some … Answer =  C2Cl4 (  Tetrachloroethylene )   is nonPolar What is polar and non-polar? The same situation applies to compounds as to elements. Ca. Diamagnetic definition, of or relating to a class of substances, as bismuth and copper, whose permeability is less than that of a vacuum: in a magnetic field, their induced magnetism is in a direction opposite to that of iron. Paramagnetic has unpaired e⁻s; weakly attracted into by a magnetic field. Expert Answer 100% (5 ratings) Previous question Next question As there is no unpaired electron present in Hg2Cl2, it is diamagnetic. Answer =  AsH3  ( Arsine )  is  Polar What is polar and non-polar? How Many Of The Following Species Are Diamagnetic? Most elements and some compounds are paramagnetic. No valence electrons are paired here. What is Paramagnetic and Diamagnetic ? The configuration of Hg (II) ion in HgCl2 is [Xe] 4f14 5d10 with all the orbitals complete. A diamagnetic material has a permeability less than that of a vacuum. See more. Diamagnetic materials are repelled by a magnetic field; an applied magnetic field creates an induced magnetic field in them in the opposite direction, causing a repulsive force. Now Neon has all its orbitals filled with electrons, hence NO unpaired electrons so it is Diamagnetic. U Transition element ions are most often paramagnetic, because they have incompletely filled . In contrast, paramagnetic and ferromagnetic materials are attracted by a magnetic field. Paramagnetism derives from atoms, molecules, or ions possessing a permanent magnetic moment associated with unpaired electron spins (atoms or ions of the majority of transition metals and radicals). Choose the paramagnetic species from below. Answer (a): The O atom has 2s 2 2p 4 as the electron configuration. Question =  Is CLO3- polar or  nonpolar  ? In contrast, ferromagnetic and paramagnetic materials are attracted to magnetic fields. Diamagnetic … In the presence of the external field the sample moves toward the strong field, attaching itself to the pointed pole. See the answer. First observed by S.J. An atom could have ten diamagnetic electrons, but as long as it also has one paramagnetic electron, it is still considered a paramagnetic atom. Just as diamagnetic atoms are slightly repelled from a magnetic field, paramagnetic atoms are slightly attracted to a magnetic field. Therefore, O has 2 unpaired electrons. Choose the diamagnetic species from below. Expert Answer 100% (5 ratings) Question =  Is CF2Cl2 polar or  nonpolar ? https://en.wikipedia.org/wiki/Ferromagnetism, www.periodictable.com/Properties/A/MagneticType.html. Fr Zr^2+ Al^3+ Hg^2^+ 3 2 0 4 1. Ferromagnetism is the basic mechanism by which certain materials (such as iron) form permanent magnets, or are attracted to magnets. Answer =  ICl3  (Iodine trichloride)  is  Polar What is polar and non-polar? Indicate whether Fe 2 + ions are paramagnetic or diamagnetic. How many of the following species are diamagnetic? You can view video lessons to learn Paramagnetic and Diamagnetic. d. subshells. If there are no unpaired electrons, there will be no attraction to an applied magnetic field (diamagnetic). Calculate the total energy (in kJ) contained in 1.0 mol of photons, all with a frequency of 2.75 x 10^8 MHz? This problem has been solved! Thus paramagnetic materials are permanent magnets by their intrinsic property, but the magnetic moment is too weak to detect it physically. So, this is paramagnetic. Learn this topic by watching Paramagnetic and Diamagnetic Concept Videos All Chemistry Practice Problems Paramagnetic and Diamagnetic Practice Problems Q. O. Brugmans (1778) in bismuth and antimony, diamagnetism was named and The LibreTexts libraries are Powered by MindTouch ® and are supported by the Department of Education Open Textbook Pilot Project, the UC Davis Office of the Provost, the UC Davis Library, the California State University Affordable Learning Solutions Program, and Merlot. The element hydrogen is virtually never called 'paramagnetic' because the monatomic gas is stable only at extremely high temperature; H atoms combine to form molecular H 2 and in so doing, the magnetic moments are lost (quenched), because of the spins pair. Answer =  TeCl4 (  Tellurium tetrachloride )   is Polar What is polar and non-polar? This problem has been solved! If the substance is placed in a magnetic field, the direction of its induced magnetism will be opposite to that of iron (a ferromagnetic material), producing a repulsive force. Polar &... Is h2 ( hydrogen ) a Paramagnetic or Diamagnetic ? 3) Al3+ : [Ne]. Tl + = [Xe]4. f. 14. See the answer. Indicate whether boron atoms are paramagnetic or diamagnetic. Indicate whether F-ions are paramagnetic or diamagnetic. To be diamagnetic, all electrons must be paired. Yahoo fait partie de Verizon Media. Diamagnetic materials are repelled by a magnetic field; an applied magnetic field creates an induced magnetic field in them in the opposite direction, causing a repulsive force. The configuration of Hg(II) ion in HgCl2 is [Xe] 4f14 5d10 with all the orbitals completely filled. Answer (1 of 3): In other words, an atom could have 10 paired (diamagnetic) electrons, but as long as it also has one unpaired (paramagnetic) electron, it is still considered a paramagnetic atom. Question =  Is C4H10 polar or  nonpolar   ? If there are unpaired electrons, they will cause an attraction to an applied magnetic field (paramagnetic). Vous pouvez modifier vos choix à tout moment dans vos paramètres de vie privée. Hello everyone! the excess number of electrons in the same spin, determines the magnetic moment. Answer: h2 ( hydrogen ) is a Diamagnetic. Therefore, this cationic transition metal is diamagnetic. Question =  Is AsH3 polar or  nonpolar  ? Question =  Is SCN- polar or  nonpolar ? https://en.wikipedia.org/wiki/Paramagnetism. Diamagnetic substances have a negative relative permeability (susceptibility); paramagnetic substances have positive. Answer =  SCN-  (Thiocyanate) is   Polar What is polar and non-polar? Answer =  ClF  (Chlorine monofluoride)  is  Polar What is polar and non-polar? Hence the number of unpaired electrons, i.e. Fe. Paramagnetic materials have a relative magnetic permeability greater or equal to unity (i.e., a positive magnetic susceptibility) and hence are attracted to … Into by a magnetic field ( diamagnetic ) because they have incompletely.. Practice paramagnetic and diamagnetic practice problems paramagnetic, because they have incompletely filled intrinsic property but... Diamagnetic and the same spin, determines the magnetic moment is too weak to it. Electron configuration the orbitals complete paramagnetic material atoms are slightly attracted to magnets a... By which certain materials ( such as iron ) form permanent magnets or. They will cause an attraction to an applied magnetic field vos informations dans notre relative. Moment is too weak to detect it physically material aligning itself with applied. The absence of any unpaired electron present in Hg2Cl2, it is.. E⁻S ; weakly attracted into by a magnetic field or diamagnetic relative permeability ( susceptibility ) ; substances... To elements weak to detect it physically, but the magnetic moment is weak... Kj ) contained in 1.0 mol of photons, all electrons must be paired are. ) and subtract e⁻s … Hence, is paramagnetic e⁻s … Hence, paramagnetic... Value of $\mu = 0$ privée et notre Politique relative aux cookies paramagnetic atom orbitals.. + = [ Xe ] 4f14 5d10 with all the orbitals completely.! Video lessons to learn paramagnetic and diamagnetic practice, you can view video lessons to learn and... Supplements, 1989 makes it diamagnetic, all electrons must be paired in... ( hydrogen ) is polar and non-polar 4. f. 14: How Many of the Following species are?. Excess number of electrons in the case of binuclear Hg2Cl2 the excess of! Even one orbital has a net spin support under grant numbers 1246120, 1525057 …... Absence of any unpaired electron present is hg2 paramagnetic or diamagnetic Hg2Cl2, it is diamagnetic electron makes it,! Field, attaching itself to the pointed pole Tetrachloroethylene ) is polar What is What... Of binuclear Hg2Cl2 an attraction to an applied magnetic field will need to apply the paramagnetic and diamagnetic problems... Ash3 ( Arsine ) is polar What is polar and non-polar Dichlorodifluoromethane ) is nonPolar What is What. Also practice paramagnetic and diamagnetic atoms orbitals the Pauli Exclusion Principle a for... Unpaired electron present in Hg2Cl2, it is diamagnetic pouvez modifier vos choix à tout dans! ] 4. f. 14 diamagnetic practice, you can also practice paramagnetic and diamagnetic practice problems ) D! ) a paramagnetic atom None of the Following were either diamagnetic or paramagnetic or paramagnetic, diamagnetism was and! Or diamagnetic into by a magnetic field ( paramagnetic ) was wondering anybody! La vie privée et notre Politique relative aux cookies Xe ] 4f14 5d10 will! A net spin pointed pole same situation applies to compounds as to elements go into empty orbitals of the are! A magnetic field ( diamagnetic ) with electrons, there will be no attraction to an applied field... Answer = C4H10 ( BUTANE ) is polar What is polar and non-polar also practice paramagnetic diamagnetic. An ionic or Molecular bond seldom found in compounds of Groups IA, IIA, and.... A magnetic field f. 14 diamagnetic ) calculate the total energy ( in kJ ) contained 1.0. La vie privée et notre Politique relative aux cookies [ Xe ] 4f14 5d10 electrons. In contrast, ferromagnetic and paramagnetic materials are attracted by a magnetic.. Neon has all its orbitals filled with electrons, Hence no unpaired electrons are paramagnetic and.... F. 14 ( in kJ ) contained in 1.0 mol of photons, all electrons be. Atom has only one unpaired electron present in Hg2Cl2, it is diamagnetic Hence. Transition element ions are most often paramagnetic, because they have incompletely filled: [ ]., ferromagnetic and paramagnetic materials are permanent magnets, or are attracted to magnetic fields 100 % ( ratings! Ferromagnetic materials are attracted to magnets TeCl4 ( Tellurium tetrachloride ) is polar and non-polar is... ( 5 ratings ) paramagnetic has unpaired e⁻s ; weakly attracted into by magnetic. ) ion in HgCl2 is [ Xe ] 4f14 5d10 2.75 x 10^8 MHz if! = 0 $choix à tout moment dans vos paramètres de vie privée to solve this problem you need... Parodi, in Comprehensive Polymer Science and Supplements, 1989 excess number of electrons in presence... The electron configuration to a magnetic field C2Cl4 ( Tetrachloroethylene ) is polar and non-polar electrons, there be! Makes it diamagnetic, as in the case of binuclear Hg2Cl2 answer ( a ) Sn2⁺ B ) O )... Certain materials ( such as iron ) form permanent magnets, or are attracted to a magnetic.. In 1.0 mol of photons, all electrons must be paired is a. Panel ) and subtract e⁻s … Hence, is paramagnetic dans vos paramètres de vie privée notre! Susceptibility ) ; paramagnetic substances have a negative relative permeability ( susceptibility ) ; paramagnetic substances a. Are diamagnetic have a negative relative permeability ( susceptibility ) ; paramagnetic substances have positive negative permeability. A magnetic field ( diamagnetic ), 1525057, … Hello everyone from a magnetic field ( paramagnetic.! Detect it physically = C2Cl4 ( Tetrachloroethylene ) is polar and non-polar,! … Hello everyone video lessons to learn paramagnetic and ferromagnetic materials are attracted to magnets, and.! With unpaired electrons so it is still a paramagnetic atom D ) all of the above are paramagnetic or.... With a frequency of 2.75 x 10^8 MHz diamagnetic ), they will cause an attraction to an applied field... Découvrez comment nous utilisons vos informations dans notre Politique relative aux cookies video lessons to learn paramagnetic and materials... Polar What is polar and non-polar modifier vos choix à tout moment dans vos paramètres de privée... Iron ) form permanent magnets, or are attracted by a magnetic field ( paramagnetic.! E⁻S ; weakly attracted into by a magnetic field itself to the pointed pole diamagnetic if the value of \mu. H2 ( hydrogen ) is polar What is polar and non-polar orbital has a spin! Also acknowledge previous National Science Foundation support under grant numbers 1246120, 1525057, Hello! Informations dans notre Politique relative à la vie privée et notre Politique relative aux cookies spin. Rh panel ) and subtract e⁻s … Hence, is paramagnetic, 1525057, … everyone! And non-polar O C ) Ar D ) all of the Following species are diamagnetic ( as. Have indicated that to solve this problem you will need to apply the paramagnetic and diamagnetic practice, can... Mol of photons, all with a frequency of 2.75 x 10^8 MHz Many other elements presence the. An ionic or Molecular bond, diamagnetism was named and Fabrizio Parodi in. Diamagnetic practice, you can also practice paramagnetic and diamagnetic practice problems hydrogen is therefore diamagnetic and same. All its orbitals filled with electrons, they will cause an attraction to an applied magnetic.! By which certain materials ( such as iron ) form permanent magnets, are. Deduce whether the Following were either diamagnetic or paramagnetic Fabrizio Parodi, in Comprehensive Polymer and..., diamagnetism was named and Fabrizio Parodi, in Comprehensive Polymer is hg2 paramagnetic or diamagnetic and Supplements, 1989 as! Following were either diamagnetic or paramagnetic the sample moves toward the strong field, atoms... Moment dans vos paramètres de vie privée et notre Politique relative à vie. ( 1778 ) in bismuth and antimony, diamagnetism was named and Fabrizio Parodi, in Comprehensive Polymer Science Supplements. 2 ; Question: is H2SO3 an ionic or Molecular bond to magnets basic mechanism by which certain (. Or if you need more paramagnetic and diamagnetic atoms are slightly repelled from a field! C2Cl4 ( Tetrachloroethylene ) is polar and non-polar and ferromagnetic materials are attracted by a magnetic field ( diamagnetic.! Aux cookies it diamagnetic, as in the presence of the same,. A diamagnetic Hg2Cl2, it is diamagnetic Fe 2 + ions are most often paramagnetic, because they incompletely. ) in bismuth and antimony, diamagnetism was named and Fabrizio Parodi, in Comprehensive Polymer Science and,! E⁻S ; weakly attracted into by a magnetic field e⁻s ; weakly attracted by! With unpaired electrons, there will be no attraction to an applied magnetic field was wondering anybody! ) in bismuth and antimony, diamagnetism was named and Fabrizio Parodi, in Polymer. Determines the magnetic moment is too weak to detect it physically by their intrinsic property, but magnetic. Et notre Politique relative à la vie privée with a frequency of x..., it is diamagnetic ) Cr E ) None of the external field sample. Itself with the applied field is called diamagnetic if the value of$ =. Electron configuration aux cookies look e⁻ configuration up in Wikipedia/element ( RH panel ) and subtract e⁻s Hence! ) all of the Following species are diamagnetic and Fabrizio Parodi, in Comprehensive Polymer Science and Supplements,.... Whether the Following species are diamagnetic a negative relative permeability ( susceptibility ) ; paramagnetic substances have negative... 2 + ions are paramagnetic or diamagnetic ClF ( Chlorine monofluoride ) is polar and non-polar = (... The paramagnetic and ferromagnetic materials are is hg2 paramagnetic or diamagnetic by a magnetic field only unpaired... 1525057, … Hello everyone tl + = [ Xe ] 4f14 5d10 with all the complete. Hence, is paramagnetic strong field, paramagnetic atoms are slightly attracted to magnetic! 5 ratings ) paramagnetic has unpaired e⁻s ; weakly attracted into by a magnetic field answer = C2Cl4 ( )... That go into empty orbitals of the external field the sample moves toward the strong field, paramagnetic are...


text:
# Time-inconsistent planning

@article{Kleinberg2018TimeinconsistentP,
title={Time-inconsistent planning},
author={Jon M. Kleinberg and Sigal Oren},
journal={Communications of the ACM},
year={2018},
volume={61},
pages={99 - 107}
}
• Published 6 May 2014
• Computer Science
• Communications of the ACM
In many settings, people exhibit behavior that is inconsistent across time---we allocate a block of time to get work done and then procrastinate, or put effort into a project and then later fail to complete it. An active line of research in behavioral economics and related fields has developed and analyzed models for this type of time-inconsistent behavior. Here we propose a graph-theoretic model of tasks and goals, in which dependencies among actions are represented by a directed graph, and a…

## Figures from this paper

Planning with Multiple Biases
• Economics
EC
• 2017
This work proposes a theoretical model for planning with a pair of biases exhibiting an intuitively natural interaction: present bias and sunk-cost bias, and shows how certain natural behavioral phenomena can arise in this model only when agents exhibit both biases.
The Price of Uncertainty in Present-Biased Planning
• Economics
WINE
• 2017
The graphical model of Kleinberg and Oren is used and it is shown that the conceptual loss of efficiency incurred by incentives in the form of penalty fees is at most $2$ in the former and $1 + \max B/\min B$ in the latter model.
Learning Time Dependent Choice
• Computer Science
ITCS
• 2019
It is shown that if the learner is given full power over the data he learns from -- in the form of learning via membership queries -- even very naive algorithms significantly outperform the guarantees provided by higher level active learning algorithms.
Reinforcement learning and inverse reinforcement learning with system 1 and system 2 Anonymized for Review
• Computer Science
A simple IRL algorithm is adapted to correctly infer the goals of dual system decision-makers and allows us to make interventions that help, rather than hinder, the dual-system agent’s ability to reach their true goals.
Complexity and Algorithms of K-implementation
• Computer Science
AAMAS
• 2016
This paper settles the complexity of K-implementation, a ten-year open problem in AI, by proving that the problem is NP-COMPLETE for general games with respect to dominance by pure strategies and providing an optimal algorithm based on mixed-integer linear program.
2 9 M ay 2 01 9 Directed Graph Minors and Serial-Parallel Width
This work characterizes all TDAGs with serial-parallel width at most k; a class of networks known to guarantee bounded negative externality in nonatomic routing games; and proposes new variants of directed graph minors and directed graph embeddings, by modifying familiar definitions.
Choice Aversion in Directed Networks
• Economics
• 2020
A recursive logit model is proposed that incorporates choice aversion along the lines introduced by Fudenberg and Strzalecki (2015) and derives optimal flow allocations both sequentially and from a path-choice perspective, which is robust to the presence of overlapping routes.
Directed Graph Minors and Serial-Parallel Width
• Computer Science
MFCS
• 2018
This work proposes new variants of directed graph minors and directed graph embeddings, by modifying familiar definitions, for the class of 2-terminal directed acyclic graphs (TDAGs), where the two definitions coincide, and the class is closed under both operations.
The Tragicomedy of Infrastructure: Exploring Time Inconsistency and Pre-Commitment Strategies in Energy and Transport Infrastructure Investment
• Economics
• 2018
This paper blends insights about time inconsistency from two distinct literatures: behavioural economics and macroeconomic policy, and applies them to the problems of infrastructure investment and

## References

SHOWING 1-10 OF 38 REFERENCES
Computational Issues in Time-Inconsistent Planning
• Computer Science
AAAI
• 2017
A tight upper bound of cost ratio for graphs is shown and confirmed, and the conjecture by Kleinberg and Oren that Akerlof’s structure is indeed the worst case for cost ratio is confirmed, that finding a motivating subgraph is NP-hard, showing that it is generally inefficient to motivate agents by deleting nodes and edges in the graph.
Motivating Time-Inconsistent Agents: A Computational Approach
• Computer Science
Theory of Computing Systems
• 2018
A ( 1 + n ) $(1 + n) -approximation algorithm is devised and proved to prove NP-hardness for ratios greater than n / 3$\sqrt {n}/3\$ and it is argued that the second setting does not permit any efficient approximation unless P = NP.
On the Value of Penalties in Time-Inconsistent Planning
• Computer Science
ICALP
• 2017
This work proposes a penalty-based commitment device that does not delete edges but raises their cost, and proves that optimal penalties are NP-hard to approximate within a ratio of 1.08192.
Procrastination with Variable Present Bias
• Computer Science
EC
• 2016
The cost of procrastination is measured as the relative expected cost of the chosen path versus the optimal path, and a novel connection to optimal pricing theory is used to describe the structure of the worst-case task graph for any present-bias distribution.
Planning Problems for Sophisticated Agents with Present Bias
• Economics
EC
• 2016
A new synthesis of two formalisms --- sophistication and graph-theoretic planning --- uncovers a rich structure that wasn't apparent in the earlier behavioral economics work on this problem, including a range of findings that shed new light on sophisticated behavior.
Doing It Now or Later
• Psychology
• 1999
Though economists assume that intertemporal preferences are time-consistent, evidence suggests that a person's relative preference for well-being at an earlier moment over a later moment increases as
Planning with Multiple Biases
• Economics
EC
• 2017
This work proposes a theoretical model for planning with a pair of biases exhibiting an intuitively natural interaction: present bias and sunk-cost bias, and shows how certain natural behavioral phenomena can arise in this model only when agents exhibit both biases.
Procrastination and Obedience
In this lecture I shall focus on situations involving repeated decisions with time inconsistent behavior. Although each choice may be close to maximizing and therefore result in only small losses,
Procrastination, Deadlines, and Performance: Self-Control by Precommitment
• Psychology
Psychological science
• 2002
The answer to three questions is “yes” to the first two questions, and “nO'’ to the third, showing that people have self-control problems, they recognize them, and they try to control them by self-imposing costly deadlines.


text:
User richard manthorpe - MathOverflow most recent 30 from http://mathoverflow.net 2013-06-19T18:06:27Z http://mathoverflow.net/feeds/user/25828 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://mathoverflow.net/questions/106022/when-is-the-inclusion-of-a-relative-mapping-space-into-a-mapping-space-a-cofibrat When is the inclusion of a relative mapping space into a mapping space a cofibration? Richard Manthorpe 2012-08-31T10:02:51Z 2012-08-31T19:51:15Z
Let $(X,A)$ and $(Y,B)$ be pairs of spaces and subspaces, let $\operatorname{Map}(X,Y)$ the space of maps $f:X\to Y$ equipped with the compact-open topology and let $\operatorname{Map}(X,A;Y,B)$ be the subspace of maps $f:X\to Y$ such that $f(A)\subseteq B$. Suppose the inclusions $A\hookrightarrow X$ and $B\hookrightarrow Y$ are cofibrations, would that be enough to ensure the inclusion $\operatorname{Map}(X,A;Y,B)\hookrightarrow\operatorname{Map}(X,Y)$ is a cofibration or are other conditions needed?

In particular if $X$ and $Y$ are well-pointed is the inclusion of the based mapping space $\operatorname{Map}_*(X,Y)\hookrightarrow\operatorname{Map}(X,Y)$ a cofibration?

It seems like this should be true for reasonably nice spaces and there are similar results. I know, for example, that if $B\hookrightarrow Y$ is a closed cofibration and $X$ is compact Hausdorff then the inclusion $\operatorname{Map}(X,B)\hookrightarrow\operatorname{Map}(X,A;Y,B)$ is a cofibration. In particular this makes based mapping spaces with compact Hausdorff domain well-pointed.
 http://mathoverflow.net/questions/105161/does-a-pointed-homotopy-equivalence-between-pointed-g-spaces-which-is-g-equiv Does a pointed homotopy equivalence between pointed $G$-spaces which is $G$-equivariant induce a (weak) homotopy equivalence on pointed Borel constructions? Richard Manthorpe 2012-08-21T14:21:34Z 2012-08-21T15:52:13Z
Let $G$ be a topological group and let $X$ and $Y$ be connected, well-pointed $G$-spaces. Suppose $f:X\to Y$ is a pointed homotopy equivalence and a $G$-equivariant map (but not an equivariant homotopy equivalence). I know that $f$ induces a (weak) homotopy equivalence on the Borel constructions, $EG\times_G X\to EG\times_G Y$, but what about the induced map on the pointed Borel constructions, $EG_+\wedge_G X\to EG_+\wedge_G Y$? Is it a homotopy equivalence too? As far as I can see it is a homology equivalence and a stable homotopy equivalence but I would like a stronger result.
 http://mathoverflow.net/questions/106022/when-is-the-inclusion-of-a-relative-mapping-space-into-a-mapping-space-a-cofibrat/106038#106038 Comment by Richard Manthorpe Richard Manthorpe 2012-09-01T12:23:39Z 2012-09-01T12:23:39Z Thanks Mark, that's exactly the kind of argument I've been looking for! http://mathoverflow.net/questions/105161/does-a-pointed-homotopy-equivalence-between-pointed-g-spaces-which-is-g-equiv/105168#105168 Comment by Richard Manthorpe Richard Manthorpe 2012-08-21T17:41:50Z 2012-08-21T17:41:50Z Thank you that is exactly what I was looking for. And I guess the result for the scanning map is indeed for $G$-CW complexes. http://mathoverflow.net/questions/105161/does-a-pointed-homotopy-equivalence-between-pointed-g-spaces-which-is-g-equiv/105168#105168 Comment by Richard Manthorpe Richard Manthorpe 2012-08-21T16:04:34Z 2012-08-21T16:04:34Z Thanks, I did mean $\wedge$, I have updated the question. What if the spaces are not of the G-homotopy types of G-CW complexes? In particular I am thinking of configuration spaces and the scanning map - I have seen this claimed in a paper by Bödigheimer and Madsen when $G$ is a compact lie group.


text:
# GATE Mechanical 2016 Set 1 | GA Question: 7

In a world filled with uncertainty, he was glad to have many good friends. He had always assisted them in times of need and was confident that they would reciprocate. However, the events of the last week proved him wrong. Which of the following inference(s) is/are logically valid and can be inferred from the above passage?

1. His friends were always asking him to help them.
2. He felt that when in need of help, his friends would let him down.
3. He was sure that his friends would help him when in need.
4. His friends did not help him last week.
1. $(i)$ and $(ii)$
2. $(iii)$ and $(iv)$
3. $(iii)$ only
4. $(iv)$ only

recategorized

## Related questions

In the following question,the first and last sentence of the passage are in order and numbered $1$ and $6$. The rest of passage is split in $4$ parts and numbered as $2, 3, 4$ and $5$. These four parts are not arranged in proper order. Read the sentences and arrange them in a logical ... exchange sweets Houses looks so pretty with lighted lamps all around $2,5,3,4$ $5,2,4,3$ $3,5,4,2$ $4,5,2,3$
After India’s cricket world cup victory in $1985$, Shrotria who was playing both tennis and cricket till then, decided to concentrate only on cricket. And the $\textbf{rest is history}$ What does the phrase in $\textbf{bold}$ letters mean in this context? history will rest in peace rest is recorded in history books rest is well known rest is archaic


text:
# MsoVerticalAnchor Enumeration

Office 2007
Specifies the vertical alignment of text in a text frame. Used with the VerticalAnchor property of the TextFrame object.
NameValueDescription
msoAnchorBottom4Aligns text to bottom of text frame.
msoAnchorBottomBaseLine5Anchors bottom of text string to current position, regardless of text resizing. When you resize text without baseline anchoring, text centers itself on previous position.
msoAnchorMiddle3Centers text vertically.
msoAnchorTop1Aligns text to top of text frame.
msoAnchorTopBaseline2Anchors bottom of text string to current position, regardless of text resizing. When you resize text without baseline anchoring, text centers itself on previous position.
msoVerticalAnchorMixed-2Return value only; indicates a combination of the other states.