About Me
Elyse Daly is a Research Assistant for Dr. Bonnie Spring's lab in Northwestern University's Department of Preventive Medicine in Chicago, IL. The Spring Lab conducts research to test approaches to weight loss and smoking cessation using wearable devices and apps. Elyse's goal is to be able to create her own apps and websites to conduct health and wellness research, using her newfound web development knowledge.
Elyse has lived in Chicago for the last 3 years. When she is not seeing research participants in lab or coding like crazy, you'll probably find her playing videogames, playing soccer, watching terrible reality television, or reading not so terrible books.


Maecenas scelerisque felis ornare placerat tempus. In turpis nisi, viverra hendrerit dolor vel, auctor blandit sapien. Aenean quis venenatis felis, adipiscing pretium nunc.
A brief story about how this process works, keep an eye till the end.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type love the specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. consectetur adipiscing elit. Nulla id dolor ut mauris tempor dapibus ut ac justo. consectetur adipiscing elit. Nulla id dolor ut mauris tempor dapibus ut ac justo.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. consectetur adipiscing elit.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. consectetur adipiscing elit. Nulla id dolor ut mauris tempor dapibus ut ac justo. consectetur adipiscing elit. Nulla id dolor ut mauris tempor dapibus ut ac justo.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. consectetur adipiscing elit.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. consectetur adipiscing elit. Nulla id dolor ut mauris tempor dapibus ut ac justo. consectetur adipiscing elit. Nulla id dolor ut mauris tempor dapibus ut ac justo.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. consectetur adipiscing elit.
It has always been a debate whether to buy new or used construction equipment. Small fleets prefer to buy used construction equipment investments used construction equipment investments.
It has always been a debate whether to buy new or used construction equipment. Smaller fleets prefer to buy used construction equipmen investments used construction equipment investments.
Smaller fleets prefer to buy used construction equipment as they attract less capital so do investments.
It is a long established fact that a reader will be distracted by the readable content of a page when.
This rank tracker has the best UI out of all hosted trackers I have used. Plus it's cheap and fast,
I'll send my friends over.
Kingfisher, CEO
This tool makes it convenient to share a site for critiquing and gathering feedback, relying on the social
web's unrestrained penchant for talking about things. This tool is.
Kingfisher, CEO
This tool makes it convenient to share a site for critiquing and gathering feedback, relying on the social
web's unrestrained penchant for talking about things. This tool is.
Kingfisher, CEO
This rank tracker has the best UI out of all hosted trackers I have used. Plus it's cheap and fast,
I'll send my friends over.
Kingfisher, CEO
This tool makes it convenient to share a site for critiquing and gathering feedback, relying on the social
web's unrestrained penchant for talking about things. This tool is.
Kingfisher, CEO
This rank tracker has the best UI out of all hosted trackers I have used. Plus it's cheap and fast,
I'll send my friends over.
Kingfisher, CEO


This example shows how you can use the Vernier Go Direct Module to connect and collect from multiple Vernier Go Direct Sensor.
Bluetooth USB


Amoveo3 Wallet
Fields must not be 0
An error occurred, please try again later.
Your channel is out of sync. You cannot make or cancel bets with an old channel state.
Do you want to sync your channel state with Amoveobook?


{% extends '_layouts/layout_2-3_no_title_block.html' %} {% block page_title %} Book an appointment - NHS.UK {% endblock %} {% block pageTitle %} Do you have any of these symptoms? {% endblock %} {% block pageIntro %} {% endblock %} {% block content %}
Ask your surgery for an online services registration form. After you fill in the form, the surgery will send you a username and password.


WITNESS LIST Administration Committee March 23, 1999-8:30A SB 1367 FOR: Collins, Steven R. (Texas Legislative Council), Austin ON: Edmondson, David (Senate Redistricting/Texas Legislative Council), Austin Registering, but not testifying: On: Atkinson, Kelley (Texas Legislative Council), Austin Fulton, Deborah L. (Texas Legislative Council), Austin SB 1368 FOR: Collins, Steven R. (Texas Legislative Council), Austin Registering, but not testifying: On: Starke, David (Texas Legislative Council), Austin SB 1369 FOR: Collins, Steven R. (Texas Legislative Council), Austin Registering, but not testifying: On: Griesel, Christopher (Texas Legislative Council), Austin Marshall, Mike (Texas Legislative Council), Austin SB 1370 FOR: Collins, Steven R. (Texas Legislative Council), Austin Registering, but not testifying: On: Harrison, Shawn M. (Texas Legislative Council), Austin Hougland, Eric (Texas Legislative Council), Austin SB 1467 FOR: Collins, Steven R. (Texas Legislative Council), Austin SCR 42 Registering, but not testifying: For: Munoz, Henry R. (The Alameda), San Antonio


NxS Thinger control - ReadMeUse these to open/close all sections: [Open all] [Close all] - Remember all the lost lifes in Thailand, Sri-Lanka, Eastern India, Indonesia and the rest of the south-east asia. - OverviewNxS Thinger is an attempt to port the Thinger component in Winamp3 to a Winamp 2.x/5.x plugin. It supports these "components":
Check out the "What's new?" section below... Thinger APIThe following describes how to use the Thinger API... - Open section First of all you need to place the following code in your source file: // Flags to use for the dwFlags member of NxSThingerIconStruct #define NTIS_ADD 1 #define NTIS_MODIFY 2 #define NTIS_DELETE 4 #define NTIS_NOMSG 8 #define NTIS_NOICON 16 #define NTIS_NODESC 32 #define NTIS_HIDDEN 64 #define NTIS_BITMAP 128 typedef struct _NxSThingerIconStruct { DWORD dwFlags; /* NTIS_* flags */ UINT uIconId; /* Only used for NTIS_MODIFY and NTIS_DELETE flags */ LPTSTR lpszDesc; /* These are HBITMAP if the NTIS_BITMAP flag is used. */ union { HICON hIcon; HBITMAP hBitmap; }; union { HICON hIconHighlight; HBITMAP hBitmapHighlight; }; /* Following is the message to send when icon is clicked */ HWND hWnd; /* Set to NULL to send to Winamp. From v0.51 on, this actually works. ;-) */ UINT uMsg; WPARAM wParam; LPARAM lParam; } NxSThingerIconStruct, * lpNxSThingerIconStruct; Assuming the handle to Winamp is located in "plugin.hwndParent" we call this to get the message number to use when using the API: int iThingerIPC = SendMessage(plugin.hwndParent, WM_WA_IPC, (WPARAM)"NxSThingerIPCMsg", IPC_REGISTER_WINAMP_IPCMESSAGE); To add an icon to the Thinger this will do the trick: NxSThingerIconStruct ntis; ntis.dwFlags = NTIS_ADD; ntis.lpszDesc = "My thinger icon :)"; ntis.hWnd = myfunnyhwnd; ntis.uMsg = WM_USER+1; ntis.wParam = 0; ntis.lParam = 0; UINT myiconid = SendMessage(plugin.hwndParent, WM_WA_IPC, (WPARAM)&ntis, (LPARAM)iThingerIPC); Remember to keep the value in myiconid around to be able to delete the icon, like: NxSThingerIconStruct ntis; ntis.dwFlags = NTIS_DELETE; ntis.hIcon = LoadIcon(plugin.hDllInstance, (LPCTSTR)IDI_MYICON); ntis.uIconId = myiconid; SendMessage(plugin.hwndParent, WM_WA_IPC, (WPARAM)&ntis, (LPARAM)iThingerIPC); Or modifying: NxSThingerIconStruct ntis; ntis.dwFlags = NTIS_MODIFY | NTIS_NOICON | NTIS_NOMSG; ntis.uIconId = myiconid; ntis.lpszDesc = "New description!!"; SendMessage(plugin.hwndParent, WM_WA_IPC, (WPARAM)&ntis, (LPARAM)iThingerIPC); NOTE I: NOTE II: - Open section Declare this at global scope: WNDPROC lpWinampWndProcOld; In your "init" function: lpWinampWndProcOld = (WNDPROC)SetWindowLong(plugin.hwndParent, GWL_WNDPROC, (LONG)WinampSubclass); PostMessage(plugin.hwndParent, WM_USER+100, 0, 0); This is the replacement window procedure (the subclass): LRESULT CALLBACK WinampSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (uMsg==WM_USER && wParam==0 && lParam==0) { NxSThingerIconStruct ntis; ntis.dwFlags = NTIS_ADD; ntis.lpszDesc = "My thinger icon :)"; ntis.hWnd = myfunnyhwnd; ntis.uMsg = WM-USER+1; ntis.wParam = 0; ntis.lParam = 0; g_myiconid = SendMessage(plugin.hwndParent, WM_WA_IPC, (WPARAM)&ntis, (LPARAM)iThingerIPC); /* Remove the subclass since it's not needed anymore */ SetWindowLong(plugin.hwndParent, GWL_WNDPROC, (LONG)lpWinampWndProcOld); } return CallWindowProc(lpWinampWndProcOld, hwnd, uMsg, wParam, lParam); } Notes- Open section The source code for this plug-in is included with the installation package. Someone suggested me to add a menu item to Winamp's Main menu for each icon added to the Thinger. I will never ever implement this. NxS Thinger is only made to replicate the Thinger from Winamp 3 and that's it. Contact
Version history- Open section
Known bugs list
License- Open section This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any distribution. |


hackNY 2012 Summer Presentation
Sophie Chou
What does Intent Media do?
Most people who search for flights and hotels don't actually buy anything (only ~3-5% do!)
publishers like Expedia and Orbitz look towards advertising to increase revenue.
think Google AdWords for travel sites
The Challenge
How can a publisher gain media revenue from showing ads without sacrificing transaction revenue from selling products (airplane tickets, hotels, etc.)?
If a site shows ads from its competitors, it could potentially lose more revenue than it gains from advertisements!
Intent Media uses machine learning techniques to help mitigate that risk.
A Picture
Our Basic Model
$$Y_i = \beta_0 + \beta_1X_{i,1} + .... + \beta_PX_{i,P} + \epsilon_i$$
- We have a set of input signals or characteristics about users
- From these signals we can model or predict either transaction (purchase) or media (advertisement) revenue
- We use a linear regression to do so.
What is Seasonality?
Trends in revenue that are related to intervals in time
For example, the hour of day, day of week, or month of year.
We can observe many such trends in our data!
Average Revenue vs. Hour
Average Revenue vs. Weekday
Average Revenue vs. Day of Month
Average Revenue vs. Month
The Seasonality Problem
- Trying to fit a linear regression to data that has seasonality can lead to large errors.
- If we can first model these seasonalities and remove or demean the dataset, then we can do a better job of modeling our original regression.
- In other words: remove predictability from the data to focus on the less predictable parts.
The Seasonality Model
using a linear regression,
$$y = \beta_0 + \beta_1x_1 + ... + \beta_jx_j$$
we want to generate the revenue $y$ based on signals $x_1 ... x_j$,
where each variable represents a time interval.
The Seasonality Model, con't
Let's use the average revenue of all the data points we have for a certain interval as a predictor for future revenue.
That means that the $\beta$ values will simply be the average of each time interval!
$x_1 ... x_j$ will be either 0 or 1 (booleans) depending on whether we are looking at that time interval or not.
Example: Weekday Seasonality
$$y = \beta_0 + \beta_1x_1 + \beta_2x_2 + \beta_3x_3 + \beta_4x_4 + \beta_5x_5 + \beta_6x_6 $$
$y$ is the publisher revenue
$x_1$...$x_6$ are the variables Monday through Saturday (either 0 or 1 depending on
what day of the week it is; Sunday is the intercept)
$\beta_0$...$\beta_6$ are the average values of the revenue on Sunday-Monday, respectively.
Downweighting
But what if we had two or more weeks of data?
We want the value of $\beta$ to be cumulative, but don't want the data from 6 months ago to be worth the same as yesterday's data!
Data that is more recent is likely to be a better predictor for the revenue.
con't...
introduce the variable $\gamma$ (where $\gamma \le 1 $) to downweight older data.
Let's say we had $n$ weeks of data. Then, we'll multiply the $i^{th}$ week's data by $\gamma^{i-n}$,
where i = 1, 2, ..., n.
That means the most recent data has downweight $\gamma^0$, or no downweighting at all,
whereas the first week will be downweighted by a multiple of $\gamma^{n-1}$, yielding a much smaller product.
Ex: if $\gamma$ = 0.5, then multiply this week's data by $0.5^0$ or 1, multiply last week's data by $0.5^1$ or $1/2$, multiply the previous week's data by $0.5^2$ or $1/4$, and so on...
Linear Algebra
since we train our data incrementally, we want a way to easily accumulate and calculate our values.
this is more easily done using matrix manipulation, and provides a generic framework.
Weekday Example, again
Let's say we only have one week's worth of data. Then,
$$x = \begin{bmatrix}Sunday\\Monday\\Monday\\Tuesday\\Tuesday\\Tuesday\\Wednesday\\Thursday\\Friday\\Friday\\Saturday\end{bmatrix} =
\begin{bmatrix}1 & 0 & 0 & 0 & 0 & 0 & 0\\1 & 1 & 0 & 0 & 0 & 0 & 0\\1 & 1 & 0 & 0 & 0 & 0 & 0\\1 & 0 & 1 & 0 & 0 & 0 & 0\\1 & 0 & 1 & 0 & 0 & 0 & 0\\1 & 0 & 1 & 0 & 0 & 0 & 0\\1 & 0 & 0 & 1 & 0 & 0 & 0\\1 & 0 & 0 & 0 & 1 & 0 & 0\\1 & 0 & 0 & 0 & 0 & 1 & 0\\1 & 0 & 0 & 0 & 0 & 1 & 0\\1 & 0 & 0 & 0 & 0 & 0 & 1\end{bmatrix}
y = \begin{bmatrix} $_{Sun} \\ $_{Mon} \\ \ $_{Mon} \\ $_{Tues} \\ $_{Tues} \\ $_{Tues} \\$_{Weds} \\ $_{Thurs} \\ $_{Fri} \\ $_{Fri} \\ $_{Sat} \end{bmatrix} =
\begin{bmatrix} 0.0 \\ 0.5 \\ 0.5 \\1.0 \\ 1.5 \\ 1.5 \\ 0.0 \\ 0.5 \\ 1.0 \\ 0.5 \\ 1.0 \end{bmatrix}$$
The repetition of days means that several transactions occurred on that day.
This is a simplified example: In reality, there would be many, many values per day, of course! (y-values hypothetical)
con't...
$$\beta = (X^{\top}X)^{-1}X^{\top}Y$$
$$\beta = \begin{bmatrix} \beta_{Sun} \\ \beta_{Mon} \\ \beta_{Tues} \\ \beta_{Weds} \\ \beta_{Thurs} \\ \beta_{Fri} \\ \beta_{Sat} \end{bmatrix} =
\begin{bmatrix} 0.00 \\ 0.50 \\ 1.33 \\ 0.00 \\ 0.50 \\ 0.75 \\ 1.00 \end{bmatrix} $$
Which is indeed the average revenue per ad call on a given day!
Cumulative Betas
Let's say, for example, we have 3 weeks of data, and we set $\gamma = 0.5$ (in other words, each week is worth half as much the further back you go in time).
$$\beta_1 = (X_1^{\top}X_1)^{-1}(X_1^{\top}Y_1)$$
$$\beta_2 = (0.5*X_1^{\top}X_1 + X_2^{\top}X_2)^{-1}(0.5*X_1^{\top}Y_1 + X_2^{\top}Y_2)$$
$$\beta_3 = (0.25*X_1^{\top}X_1 + 0.5*X_2^{\top}X_2 + X_3^{\top}X_3)^{-1}(0.25*X_1^{\top}Y_1 + 0.5*X_2^{\top}Y_2 + X_3^{\top}Y_2)$$


{# Empty div for centering logo (on mobile), specified with grid-template-columns #}
{# Empty div for spacing left of logo, specified with grid-template-columns #}
{# `aria-label` should be used in conjunction with `role="navigation"`, which the `nav` tag specifies implicitly #}
{# See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Navigation_Role #}
{% if user.is_authenticated %}
{{ user.first_name|first_word }}
{% if user|has_any_permissions or user.is_superuser %}
{% if LANGUAGE_CODE == "en" %}
Norsk
{% else %}
English
{% endif %}
{# Show all site-wide announcements #}
{% site_wide_announcements as announcements %}
{% for announcement in announcements %}
{% include "announcements/announcement.html" with announcement=announcement %}
{% endfor %}
{# This form is hidden, but is submitted through jQuery #}


This is a quick introduction to help you get started using this API. On the left sidebar you see all available documentation resources. The API reference lists all available resources to discover the endpoints. On the support page you can see all available support options if you get stuck.
You can also register a new account to create a new app. Through this app you can access protected parts of the API. The authorization documentation contains more information how you can authenticate.


Elevate Lab is an Organisation for university students
who want to bring about a change through technology. We are focused upon building technical and non-technical skills, which would help students to build a better community.
# Lets Learn, Grow and Innovate together.
Elevate Lab's primary aim lies in empowering students with development skills and other technical abilities for growth and advancement.
We believe in innovation and evolution. For students to grow their skills to tackle problems and to bring about change.
Elevate Lab's activities are targeted at university students and those who wish to learn technology for solving real life problems.


CHAPTER 518
COVENANTS IN LEASES
Section
518-1 Unlawful covenants
518-2 No recovery on illegal covenants
518-3 Invalidity of certain restrictive covenants


Plain gallery contains a list of clickable thumbnails to open modal gallery. Layouts are configurable and users could also use a custom implementation to draw everything they want.
To add plain gallery in your application, you must add <ks-plain-gallery></ks-plain-gallery>
in your component template file
and pass the mandatory inputs id
, images
and showGallery
.
The minimal plain gallery in your HTML file is:
Then, in your Typescript component you have to init the images array with Image class instances and write the method to open modal gallery.
To customize the plain gallery exploring all possibilities, see the table below to pass your configuration. To listen for plain gallery events, check the Output table.
To try more plain gallery live demos with custom configuration, please take a look at the example section of this website.
id |
Type:
number
A mandatory unique id >= 0 of the current gallery.
|
images |
Type:
Image[]
The mandatory array of
Image objects, that represent both the thumb gallery and the
modal images. In fact, an Image is an object with both thumb and
image source paths with other additional configuration parameters. For more info check Image .
Please don't use this.images.push(img) , when you want to modify this array, instead re-assign it to trigger change detection.
For instance: this.images = [...this.images, newImage] to create a new array from the original with a new image at the end.
Attention: if you need to add the same image (same url) multiple times in the same plain gallery, you must append to the url a random but unique query param to prevent caching issues.
For more info, please read this issue.
|
showGallery |
Type:
boolean
Show/hide plain gallery. If true the plain gallery will be visible, false otherwise.
|
config
|
Type:
LibConfig optional
Interface to configure plain gallery. |
showImage |
A |
Interface that represent the optional plain image used to open modal image, clicking on it.
If you don't provide this object, angular-modal-gallery will scale down the img path of modal image to display the thumbnail.
img |
Type:
string
Mandatory source path of the plain image. |
description |
Type:
string optional
Optional description text. To ignore this feature, don't add this property. |
title |
Type:
string optional
Optional title text. It sets 'title' html's attribute, useful for accessibility purposes. To ignore this feature, don't add this property. |
alt |
Type:
string optional
Optional alt text. It sets 'alt' html's attribute, useful for accessibility purposes. To ignore this feature, don't add this property. |
arialLabel |
Type:
string optional
Optional aria label text. It sets 'aria-label' html's attribute, useful for accessibility purposes. To ignore this feature, don't add this property. |
Interface to configure plain gallery.
strategy |
Type:
PlainGalleryStrategy
Enum that represents the strategy used to show thumbnails. |
layout |
Type:
PlainGalleryLayout
It can be either |
advanced |
Type:
AdvancedConfig optional
Optional object used to configure |
Empty interface implemented by both LineLayout
,
GridLayout
, AdvancedLayout
.
Class to configure a linear plain gallery.
breakConfig |
Type:
BreakConfig
Object to configure length and wrap. |
justify |
Type:
string
Represent the flexbox 'justify-content' property. For more info check justify-content's doc at Mozilla |
size |
Type:
Size
Object to change the size of thumbnails. |
Class to configure a grid plain gallery.
breakConfig |
Type:
BreakConfig
Object to configure length and wrap. |
size |
Type:
Size
Object to change the size of thumbnails. |
Class to configure a custom plain gallery.
modalOpenerByIndex |
Type:
number
Index of the image to open as current image of the modal gallery. |
hideDefaultPlainGallery |
Type:
boolean
If |
Interface to limit the number of items of the plain gallery or to fill other lines.
length |
Type:
number
Number of items to show. |
wrap |
Type:
boolean
If |
Interface to use <a> tags instead of <img> and to customize the css background property for thumbnails in plain gallery.
aTags |
Type:
boolean
Is true, thumbnails will be <a> tags instead of <img>. false by default. |
additionalBackground |
Type:
string
Value useful to change the css background property. '50% 50%/cover' by default. For more info check background CSS3 property |
Enum that represent the strategy used to show thumbnails in plain gallery. It can be one of these enum values:
ROW
: to show thumbnails in a row horizontallyCOLUMN
: to show thumbnails in a row verticallyGRID
: to show thumbnails in a gridCUSTOM
: to show thumbnails with a custom logic


Next: Debugging, Previous: Memory Support, Up: Libc [Contents]
These are called by newlib
but don’t apply to the embedded
environment. isatty()
is self explanatory. kill()
doesn’t
apply either in an environment withno process control, so it justs
exits, which is a similar enough behavior. getpid()
can safely
return any value greater than 1. The value doesn’t effect anything in
newlib
because once again there is no process control.
/* * isatty -- returns 1 if connected to a terminal device, * returns 0 if not. Since we're hooked up to a * serial port, we'll say yes and return a 1. */ int isatty(fd) int fd; { return (1); } /* * getpid -- only one process, so just return 1. */ #define __MYPID 1 int getpid() { return __MYPID; } /* * kill -- go out via exit... */ int kill(pid, sig) int pid; int sig; { if(pid == __MYPID) _exit(sig); return 0; }


2flock
groups
stuff...
more stuff...
stuff: tokyo drift
you
join group
create group
logout
stuff, tokyo drift
new post
submit
add member
invite a new person!
(content goes here?)


Vindman Puts Nunes In His Place With Reminder Of Military Rank
That’s Lt. Col. Vindman to you, Rep. Nunes.
While asking Lt. Col. Alexander Vindman Tuesday whether he knew the whistleblower, which the Purple Heart recipient has previously testified he does not, Rep. Devin Nunes (R-CA) referred to the witness as “Mr. Vindman.”
“Ranking member, it’s Lt. Col. Vindman, please,” Vindman corrected the lawmaker, who’s spent the majority of the public proceedings on Tuesday raising conspiracy theories about the Burisma gas company and the Biden family as well as denigrating the media.
“Lt. Col. Vindman, you testified in the deposition that you did not know who the whistleblower was or is?” Nunes clarified.
“I do not know who the whistleblower is, that is correct,” Vindman said.
Just after thanking Vindman for his service, Rep. Chris Stewart (R-UT) attempted to belittle Vindman’s request to Nunes by asking: “Do you always insist on civilians calling you by your rank?”
“Rep. Stewart, I’m in uniform, wearing my military rank, I just thought it was appropriate to stick with that,” Vindman said, with Stewart adding that he’s sure Nunes meant “no disrespect.”
“I don’t believe he did, but the attacks in the press, in Twitter have kind of eliminated the fact that– either marginalized me as a military officer or–” Vindman said as Stewart cut him off to say that Nunes didn’t mean to disrespect him.
“I believe that,” Vindman said.


Configuration Information
Configuration information is placed in /etc/pam.d/
. Below is an example file:
# Begin /etc/pam.d/other
auth required pam_unix.so nullok
account required pam_unix.so
session required pam_unix.so
password required pam_unix.so nullok
# End /etc/pam.d/other
Now set up some generic files. As root:
install -vdm755 /etc/pam.d &&
cat > /etc/pam.d/system-account << "EOF" &&
# Begin /etc/pam.d/system-account
account required pam_unix.so
# End /etc/pam.d/system-account
EOF
cat > /etc/pam.d/system-auth << "EOF" &&
# Begin /etc/pam.d/system-auth
auth required pam_unix.so
# End /etc/pam.d/system-auth
EOF
cat > /etc/pam.d/system-session << "EOF"
# Begin /etc/pam.d/system-session
session required pam_unix.so
# End /etc/pam.d/system-session
EOF
The remaining generic file depends on whether CrackLib-2.9.7 is
installed. If it is installed, use:
cat > /etc/pam.d/system-password << "EOF"
# Begin /etc/pam.d/system-password
# check new passwords for strength (man pam_cracklib)
password required pam_cracklib.so authtok_type=UNIX retry=1 difok=5 \
minlen=9 dcredit=1 ucredit=1 \
lcredit=1 ocredit=1 minclass=0 \
maxrepeat=0 maxsequence=0 \
maxclassrepeat=0 \
dictpath=/lib/cracklib/pw_dict
# use sha512 hash for encryption, use shadow, and use the
# authentication token (chosen password) set by pam_cracklib
# above (or any previous modules)
password required pam_unix.so sha512 shadow use_authtok
# End /etc/pam.d/system-password
EOF
Note
In its default configuration, pam_cracklib will allow multiple
case passwords as short as 6 characters, even with the
minlen
value set to 11.
You should review the pam_cracklib(8) man page and determine if
these default values are acceptable for the security of your
system.
If CrackLib-2.9.7 is NOT installed, use:
cat > /etc/pam.d/system-password << "EOF"
# Begin /etc/pam.d/system-password
# use sha512 hash for encryption, use shadow, and try to use any previously
# defined authentication token (chosen password) set by any prior module
password required pam_unix.so sha512 shadow try_first_pass
# End /etc/pam.d/system-password
EOF
Now add a restrictive /etc/pam.d/other
configuration file. With this
file, programs that are PAM aware will not run unless a
configuration file specifically for that application is created.
cat > /etc/pam.d/other << "EOF"
# Begin /etc/pam.d/other
auth required pam_warn.so
auth required pam_deny.so
account required pam_warn.so
account required pam_deny.so
password required pam_warn.so
password required pam_deny.so
session required pam_warn.so
session required pam_deny.so
# End /etc/pam.d/other
EOF
The PAM man page (man pam) provides a good
starting point for descriptions of fields and allowable entries.
The Linux-PAM
System Administrators' Guide is recommended for additional
information.
Important
You should now reinstall the Shadow-4.8.1 package.


It is possible to change the font-family, color, background color, and even spacing of your font. In this example I have changed the line-height to add additional spacing. If I give it a value less than 100%, the text will move closer together. Try it.
The heading above defaults to the browser setting for h2 headings, nothing fancy there.


$$\begin{aligned} f'(x) &= \lim_{h\to0}\frac{f(x+h) - f(x)}{h}\\ &= \frac{df}{dx} \end{aligned}$$
In words:
So the derivative is a small change in the outcome of a function divided by a small change in the argument of that function.
Let us define the following function:
$$y = 30*sin(x\frac{\pi}{50})$$
Then we can write the above formula for the derivative as:
You can use the following slider to change the point at which you want to take the derivative
You can use the following slider to influence $h$. Notice how for every point, when the value of $h$ goes to zero, then the calculated derivatives approaching from the left and the right converge to the same value. Our function is derivable.
(If you move this slider too fast the visuals can't follow, so be easy with it)
Let us define the following function:
$$y = abs(30*sin(x\frac{\pi}{50}))$$
Then we can write the above formula for the derivative as:
You can use the following slider to change the point at which you want to take the derivative
You can use the following slider to influence $h$. Notice how for $x=0$, when the value of $h$ goes to zero, then the calculated derivatives approaching from the left and the right do NOT converge to the same value. Our function is NOT derivable.
(If you move this slider too fast the visuals can't follow, so be easy with it)


Best known for its modern shipbuilding and the 2nd World war submarine pens. The town was completely destroyed during the war and has been rebuild in a rather nondescript style.
Position 45° 15'56"N, 02° 12' 14"W (harbour entrance)
The large outer harbour is for cruise ships, and yachts use the lock to the east to pass into Bassin de St Nazaire.


Injury Update For Cowboys LB Leighton Vander Esch
by Matt HladikThe Dallas Cowboys may head into this weekend’s showdown with the New England Patriots without the services of key linebacker Leighton Vander Esch.
Vander Esch missed the Week 9 game against the New York Giants with a neck injury but returned to play in Dallas’ next two games. However, it looks like the issue has reared its ugly head again.
According to the Dallas Morning News’ Michael Gehlken, Vander Esch had an MRI today on his neck. Ian Rapoport of NFL Network said Vander Esch would miss tomorrow’s practice because of a back problem, but we’re assuming both are talking about the same thing.
Both reporters said Vander Esch is not expected to play this weekend.
In nine games this season, Vander Esch has recorded 70 tackles, three passes defensed, a forced fumble and half of a sack.
His numbers are down from last season, when he was a revelation as a rookie and earned Pro Bowl and second team All-Pro honors.
The Cowboys and Patriots will square off at 4:25 p.m. ET Sunday on FOX.


GS1 Resolver - Download Your Data
Please paste your authentication key here:
Download Data Now
Download as Text (CSV) File
Back to the home page


Blurred Forms: An Unsteady History of Drunkenness
During an evening of carousing and drinking at a Salisbury tavern, a soldier and his comrades were drinking to one another’s health. Then the soldier did the unthinkable: he drank to the health of the Devil. Boldly daring the Devil to appear, the soldier claimed that if the Devil did not, it was proof that neither the Devil, nor God, existed. The soldier’s drinking companions quickly fled the room out of fear, but they returned “after hearing a hideous noise, and smelling a stinking savour.” After returning to the room, the soldier had vanished, and all they found was a broken window, the iron bar within it bowed and covered in blood. The soldier was never heard from again.
This peculiar tale, told in 1682 by the Anglican minister Samuel Clarke, made up a part of his warning to all regarding the treacherous fates that awaited drunkards. The soldier made the fatal error of losing his wits and drinking to the health of the Devil, inviting the evil being into his world. This story, however, was only one of the terrifying possibilities outlined by Clarke. Illness, madness, bodily and spiritual destruction, and–ultimately–death comprised the tragic fates that awaited every drunkard.
 Murmurs in the mid-seventeenth century–shocked at the sudden increase of cheaply available spirituous liquors–increased to a roar of condemnation throughout the decades of the following century. By the turn of the nineteenth century, the damnations against alcohol had become a deafening clamor that came in the form of speeches, books, medical inquiries, and artwork. One aspect often featured in such anti-liquor declarations were the drunkards themselves–more specifically, the drunkard’s unsteady, untrustworthy body.
Spiritual and medical inquiries about the effect of alcohol on a person’s body remained a constant source of concern, long before nineteenth-century movements for temperance. Published inquiries often emphasized the personal manner in which alcohol, after entering the body, initiated a process of deterioration and a literal process of physical transformation.
In 1677, Edward Bury, a former minister of Great Bolas in Shropshire, and a contemporary of Clarke, wrote at length about the ways alcohol distorted the body. He posed to the reader, “Consider also how much this Beastly sin of Drunkenness doth debauch, defile, deform the Body of man.” Drinking, Bury claimed, transformed the body–a perfect work of creation–by turning “the Nose, the Eyes, the Cheeks… red and pimpled, the Face swoln like a Bladder, the Countenance disturbed, writhen, and deformed.” To Bury, the most comparable creature to the drunkard was the swine, as drunkards seemed to take great pleasure in wallowing in their own vomit, dung, and the dirt.
To Clarke, imbibing alcohol did not turn men into swine, as Bury claimed. Instead, he claimed that drinking resulted in a much more profound transformation:
The bewitching, besotting nature of Drunkenness: It doth not turn men into Beasts, as some think, for a Beast scorns it… But it turns them into Fools and Sots, dehominates them, turns them out of their own Essences for the time, and so disfigures them, that God saith, Non est hæe Imago mea, This is not my Image…
Drinking altered the physical appearance of the body in a way that no other vice seemed to do. According to Clarke, by soaking one’s body with liquors, the drunkard experienced a process of metamorphosis; the body grew malleable, so much so that it was like soft clay with which “Satan can mould [the drunkard] into any shape.” Consuming alcohol could warp the drunkard’s features to the extent that his own Creator would no longer recognize his distorted face.
Spiritual concerns dominated early denouncements of drinking, but new observations of alcohol’s transformative power emerged in the eighteenth century. If a drinker, saturated in pernicious liquors, opened their bodies to Satan’s devious touch, man did not turn into beast. Instead, the body seemed to wither and collapse on itself. With a pallid countenance and leathery skin, the drunkard’s decaying appearance became one popularly associated with death.
The sudden rise in the drinking of gin amongst the poor of London at the turn of the eighteenth century brought forth a number of such claims. The bodily destruction was described as a gradual process; the drunkard’s constitution slowly broke down, their eyes–“except when lighten’d by the Fire of the spirituous Draught”–remained heavy and dull. The drunkard’s face was pale, their demeanor listless. If the drunkard was a woman, “the Bloom of her Beauty is soon changed for red Pimples in her Face,” and her complexion turned dull and sallow. Once the woman lost her beauty, a victim to her drunkenness, all hopes for marriage vanished, leaving the woman with truly no hope for the future.
Thomas Wilson, the Bishop of Sodor and Man, who also spoke in opposition to the increased consumption of gin, pointed out the ways in which drinking seemed to emaciate the drunkard, essentially reducing the body to a skeleton.
Such a description harkened an image that was unmistakably associated with mankind’s inevitable mortality. Overconsumption did not turn drunkards into beasts, or unrecognizable in the eyes of God, as Bury and Clark suggested; instead, these besotted individuals came to resemble the appearance all held once in the grave. The drunkard’s deteriorated body became a symbol of death, an unquestionable threat to all. Wilson was not the only to comment on such stark appearances. An eighteenth-century poem by Charles Darby likewise captured the haunting imagery of a skeletal drunkard:
The Actors in this Scene were not of one
Age, Humour, Figure, or Condition.
See One with hollow Cheek, meagre, and lean,
By Sipping-Hectick, e’en consumed quite,
As he a Skeleton had been,
Enough to put Death’s self into a Fright
This imagery became a powerful tool for organized opponents to alcohol. Quite often, the notion of a drinker who wasted away unto the point of death became a mainstay of anti-alcohol literature. Physicians who wrote about drinking’s effects did not shy away from such warnings either. Benjamin Rush, the famous physician from Pennsylvania, told the story of a man who failed to find satisfaction in his drinking. Always seeking out stronger tipples, this man moved from a daily toddy, to grog, to raw Jamaican rum, mixed with a tablespoon of ground pepper, to (as Rush stated) “take off their coldness.” Rush succinctly concluded this tale, without much expression of sympathy, or even surprise, when he stated that the man died, “a martyr to his intemperance.”
While Rush’s efforts against the consumption of alcohol certainly stood at the forefront of the emerging temperance movement, he, as well as other physicians, did attempt to convey some understanding of how drinking affected the human body. Rush noted the frequency of upset stomachs and vomiting the morning after a person engaged in heavy drinking. He also commented on the development of tremors in a drunkard’s hands, which could only be eased with a dose of cordial liquor, as well as a paleness in the face, contrasted against small, red streaks that appeared across the drunkard’s cheeks.
In A Treatise, on the True Effects of Drinking Spirituous Liquors, Wine and Beer, on Body and Mind, published in 1794, the anonymous author discussed the physical alterations caused by drinking. Initially, the author claims that drinking brought on an early form of aging–preventing “the growth of youth,” and mutating the young body so that it prematurely reflected the decay of old age. Throughout the piece, however, the author makes a claim–one that echoed the arguments made by Edward Bury a century before: that drinking not only aged the drunkard’s body, but by corrupting judgment, it made the drinker more beast than man.
By the final decades of the eighteenth century, questions began to arise regarding the proper amount of alcohol one should drink, or if one should drink at all. Due to the traditional association of alcohol and medicine, many physicians, ministers, and other societal leaders did claim that alcohol was perfectly acceptable to drink in moderation. Rush himself made this claim, but he carefully noted that only certain alcoholic beverages were acceptable to drink in moderation. Many of the more popular spirits, he stated, were not acceptable to drink at all, and those who did risked an array of diseases and punishments (with almost all ending in certain death).
Even as certain kinds of alcohol fell under scrutiny, however, the long-held notion that drinking in moderation remained acceptable likewise came into question. The previously mentioned anonymous author was especially critical of what drinking in moderation actually meant, stating:
[F]or instance, many a one would think three glasses of gin daily taken, to be a very moderate quantity, and another by drinking them would in a short time be thrown into a violent fever; for this reason it is impossible to determine the quantity that is harmless and that which will hurt.
Certainly, three glasses of gin a day might fall under suspicion as to whether that qualifies as “drinking in moderation,” but this question did mark a shift in the view that introducing alcohol–of any amount–into the human body could potentially lead to decay and transform a moderate drinker into a deplorable drunkard.
By the nineteenth century, organized advocates for temperance gathered to end the habitual consumption of the “demon drink.” Temperance literature often emphasized the inevitable “road to ruin” awaiting each person who made the unfortunate decision to drink. Timothy Shay Arthur, in particular, helped convince the American public of the dangers of alcohol through his popular novel Ten Nights in a Bar-Room and What I Saw There, originally published in 1854. Set in a tavern called the “Sickle and Sheaf,” Arthur lays out the menace of alcohol in dramatic detail. Throughout the novel, descriptions of drunkards, again, emphasized the physical deterioration drinking caused, revealing the continued importance of the body in anti-alcohol literature. In particular, the town drunkard, Joe Morgan, stands out in Arthur’s narrative as an unwanted but familiar element of the tavern. Arthur noted the physical decay habitual drinking had on the man’s body:
A glance showed him to be one of a class seen in all bar-rooms; a poor, broken-down inebriate, with the inward power of resistance gone – conscious of having no man’s respect, and giving respect to none.
Again, after the passage of a year, and with the return of Arthur’s protagonist to the same bar, comments on Joe Morgan appear once more:
He was standing at the bar, with an emptied glass in his hand. A year had made no improvement in his appearance. On the contrary, his clothes were more worn and tattered; his countenance more sadly marred.
Depictions of a demoralized local drunkard were only one aspect of the physical decline drinking wrought. In another, non-fictional book published by Arthur, Grappling With the Monster, he lays out the ways alcohol “Curses the Body,” stating:
One would suppose, from the marred and scarred, and sometimes awfully disfigured forms and faces of men who have indulged in intoxicating drinks, which are to be seen everywhere and among all classes of society, that there would be no need of other testimony to show that alcohol is an enemy to the body. And yet, strange to say, men of good sense, clear judgment and quick perception in all moral questions and in the general affairs of life, are often so blind… as to affirm that this substance, alcohol… is not only harmless, when taken in moderation – each being his own judge as to what ‘moderation’ means – but actually useful and nutritious!
Scarred, disfigured features mark the faces of drunkards–how evident it is that alcohol is an invasive “enemy to the body.” Also, once more, the issue of moderation is brought into question; is such moderation even possible? As the temperance movement gained full strength during the era of Arthur’s publications, it was no longer an issue of debate. Alcohol cursed the body, deteriorated physical features, and reduced the drunkard into a “broken-down inebriate”-far from our contemporary notion of a functioning alcoholic.
And yet, those dramatic warnings created a counter response–a skeptical backlash that questioned the validity of such claims. Did drinking really result in bodily decay? Could a person imbibe alcohol without turning into a beastly, mindless drunkard or an unwanted societal burden? Was it possible that the drunkard did not transform but vacillating observations did? A cartoon from Puck magazine presented a different image of temperance, one that struck a balance “Between Two Evils.”
To the right, an Intemperate Teetotaler appears, snobbishly refusing to even gaze upon a repulsive glass of alcohol. To the left, an Intemperate Drunkard, who, in many ways, reflects the same physical deterioration as described by temperance writers like Arthur. In the middle, though, sits a man who represents True Temperance. He holds a mug of beer, but no bodily decay marks the Temperate Man’s features; he is well dressed and of amiable countenance. While anti-liquor advocates long promoted the physical decline incurred by drinking, this figure represents quite the opposite. T. S. Arthur scoffed at the idea that alcohol could provide any source of nutrition. Benjamin Rush claimed that drinking at all would create an insatiable appetite for stronger drinks, leading, inevitably, to incurable drunkenness and death. Samuel Clarke warned that alcohol would open the drinker to possible corruption from the Devil.
Sitting between these two extremes, the Temperate Man grasps his mug of beer and, with a small smile, resolutely states, “I want nothing to do with either of you!”


Requests closest to the head are served first, this may cause that while requests arrive close to the head, those further away are not served (Starvation)
Reminder: disk geometry is one platter, 16 cylinders, 12 sectors per cylinder, 192 sectors in total.
| Sector | Cylinder | Delay |
| 170 | 14 | 0 |
| 150 | 12 | 0 |
| 120 | 10 | 0 |
| 40 | 3 | 1 |
| 20 | 1 | 2 |
| 35 | 2 | 5 |
| 2 | 0 | 6 |
| 10 | 0 | 8 |
| 50 | 4 | 15 |
| 0 | 0 | 15 |
The head is initially positioned at sector 50 (Cylinder 4)
All requests arrive in the table order, according to the delay indicated.
Comments:


{{define "tickets"}}
{{ .User.MultiSigAddress }}
{{ .User.MultiSigScript }}
Step 1
It is recommended to use the latest versions of the Decred software before starting. ⇣ Installer | ⇣ Binaries
Step 2
Your P2SH multisignature script for delegating votes has been generated. Please first import it locally into your wallet using dcrctl for safe keeping, so you can recover your funds and vote in the unlikely event of a pool failure:
dcrctl --wallet importscript "script"
For example:
$ dcrctl {{ if eq .Network "testnet"}}--testnet{{end}} --wallet importscript {{ .User.MultiSigScript }}
After successfully importing the script into your wallet, you may generate tickets delegated to the pool in either of two ways:
Step 3
Option A - dcrwallet - Automatic purchasing (Recommended)
Stop dcrwallet if it is currently running and add the following to dcrwallet.conf:
[Application Options] enableticketbuyer=1 pooladdress={{ .User.UserFeeAddr }} poolfees={{ .PoolFees }} ticketaddress={{ .User.MultiSigAddress }} [Ticket Buyer Options] ticketbuyer.maxpriceabsolute=58
Unlock dcrwallet and it will automatically purchase stake tickets delegated to the pool address.
See documentation for more options.
Option B - dcrwallet - Manual purchasing (Not recommended)
Start a wallet with funds available and manually purchase tickets with the following command using dcrctl:
dcrctl {{ if eq .Network "testnet"}}--testnet{{end}} --wallet purchaseticket "fromaccount" spendlimit minconf ticketaddress numtickets poolfeeaddress poolfeeamt
dcrctl {{ if eq .Network "testnet"}}--testnet{{end}} --wallet purchaseticket "default" 58 1 {{ .User.MultiSigAddress }} 1 {{ .User.UserFeeAddr }} {{ .PoolFees}}
Will purchase a ticket delegated to the pool and an address from the voting account using funds from the default account only if the current network price for a ticket is less than 58.0 coins.
No live tickets.
{{end}} {{if .TicketsLive}}| Ticket | TicketHeight |
|---|---|
| Ticket | TicketHeight |
| {{$data.Ticket}} | {{ $data.TicketHeight }} |
No voted tickets.
{{end}} {{if .TicketsVoted}}| Ticket | SpentByHeight | TicketHeight |
|---|---|---|
| Ticket | SpentByHeight | TicketHeight |
| {{$data.Ticket}} | {{$data.SpentByHeight}} | {{$data.TicketHeight}} |
No missed tickets.
{{end}} {{if .TicketsMissed}}| Ticket | SpentByHeight | TicketHeight |
|---|---|---|
| Ticket | SpentByHeight | TicketHeight |
| {{$data.Ticket}} | {{$data.SpentByHeight}} | {{$data.TicketHeight}} |
No tickets.
{{end}} {{if .TicketsInvalid}}| Ticket |
|---|
| Ticket |
| {{$data.Ticket}} |


| gam {mgcv} | R Documentation |
Fits a generalized additive model (GAM) to
data, the term ‘GAM’ being taken to include any quadratically penalized GLM and a variety of
other models estimated by a quadratically penalised likelihood type approach (see family.mgcv
).
The degree of smoothness of model terms is estimated as part of
fitting. gam
can also fit any GLM subject to multiple quadratic penalties (including
estimation of degree of penalization). Confidence/credible intervals are readily
available for any quantity predicted using a fitted model.
Smooth terms are represented using penalized regression splines (or similar smoothers)
with smoothing parameters selected by GCV/UBRE/AIC/REML or by regression splines with
fixed degrees of freedom (mixtures of the two are permitted). Multi-dimensional smooths are
available using penalized thin plate regression splines (isotropic) or tensor product splines
(when an isotropic smooth is inappropriate), and users can add smooths.
Linear functionals of smooths can also be included in models.
For an overview of the smooths available see smooth.terms
.
For more on specifying models see gam.models
, random.effects
and linear.functional.terms
. For more on model selection see gam.selection
. Do read gam.check
and choose.k
.
See gam from package gam
, for GAMs via the original Hastie and Tibshirani approach (see details for differences to this implementation).
For very large datasets see bam
, for mixed GAM see gamm
and random.effects
.
gam(formula,family=gaussian(),data=list(),weights=NULL,subset=NULL, na.action,offset=NULL,method="GCV.Cp", optimizer=c("outer","newton"),control=list(),scale=0, select=FALSE,knots=NULL,sp=NULL,min.sp=NULL,H=NULL,gamma=1, fit=TRUE,paraPen=NULL,G=NULL,in.out,drop.unused.levels=TRUE, drop.intercept=NULL,...)
formula |
A GAM formula, or a list of formulae (see |
family |
This is a family object specifying the distribution and link to use in
fitting etc (see |
data |
A data frame or list containing the model response variable and
covariates required by the formula. By default the variables are taken
from |
weights |
prior weights on the contribution of the data to the log likelihood. Note that a weight of 2, for example,
is equivalent to having made exactly the same observation twice. If you want to reweight the contributions
of each datum without changing the overall magnitude of the log likelihood, then you should normalize the weights
(e.g. |
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
na.action |
a function which indicates what should happen when the data contain ‘NA’s. The default is set by the ‘na.action’ setting of ‘options’, and is ‘na.fail’ if that is unset. The “factory-fresh” default is ‘na.omit’. |
offset |
Can be used to supply a model offset for use in fitting. Note
that this offset will always be completely ignored when predicting, unlike an offset
included in |
control |
A list of fit control parameters to replace defaults returned by
|
method |
The smoothing parameter estimation method. |
optimizer |
An array specifying the numerical optimization method to use to optimize the smoothing
parameter estimation criterion (given by |
scale |
If this is positive then it is taken as the known scale parameter. Negative signals that the scale parameter is unknown. 0 signals that the scale parameter is 1 for Poisson and binomial and unknown otherwise. Note that (RE)ML methods can only work with scale parameter 1 for the Poisson and binomial cases. |
select |
If this is |
knots |
this is an optional list containing user specified knot values to be used for basis construction.
For most bases the user simply supplies the knots to be used, which must match up with the |
sp |
A vector of smoothing parameters can be provided here.
Smoothing parameters must be supplied in the order that the smooth terms appear in the model
formula. Negative elements indicate that the parameter should be estimated, and hence a mixture
of fixed and estimated parameters is possible. If smooths share smoothing parameters then |
min.sp |
Lower bounds can be supplied for the smoothing parameters. Note
that if this option is used then the smoothing parameters |
H |
A user supplied fixed quadratic penalty on the parameters of the GAM can be supplied, with this as its coefficient matrix. A common use of this term is to add a ridge penalty to the parameters of the GAM in circumstances in which the model is close to un-identifiable on the scale of the linear predictor, but perfectly well defined on the response scale. |
gamma |
It is sometimes useful to inflate the model degrees of freedom in the GCV or UBRE/AIC score by a constant multiplier. This allows such a multiplier to be supplied. |
fit |
If this argument is |
paraPen |
optional list specifying any penalties to be applied to parametric model terms.
|
G |
Usually |
in.out |
optional list for initializing outer iteration. If supplied
then this must contain two elements: |
drop.unused.levels |
by default unused levels are dropped from factors before fitting. For some smooths involving factor variables you might want to turn this off. Only do so if you know what you are doing. |
drop.intercept |
Set to |
... |
further arguments for
passing on e.g. to |
A generalized additive model (GAM) is a generalized linear model (GLM) in which the linear predictor is given by a user specified sum of smooth functions of the covariates plus a conventional parametric component of the linear predictor. A simple example is:
log(E(y_i))= a + f_1(x_1i)+f_2(x_2i)
where the (independent) response variables y_i~Poi, and
f_1 and f_2 are smooth functions of covariates x_1 and
x_2. The log is an example of a link function. Note that to be identifiable the model
requires constraints on the smooth functions. By default these are imposed automatically and require that the function sums to zero over the observed covariate values (the presence of a metric by
variable is the only case which usually suppresses this).
If absolutely any smooth functions were allowed in model fitting then maximum likelihood estimation of such models would invariably result in complex overfitting estimates of f_1 and f_2. For this reason the models are usually fit by penalized likelihood maximization, in which the model (negative log) likelihood is modified by the addition of a penalty for each smooth function, penalizing its ‘wiggliness’. To control the tradeoff between penalizing wiggliness and penalizing badness of fit each penalty is multiplied by an associated smoothing parameter: how to estimate these parameters, and how to practically represent the smooth functions are the main statistical questions introduced by moving from GLMs to GAMs.
The mgcv
implementation of gam
represents the smooth functions using
penalized regression splines, and by default uses basis functions for these splines that
are designed to be optimal, given the number basis functions used. The smooth terms can be
functions of any number of covariates and the user has some control over how smoothness of
the functions is measured.
gam
in mgcv
solves the smoothing parameter estimation problem by using the
Generalized Cross Validation (GCV) criterion
n D/(n - DoF)^2
or an Un-Biased Risk Estimator (UBRE )criterion
D/n + 2 s DoF / n -s
where D is the deviance, n the number of data, s the scale parameter and DoF the effective degrees of freedom of the model. Notice that UBRE is effectively just AIC rescaled, but is only used when s is known.
Alternatives are GACV, or a Laplace approximation to REML. There
is some evidence that the latter may actually be the most effective choice.
The main computational challenge solved
by the mgcv
package is to optimize the smoothness selection criteria efficiently and reliably.
Broadly gam
works by first constructing basis functions and one or more quadratic penalty
coefficient matrices for each smooth term in the model formula, obtaining a model matrix for
the strictly parametric part of the model formula, and combining these to obtain a
complete model matrix (/design matrix) and a set of penalty matrices for the smooth terms.
The linear identifiability constraints are also obtained at this point. The model is
fit using gam.fit
, gam.fit3
or varaints, which are modifications
of glm.fit
. The GAM
penalized likelihood maximization problem is solved by Penalized Iteratively
Reweighted Least Squares (P-IRLS) (see e.g. Wood 2000).
Smoothing parameter selection is possible in one of two ways. (i)
‘Performance iteration’ uses the fact that at each P-IRLS step a working penalized linear model
is estimated, and the smoothing parameter estimation can be performed for each such working model.
Eventually, in most cases, both model parameter estimates and smoothing
parameter estimates converge. This option is available in bam
and gamm
but
is deprecated for gam
(ii) Alternatively the P-IRLS scheme is iterated to
convergence for each trial set of smoothing parameters, and GCV, UBRE or REML scores
are only evaluated on convergence - optimization is then ‘outer’ to the P-IRLS
loop: in this case the P-IRLS iteration has to be differentiated, to
facilitate optimization, and gam.fit3
or one of its variants is used in place of
gam.fit
. gam
uses the second method, outer iteration.
Several alternative basis-penalty types are built in for representing model
smooths, but alternatives can easily be added (see smooth.terms
for an overview and smooth.construct
for how to add smooth classes). The choice of the basis dimension
(k
in the s
, te
, ti
and t2
terms) is something that should be considered carefully
(the exact value is not critical, but it is important not to make it restrictively small, nor very large and
computationally costly). The basis should
be chosen to be larger than is believed to be necessary to approximate the smooth function concerned.
The effective degrees of freedom for the smooth will then be controlled by the smoothing penalty on
the term, and (usually) selected automatically (with an upper limit set by
k-1
or occasionally k
). Of course
the k
should not be made too large, or computation will be slow (or in
extreme cases there will be more
coefficients to estimate than there are data).
Note that gam
assumes a very inclusive definition of what counts as a GAM:
basically any penalized GLM can be used: to this end gam
allows the non smooth model
components to be penalized via argument paraPen
and allows the linear predictor to depend on
general linear functionals of smooths, via the summation convention mechanism described in
linear.functional.terms
. link{family.mgcv}
details what is available beyond GLMs
and the exponential family.
Details of the default underlying fitting methods are given in Wood (2011 and 2004). Some alternative methods are discussed in Wood (2000 and 2006).
gam()
is not a clone of Trevor Hastie's original (as supplied in S-PLUS or package gam). The major
differences are (i) that by default estimation of the
degree of smoothness of model terms is part of model fitting, (ii) a
Bayesian approach to variance estimation is employed that makes for easier
confidence interval calculation (with good coverage probabilities), (iii) that the model
can depend on any (bounded) linear functional of smooth terms, (iv) the parametric part of the model can be penalized,
(v) simple random effects can be incorporated, and
(vi) the facilities for incorporating smooths of more than one variable are
different: specifically there are no lo
smooths, but instead (a) s
terms can have more than one argument, implying an isotropic smooth and (b) te
,
ti
or t2
smooths are
provided as an effective means for modelling smooth interactions of any
number of variables via scale invariant tensor product smooths. Splines on the sphere, Duchon splines
and Gaussian Markov Random Fields are also available. (vii) Models beyond the exponential family are available.
See gam from package gam
, for GAMs via the original Hastie and Tibshirani approach.
If fit=FALSE
the function returns a list G
of items needed to
fit a GAM, but doesn't actually fit it.
Otherwise the function returns an object of class "gam"
as described in gamObject
.
The default basis dimensions used for smooth terms are essentially arbitrary, and
it should be checked that they are not too small. See choose.k
and
gam.check
.
You must have more unique combinations of covariates than the model has total parameters. (Total parameters is sum of basis dimensions plus sum of non-spline terms less the number of spline terms).
Automatic smoothing parameter selection is not likely to work well when fitting models to very few response data.
For data with many zeroes clustered together in the covariate space it is quite easy to set up GAMs which suffer from identifiability problems, particularly when using Poisson or binomial families. The problem is that with e.g. log or logit links, mean value zero corresponds to an infinite range on the linear predictor scale.
Simon N. Wood<EMAIL_ADDRESS>Front end design inspired by the S function of the same name based on the work of Hastie and Tibshirani (1990). Underlying methods owe much to the work of Wahba (e.g. 1990) and Gu (e.g. 2002).
Key References on this implementation:
Wood, S.N., N. Pya and B. Saefken (2016), Smoothing parameter and model selection for general smooth models (with discussion). Journal of the American Statistical Association 111, 1548-1575 http://dx.doi.org/10.1080/01621459.2016.1180986
Wood, S.N. (2011) Fast stable restricted maximum likelihood and marginal likelihood estimation of semiparametric generalized linear models. Journal of the Royal Statistical Society (B) 73(1):3-36
Wood, S.N. (2004) Stable and efficient multiple smoothing parameter estimation for generalized additive models. J. Amer. Statist. Ass. 99:673-686. [Default method for additive case by GCV (but no longer for generalized)]
Wood, S.N. (2003) Thin plate regression splines. J.R.Statist.Soc.B 65(1):95-114
Wood, S.N. (2006a) Low rank scale invariant tensor product smooths for generalized additive mixed models. Biometrics 62(4):1025-1036
Wood S.N. (2017) Generalized Additive Models: An Introduction with R (2nd edition). Chapman and Hall/CRC Press.
Wood S.N., F. Scheipl and J.J. Faraway (2012) Straightforward intermediate rank tensor product smoothing in mixed models. Statistical Computing.
Marra, G and S.N. Wood (2012) Coverage Properties of Confidence Intervals for Generalized Additive Model Components. Scandinavian Journal of Statistics, 39(1), 53-74.
Key Reference on GAMs and related models:
Hastie (1993) in Chambers and Hastie (1993) Statistical Models in S. Chapman and Hall.
Hastie and Tibshirani (1990) Generalized Additive Models. Chapman and Hall.
Wahba (1990) Spline Models of Observational Data. SIAM
Wood, S.N. (2000) Modelling and Smoothing Parameter Estimation with Multiple Quadratic Penalties. J.R.Statist.Soc.B 62(2):413-428 [The original mgcv paper, but no longer the default methods.]
Background References:
Green and Silverman (1994) Nonparametric Regression and Generalized Linear Models. Chapman and Hall.
Gu and Wahba (1991) Minimizing GCV/GML scores with multiple smoothing parameters via the Newton method. SIAM J. Sci. Statist. Comput. 12:383-398
Gu (2002) Smoothing Spline ANOVA Models, Springer.
McCullagh and Nelder (1989) Generalized Linear Models 2nd ed. Chapman & Hall.
O'Sullivan, Yandall and Raynor (1986) Automatic smoothing of regression functions in generalized linear models. J. Am. Statist.Ass. 81:96-103
Wood (2001) mgcv:GAMs and Generalized Ridge Regression for R. R News 1(2):20-25
Wood and Augustin (2002) GAMs with integrated model selection using penalized regression splines and applications to environmental modelling. Ecological Modelling 157:157-177
http://www.maths.bris.ac.uk/~sw15190/
mgcv-package
, gamObject
, gam.models
, smooth.terms
,
linear.functional.terms
, s
,
te
predict.gam
,
plot.gam
, summary.gam
, gam.side
,
gam.selection
, gam.control
gam.check
, linear.functional.terms
negbin
, magic
,vis.gam
## see also examples in ?gam.models (e.g. 'by' variables, ## random effects and tricks for large binary datasets) library(mgcv) set.seed(2) ## simulate some data... dat <- gamSim(1,n=400,dist="normal",scale=2) b <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),data=dat) summary(b) plot(b,pages=1,residuals=TRUE) ## show partial residuals plot(b,pages=1,seWithMean=TRUE) ## `with intercept' CIs ## run some basic model checks, including checking ## smoothing basis dimensions... gam.check(b) ## same fit in two parts ..... G <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),fit=FALSE,data=dat) b <- gam(G=G) print(b) ## 2 part fit enabling manipulation of smoothing parameters... G <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),fit=FALSE,data=dat,sp=b$sp) G$lsp0 <- log(b$sp*10) ## provide log of required sp vec gam(G=G) ## it's smoother ## change the smoothness selection method to REML b0 <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),data=dat,method="REML") ## use alternative plotting scheme, and way intervals include ## smoothing parameter uncertainty... plot(b0,pages=1,scheme=1,unconditional=TRUE) ## Would a smooth interaction of x0 and x1 be better? ## Use tensor product smooth of x0 and x1, basis ## dimension 49 (see ?te for details, also ?t2). bt <- gam(y~te(x0,x1,k=7)+s(x2)+s(x3),data=dat, method="REML") plot(bt,pages=1) plot(bt,pages=1,scheme=2) ## alternative visualization AIC(b0,bt) ## interaction worse than additive ## Alternative: test for interaction with a smooth ANOVA ## decomposition (this time between x2 and x1) bt <- gam(y~s(x0)+s(x1)+s(x2)+s(x3)+ti(x1,x2,k=6), data=dat,method="REML") summary(bt) ## If it is believed that x0 and x1 are naturally on ## the same scale, and should be treated isotropically ## then could try... bs <- gam(y~s(x0,x1,k=40)+s(x2)+s(x3),data=dat, method="REML") plot(bs,pages=1) AIC(b0,bt,bs) ## additive still better. ## Now do automatic terms selection as well b1 <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),data=dat, method="REML",select=TRUE) plot(b1,pages=1) ## set the smoothing parameter for the first term, estimate rest ... bp <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),sp=c(0.01,-1,-1,-1),data=dat) plot(bp,pages=1,scheme=1) ## alternatively... bp <- gam(y~s(x0,sp=.01)+s(x1)+s(x2)+s(x3),data=dat) # set lower bounds on smoothing parameters .... bp<-gam(y~s(x0)+s(x1)+s(x2)+s(x3), min.sp=c(0.001,0.01,0,10),data=dat) print(b);print(bp) # same with REML bp<-gam(y~s(x0)+s(x1)+s(x2)+s(x3), min.sp=c(0.1,0.1,0,10),data=dat,method="REML") print(b0);print(bp) ## now a GAM with 3df regression spline term & 2 penalized terms b0 <- gam(y~s(x0,k=4,fx=TRUE,bs="tp")+s(x1,k=12)+s(x2,k=15),data=dat) plot(b0,pages=1) ## now simulate poisson data... set.seed(6) dat <- gamSim(1,n=2000,dist="poisson",scale=.1) ## use "cr" basis to save time, with 2000 data... b2<-gam(y~s(x0,bs="cr")+s(x1,bs="cr")+s(x2,bs="cr")+ s(x3,bs="cr"),family=poisson,data=dat,method="REML") plot(b2,pages=1) ## drop x3, but initialize sp's from previous fit, to ## save more time... b2a<-gam(y~s(x0,bs="cr")+s(x1,bs="cr")+s(x2,bs="cr"), family=poisson,data=dat,method="REML", in.out=list(sp=b2$sp[1:3],scale=1)) par(mfrow=c(2,2)) plot(b2a) par(mfrow=c(1,1)) ## similar example using GACV... dat <- gamSim(1,n=400,dist="poisson",scale=.25) b4<-gam(y~s(x0)+s(x1)+s(x2)+s(x3),family=poisson, data=dat,method="GACV.Cp",scale=-1) plot(b4,pages=1) ## repeat using REML as in Wood 2011... b5<-gam(y~s(x0)+s(x1)+s(x2)+s(x3),family=poisson, data=dat,method="REML") plot(b5,pages=1) ## a binary example (see ?gam.models for large dataset version)... dat <- gamSim(1,n=400,dist="binary",scale=.33) lr.fit <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),family=binomial, data=dat,method="REML") ## plot model components with truth overlaid in red op <- par(mfrow=c(2,2)) fn <- c("f0","f1","f2","f3");xn <- c("x0","x1","x2","x3") for (k in 1:4) { plot(lr.fit,residuals=TRUE,select=k) ff <- dat[[fn[k]]];xx <- dat[[xn[k]]] ind <- sort.int(xx,index.return=TRUE)$ix lines(xx[ind],(ff-mean(ff))[ind]*.33,col=2) } par(op) anova(lr.fit) lr.fit1 <- gam(y~s(x0)+s(x1)+s(x2),family=binomial, data=dat,method="REML") lr.fit2 <- gam(y~s(x1)+s(x2),family=binomial, data=dat,method="REML") AIC(lr.fit,lr.fit1,lr.fit2) ## For a Gamma example, see ?summary.gam... ## For inverse Gaussian, see ?rig ## now 2D smoothing... eg <- gamSim(2,n=500,scale=.1) attach(eg) op <- par(mfrow=c(2,2),mar=c(4,4,1,1)) contour(truth$x,truth$z,truth$f) ## contour truth b4 <- gam(y~s(x,z),data=data) ## fit model fit1 <- matrix(predict.gam(b4,pr,se=FALSE),40,40) contour(truth$x,truth$z,fit1) ## contour fit persp(truth$x,truth$z,truth$f) ## persp truth vis.gam(b4) ## persp fit detach(eg) par(op) ################################################## ## largish dataset example with user defined knots ################################################## par(mfrow=c(2,2)) n <- 5000 eg <- gamSim(2,n=n,scale=.5) attach(eg) ind<-sample(1:n,200,replace=FALSE) b5<-gam(y~s(x,z,k=40),data=data, knots=list(x=data$x[ind],z=data$z[ind])) ## various visualizations vis.gam(b5,theta=30,phi=30) plot(b5) plot(b5,scheme=1,theta=50,phi=20) plot(b5,scheme=2) par(mfrow=c(1,1)) ## and a pure "knot based" spline of the same data b6<-gam(y~s(x,z,k=64),data=data,knots=list(x= rep((1:8-0.5)/8,8), z=rep((1:8-0.5)/8,rep(8,8)))) vis.gam(b6,color="heat",theta=30,phi=30) ## varying the default large dataset behaviour via `xt' b7 <- gam(y~s(x,z,k=40,xt=list(max.knots=500,seed=2)),data=data) vis.gam(b7,theta=30,phi=30) detach(eg)


{{ include('dashboard/header.html') }} {{ include('dashboard/navbar.html') }} Edit user Username: First name: Last name: E-mail: User role: User Admin


|
Here are some of the other ways to pay.
PayPal. PayPal is an e-commerce payment processing company owned by eBay. ...
Bill Me Later. "Bill me later" is a way to use PayPal and pay without a credit card. ...
Debit Card. ...
Bank Transfer. ...
Electronic Bill Payment. ...
Mobile Payments. ...
Electronic Check.
|


Across: 1. Police hold everyone after Bob finds shells (8) 5. Braved bravely, for example (6) 9. Lola Grey composed meaningful story (8) 10. In show with Harpo I toured part of France (6) 12. Wait a second! Sounds like feet! (4) 13. Used for moving in horological circles (10) 15. Men can gas, Lord, and gossip! (13) 19. Quiet about detective in white being biased (13) 23. Walker taped siren (10) 25. Part of the crust is beige (4) 28. Corrects and finishes without me (6) 29. European fellow and I spar (8) 30. Shouted to the Spanish and French in yard (6) 31. Write punch-line about military HQ (8) Down: 1. Sea food prepared in second lot of tents by me (6) 2.  (5) 3. Records 50 own goals (4) 4. Mean to drink last drop! (7) 6. Penny waits by back door for Edwin (5) 7. Set about by danger and cut off! (9) 8. Tied to a railway fence, possibly? (8) 11. Food for confused wolf? (4) 14. Edna is crazy for Hamlet! (4) 15. In time, weed is confused with flower (9) 16. Give voice to song (3) 17. Admits initially one's worst nasty sins! (4) 18. Take axe to polyp! Some over-reaction, surely? (8) 20. Chops bear's head off for these trophies? (4) 21. Time ape finding food (4 3) 22.  Man lets half creep sideways (5) 26. Chris Lang makes a noise! (5) 27. Tie up 100 at Kings Head (4)


| Prev | Next | size |
| Matlab or Octave |
[ m, n] = size( x)
|
| C++ |
m = x.size1()
|
n = x.size2()
|
[
m,
n] = size(
x)
returns the row dimension m and column dimension n
of the matrix x.
function [ok] = size_ok()
ok = true;
x = [ 1 2 3 ; 4 5 6 ];
% ----------------
[m, n] = size(x);
% ----------------
ok = ok & (m == 2);
ok = ok & (n == 3);
return
m =
x.size1()
n =
x.size2()
where x is a ublas matrix<double>
and
m, n are size_t
objects.
# include <mat2cpp.hpp>
bool size_ok(void)
{ bool ok = true;
using namespace mat2cpp;
size_t m(2), n(3);
matrix<double> x(m, n);
// --------------------
ok &= (x.size1() == m);
ok &= (x.size2() == n);
// --------------------
return ok;
}


@import idapiclient.responses.Error @( page: model.Page, idRequest: services.IdentityRequest, idUrlBuilder: services.IdentityUrlBuilder, errors: List[Error], user: com.gu.identity.model.User, userContentAccess: services.ContentAccess )(implicit request: RequestHeader, messages: play.api.i18n.Messages, context: model.ApplicationContext, ) @import views.html.fragments.registrationFooter @emailIsValidated = @{ user.statusFields.userEmailValidated.fold(false)(identity) }
We've noticed you have an active membership, recurring contribution or subscription with the Guardian, so you won't be able to automatically delete your account online. Please follow the instructions below first and try again if you would still like delete your account.
 To cancel your membership please click here.
} @if(userContentAccess.recurringContributor) {You must first cancel your recurring contribution before you can delete your account online. To cancel this please click here.
} @if(userContentAccess.hasSubscription) {You cannot delete your account while you have an active subscription. If you would like to cancel your subscription, please email the Subscriptions Team at customer.help@@theguardian.com
}Before you can delete your account you need to validate your email address by resetting your password. Once you have validated, please reload this page and you will be able to delete your account.
Reset your password


Julia
provides one of the best, if not the best, environments for numerical linear algebra.
The Base
package provides basic array (vector, matrix, etc.) construction and manipulation; *
, /
, \
, '
. The LinearAlgebra
package provides many definitions of matrix types (Diagonal
, UpperTriangular
, ...) and factorizations. The SparseArrays
packages provides types and methods for sparse matrices.
A = rand(4,3) # simulate a matrix with elements selected at random from (0,1)
4×3 Array{Float64,2}: 0.871159 0.273019 0.264304 0.419799 0.11469 0.609529 0.559835 0.84473 0.876732 0.581368 0.634278 0.361042
B = rand(3, 4)
3×4 Array{Float64,2}: 0.40449 0.977604 0.777997 0.421952 0.0655067 0.455899 0.988932 0.588827 0.0560149 0.654017 0.365024 0.0609093
A' # "lazy" transpose
3×4 LinearAlgebra.Adjoint{Float64,Array{Float64,2}}: 0.871159 0.419799 0.559835 0.581368 0.273019 0.11469 0.84473 0.634278 0.264304 0.609529 0.876732 0.361042
A*B
4×4 Array{Float64,2}: 0.385065 1.14898 1.04423 0.544447 0.21146 0.861326 0.662516 0.281794 0.330893 1.50581 1.59096 0.787025 0.296931 1.09364 1.21135 0.640781
A least squares solution is one of the building blocks for statistical models.
If X
is an $n\times p$ model matrix and y
is an $n$-dimensional vector of observed responses, a linear model is of the form
\[ \mathcal{Y}\sim\mathcal{N}(\mathbf{X}\beta, \sigma^2\mathbf{I}) \]
That is, the mean response is modeled as a linear predictor , $\mathbf{X}\beta$, depending on the parameter vector, $\beta$ (also called coefficients) with the covariance matrix, $\sigma^2\mathbf{I}$. In general the probability density for a multivariate normal distribution with mean $\mu$ and covariance matrix $\Sigma$ is
\[ f(\mathbf{y}|\mu,\Sigma) = \frac{1}{(2\pi)^{n/2}|\Sigma|^{1/2}} \exp\left(-\frac{(\mathbf{y}-\mu)'\Sigma^{-1}(\mathbf{y}-\mu)}{2}\right) \]
where $|\Sigma|$ denotes the determinant of $\Sigma$.
When the covariance matrix is of the form $\sigma^2\mathbf{I}$ the distribution is called a spherical normal distribution because the contours of constant density are $n$-dimensional spheres centered at $\mu$. In these cases the probability density can be simplified to
\[ \begin{aligned} f(\mathbf{y}|\beta,\sigma)&= \frac{1}{(2\pi\sigma^2)^{n/2}} \exp\left(-\frac{(\mathbf{y}-\mathbf{X}\beta)'(\mathbf{y}-\mathbf{X}\beta)}{2\sigma^2}\right)\newline &= \frac{1}{(2\pi\sigma^2)^{n/2}} \exp\left(-\frac{\|\mathbf{y}-\mathbf{X}\beta)\|^2}{2\sigma^2}\right) . \end{aligned} \]
The likelihood of the parameters, $\beta$ and $\sigma$, given the data, $\mathbf{y}$ (and, implicitly, $\mathbf{X}$), is the same expression as the density but with the roles of the parameters and the observations reversed
\[ L(\beta,\sigma|\mathbf{y})=\frac{1}{(2\pi\sigma^2)^{n/2}} \exp\left(-\frac{\|\mathbf{y}-\mathbf{X}\beta)\|^2}{2\sigma^2}\right) . \]
The maximum likelihood estimates of the parameters are the values that maximize the likelihood given the data. It is convenient to maximize the logarithm of the likelihood, called the log-likelihood, instead of the likelihood.
\[ \ell(\beta,\sigma|\mathbf{y})=\log L(\beta,\sigma|\mathbf{y})= -\frac{n}{2}\log(2\pi\sigma^2)-\frac{\|\mathbf{y}-\mathbf{X}\beta)\|^2}{2\sigma^2} \]
(Because the logarithm function is monotone increasing, the values of $\beta$ and $\sigma$ that maximize the log-likelihood also maximize the likelihood.)
For any value of $\sigma$ the value of $\beta$ that maximizes the log-likelihood is the value that minimizes the sum of squared residuals,
\[ \widehat{\beta}=\arg\min_\beta \|\mathbf{y} - \mathbf{X}\beta\|^2 \]
Data from a calibration experiment on the optical density versus the concentration of Formaldehyde are available as the Formaldehyde
data in R
. We use the RCall
package to retrieve these data from R
.
using LinearAlgebra, RCall, StatsModels, Tables
Formaldehyde = rcopy(R"Formaldehyde")
| carb | optden | |
|---|---|---|
| Float64 | Float64 | |
| 1 | 0.1 | 0.086 |
| 2 | 0.3 | 0.269 |
| 3 | 0.5 | 0.446 |
| 4 | 0.6 | 0.538 |
| 5 | 0.7 | 0.626 |
| 6 | 0.9 | 0.782 |
R"""
library(ggplot2)
qplot(x=carb, y=optden, data=Formaldehyde, geom="point")
"""
RCall.RObject{RCall.VecSxp}
In a simple linear regression the model matrix, $\mathbf{X}$, consists of a column of 1's and a column of the covariate values; carb
, in this case.
X = hcat(ones(size(Formaldehyde, 1)), Formaldehyde.carb)
6×2 Array{Float64,2}: 1.0 0.1 1.0 0.3 1.0 0.5 1.0 0.6 1.0 0.7 1.0 0.9
y = Formaldehyde.optden
6-element Array{Float64,1}: 0.086 0.269 0.446 0.538 0.626 0.782
β = X\y # least squares estimate
2-element Array{Float64,1}: 0.005085714285714445 0.876285714285714
r = y - X*β #residual
6-element Array{Float64,1}: -0.006714285714285853 0.0010285714285713787 0.002771428571428536 0.0071428571428572285 0.007514285714285807 -0.011742857142857055
One of the conditions for $\hat{\beta}$ being the least squares estimate is that the residuals must be orthogonal to the columns of $\mathbf{X}$
X'r # not exactly zero but very small entries
2-element Array{Float64,1}: 4.163336342344337e-17 1.48318857196017e-16
Creating model matrices from a data table can be a tedious and error-prone operation. In addition, statistical inference regarding a linear model often considers groups of columns generated by model terms. The GLM
package provides methods to fit and analyze linear models and generalized linear models (described later) using a formula/data specification similar to that in R.
using GLM
m1 = fit(LinearModel, @formula(optden ~ 1 + carb), Formaldehyde)
StatsModels.TableRegressionModel{GLM.LinearModel{GLM.LmResp{Array{Float64,1 }},GLM.DensePredChol{Float64,LinearAlgebra.Cholesky{Float64,Array{Float64,2 }}}},Array{Float64,2}} optden ~ 1 + carb Coefficients: ─────────────────────────────────────────────────────────────────────────── ──── Estimate Std. Error t value Pr(>|t|) Lower 95% Upper 95% ─────────────────────────────────────────────────────────────────────────── ──── (Intercept) 0.00508571 0.00783368 0.649211 0.5516 -0.0166641 0.026 8355 carb 0.876286 0.0135345 64.7444 <1e-6 0.838708 0.913 864 ─────────────────────────────────────────────────────────────────────────── ────
The evaluation of the formula is performed by the StatsModels
package in stages.
f1 = @formula(optden ~ 1 + carb) y, X = modelcols(apply_schema(f1, schema(Formaldehyde)), Formaldehyde)
([0.086, 0.269, 0.446, 0.538, 0.626, 0.782], [1.0 0.1; 1.0 0.3; … ; 1.0 0.7 ; 1.0 0.9])
X
6×2 Array{Float64,2}: 1.0 0.1 1.0 0.3 1.0 0.5 1.0 0.6 1.0 0.7 1.0 0.9
According to the formulas given in text books, the least squares estimates are calculated as
\[ \widehat{\mathbf{\beta}}=\mathbf{X^\prime X}^{-1}\mathbf{X^\prime y} \]
In practice, this formula is not the way the estimates are calculated, because it is wasteful to evaluate the inverse of a matrix if you just want to solve a system of equations.
Recall that the least squares estimate satisfies the condition that the residual is orthogonal to the columns of $\mathbf{X}$.
\[ \mathbf{X^\prime (y - X\widehat{\beta})} = \mathbf{0} \]
which can be re-written as
\[ \mathbf{X^\prime X}\widehat{\mathbf{\beta}}=\mathbf{X^\prime y} \]
These are called the normal equations - "normal" in the sense of orthogonal, not in the sense of the normal distribution.
The matrix $\mathbf{X^\prime X}$ is symmetric and positive definite. The latter condition means that
\[ \mathbf{v^\prime(X^\prime X)v}=\mathbf{(Xv)^\prime Xv} = \|\mathbf{Xv}\|^2 > 0\quad\forall \mathbf{v}\ne\mathbf{0} \]
if $\mathbf{X}$ has full column rank.
We will assume that the model matrices $\mathbf{X}$ we will use do have full rank. It is possible to handle rank-deficient model matrices but we will not cover that here.
A positive-definite matrix has a "square root" in the sense that there is a $p\times p$ matrix $\mathbf{A}$ such that $\mathbf{A^\prime A}=\mathbf{X^\prime X} .$ In fact, when $p>1$ there are several. A specific choice of $\mathbf{A}$ is an upper triangular matrix with positive elements on the diagonal, usually written $\mathbf{R}$ and called the upper Cholesky factor of $\mathbf{X^\prime X}$.
X
6×2 Array{Float64,2}: 1.0 0.1 1.0 0.3 1.0 0.5 1.0 0.6 1.0 0.7 1.0 0.9
xpx = X'X
2×2 Array{Float64,2}: 6.0 3.1 3.1 2.01
ch = cholesky(xpx)
LinearAlgebra.Cholesky{Float64,Array{Float64,2}} U factor: 2×2 LinearAlgebra.UpperTriangular{Float64,Array{Float64,2}}: 2.44949 1.26557 ⋅ 0.63901
ch.U'ch.U
2×2 Array{Float64,2}: 6.0 3.1 3.1 2.01
ch.U'ch.U ≈ xpx
true
Because the Cholesky factor is triangular, it is possible to solve systems of equations of the form $\mathbf{R^\prime R}\widehat{\mathbf{\beta}}=\mathbf{X^\prime y}$ in place in two stages. First solve for $\mathbf{v}$ in $\mathbf{R^\prime v}=\mathbf{X^\prime y}$
v = ldiv!(ch.U', X'y)
2-element Array{Float64,1}: 1.1214580539042318 0.5599550279561151
then solve for $\widehat{\mathbf{\beta}}$ in
\[ \mathbf{R}\widehat{\mathbf{\beta}}=\mathbf{v} \]
βc = ldiv!(ch.U, copy(v)) # solution from the Cholesky factorization
2-element Array{Float64,1}: 0.005085714285713629 0.8762857142857156
βc ≈ β
true
These steps are combined in one of the many LinearAlgebra
methods for solutions of equations.
ldiv!(ch, X'y)
2-element Array{Float64,1}: 0.005085714285713629 0.8762857142857156
Another way of approaching the least squares problem is to write the sum of squared residuals as what is called a quadratic form.
\[ \begin{aligned} r^2(\mathbf{\beta}) & = \|\mathbf{y} - \mathbf{X\beta}\|^2\\ &=\left\|\begin{bmatrix}\mathbf{X}&\mathbf{y}\end{bmatrix}\begin{bmatrix}\mathbf{-\beta}\\ 1\end{bmatrix}\right\|^2\\ &=\begin{bmatrix}\mathbf{-\beta}&1\end{bmatrix}\begin{bmatrix}\mathbf{X^\prime X} & \mathbf{X^\prime y}\\ \mathbf{y^\prime X}&\mathbf{y^\prime y}\end{bmatrix} \begin{bmatrix}\mathbf{-\beta}\\ 1\end{bmatrix}\\ &=\begin{bmatrix}\mathbf{-\beta}&1\end{bmatrix} \begin{bmatrix} \mathbf{R_{XX}}^\prime&\mathbf{0}\\ \mathbf{r_{Xy}}^\prime&r_{\mathbf{yy}} \end{bmatrix} \begin{bmatrix} \mathbf{R_{XX}}&\mathbf{r_{Xy}}\\ \mathbf{0}&r_{\mathbf{yy}} \end{bmatrix} \begin{bmatrix}\mathbf{-\beta}\\ 1\end{bmatrix}\\ &= \left\| \begin{bmatrix} \mathbf{R_{XX}}&\mathbf{r_{Xy}}\\ \mathbf{0}&r_{\mathbf{yy}} \end{bmatrix} \begin{bmatrix}\mathbf{-\beta}\\ 1\end{bmatrix}\right\|^2\\ &= \|\mathbf{r_{Xy}}-\mathbf{R_{XX}\beta}\|^2 + r_{\mathbf{yy}}^2 \end{aligned} \]
where $\begin{bmatrix}\mathbf{R_{XX}}&\mathbf{r_{Xy}}\\ \mathbf{0}&r_{\mathbf{yy}}\end{bmatrix}$ is the upper Cholesky factor of the augmented matrix $\begin{bmatrix}\mathbf{X^\prime X} & \mathbf{X^\prime y}\\ \mathbf{y^\prime X}&\mathbf{y^\prime y}\end{bmatrix}$.
Xy = hcat(X, y) # augmented model matrix
6×3 Array{Float64,2}: 1.0 0.1 0.086 1.0 0.3 0.269 1.0 0.5 0.446 1.0 0.6 0.538 1.0 0.7 0.626 1.0 0.9 0.782
cha = cholesky(Xy'Xy) # augmented Cholesky factor
LinearAlgebra.Cholesky{Float64,Array{Float64,2}} U factor: 3×3 LinearAlgebra.UpperTriangular{Float64,Array{Float64,2}}: 2.44949 1.26557 1.12146 ⋅ 0.63901 0.559955 ⋅ ⋅ 0.0172974
Note that $\mathbf{R_{XX}}$ is just the Cholesky factor of $\mathbf{X^\prime X}$ which was previously calculated and the vector $\mathbf{r_{Xy}}$ is the solution to $\mathbf{R^\prime v}=\mathbf{X^\prime y}$. The minimum sum of squares is $r^{\mathbf{yy}}$ which is attained when $\mathbf{\beta}$ is the solution to $\mathbf{R_{XX}}\widehat{\beta}=\mathbf{r_{Xy}}$
RXX = UpperTriangular(view(cha.U, 1:2, 1:2))
2×2 LinearAlgebra.UpperTriangular{Float64,SubArray{Float64,2,LinearAlgebra. UpperTriangular{Float64,Array{Float64,2}},Tuple{UnitRange{Int64},UnitRange{ Int64}},false}}: 2.44949 1.26557 ⋅ 0.63901
RXX ≈ ch.U
true
rXy = cha.U[1:2, end] # creates a copy ("view" doesn't copy)
2-element Array{Float64,1}: 1.1214580539042318 0.5599550279561146
rXy ≈ v
true
βac = ldiv!(RXX, copy(rXy)) # least squares solution from the augmented Cholesky
2-element Array{Float64,1}: 0.005085714285713991 0.8762857142857148
βac ≈ β
true
abs2(cha.U[end,end]) ≈ sum(abs2, y - X*β) # check on residual sum of squares
true
One reason for writing the least squares solution in this way is that we will use a similar decomposition for linear mixed models later. Another is that when dealing with very large data sets we may wish to parallelize the calculation over many cores or over many processors. The natural way to parallelize the calculation is in blocks of rows and the augmented Cholesky can be formed row by row using a lowrankupdate
.
To show this we create a row-oriented table from our Formaldehyde
data set, which is in a column-oriented format.
Formrows = Tables.rowtable(Formaldehyde)
6-element Array{NamedTuple{(:carb, :optden),Tuple{Float64,Float64}},1}: (carb = 0.1, optden = 0.086) (carb = 0.3, optden = 0.269) (carb = 0.5, optden = 0.446) (carb = 0.6, optden = 0.538) (carb = 0.7, optden = 0.626) (carb = 0.9, optden = 0.782)
then initialize a Cholesky factor and zero out its contents
chr = cholesky(zeros(3, 3) + I) # initialize
LinearAlgebra.Cholesky{Float64,Array{Float64,2}} U factor: 3×3 LinearAlgebra.UpperTriangular{Float64,Array{Float64,2}}: 1.0 0.0 0.0 ⋅ 1.0 0.0 ⋅ ⋅ 1.0
fill!(chr.factors, 0); # zero out the contents chr
LinearAlgebra.Cholesky{Float64,Array{Float64,2}} U factor: 3×3 LinearAlgebra.UpperTriangular{Float64,Array{Float64,2}}: 0.0 0.0 0.0 ⋅ 0.0 0.0 ⋅ ⋅ 0.0
Update by rows
fill!(chr.factors, 0) for r in Formrows lowrankupdate!(chr, [1.0, r.carb, r.optden]) end chr
LinearAlgebra.Cholesky{Float64,Array{Float64,2}} U factor: 3×3 LinearAlgebra.UpperTriangular{Float64,Array{Float64,2}}: 2.44949 1.26557 1.12146 ⋅ 0.63901 0.559955 ⋅ ⋅ 0.0172974
This is the same augmented Cholesky factor as before but obtained in a different way. For generalized linear mixed models and for nonlinear mixed models it can be an advantage to work row-wise when performing some of the least squares calculations.
There are other ways of solving a least squares problem, such as using an orthogonal-triangular decomposition, also called a QR decomposition, or a singular value decomposition. The bottom line is that we decompose $\mathbf{X}$ or $\mathbf{X^\prime X}$ into some convenient product of orthogonal or triangular or diagonal matrices and work with those. Just to relate these ideas, the QR decomposition of $\mathbf{X}$ is
qrX = qr(X)
LinearAlgebra.QRCompactWY{Float64,Array{Float64,2}} Q factor: 6×6 LinearAlgebra.QRCompactWYQ{Float64,Array{Float64,2}}: -0.408248 -0.652051 -0.373705 -0.340529 -0.307353 -0.241002 -0.408248 -0.339066 0.0546099 0.22072 0.386829 0.719049 -0.408248 -0.026082 0.868576 -0.143979 -0.156535 -0.181645 -0.408248 0.13041 -0.153597 0.812553 -0.221297 -0.288998 -0.408248 0.286902 -0.17577 -0.230915 0.71394 -0.39635 -0.408248 0.599887 -0.220116 -0.31785 -0.415585 0.388946 R factor: 2×2 Array{Float64,2}: -2.44949 -1.26557 0.0 0.63901
Notice that the R
factor is the upper Cholesky factor of $\mathbf{X^\prime X}$ with the first row multiplied by -1 so its transposed product with itself is $\mathbf{X^\prime X}$.
qrX.R'qrX.R
2×2 Array{Float64,2}: 6.0 3.1 3.1 2.01
That is,
qrX.R'qrX.R ≈ xpx
true
The original solution for $\widehat{\mathbf{\beta}}$ from the expression X\y
is actually performed by taking a QR decomposition of X
.


A Model defines your data. Under the hood, it uses the
ko.mapping
plugin.
Quoting the Official Documentation,
The mapping plugin gives you a straightforward way to map that plain JavaScript object into a view model with the appropriate observables. This is an alternative to manually writing your own JavaScript code that constructs a view model based on some data you’ve fetched from the server.
Models are defined using the
metaproject.Model(defaults, mapping)
function. The
defaults
parameter expects an object with the initial
values for new instances of this entity.
var Calculator = metaproject.Model({ val1: 0, val2: 0, sum: function() { return this.val1() + this.val2(); } });
Functions are mapped to computed observables and scoped to the current instance, allowing the programmer to return complex properties.
Once defined, new objects may be instantiated.
var calc = new Calculator({ val1: 2, val2: 2 }); // Will alert "4" alert(calc.sum());
Sometimes it may be necessary to have more control over how the mapping is
performed. This is accomplished using mapping
options.
On this
more complex example, we'll define a Contact
Model, which has a
list of Address
instances on the addresses
field.
var Address = metaproject.Model({ street: null, number: null }); var Contact = metaproject.Model({ firstName: null, lastName: null, name: function() { return this.firstName() + " " + this.lastName(); }, addresses: [] }, { addresses: Address.mapper });
Address.mapper
is a static mapper for this type.
The following methods may be used to define and interact with a DataSource.
Model.bind(url) |
Binds this Model to the url REST endpoint.
|
|---|---|
Model.query(params) |
Instantiates a Query using the provided
params , see Model Queries below
|
Model.publish(channel, params) |
Queries this model and publishes results to
channel , returns the Query.
|
/* * Model.bind, Model.query and Model.publish */ var User = metaproject.Model({ id: null, name: null, age: null }).bind('/users'); // Queries all users (GET /users) var users = User.query({}); // Queries users with less than 12 years old (GET /users?age=<12) // Publish the results to the kids channel var kids = User.publish('kids', { age: '<12' }); // local viewmodel viewmodel = { users: users, kids: kids } // on another module // Listen to the "kids" channel. The true parameter // enables populating the field which the last known // value for the channel. When false it would start // undefined until the kids query refreshes otherviewmodel = { kids: ko.observableArray().subscribeTo('kids', true) }
A Query object is an observable array which updates itself automatically when its filter changes
var query = Model.query(params);
Data is also reloaded automatically when the underlying datasource
emits a changed
event (every delete, post, put), to
change this behavior, set query._live = false;
after
instantiating the Query
query.loading |
Observable, true if data is being loaded
|
|---|---|
query.filter |
Observable, object with the query parameters To set a new filter, use To set a specific field use |
A query.observable is a dependent query that is updated then the filter changes
var observable = query.observable(params, transform)
The observable params
are merged with the query's
filter and its contents are refreshed whenever the filter changes
The optional transform
callback, if specified, is used
to transform the datasource response.
observable.loading
Observable boolean, true if data is being loaded
When bound to a DataSource, the following methods may be used.
save(callback) |
POSTs or PUTs to the DataSource depending on the
primary key, calls callback on success.
|
|---|
/* * new Model, Model.get, model.save */ var User = metaproject.Model({ id: null, name: null, age: null }).bind('/users'); // Create a new user var user = new User({ name: 'John Doe', age: 33 }); // Commit changes (POST /users) user.save(); // Retrieves a user (GET /users/1) User.get(1, function(user) { user.age(34); // Updates the user (PUT /users/1) user.save(); });
Abstract requests to REST endpoints
var datasource = new metaproject.DataSource(base_url,
options)
Root url which this DataSqource will use
key
- Field to be used as the primary key, defaults to id
datasource.get(model or path, callback) |
GETs data from
|
|---|---|
datasource.post(data, callback) |
POSTs data to base_url
|
datasource.put(id, data, callback) |
PUTs data on base_url /id
|
datasource.destroy(id or model, callback) |
DELETEs base_url /id (or model[options.key])
|
datasource.on('event', callback) |
attachs an event handler to this datasource |
changed |
Callback Parameters
{ action: <'put', 'post' or 'delete'>,
data: <response data> }
|
|---|


My Marcelo Sotomaior. I am from Brazil. I love running and playing soccer with my friends. Also, I also enjoy traveling and experiencing new cultures..


Object used to obtain a Matcher for a RecyclerView.ViewHolder.itemView or a specific View inside of a RecyclerView.ViewHolder.itemView.